@assistant-ui/react 0.7.75 → 0.7.77
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 +36 -0
- package/dist/api/AssistantRuntime.d.ts +1 -1
- package/dist/api/AssistantRuntime.js +1 -1
- package/dist/api/AssistantRuntime.js.map +1 -1
- package/dist/api/AssistantRuntime.mjs +1 -1
- package/dist/api/AssistantRuntime.mjs.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +1 -1
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.mjs +1 -1
- package/dist/primitives/threadList/ThreadListItems.mjs.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js +2 -2
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs +2 -2
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.js +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.mjs +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.mjs.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts +4 -5
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.js +2 -2
- package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.mjs +2 -2
- package/dist/runtimes/local/LocalRuntimeOptions.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +2 -8
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +2 -8
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/shouldContinue.d.ts +1 -1
- package/dist/runtimes/local/shouldContinue.d.ts.map +1 -1
- package/dist/runtimes/local/shouldContinue.js +8 -3
- package/dist/runtimes/local/shouldContinue.js.map +1 -1
- package/dist/runtimes/local/shouldContinue.mjs +8 -3
- package/dist/runtimes/local/shouldContinue.mjs.map +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +7 -7
- package/dist/styles/tailwindcss/thread.css.json +6 -6
- package/package.json +3 -3
- package/src/api/AssistantRuntime.ts +2 -2
- package/src/context/providers/AssistantRuntimeProvider.tsx +1 -1
- package/src/primitives/threadList/ThreadListItems.tsx +2 -2
- package/src/runtimes/edge/converters/toLanguageModelMessages.ts +5 -2
- package/src/runtimes/edge/streams/toolResultStream.ts +1 -1
- package/src/runtimes/local/LocalRuntimeOptions.tsx +4 -5
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +2 -10
- package/src/runtimes/local/shouldContinue.tsx +21 -9
- package/src/styles/tailwindcss/thread.css +7 -7
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"@apply flex h-full flex-col items-center overflow-y-scroll scroll-smooth bg-inherit px-4 pt-8": {}
|
|
7
7
|
},
|
|
8
8
|
".aui-thread-viewport-footer": {
|
|
9
|
-
"@apply max-w-[var(--aui-thread-max-width)]
|
|
9
|
+
"@apply sticky bottom-0 mt-3 flex w-full max-w-[var(--aui-thread-max-width)] flex-col items-center justify-end rounded-t-lg bg-inherit pb-4": {}
|
|
10
10
|
},
|
|
11
11
|
".aui-thread-scroll-to-bottom": {
|
|
12
12
|
"@apply absolute -top-8 rounded-full disabled:invisible": {}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@apply bg-aui-background hover:bg-aui-muted/80 rounded-full border px-3 py-1 text-sm transition-colors ease-in": {}
|
|
19
19
|
},
|
|
20
20
|
".aui-thread-welcome-root": {
|
|
21
|
-
"@apply max-w-[var(--aui-thread-max-width)] flex
|
|
21
|
+
"@apply flex w-full max-w-[var(--aui-thread-max-width)] flex-grow flex-col": {}
|
|
22
22
|
},
|
|
23
23
|
".aui-thread-welcome-center": {
|
|
24
24
|
"@apply flex w-full flex-grow flex-col items-center justify-center": {}
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"@apply text-aui-muted-foreground [&>svg]:bg-aui-background absolute -right-3 -top-3 size-6 [&>svg]:size-4 [&>svg]:rounded-full": {}
|
|
79
79
|
},
|
|
80
80
|
".aui-user-message-root": {
|
|
81
|
-
"@apply grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [
|
|
82
|
-
"@apply max-w-[var(--aui-thread-max-width)]
|
|
81
|
+
"@apply grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [&:where(>*)]:col-start-2": {},
|
|
82
|
+
"@apply w-full max-w-[var(--aui-thread-max-width)] py-4": {}
|
|
83
83
|
},
|
|
84
84
|
":where(.aui-user-message-root) > .aui-branch-picker-root": {
|
|
85
85
|
"@apply col-span-full col-start-1 row-start-3": {},
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"@apply col-start-1 row-start-2 mr-3 mt-2.5": {}
|
|
104
104
|
},
|
|
105
105
|
".aui-edit-composer-root": {
|
|
106
|
-
"@apply bg-aui-muted max-w-[var(--aui-thread-max-width)]
|
|
106
|
+
"@apply bg-aui-muted my-4 flex w-full max-w-[var(--aui-thread-max-width)] flex-col gap-2 rounded-xl": {}
|
|
107
107
|
},
|
|
108
108
|
".aui-edit-composer-input": {
|
|
109
109
|
"@apply text-aui-foreground flex h-8 w-full resize-none bg-transparent p-4 pb-0 outline-none": {}
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
".aui-assistant-message-root": {
|
|
115
115
|
"@apply grid grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr]": {},
|
|
116
|
-
"@apply max-w-[var(--aui-thread-max-width)]
|
|
116
|
+
"@apply relative w-full max-w-[var(--aui-thread-max-width)] py-4": {}
|
|
117
117
|
},
|
|
118
118
|
":where(.aui-assistant-message-root) > .aui-avatar-root": {
|
|
119
119
|
"@apply col-start-1 row-span-full row-start-1 mr-4": {}
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"conversational-ui",
|
|
30
30
|
"conversational-ai"
|
|
31
31
|
],
|
|
32
|
-
"version": "0.7.
|
|
32
|
+
"version": "0.7.77",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
|
@@ -113,9 +113,9 @@
|
|
|
113
113
|
"tailwindcss": "^3.4.17",
|
|
114
114
|
"tailwindcss-animate": "^1.0.7",
|
|
115
115
|
"tsx": "^4.19.2",
|
|
116
|
-
"@assistant-ui/tsconfig": "0.0.0",
|
|
117
116
|
"@assistant-ui/tailwindcss-transformer": "0.1.0",
|
|
118
|
-
"@assistant-ui/tsbuildutils": "^0.0.1"
|
|
117
|
+
"@assistant-ui/tsbuildutils": "^0.0.1",
|
|
118
|
+
"@assistant-ui/tsconfig": "0.0.0"
|
|
119
119
|
},
|
|
120
120
|
"publishConfig": {
|
|
121
121
|
"access": "public",
|
|
@@ -21,7 +21,7 @@ export type AssistantRuntime = {
|
|
|
21
21
|
readonly thread: ThreadRuntime;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* @deprecated This field was renamed to `threads
|
|
24
|
+
* @deprecated This field was renamed to `threads`.
|
|
25
25
|
*/
|
|
26
26
|
readonly threadList: ThreadListRuntime;
|
|
27
27
|
|
|
@@ -69,7 +69,7 @@ export class AssistantRuntimeImpl implements AssistantRuntime {
|
|
|
69
69
|
) => ThreadRuntime = ThreadRuntimeImpl,
|
|
70
70
|
) {
|
|
71
71
|
this.threads = new ThreadListRuntimeImpl(_core.threads, runtimeFactory);
|
|
72
|
-
this._thread = this.
|
|
72
|
+
this._thread = this.threads.main;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
protected __internal_bindMethods() {
|
|
@@ -66,7 +66,7 @@ export const AssistantRuntimeProviderImpl: FC<
|
|
|
66
66
|
{RenderComponent && <RenderComponent />}
|
|
67
67
|
<ThreadRuntimeProvider
|
|
68
68
|
runtime={runtime.thread}
|
|
69
|
-
listItemRuntime={runtime.
|
|
69
|
+
listItemRuntime={runtime.threads.mainItem}
|
|
70
70
|
>
|
|
71
71
|
{children}
|
|
72
72
|
</ThreadRuntimeProvider>
|
|
@@ -28,8 +28,8 @@ const ThreadListItemImpl: FC<ThreadListItemProps> = ({
|
|
|
28
28
|
const runtime = useMemo(
|
|
29
29
|
() =>
|
|
30
30
|
archived
|
|
31
|
-
? assistantRuntime.
|
|
32
|
-
: assistantRuntime.
|
|
31
|
+
? assistantRuntime.threads.getArchivedItemByIndex(partIndex)
|
|
32
|
+
: assistantRuntime.threads.getItemByIndex(partIndex),
|
|
33
33
|
[assistantRuntime, partIndex, archived],
|
|
34
34
|
);
|
|
35
35
|
|
|
@@ -58,8 +58,11 @@ const assistantMessageSplitter = () => {
|
|
|
58
58
|
type: "tool-result",
|
|
59
59
|
toolCallId: part.toolCallId,
|
|
60
60
|
toolName: part.toolName,
|
|
61
|
-
result:
|
|
62
|
-
|
|
61
|
+
result:
|
|
62
|
+
part.result === undefined
|
|
63
|
+
? "Error: tool is has no configured code to run"
|
|
64
|
+
: undefined,
|
|
65
|
+
isError: part.isError ?? part.result === undefined,
|
|
63
66
|
});
|
|
64
67
|
},
|
|
65
68
|
getMessages: () => {
|
|
@@ -17,10 +17,9 @@ export type LocalRuntimeOptionsBase = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
* This feature will be removed in a future version without notice. DO NOT USE.
|
|
20
|
+
* Names of tools that are allowed to interrupt the run in order to wait for human/external approval.
|
|
22
21
|
*/
|
|
23
|
-
|
|
22
|
+
unstable_humanToolNames?: string[] | undefined;
|
|
24
23
|
};
|
|
25
24
|
|
|
26
25
|
// TODO align LocalRuntimeOptions with LocalRuntimeOptionsBase
|
|
@@ -38,7 +37,7 @@ export const splitLocalRuntimeOptions = <T extends LocalRuntimeOptions>(
|
|
|
38
37
|
initialMessages,
|
|
39
38
|
maxSteps,
|
|
40
39
|
adapters,
|
|
41
|
-
|
|
40
|
+
unstable_humanToolNames,
|
|
42
41
|
...rest
|
|
43
42
|
} = options;
|
|
44
43
|
|
|
@@ -48,7 +47,7 @@ export const splitLocalRuntimeOptions = <T extends LocalRuntimeOptions>(
|
|
|
48
47
|
initialMessages,
|
|
49
48
|
maxSteps,
|
|
50
49
|
adapters,
|
|
51
|
-
|
|
50
|
+
unstable_humanToolNames,
|
|
52
51
|
},
|
|
53
52
|
otherOptions: rest,
|
|
54
53
|
};
|
|
@@ -151,12 +151,7 @@ export class LocalThreadRuntimeCore
|
|
|
151
151
|
try {
|
|
152
152
|
do {
|
|
153
153
|
message = await this.performRoundtrip(parentId, message, runConfig);
|
|
154
|
-
} while (
|
|
155
|
-
shouldContinue(
|
|
156
|
-
message,
|
|
157
|
-
this._options.unstable_shouldContinueIgnoreToolNames ?? [],
|
|
158
|
-
)
|
|
159
|
-
);
|
|
154
|
+
} while (shouldContinue(message, this._options.unstable_humanToolNames));
|
|
160
155
|
} finally {
|
|
161
156
|
this._notifyEventSubscribers("run-end");
|
|
162
157
|
}
|
|
@@ -347,10 +342,7 @@ export class LocalThreadRuntimeCore
|
|
|
347
342
|
|
|
348
343
|
if (
|
|
349
344
|
added &&
|
|
350
|
-
shouldContinue(
|
|
351
|
-
message,
|
|
352
|
-
this._options.unstable_shouldContinueIgnoreToolNames ?? [],
|
|
353
|
-
)
|
|
345
|
+
shouldContinue(message, this._options.unstable_humanToolNames)
|
|
354
346
|
) {
|
|
355
347
|
this.performRoundtrip(parentId, message, this._lastRunConfig);
|
|
356
348
|
}
|
|
@@ -2,13 +2,25 @@ import type { ThreadAssistantMessage } from "../../types";
|
|
|
2
2
|
|
|
3
3
|
export const shouldContinue = (
|
|
4
4
|
result: ThreadAssistantMessage,
|
|
5
|
-
|
|
6
|
-
) =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
!!c.result
|
|
13
|
-
|
|
5
|
+
humanToolNames: string[] | undefined,
|
|
6
|
+
) => {
|
|
7
|
+
// TODO legacy behavior -- make specifying human tool names required
|
|
8
|
+
if (humanToolNames === undefined) {
|
|
9
|
+
return (
|
|
10
|
+
result.status?.type === "requires-action" &&
|
|
11
|
+
result.status.reason === "tool-calls" &&
|
|
12
|
+
result.content.every((c) => c.type !== "tool-call" || !!c.result)
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
result.status?.type === "requires-action" &&
|
|
18
|
+
result.status.reason === "tool-calls" &&
|
|
19
|
+
result.content.every(
|
|
20
|
+
(c) =>
|
|
21
|
+
c.type !== "tool-call" ||
|
|
22
|
+
!!c.result ||
|
|
23
|
+
!humanToolNames.includes(c.toolName),
|
|
24
|
+
)
|
|
14
25
|
);
|
|
26
|
+
};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.aui-thread-viewport-footer {
|
|
11
|
-
@apply max-w-[var(--aui-thread-max-width)]
|
|
11
|
+
@apply sticky bottom-0 mt-3 flex w-full max-w-[var(--aui-thread-max-width)] flex-col items-center justify-end rounded-t-lg bg-inherit pb-4;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.aui-thread-scroll-to-bottom {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
/* thread welcome */
|
|
27
27
|
|
|
28
28
|
.aui-thread-welcome-root {
|
|
29
|
-
@apply max-w-[var(--aui-thread-max-width)] flex
|
|
29
|
+
@apply flex w-full max-w-[var(--aui-thread-max-width)] flex-grow flex-col;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.aui-thread-welcome-center {
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
/* user message */
|
|
111
111
|
|
|
112
112
|
.aui-user-message-root {
|
|
113
|
-
@apply grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [
|
|
114
|
-
@apply max-w-[var(--aui-thread-max-width)]
|
|
113
|
+
@apply grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [&:where(>*)]:col-start-2;
|
|
114
|
+
@apply w-full max-w-[var(--aui-thread-max-width)] py-4;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
:where(.aui-user-message-root) > .aui-branch-picker-root {
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
|
|
127
127
|
.aui-user-message-content {
|
|
128
128
|
@apply bg-aui-muted text-aui-foreground max-w-[calc(var(--aui-thread-max-width)*0.8)] break-words rounded-3xl px-5 py-2.5;
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
@apply col-start-2 row-start-2;
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
/* edit composer */
|
|
149
149
|
|
|
150
150
|
.aui-edit-composer-root {
|
|
151
|
-
@apply bg-aui-muted max-w-[var(--aui-thread-max-width)]
|
|
151
|
+
@apply bg-aui-muted my-4 flex w-full max-w-[var(--aui-thread-max-width)] flex-col gap-2 rounded-xl;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
.aui-edit-composer-input {
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
|
|
164
164
|
.aui-assistant-message-root {
|
|
165
165
|
@apply grid grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr];
|
|
166
|
-
@apply max-w-[var(--aui-thread-max-width)]
|
|
166
|
+
@apply relative w-full max-w-[var(--aui-thread-max-width)] py-4;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
:where(.aui-assistant-message-root) > .aui-avatar-root {
|