@assistant-ui/react 0.10.2 → 0.10.5
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/model-context/makeAssistantTool.d.ts +1 -1
- package/dist/model-context/makeAssistantTool.d.ts.map +1 -1
- package/dist/model-context/makeAssistantTool.js.map +1 -1
- package/dist/model-context/tool.d.ts +1 -10
- package/dist/model-context/tool.d.ts.map +1 -1
- package/dist/model-context/tool.js.map +1 -1
- package/dist/model-context/useAssistantTool.d.ts +2 -3
- package/dist/model-context/useAssistantTool.d.ts.map +1 -1
- package/dist/model-context/useAssistantTool.js +1 -2
- package/dist/model-context/useAssistantTool.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.js +2 -0
- package/dist/primitives/attachment/AttachmentRoot.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.js +2 -0
- package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
- package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadRoot.js +2 -0
- package/dist/primitives/thread/ThreadRoot.js.map +1 -1
- package/dist/primitives/threadList/ThreadListRoot.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListRoot.js +2 -0
- package/dist/primitives/threadList/ThreadListRoot.js.map +1 -1
- package/dist/tests/setup.js +9 -9
- package/dist/tests/setup.js.map +1 -1
- package/package.json +7 -8
- package/src/model-context/makeAssistantTool.tsx +4 -1
- package/src/model-context/tool.ts +3 -16
- package/src/model-context/useAssistantTool.tsx +9 -6
- package/src/primitives/attachment/AttachmentRoot.tsx +2 -0
- package/src/primitives/branchPicker/BranchPickerRoot.tsx +2 -0
- package/src/primitives/thread/ThreadRoot.tsx +2 -0
- package/src/primitives/threadList/ThreadListRoot.tsx +2 -0
package/package.json
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
"conversational-ui",
|
29
29
|
"conversational-ai"
|
30
30
|
],
|
31
|
-
"version": "0.10.
|
31
|
+
"version": "0.10.5",
|
32
32
|
"license": "MIT",
|
33
33
|
"type": "module",
|
34
34
|
"exports": {
|
@@ -51,13 +51,13 @@
|
|
51
51
|
"@radix-ui/primitive": "^1.1.2",
|
52
52
|
"@radix-ui/react-compose-refs": "^1.1.2",
|
53
53
|
"@radix-ui/react-context": "^1.1.2",
|
54
|
-
"@radix-ui/react-popover": "^1.1.
|
54
|
+
"@radix-ui/react-popover": "^1.1.11",
|
55
55
|
"@radix-ui/react-primitive": "^2.1.0",
|
56
56
|
"@radix-ui/react-slot": "^1.2.0",
|
57
57
|
"@radix-ui/react-use-callback-ref": "^1.1.1",
|
58
58
|
"@radix-ui/react-use-escape-keydown": "^1.1.1",
|
59
59
|
"@standard-schema/spec": "^1.0.0",
|
60
|
-
"assistant-stream": "^0.2.
|
60
|
+
"assistant-stream": "^0.2.5",
|
61
61
|
"json-schema": "^0.4.0",
|
62
62
|
"nanoid": "5.1.5",
|
63
63
|
"react-textarea-autosize": "^8.5.9",
|
@@ -67,7 +67,6 @@
|
|
67
67
|
"peerDependencies": {
|
68
68
|
"@types/react": "*",
|
69
69
|
"@types/react-dom": "*",
|
70
|
-
"assistant-stream": "^0.2.2",
|
71
70
|
"react": "^18 || ^19 || ^19.0.0-rc",
|
72
71
|
"react-dom": "^18 || ^19 || ^19.0.0-rc"
|
73
72
|
},
|
@@ -87,9 +86,8 @@
|
|
87
86
|
"eslint": "^9",
|
88
87
|
"eslint-config-next": "15.3.1",
|
89
88
|
"tsx": "^4.19.3",
|
90
|
-
"vitest": "^3.1.
|
91
|
-
"@assistant-ui/
|
92
|
-
"@assistant-ui/tsconfig": "0.0.0"
|
89
|
+
"vitest": "^3.1.2",
|
90
|
+
"@assistant-ui/x-buildutils": "0.0.1"
|
93
91
|
},
|
94
92
|
"publishConfig": {
|
95
93
|
"access": "public",
|
@@ -107,6 +105,7 @@
|
|
107
105
|
"build": "tsx scripts/build.mts",
|
108
106
|
"test": "vitest run",
|
109
107
|
"test:watch": "vitest",
|
110
|
-
"test:mutation": "stryker run"
|
108
|
+
"test:mutation": "stryker run",
|
109
|
+
"lint": "eslint ."
|
111
110
|
}
|
112
111
|
}
|
@@ -7,7 +7,10 @@ export type AssistantTool = FC & {
|
|
7
7
|
unstable_tool: AssistantToolProps<any, any>;
|
8
8
|
};
|
9
9
|
|
10
|
-
export const makeAssistantTool = <
|
10
|
+
export const makeAssistantTool = <
|
11
|
+
TArgs extends Record<string, unknown>,
|
12
|
+
TResult,
|
13
|
+
>(
|
11
14
|
tool: AssistantToolProps<TArgs, TResult>,
|
12
15
|
) => {
|
13
16
|
const Tool: AssistantTool = () => {
|
@@ -1,20 +1,7 @@
|
|
1
|
-
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
2
1
|
import { Tool } from "assistant-stream";
|
3
|
-
import { JSONSchema7 } from "json-schema";
|
4
2
|
|
5
|
-
export function tool<
|
6
|
-
|
7
|
-
|
8
|
-
>(tool: {
|
9
|
-
description?: string | undefined;
|
10
|
-
parameters: StandardSchemaV1<TArgs> | JSONSchema7;
|
11
|
-
execute?: (
|
12
|
-
args: TArgs,
|
13
|
-
context: {
|
14
|
-
toolCallId: string;
|
15
|
-
abortSignal: AbortSignal;
|
16
|
-
},
|
17
|
-
) => TResult | Promise<TResult>;
|
18
|
-
}): Tool<TArgs, TResult> {
|
3
|
+
export function tool<TArgs extends Record<string, unknown>, TResult = any>(
|
4
|
+
tool: Tool<TArgs, TResult>,
|
5
|
+
): Tool<TArgs, TResult> {
|
19
6
|
return tool;
|
20
7
|
}
|
@@ -8,13 +8,18 @@ import {
|
|
8
8
|
import type { ToolCallContentPartComponent } from "../types/ContentPartComponentTypes";
|
9
9
|
import type { Tool } from "assistant-stream";
|
10
10
|
|
11
|
-
export type AssistantToolProps<
|
11
|
+
export type AssistantToolProps<
|
12
|
+
TArgs extends Record<string, unknown>,
|
13
|
+
TResult,
|
14
|
+
> = Tool<TArgs, TResult> & {
|
12
15
|
toolName: string;
|
13
16
|
render?: ToolCallContentPartComponent<TArgs, TResult> | undefined;
|
14
|
-
disabled?: boolean | undefined;
|
15
17
|
};
|
16
18
|
|
17
|
-
export const useAssistantTool = <
|
19
|
+
export const useAssistantTool = <
|
20
|
+
TArgs extends Record<string, unknown>,
|
21
|
+
TResult,
|
22
|
+
>(
|
18
23
|
tool: AssistantToolProps<TArgs, TResult>,
|
19
24
|
) => {
|
20
25
|
const assistantRuntime = useAssistantRuntime();
|
@@ -27,9 +32,7 @@ export const useAssistantTool = <TArgs, TResult>(
|
|
27
32
|
}, [toolUIsStore, tool.toolName, tool.render]);
|
28
33
|
|
29
34
|
useEffect(() => {
|
30
|
-
const { toolName, render,
|
31
|
-
if (disabled) return;
|
32
|
-
|
35
|
+
const { toolName, render, ...rest } = tool;
|
33
36
|
const context = {
|
34
37
|
tools: {
|
35
38
|
[toolName]: rest,
|