@assistant-ui/react 0.14.5 → 0.14.7
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/LICENSE +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts +8 -2
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
- package/dist/legacy-runtime/hooks/AssistantContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/AssistantContext.js +1 -1
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/AttachmentContext.js +1 -1
- package/dist/legacy-runtime/hooks/ComposerContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/ComposerContext.js +1 -1
- package/dist/legacy-runtime/hooks/MessageContext.d.ts +3 -3
- package/dist/legacy-runtime/hooks/MessageContext.js +2 -2
- package/dist/legacy-runtime/hooks/MessagePartContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/MessagePartContext.js +1 -1
- package/dist/legacy-runtime/hooks/ThreadContext.d.ts +4 -4
- package/dist/legacy-runtime/hooks/ThreadContext.js +2 -2
- package/dist/legacy-runtime/hooks/ThreadListItemContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/ThreadListItemContext.js +1 -1
- package/dist/mcp-apps/McpAppRenderer.d.ts +8 -0
- package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppRenderer.js +8 -0
- package/dist/mcp-apps/McpAppRenderer.js.map +1 -1
- package/dist/mcp-apps/McpAppsRemoteHost.d.ts +7 -0
- package/dist/mcp-apps/McpAppsRemoteHost.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppsRemoteHost.js +7 -0
- package/dist/mcp-apps/McpAppsRemoteHost.js.map +1 -1
- package/dist/mcp-apps/utils.d.ts +7 -0
- package/dist/mcp-apps/utils.d.ts.map +1 -1
- package/dist/mcp-apps/utils.js +7 -0
- package/dist/mcp-apps/utils.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js +6 -1
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/messagePart/MessagePartInProgress.d.ts +1 -5
- package/dist/primitives/messagePart/MessagePartInProgress.d.ts.map +1 -1
- package/dist/primitives/messagePart/MessagePartInProgress.js +1 -7
- package/dist/primitives/messagePart/MessagePartInProgress.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartData.d.ts +16 -0
- package/dist/primitives/messagePart/useMessagePartData.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartData.js +16 -0
- package/dist/primitives/messagePart/useMessagePartData.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartFile.d.ts +15 -0
- package/dist/primitives/messagePart/useMessagePartFile.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartFile.js +15 -0
- package/dist/primitives/messagePart/useMessagePartFile.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartImage.d.ts +15 -0
- package/dist/primitives/messagePart/useMessagePartImage.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartImage.js +15 -0
- package/dist/primitives/messagePart/useMessagePartImage.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartReasoning.d.ts +15 -0
- package/dist/primitives/messagePart/useMessagePartReasoning.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartReasoning.js +15 -0
- package/dist/primitives/messagePart/useMessagePartReasoning.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartSource.d.ts +15 -0
- package/dist/primitives/messagePart/useMessagePartSource.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartSource.js +15 -0
- package/dist/primitives/messagePart/useMessagePartSource.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartText.d.ts +15 -0
- package/dist/primitives/messagePart/useMessagePartText.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartText.js +15 -0
- package/dist/primitives/messagePart/useMessagePartText.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +50 -27
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/utils/smooth/useSmooth.d.ts.map +1 -1
- package/dist/utils/smooth/useSmooth.js +27 -10
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/package.json +14 -16
- package/src/index.ts +6 -0
- package/src/legacy-runtime/AssistantRuntimeProvider.tsx +8 -2
- package/src/legacy-runtime/hooks/AssistantContext.ts +2 -2
- package/src/legacy-runtime/hooks/AttachmentContext.ts +2 -2
- package/src/legacy-runtime/hooks/ComposerContext.ts +2 -2
- package/src/legacy-runtime/hooks/MessageContext.ts +3 -3
- package/src/legacy-runtime/hooks/MessagePartContext.ts +2 -2
- package/src/legacy-runtime/hooks/ThreadContext.ts +4 -4
- package/src/legacy-runtime/hooks/ThreadListItemContext.ts +2 -2
- package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.test.ts +254 -0
- package/src/mcp-apps/McpAppRenderer.tsx +8 -0
- package/src/mcp-apps/McpAppsRemoteHost.ts +7 -0
- package/src/mcp-apps/utils.ts +7 -0
- package/src/primitives/actionBar/ActionBarCopy.tsx +6 -1
- package/src/primitives/messagePart/MessagePartInProgress.ts +1 -17
- package/src/primitives/messagePart/useMessagePartData.ts +16 -0
- package/src/primitives/messagePart/useMessagePartFile.ts +15 -0
- package/src/primitives/messagePart/useMessagePartImage.ts +15 -0
- package/src/primitives/messagePart/useMessagePartReasoning.ts +15 -0
- package/src/primitives/messagePart/useMessagePartSource.ts +15 -0
- package/src/primitives/messagePart/useMessagePartText.ts +15 -0
- package/src/primitives/thread/useThreadViewportAutoScroll.test.tsx +320 -0
- package/src/primitives/thread/useThreadViewportAutoScroll.ts +59 -29
- package/src/tests/BaseComposerRuntimeCore.test.ts +1 -1
- package/src/utils/smooth/useSmooth.ts +28 -12
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
import type { DataMessagePart } from "@assistant-ui/core";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
4
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
5
|
+
* preserve the old hook's strict behavior.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const part = useAuiState((s) =>
|
|
10
|
+
* s.part.type === "data" && (!name || s.part.name === name)
|
|
11
|
+
* ? s.part
|
|
12
|
+
* : null,
|
|
13
|
+
* );
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
17
|
+
*/
|
|
2
18
|
export declare const useMessagePartData: <T = any>(name?: string) => DataMessagePart<T> | null;
|
|
3
19
|
//# sourceMappingURL=useMessagePartData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartData.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartData.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,eAAO,MAAM,kBAAkB,GAAI,CAAC,GAAG,GAAG,EAAE,OAAO,MAAM,8BAiBxD,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartData.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartData.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,GAAG,GAAG,EAAE,OAAO,MAAM,8BAiBxD,CAAC"}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
5
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
6
|
+
* preserve the old hook's strict behavior.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const part = useAuiState((s) =>
|
|
11
|
+
* s.part.type === "data" && (!name || s.part.name === name)
|
|
12
|
+
* ? s.part
|
|
13
|
+
* : null,
|
|
14
|
+
* );
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
18
|
+
*/
|
|
3
19
|
export const useMessagePartData = (name) => {
|
|
4
20
|
const part = useAuiState((s) => {
|
|
5
21
|
if (s.part.type !== "data") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartData.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartData.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAU,IAAa,EAAE,EAAE;IAC3D,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,CAAC,CAAC,IAA0B,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartData.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartData.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAU,IAAa,EAAE,EAAE;IAC3D,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,CAAC,CAAC,IAA0B,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type { FileMessagePart } from "@assistant-ui/core";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
4
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
5
|
+
* preserve the old hook's strict behavior.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const file = useAuiState((s) => {
|
|
10
|
+
* if (s.part.type !== "file") return null;
|
|
11
|
+
* return s.part;
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
16
|
+
*/
|
|
2
17
|
export declare const useMessagePartFile: () => FileMessagePart & {
|
|
3
18
|
readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
|
|
4
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartFile.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartFile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,oBAAoB,CAAC;AAG5E,eAAO,MAAM,kBAAkB;;CAW9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartFile.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartFile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,oBAAoB,CAAC;AAG5E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB;;CAW9B,CAAC"}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
5
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
6
|
+
* preserve the old hook's strict behavior.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const file = useAuiState((s) => {
|
|
11
|
+
* if (s.part.type !== "file") return null;
|
|
12
|
+
* return s.part;
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
17
|
+
*/
|
|
3
18
|
export const useMessagePartFile = () => {
|
|
4
19
|
const file = useAuiState((s) => {
|
|
5
20
|
if (s.part.type !== "file")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartFile.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartFile.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM;YACxB,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;QAEJ,OAAO,CAAC,CAAC,IAA0C,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartFile.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartFile.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM;YACxB,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;QAEJ,OAAO,CAAC,CAAC,IAA0C,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type { ImageMessagePart } from "@assistant-ui/core";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
4
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
5
|
+
* preserve the old hook's strict behavior.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const image = useAuiState((s) => {
|
|
10
|
+
* if (s.part.type !== "image") return null;
|
|
11
|
+
* return s.part;
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
16
|
+
*/
|
|
2
17
|
export declare const useMessagePartImage: () => ImageMessagePart & {
|
|
3
18
|
readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
|
|
4
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartImage.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartImage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,oBAAoB,CAAC;AAG7E,eAAO,MAAM,mBAAmB;;CAW/B,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartImage.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartImage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,oBAAoB,CAAC;AAG7E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB;;CAW/B,CAAC"}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
5
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
6
|
+
* preserve the old hook's strict behavior.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const image = useAuiState((s) => {
|
|
11
|
+
* if (s.part.type !== "image") return null;
|
|
12
|
+
* return s.part;
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
17
|
+
*/
|
|
3
18
|
export const useMessagePartImage = () => {
|
|
4
19
|
const image = useAuiState((s) => {
|
|
5
20
|
if (s.part.type !== "image")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartImage.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartImage.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC9B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO;YACzB,MAAM,IAAI,KAAK,CACb,+DAA+D,CAChE,CAAC;QAEJ,OAAO,CAAC,CAAC,IAA2C,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartImage.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartImage.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC9B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO;YACzB,MAAM,IAAI,KAAK,CACb,+DAA+D,CAChE,CAAC;QAEJ,OAAO,CAAC,CAAC,IAA2C,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type { ReasoningMessagePart } from "@assistant-ui/core";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
4
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
5
|
+
* preserve the old hook's strict behavior.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const reasoning = useAuiState((s) => {
|
|
10
|
+
* if (s.part.type !== "reasoning") return null;
|
|
11
|
+
* return s.part;
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
16
|
+
*/
|
|
2
17
|
export declare const useMessagePartReasoning: () => ReasoningMessagePart & {
|
|
3
18
|
readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
|
|
4
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartReasoning.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartReasoning.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,uBAAuB;;CAWnC,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartReasoning.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartReasoning.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB;;CAWnC,CAAC"}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
5
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
6
|
+
* preserve the old hook's strict behavior.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const reasoning = useAuiState((s) => {
|
|
11
|
+
* if (s.part.type !== "reasoning") return null;
|
|
12
|
+
* return s.part;
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
17
|
+
*/
|
|
3
18
|
export const useMessagePartReasoning = () => {
|
|
4
19
|
const text = useAuiState((s) => {
|
|
5
20
|
if (s.part.type !== "reasoning")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartReasoning.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartReasoning.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAMb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW;YAC7B,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;QAEJ,OAAO,CAAC,CAAC,IAA+C,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartReasoning.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartReasoning.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAMb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW;YAC7B,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;QAEJ,OAAO,CAAC,CAAC,IAA+C,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
3
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
4
|
+
* preserve the old hook's strict behavior.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const source = useAuiState((s) => {
|
|
9
|
+
* if (s.part.type !== "source") return null;
|
|
10
|
+
* return s.part;
|
|
11
|
+
* });
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
15
|
+
*/
|
|
1
16
|
export declare const useMessagePartSource: () => ({
|
|
2
17
|
readonly type: "source";
|
|
3
18
|
readonly sourceType: "url";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartSource.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartSource.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;EAWhC,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartSource.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartSource.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;EAWhC,CAAC"}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
5
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
6
|
+
* preserve the old hook's strict behavior.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const source = useAuiState((s) => {
|
|
11
|
+
* if (s.part.type !== "source") return null;
|
|
12
|
+
* return s.part;
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
17
|
+
*/
|
|
3
18
|
export const useMessagePartSource = () => {
|
|
4
19
|
const source = useAuiState((s) => {
|
|
5
20
|
if (s.part.type !== "source")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartSource.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartSource.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ;YAC1B,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;QAEJ,OAAO,CAAC,CAAC,IAA4C,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartSource.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartSource.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ;YAC1B,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;QAEJ,OAAO,CAAC,CAAC,IAA4C,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type { TextMessagePart, ReasoningMessagePart } from "@assistant-ui/core";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
4
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
5
|
+
* preserve the old hook's strict behavior.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const text = useAuiState((s) => {
|
|
10
|
+
* if (s.part.type !== "text" && s.part.type !== "reasoning") return null;
|
|
11
|
+
* return s.part;
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
16
|
+
*/
|
|
2
17
|
export declare const useMessagePartText: () => (TextMessagePart & {
|
|
3
18
|
readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
|
|
4
19
|
}) | (ReasoningMessagePart & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartText.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartText.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EAErB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,kBAAkB;;;;EAY9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartText.d.ts","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartText.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EAErB,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB;;;;EAY9B,CAAC"}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
5
|
+
* Return `null` for optional rendering, or throw inside the selector to
|
|
6
|
+
* preserve the old hook's strict behavior.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const text = useAuiState((s) => {
|
|
11
|
+
* if (s.part.type !== "text" && s.part.type !== "reasoning") return null;
|
|
12
|
+
* return s.part;
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
|
|
17
|
+
*/
|
|
3
18
|
export const useMessagePartText = () => {
|
|
4
19
|
const text = useAuiState((s) => {
|
|
5
20
|
if (s.part.type !== "text" && s.part.type !== "reasoning")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessagePartText.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartText.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAOb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW;YACvD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAC;QAEJ,OAAO,CAAC,CAAC,IACiC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"useMessagePartText.js","sourceRoot":"","sources":["../../../src/primitives/messagePart/useMessagePartText.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAOb,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW;YACvD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAC;QAEJ,OAAO,CAAC,CAAC,IACiC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -15,7 +15,7 @@ export declare namespace useThreadViewportAutoScroll {
|
|
|
15
15
|
*/
|
|
16
16
|
scrollToBottomOnRunStart?: boolean | undefined;
|
|
17
17
|
/**
|
|
18
|
-
* Whether to scroll to bottom when
|
|
18
|
+
* Whether to scroll to bottom when messages first appear in the thread.
|
|
19
19
|
*
|
|
20
20
|
* Defaults to true.
|
|
21
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThreadViewportAutoScroll.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/useThreadViewportAutoScroll.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"useThreadViewportAutoScroll.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/useThreadViewportAutoScroll.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwC,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAQ/E,yBAAiB,2BAA2B,CAAC;IAC3C,KAAY,OAAO,GAAG;QACpB;;;;;WAKG;QACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAEjC;;;;WAIG;QACH,wBAAwB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAE/C;;;;WAIG;QACH,0BAA0B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAEjD;;;;WAIG;QACH,4BAA4B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACpD,CAAC;CACH;AAED,eAAO,MAAM,2BAA2B,GAAI,QAAQ,SAAS,WAAW,EAAE,qGAKvE,2BAA2B,CAAC,OAAO,KAAG,WAAW,CAAC,QAAQ,CAmJ5D,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
3
|
-
import { useCallback, useRef } from "react";
|
|
4
|
-
import { useAuiEvent } from "@assistant-ui/store";
|
|
3
|
+
import { useCallback, useLayoutEffect, useRef } from "react";
|
|
4
|
+
import { useAuiEvent, useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import { useOnResizeContent } from "../../utils/hooks/useOnResizeContent.js";
|
|
6
6
|
import { useOnScrollToBottom } from "../../utils/hooks/useOnScrollToBottom.js";
|
|
7
7
|
import { useManagedRef } from "../../utils/hooks/useManagedRef.js";
|
|
@@ -9,14 +9,16 @@ import { writableStore } from "../../context/ReadonlyStore.js";
|
|
|
9
9
|
import { useThreadViewportStore } from "../../context/react/ThreadViewportContext.js";
|
|
10
10
|
export const useThreadViewportAutoScroll = ({ autoScroll, scrollToBottomOnRunStart = true, scrollToBottomOnInitialize = true, scrollToBottomOnThreadSwitch = true, }) => {
|
|
11
11
|
const divRef = useRef(null);
|
|
12
|
+
const hasMessages = useAuiState((s) => s.thread.messages.length > 0);
|
|
13
|
+
const initializeScrollRequestedRef = useRef(false);
|
|
14
|
+
const scheduledFrameRef = useRef(null);
|
|
12
15
|
const threadViewportStore = useThreadViewportStore();
|
|
13
16
|
if (autoScroll === undefined) {
|
|
14
17
|
autoScroll = threadViewportStore.getState().turnAnchor !== "top";
|
|
15
18
|
}
|
|
16
19
|
const lastScrollTop = useRef(0);
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
// stores the scroll behavior to reuse during content resize, or null if not scrolling
|
|
20
|
+
// Pending bottom-scroll intent. Planted by initialize/run-start/switch/button
|
|
21
|
+
// triggers, cleared only when handleScroll confirms we reached bottom.
|
|
20
22
|
const scrollingToBottomBehaviorRef = useRef(null);
|
|
21
23
|
const scrollToBottom = useCallback((behavior) => {
|
|
22
24
|
const div = divRef.current;
|
|
@@ -25,6 +27,21 @@ export const useThreadViewportAutoScroll = ({ autoScroll, scrollToBottomOnRunSta
|
|
|
25
27
|
scrollingToBottomBehaviorRef.current = behavior;
|
|
26
28
|
div.scrollTo({ top: div.scrollHeight, behavior });
|
|
27
29
|
}, []);
|
|
30
|
+
const scheduleScrollToBottom = useCallback((behavior) => {
|
|
31
|
+
scrollingToBottomBehaviorRef.current = behavior;
|
|
32
|
+
if (scheduledFrameRef.current !== null) {
|
|
33
|
+
cancelAnimationFrame(scheduledFrameRef.current);
|
|
34
|
+
}
|
|
35
|
+
scheduledFrameRef.current = requestAnimationFrame(() => {
|
|
36
|
+
scheduledFrameRef.current = null;
|
|
37
|
+
scrollToBottom(behavior);
|
|
38
|
+
});
|
|
39
|
+
}, [scrollToBottom]);
|
|
40
|
+
useLayoutEffect(() => () => {
|
|
41
|
+
if (scheduledFrameRef.current !== null) {
|
|
42
|
+
cancelAnimationFrame(scheduledFrameRef.current);
|
|
43
|
+
}
|
|
44
|
+
}, []);
|
|
28
45
|
const hasActiveTopAnchor = useCallback(() => {
|
|
29
46
|
const state = threadViewportStore.getState();
|
|
30
47
|
return (state.turnAnchor === "top" &&
|
|
@@ -38,12 +55,19 @@ export const useThreadViewportAutoScroll = ({ autoScroll, scrollToBottomOnRunSta
|
|
|
38
55
|
const isAtBottom = threadViewportStore.getState().isAtBottom;
|
|
39
56
|
const newIsAtBottom = Math.abs(div.scrollHeight - div.scrollTop - div.clientHeight) < 1 ||
|
|
40
57
|
div.scrollHeight <= div.clientHeight;
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
const isInFlightDownwardScroll = !newIsAtBottom && lastScrollTop.current < div.scrollTop;
|
|
59
|
+
if (isInFlightDownwardScroll) {
|
|
60
|
+
// no-op: a smooth scroll-to-bottom fires many midpoint scroll events
|
|
61
|
+
// before landing, don't flicker isAtBottom or clear intent mid-animation
|
|
43
62
|
}
|
|
44
63
|
else {
|
|
45
64
|
if (newIsAtBottom) {
|
|
46
|
-
|
|
65
|
+
// newIsAtBottom is ambiguous when the viewport doesn't overflow —
|
|
66
|
+
// keep intent alive until content can actually scroll
|
|
67
|
+
const viewportOverflows = div.scrollHeight > div.clientHeight + 1;
|
|
68
|
+
if (viewportOverflows) {
|
|
69
|
+
scrollingToBottomBehaviorRef.current = null;
|
|
70
|
+
}
|
|
47
71
|
}
|
|
48
72
|
const shouldUpdate = newIsAtBottom || scrollingToBottomBehaviorRef.current === null;
|
|
49
73
|
if (shouldUpdate && newIsAtBottom !== isAtBottom) {
|
|
@@ -74,37 +98,36 @@ export const useThreadViewportAutoScroll = ({ autoScroll, scrollToBottomOnRunSta
|
|
|
74
98
|
el.removeEventListener("scroll", handleScroll);
|
|
75
99
|
};
|
|
76
100
|
});
|
|
101
|
+
useLayoutEffect(() => {
|
|
102
|
+
if (!scrollToBottomOnInitialize)
|
|
103
|
+
return;
|
|
104
|
+
if (!hasMessages) {
|
|
105
|
+
initializeScrollRequestedRef.current = false;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (initializeScrollRequestedRef.current)
|
|
109
|
+
return;
|
|
110
|
+
initializeScrollRequestedRef.current = true;
|
|
111
|
+
// defer to an in-flight run (e.g. first message on a new thread) that
|
|
112
|
+
// already planted intent — otherwise we'd downgrade its "auto" to "instant"
|
|
113
|
+
if (scrollingToBottomBehaviorRef.current !== null)
|
|
114
|
+
return;
|
|
115
|
+
scheduleScrollToBottom("instant");
|
|
116
|
+
}, [hasMessages, scheduleScrollToBottom, scrollToBottomOnInitialize]);
|
|
77
117
|
useOnScrollToBottom(({ behavior }) => {
|
|
78
118
|
scrollToBottom(behavior);
|
|
79
119
|
});
|
|
80
|
-
// autoscroll on run start
|
|
81
120
|
useAuiEvent("thread.runStart", () => {
|
|
82
121
|
if (!scrollToBottomOnRunStart)
|
|
83
122
|
return;
|
|
84
123
|
if (threadViewportStore.getState().turnAnchor === "top")
|
|
85
124
|
return;
|
|
86
|
-
|
|
87
|
-
requestAnimationFrame(() => {
|
|
88
|
-
scrollToBottom("auto");
|
|
89
|
-
});
|
|
125
|
+
scheduleScrollToBottom("auto");
|
|
90
126
|
});
|
|
91
|
-
// scroll to bottom instantly when thread history is first loaded
|
|
92
|
-
useAuiEvent("thread.initialize", () => {
|
|
93
|
-
if (!scrollToBottomOnInitialize)
|
|
94
|
-
return;
|
|
95
|
-
scrollingToBottomBehaviorRef.current = "instant";
|
|
96
|
-
requestAnimationFrame(() => {
|
|
97
|
-
scrollToBottom("instant");
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
// scroll to bottom instantly when switching threads
|
|
101
127
|
useAuiEvent("threadListItem.switchedTo", () => {
|
|
102
128
|
if (!scrollToBottomOnThreadSwitch)
|
|
103
129
|
return;
|
|
104
|
-
|
|
105
|
-
requestAnimationFrame(() => {
|
|
106
|
-
scrollToBottom("instant");
|
|
107
|
-
});
|
|
130
|
+
scheduleScrollToBottom("instant");
|
|
108
131
|
});
|
|
109
132
|
const autoScrollRef = useComposedRefs(resizeRef, scrollRef, divRef);
|
|
110
133
|
return autoScrollRef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThreadViewportAutoScroll.js","sourceRoot":"","sources":["../../../src/primitives/thread/useThreadViewportAutoScroll.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAoB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useThreadViewportAutoScroll.js","sourceRoot":"","sources":["../../../src/primitives/thread/useThreadViewportAuto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c,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,WAAW,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAClC,IAAI,CAAC,wBAAwB;YAAE,OAAO;QACtC,IAAI,mBAAmB,CAAC,QAAQ,EAAE,CAAC,UAAU,KAAK,KAAK;YAAE,OAAO;QAChE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,WAAW,CAAC,2BAA2B,EAAE,GAAG,EAAE;QAC5C,IAAI,CAAC,4BAA4B;YAAE,OAAO;QAC1C,sBAAsB,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,eAAe,CAAW,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC9E,OAAO,aAAsC,CAAC;AAChD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSmooth.d.ts","sourceRoot":"","sources":["../../../src/utils/smooth/useSmooth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AA+D5B,eAAO,MAAM,SAAS,GACpB,OAAO,gBAAgB,GAAG,CAAC,eAAe,GAAG,oBAAoB,CAAC,EAClE,SAAQ,OAAe,KACtB,gBAAgB,GAAG,CAAC,eAAe,GAAG,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useSmooth.d.ts","sourceRoot":"","sources":["../../../src/utils/smooth/useSmooth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AA+D5B,eAAO,MAAM,SAAS,GACpB,OAAO,gBAAgB,GAAG,CAAC,eAAe,GAAG,oBAAoB,CAAC,EAClE,SAAQ,OAAe,KACtB,gBAAgB,GAAG,CAAC,eAAe,GAAG,oBAAoB,CAmG5D,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
+
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
4
4
|
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
|
|
5
5
|
import { useSmoothStatusStore } from "./SmoothContext.js";
|
|
6
6
|
import { writableStore } from "../../context/ReadonlyStore.js";
|
|
@@ -55,9 +55,23 @@ const SMOOTH_STATUS = Object.freeze({
|
|
|
55
55
|
});
|
|
56
56
|
export const useSmooth = (state, smooth = false) => {
|
|
57
57
|
const { text } = state;
|
|
58
|
-
const id = useAuiState((s) => s.message.id);
|
|
59
|
-
const idRef = useRef(id);
|
|
60
58
|
const [displayedText, setDisplayedText] = useState(state.status.type === "running" ? "" : text);
|
|
59
|
+
// Render-phase resync on part flip or text discontinuity, so the
|
|
60
|
+
// first paint after a thread switch never shows the previous
|
|
61
|
+
// part's text (#4051). `displayedText` is already a prefix of
|
|
62
|
+
// `text` during normal streaming, so use it as the previous-text
|
|
63
|
+
// reference instead of carrying separate state — avoids the
|
|
64
|
+
// double render per streaming token. Read part identity through
|
|
65
|
+
// `useAuiState` so we actually subscribe to its changes instead
|
|
66
|
+
// of relying on a render-time proxy reference that may be stable
|
|
67
|
+
// across thread swaps.
|
|
68
|
+
const aui = useAui();
|
|
69
|
+
const part = useAuiState(() => aui.part());
|
|
70
|
+
const [prevPart, setPrevPart] = useState(part);
|
|
71
|
+
if (part !== prevPart || !text.startsWith(displayedText)) {
|
|
72
|
+
setPrevPart(part);
|
|
73
|
+
setDisplayedText(state.status.type === "running" ? "" : text);
|
|
74
|
+
}
|
|
61
75
|
const smoothStatusStore = useSmoothStatusStore({ optional: true });
|
|
62
76
|
const setText = useCallbackRef((text) => {
|
|
63
77
|
setDisplayedText(text);
|
|
@@ -78,23 +92,26 @@ export const useSmooth = (state, smooth = false) => {
|
|
|
78
92
|
}
|
|
79
93
|
}, [smoothStatusStore, smooth, text, displayedText, state.status]);
|
|
80
94
|
const [animatorRef] = useState(new TextStreamAnimator(displayedText, setText));
|
|
95
|
+
const animatorPartRef = useRef(part);
|
|
81
96
|
useEffect(() => {
|
|
82
97
|
if (!smooth) {
|
|
83
98
|
animatorRef.stop();
|
|
84
99
|
return;
|
|
85
100
|
}
|
|
86
|
-
|
|
87
|
-
|
|
101
|
+
// Discontinuity: part flipped, or new text breaks continuation
|
|
102
|
+
// of the animator's current target. Either case requires
|
|
103
|
+
// resetting the cursor — without the part check, a new part
|
|
104
|
+
// whose text happens to share a prefix with the previous target
|
|
105
|
+
// would keep the stale cursor and flicker.
|
|
106
|
+
const partChanged = animatorPartRef.current !== part;
|
|
107
|
+
animatorPartRef.current = part;
|
|
108
|
+
if (partChanged || !text.startsWith(animatorRef.targetText)) {
|
|
88
109
|
if (state.status.type === "running") {
|
|
89
|
-
// New streaming message → animate from empty string
|
|
90
|
-
setText("");
|
|
91
110
|
animatorRef.currentText = "";
|
|
92
111
|
animatorRef.targetText = text;
|
|
93
112
|
animatorRef.start();
|
|
94
113
|
}
|
|
95
114
|
else {
|
|
96
|
-
// Completed message → display immediately
|
|
97
|
-
setText(text);
|
|
98
115
|
animatorRef.currentText = text;
|
|
99
116
|
animatorRef.targetText = text;
|
|
100
117
|
animatorRef.stop();
|
|
@@ -103,7 +120,7 @@ export const useSmooth = (state, smooth = false) => {
|
|
|
103
120
|
}
|
|
104
121
|
animatorRef.targetText = text;
|
|
105
122
|
animatorRef.start();
|
|
106
|
-
}, [
|
|
123
|
+
}, [animatorRef, smooth, text, state.status.type, part]);
|
|
107
124
|
useEffect(() => {
|
|
108
125
|
return () => {
|
|
109
126
|
animatorRef.stop();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSmooth.js","sourceRoot":"","sources":["../../../src/utils/smooth/useSmooth.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAA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