@assistant-ui/react 0.11.44 → 0.11.46
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/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.js +2 -1
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +2 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.d.ts +3 -0
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js +4 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/index.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/local/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/index.js +2 -3
- package/dist/legacy-runtime/runtime-cores/local/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.js +3 -3
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.d.ts +6 -0
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +15 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.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/cloud/useCloudThreadListRuntime.tsx +1 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.tsx +1 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.ts +7 -3
- package/src/legacy-runtime/runtime-cores/local/index.ts +1 -1
- package/src/legacy-runtime/runtime-cores/local/useLocalRuntime.tsx +2 -1
- package/src/legacy-runtime/runtime-cores/remote-thread-list/types.tsx +7 -0
- package/src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.tsx +25 -1
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.46",
|
|
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.3.
|
|
51
|
+
"assistant-cloud": "^0.1.9",
|
|
52
|
+
"@assistant-ui/tap": "^0.3.1",
|
|
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.3",
|
|
@@ -59,10 +59,10 @@
|
|
|
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.42",
|
|
63
63
|
"nanoid": "5.1.6",
|
|
64
64
|
"react-textarea-autosize": "^8.5.9",
|
|
65
|
-
"zod": "^4.1.
|
|
65
|
+
"zod": "^4.1.13",
|
|
66
66
|
"zustand": "^5.0.8"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
@@ -80,14 +80,14 @@
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@stryker-mutator/core": "^9.
|
|
84
|
-
"@stryker-mutator/vitest-runner": "^9.
|
|
83
|
+
"@stryker-mutator/core": "^9.4.0",
|
|
84
|
+
"@stryker-mutator/vitest-runner": "^9.4.0",
|
|
85
85
|
"@types/json-schema": "^7.0.15",
|
|
86
86
|
"@types/node": "^24.10.1",
|
|
87
87
|
"eslint": "^9",
|
|
88
|
-
"eslint-config-next": "16.0.
|
|
88
|
+
"eslint-config-next": "16.0.4",
|
|
89
89
|
"tsx": "^4.20.6",
|
|
90
|
-
"vitest": "^4.0.
|
|
90
|
+
"vitest": "^4.0.14",
|
|
91
91
|
"@assistant-ui/x-buildutils": "0.0.1"
|
|
92
92
|
},
|
|
93
93
|
"publishConfig": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
import {
|
|
3
3
|
createAssistantStreamController,
|
|
4
|
-
ToolCallStreamController,
|
|
4
|
+
type ToolCallStreamController,
|
|
5
5
|
ToolResponse,
|
|
6
6
|
unstable_toolResultStream,
|
|
7
7
|
type Tool,
|
|
@@ -39,7 +39,8 @@ type UseToolInvocationsParams = {
|
|
|
39
39
|
|
|
40
40
|
export type ToolExecutionStatus =
|
|
41
41
|
| { type: "executing" }
|
|
42
|
-
| { type: "interrupt"; payload: { type: "human"; payload: unknown } }
|
|
42
|
+
| { type: "interrupt"; payload: { type: "human"; payload: unknown } }
|
|
43
|
+
| { type: "cancelled"; reason: string };
|
|
43
44
|
|
|
44
45
|
export function useToolInvocations({
|
|
45
46
|
state,
|
|
@@ -166,7 +167,10 @@ export function useToolInvocations({
|
|
|
166
167
|
if (process.env["NODE_ENV"] !== "production") {
|
|
167
168
|
console.warn(
|
|
168
169
|
"argsText updated after controller was closed:",
|
|
169
|
-
{
|
|
170
|
+
{
|
|
171
|
+
previous: lastState.argsText,
|
|
172
|
+
next: content.argsText,
|
|
173
|
+
},
|
|
170
174
|
);
|
|
171
175
|
}
|
|
172
176
|
} else {
|
|
@@ -9,7 +9,7 @@ import { useRemoteThreadListRuntime } from "../remote-thread-list/useRemoteThrea
|
|
|
9
9
|
import { useCloudThreadListAdapter } from "../remote-thread-list/adapter/cloud";
|
|
10
10
|
import { AssistantRuntimeImpl } from "../../../internal";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const useLocalThreadRuntime = (
|
|
13
13
|
adapter: ChatModelAdapter,
|
|
14
14
|
{ initialMessages, ...options }: LocalRuntimeOptions,
|
|
15
15
|
) => {
|
|
@@ -57,5 +57,6 @@ export const useLocalRuntime = (
|
|
|
57
57
|
return useLocalThreadRuntime(adapter, options);
|
|
58
58
|
},
|
|
59
59
|
adapter: cloudAdapter,
|
|
60
|
+
allowNesting: true,
|
|
60
61
|
});
|
|
61
62
|
};
|
|
@@ -39,4 +39,11 @@ export type RemoteThreadListAdapter = {
|
|
|
39
39
|
export type RemoteThreadListOptions = {
|
|
40
40
|
runtimeHook: () => AssistantRuntime;
|
|
41
41
|
adapter: RemoteThreadListAdapter;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* When true, if this runtime is used inside another RemoteThreadListRuntime,
|
|
45
|
+
* it becomes a no-op and simply calls the runtimeHook directly.
|
|
46
|
+
* This allows wrapping runtimes that internally use RemoteThreadListRuntime.
|
|
47
|
+
*/
|
|
48
|
+
allowNesting?: boolean | undefined;
|
|
42
49
|
};
|
|
@@ -7,6 +7,7 @@ import { RemoteThreadListOptions } from "./types";
|
|
|
7
7
|
import { AssistantRuntimeImpl } from "../../../internal";
|
|
8
8
|
import { AssistantRuntimeCore } from "../core/AssistantRuntimeCore";
|
|
9
9
|
import { AssistantRuntime } from "../../runtime/AssistantRuntime";
|
|
10
|
+
import { useAssistantApiImpl } from "../../../context/react/AssistantApiContext";
|
|
10
11
|
|
|
11
12
|
class RemoteThreadListRuntimeCore
|
|
12
13
|
extends BaseAssistantRuntimeCore
|
|
@@ -27,7 +28,7 @@ class RemoteThreadListRuntimeCore
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
const useRemoteThreadListRuntimeImpl = (
|
|
31
32
|
options: RemoteThreadListOptions,
|
|
32
33
|
): AssistantRuntime => {
|
|
33
34
|
const [runtime] = useState(() => new RemoteThreadListRuntimeCore(options));
|
|
@@ -37,3 +38,26 @@ export const useRemoteThreadListRuntime = (
|
|
|
37
38
|
}, [runtime, options]);
|
|
38
39
|
return useMemo(() => new AssistantRuntimeImpl(runtime), [runtime]);
|
|
39
40
|
};
|
|
41
|
+
|
|
42
|
+
export const useRemoteThreadListRuntime = (
|
|
43
|
+
options: RemoteThreadListOptions,
|
|
44
|
+
): AssistantRuntime => {
|
|
45
|
+
const api = useAssistantApiImpl();
|
|
46
|
+
const isNested = api.threadListItem.source !== null;
|
|
47
|
+
|
|
48
|
+
if (isNested) {
|
|
49
|
+
if (!options.allowNesting) {
|
|
50
|
+
throw new Error(
|
|
51
|
+
"useRemoteThreadListRuntime cannot be nested inside another RemoteThreadListRuntime. " +
|
|
52
|
+
"Set allowNesting: true to allow nesting (the inner runtime will become a no-op).",
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// If allowNesting is true and already inside a thread list context,
|
|
57
|
+
// just call the runtimeHook directly (no-op behavior)
|
|
58
|
+
return options.runtimeHook();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
62
|
+
return useRemoteThreadListRuntimeImpl(options);
|
|
63
|
+
};
|