@sixb/app 0.2.4 → 0.2.6
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/assets/connector-icons/README.md +1 -0
- package/assets/connector-icons/ctm.png +0 -0
- package/dist/agent/activity-label.d.ts.map +1 -1
- package/dist/agent/agent-chat.d.ts +3 -1
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/agent-panel.d.ts.map +1 -1
- package/dist/agent/artifact-panel.d.ts +3 -1
- package/dist/agent/artifact-panel.d.ts.map +1 -1
- package/dist/agent/components/agent-threads.d.ts.map +1 -1
- package/dist/agent/components/composer-place.d.ts.map +1 -1
- package/dist/agent/components/composer-settings.d.ts +1 -1
- package/dist/agent/components/composer-settings.d.ts.map +1 -1
- package/dist/agent/components/composer.d.ts +22 -5
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/computer-place.d.ts +24 -6
- package/dist/agent/components/computer-place.d.ts.map +1 -1
- package/dist/agent/components/context-meter.d.ts +1 -1
- package/dist/agent/components/context-meter.d.ts.map +1 -1
- package/dist/agent/components/conversation-panel.d.ts +5 -2
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/message-parts.d.ts +2 -1
- package/dist/agent/components/message-parts.d.ts.map +1 -1
- package/dist/agent/components/message-view.d.ts +13 -3
- package/dist/agent/components/message-view.d.ts.map +1 -1
- package/dist/agent/components/pending-messages.d.ts +20 -0
- package/dist/agent/components/pending-messages.d.ts.map +1 -0
- package/dist/agent/components/sandbox-recovery.d.ts +11 -2
- package/dist/agent/components/sandbox-recovery.d.ts.map +1 -1
- package/dist/agent/components/threads-button.d.ts +1 -1
- package/dist/agent/components/threads-button.d.ts.map +1 -1
- package/dist/agent/components/transcript.d.ts +13 -0
- package/dist/agent/components/transcript.d.ts.map +1 -1
- package/dist/agent/conversation.d.ts +7 -6
- package/dist/agent/conversation.d.ts.map +1 -1
- package/dist/agent/delegation/interpret.d.ts +5 -0
- package/dist/agent/delegation/interpret.d.ts.map +1 -1
- package/dist/agent/delegation/use-children.d.ts.map +1 -1
- package/dist/agent/format.d.ts +7 -0
- package/dist/agent/format.d.ts.map +1 -1
- package/dist/agent/hooks/thread-queries.d.ts +1548 -0
- package/dist/agent/hooks/thread-queries.d.ts.map +1 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts +51 -6
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-lists.d.ts +80 -3
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-place.d.ts +49 -0
- package/dist/agent/hooks/use-thread-place.d.ts.map +1 -0
- package/dist/agent/hooks/use-thread-stream.d.ts.map +1 -1
- package/dist/agent/i18n/en.d.ts +107 -6
- package/dist/agent/i18n/en.d.ts.map +1 -1
- package/dist/agent/i18n/fr.d.ts.map +1 -1
- package/dist/agent/i18n/index.d.ts +180 -12
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/inbox-handoff.d.ts +10 -0
- package/dist/agent/inbox-handoff.d.ts.map +1 -0
- package/dist/agent/live-run.d.ts +8 -1
- package/dist/agent/live-run.d.ts.map +1 -1
- package/dist/agent/model-selection.d.ts +3 -2
- package/dist/agent/model-selection.d.ts.map +1 -1
- package/dist/agent/moves.d.ts +40 -0
- package/dist/agent/moves.d.ts.map +1 -0
- package/dist/agent/search/interpret.d.ts +101 -0
- package/dist/agent/search/interpret.d.ts.map +1 -0
- package/dist/agent/search/search-tool-view.d.ts +10 -0
- package/dist/agent/search/search-tool-view.d.ts.map +1 -0
- package/dist/agent/thread-reader-state.d.ts +30 -0
- package/dist/agent/thread-reader-state.d.ts.map +1 -0
- package/dist/agent/thread-state.d.ts +26 -0
- package/dist/agent/thread-state.d.ts.map +1 -0
- package/dist/agent/tool-views/built-in.d.ts.map +1 -1
- package/dist/agent/tool-views/registry.d.ts +5 -6
- package/dist/agent/tool-views/registry.d.ts.map +1 -1
- package/dist/agent/types.d.ts +9 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/view-file/view-file-tool-view.d.ts +2 -1
- package/dist/agent/view-file/view-file-tool-view.d.ts.map +1 -1
- package/dist/artifacts/card-preview.d.ts.map +1 -1
- package/dist/artifacts/editor/block-handle.d.ts +20 -0
- package/dist/artifacts/editor/block-handle.d.ts.map +1 -0
- package/dist/artifacts/editor/blocks.d.ts +34 -0
- package/dist/artifacts/editor/blocks.d.ts.map +1 -0
- package/dist/artifacts/editor/callout-view.d.ts +7 -0
- package/dist/artifacts/editor/callout-view.d.ts.map +1 -0
- package/dist/artifacts/editor/document-editor.d.ts +30 -0
- package/dist/artifacts/editor/document-editor.d.ts.map +1 -0
- package/dist/artifacts/editor/figure-view.d.ts +12 -0
- package/dist/artifacts/editor/figure-view.d.ts.map +1 -0
- package/dist/artifacts/editor/find-blocks.d.ts +6 -0
- package/dist/artifacts/editor/find-blocks.d.ts.map +1 -0
- package/dist/artifacts/editor/markdown-document.d.ts +12 -0
- package/dist/artifacts/editor/markdown-document.d.ts.map +1 -0
- package/dist/artifacts/editor/messages.d.ts +4 -0
- package/dist/artifacts/editor/messages.d.ts.map +1 -0
- package/dist/artifacts/editor/schema.d.ts +21 -0
- package/dist/artifacts/editor/schema.d.ts.map +1 -0
- package/dist/artifacts/editor/selection-toolbar.d.ts +35 -0
- package/dist/artifacts/editor/selection-toolbar.d.ts.map +1 -0
- package/dist/artifacts/editor/slash-menu.d.ts +43 -0
- package/dist/artifacts/editor/slash-menu.d.ts.map +1 -0
- package/dist/artifacts/editor/upload.d.ts +12 -0
- package/dist/artifacts/editor/upload.d.ts.map +1 -0
- package/dist/artifacts/file-source.d.ts +5 -0
- package/dist/artifacts/file-source.d.ts.map +1 -1
- package/dist/artifacts/frame-editor/bundle.d.ts +7 -0
- package/dist/artifacts/frame-editor/bundle.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/commands.d.ts +93 -0
- package/dist/artifacts/frame-editor/commands.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/entry.d.ts +2 -0
- package/dist/artifacts/frame-editor/entry.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/frame.d.ts +5 -0
- package/dist/artifacts/frame-editor/frame.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/keys.d.ts +8 -0
- package/dist/artifacts/frame-editor/keys.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/protocol.d.ts +186 -0
- package/dist/artifacts/frame-editor/protocol.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/schema.d.ts +34 -0
- package/dist/artifacts/frame-editor/schema.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/style.d.ts +2 -0
- package/dist/artifacts/frame-editor/style.d.ts.map +1 -0
- package/dist/artifacts/frame.d.ts +2 -2
- package/dist/artifacts/frame.d.ts.map +1 -1
- package/dist/artifacts/live/boards.d.ts +2 -0
- package/dist/artifacts/live/boards.d.ts.map +1 -1
- package/dist/artifacts/live/document.d.ts +32 -0
- package/dist/artifacts/live/document.d.ts.map +1 -0
- package/dist/artifacts/live/header.d.ts +4 -4
- package/dist/artifacts/live/header.d.ts.map +1 -1
- package/dist/artifacts/live/presence.d.ts.map +1 -1
- package/dist/artifacts/live/session.d.ts +2 -0
- package/dist/artifacts/live/session.d.ts.map +1 -1
- package/dist/artifacts/live/view.d.ts +4 -3
- package/dist/artifacts/live/view.d.ts.map +1 -1
- package/dist/artifacts/messages.d.ts +226 -2
- package/dist/artifacts/messages.d.ts.map +1 -1
- package/dist/artifacts/pdf.d.ts +8 -0
- package/dist/artifacts/pdf.d.ts.map +1 -0
- package/dist/artifacts/queries.d.ts +80 -0
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/artifacts/references/references.d.ts +3 -3
- package/dist/artifacts/references/references.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/board-editor.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts +4 -2
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comments-panel.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comments.d.ts +2 -1
- package/dist/artifacts/renderers/canvas/comments.d.ts.map +1 -1
- package/dist/artifacts/renderers/designed-document.d.ts +28 -0
- package/dist/artifacts/renderers/designed-document.d.ts.map +1 -0
- package/dist/artifacts/renderers/document-tree.d.ts +2 -0
- package/dist/artifacts/renderers/document-tree.d.ts.map +1 -1
- package/dist/artifacts/renderers/document.d.ts +9 -1
- package/dist/artifacts/renderers/document.d.ts.map +1 -1
- package/dist/artifacts/renderers/live-frame.d.ts +145 -0
- package/dist/artifacts/renderers/live-frame.d.ts.map +1 -0
- package/dist/artifacts/renderers/page-editor.d.ts +16 -0
- package/dist/artifacts/renderers/page-editor.d.ts.map +1 -0
- package/dist/artifacts/renderers/page.d.ts +10 -1
- package/dist/artifacts/renderers/page.d.ts.map +1 -1
- package/dist/artifacts/viewer.d.ts.map +1 -1
- package/dist/{chunk-pxd07kvx.js → chunk-096d52h2.js} +1 -1
- package/dist/{chunk-yrcm1pbg.js → chunk-94d7enwc.js} +491 -2128
- package/dist/chunk-94d7enwc.js.map +27 -0
- package/dist/{chunk-970s5nkn.js → chunk-ezntd3yy.js} +1 -1
- package/dist/{chunk-kymx9y5e.js → chunk-qjw5r2vk.js} +12729 -5044
- package/dist/chunk-qjw5r2vk.js.map +242 -0
- package/dist/chunk-y51c4tsz.js +11 -0
- package/dist/chunk-y51c4tsz.js.map +10 -0
- package/dist/createCustomApp.d.ts +8 -1
- package/dist/createCustomApp.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +5 -5
- package/dist/pages/console/data/accounts.d.ts +94 -0
- package/dist/pages/console/data/accounts.d.ts.map +1 -0
- package/dist/pages/console/data/connectors.d.ts.map +1 -1
- package/dist/pages/console/data/live-updates.d.ts.map +1 -1
- package/dist/pages/console/data/messages.d.ts +52 -0
- package/dist/pages/console/data/messages.d.ts.map +1 -1
- package/dist/pages/console/data/shared.d.ts.map +1 -1
- package/dist/pages/console/data/sync-button.d.ts.map +1 -1
- package/dist/pages/console/data/syncs.d.ts.map +1 -1
- package/dist/pages/settings/usage/breakdown.d.ts.map +1 -1
- package/dist/pages/settings/usage/page.d.ts +4 -1
- package/dist/pages/settings/usage/page.d.ts.map +1 -1
- package/dist/pages/settings/usage/spend-model.d.ts +43 -19
- package/dist/pages/settings/usage/spend-model.d.ts.map +1 -1
- package/dist/pages.js +23044 -22570
- package/dist/pages.js.map +17 -16
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +40 -3
- package/dist/server.js.map +3 -3
- package/dist/shell/search-command.d.ts.map +1 -1
- package/package.json +22 -5
- package/src/agent/activity-label.ts +3 -0
- package/src/agent/agent-chat.tsx +58 -39
- package/src/agent/agent-execution-trace.tsx +2 -2
- package/src/agent/agent-panel.tsx +6 -4
- package/src/agent/agent.css +254 -0
- package/src/agent/artifact-panel.tsx +77 -22
- package/src/agent/components/agent-threads.tsx +42 -2
- package/src/agent/components/composer-place.tsx +2 -7
- package/src/agent/components/composer-settings.tsx +20 -10
- package/src/agent/components/composer.tsx +342 -104
- package/src/agent/components/computer-place.tsx +415 -70
- package/src/agent/components/context-meter.tsx +7 -3
- package/src/agent/components/conversation-panel.tsx +99 -54
- package/src/agent/components/message-parts.tsx +367 -59
- package/src/agent/components/message-view.tsx +428 -9
- package/src/agent/components/pending-messages.tsx +342 -0
- package/src/agent/components/sandbox-recovery.tsx +36 -17
- package/src/agent/components/threads-button.tsx +3 -2
- package/src/agent/components/transcript.tsx +198 -38
- package/src/agent/conversation.ts +219 -55
- package/src/agent/delegation/interpret.ts +31 -7
- package/src/agent/format.ts +52 -0
- package/src/agent/hooks/thread-queries.ts +75 -0
- package/src/agent/hooks/use-agent-conversation.ts +801 -211
- package/src/agent/hooks/use-thread-lists.ts +72 -7
- package/src/agent/hooks/use-thread-place.ts +239 -0
- package/src/agent/hooks/use-thread-stream.ts +10 -0
- package/src/agent/i18n/en.ts +150 -27
- package/src/agent/i18n/fr.ts +148 -31
- package/src/agent/inbox-handoff.ts +47 -0
- package/src/agent/live-run.ts +61 -2
- package/src/agent/model-selection.ts +3 -2
- package/src/agent/moves.ts +174 -0
- package/src/agent/react-router.tsx +2 -2
- package/src/agent/search/interpret.ts +367 -0
- package/src/agent/search/search-tool-view.tsx +235 -0
- package/src/agent/thread-reader-state.ts +75 -0
- package/src/agent/thread-state.ts +114 -0
- package/src/agent/tool-views/built-in.tsx +16 -0
- package/src/agent/tool-views/registry.tsx +28 -2
- package/src/agent/types.ts +13 -0
- package/src/agent/view-file/view-file-tool-view.tsx +33 -19
- package/src/artifacts/artifacts.css +398 -0
- package/src/artifacts/card-preview.tsx +6 -1
- package/src/artifacts/editor/block-handle.tsx +278 -0
- package/src/artifacts/editor/blocks.ts +216 -0
- package/src/artifacts/editor/callout-view.tsx +31 -0
- package/src/artifacts/editor/document-editor.tsx +484 -0
- package/src/artifacts/editor/figure-view.tsx +66 -0
- package/src/artifacts/editor/find-blocks.ts +19 -0
- package/src/artifacts/editor/markdown-document.tsx +72 -0
- package/src/artifacts/editor/messages.ts +4 -0
- package/src/artifacts/editor/schema.ts +159 -0
- package/src/artifacts/editor/selection-toolbar.tsx +364 -0
- package/src/artifacts/editor/slash-menu.tsx +251 -0
- package/src/artifacts/editor/upload.ts +40 -0
- package/src/artifacts/file-source.ts +11 -0
- package/src/artifacts/frame-editor/bundle.ts +8 -0
- package/src/artifacts/frame-editor/commands.ts +565 -0
- package/src/artifacts/frame-editor/entry.ts +6 -0
- package/src/artifacts/frame-editor/frame.ts +847 -0
- package/src/artifacts/frame-editor/generated/editor.txt +149 -0
- package/src/artifacts/frame-editor/generated.d.ts +5 -0
- package/src/artifacts/frame-editor/keys.ts +323 -0
- package/src/artifacts/frame-editor/protocol.ts +151 -0
- package/src/artifacts/frame-editor/schema.ts +293 -0
- package/src/artifacts/frame-editor/style.ts +58 -0
- package/src/artifacts/frame.tsx +11 -3
- package/src/artifacts/live/boards.ts +46 -3
- package/src/artifacts/live/document.ts +89 -0
- package/src/artifacts/live/header.tsx +9 -14
- package/src/artifacts/live/presence.ts +5 -1
- package/src/artifacts/live/session.ts +9 -2
- package/src/artifacts/live/view.ts +14 -8
- package/src/artifacts/messages.ts +138 -2
- package/src/artifacts/pdf.ts +50 -0
- package/src/artifacts/references/references.tsx +46 -11
- package/src/artifacts/renderers/canvas/board-editor.tsx +11 -144
- package/src/artifacts/renderers/canvas/comment-pins.tsx +5 -0
- package/src/artifacts/renderers/canvas/comments-panel.tsx +58 -1
- package/src/artifacts/renderers/canvas/comments.ts +8 -4
- package/src/artifacts/renderers/designed-document.tsx +277 -0
- package/src/artifacts/renderers/document-tree.ts +9 -0
- package/src/artifacts/renderers/document.tsx +13 -102
- package/src/artifacts/renderers/live-frame.ts +163 -0
- package/src/artifacts/renderers/page-editor.tsx +613 -0
- package/src/artifacts/renderers/page.tsx +21 -4
- package/src/artifacts/viewer.tsx +87 -41
- package/src/createCustomApp.ts +57 -3
- package/src/index.ts +10 -0
- package/src/pages/console/data/accounts.tsx +509 -0
- package/src/pages/console/data/connectors.tsx +7 -15
- package/src/pages/console/data/live-updates.ts +2 -0
- package/src/pages/console/data/messages.ts +79 -0
- package/src/pages/console/data/projections.tsx +4 -0
- package/src/pages/console/data/shared.tsx +1 -0
- package/src/pages/console/data/sync-button.tsx +56 -16
- package/src/pages/console/data/syncs.tsx +66 -41
- package/src/pages/console/ontology/lineage/trail.tsx +3 -0
- package/src/pages/section-ui.tsx +1 -1
- package/src/pages/settings/usage/breakdown.tsx +5 -2
- package/src/pages/settings/usage/filter-menu.tsx +1 -1
- package/src/pages/settings/usage/page.tsx +32 -13
- package/src/pages/settings/usage/spend-chart.tsx +2 -2
- package/src/pages/settings/usage/spend-model.ts +118 -50
- package/src/server.ts +1 -0
- package/src/shell/search-command.tsx +2 -0
- package/dist/chunk-kymx9y5e.js.map +0 -211
- package/dist/chunk-yrcm1pbg.js.map +0 -34
- /package/dist/{chunk-pxd07kvx.js.map → chunk-096d52h2.js.map} +0 -0
- /package/dist/{chunk-970s5nkn.js.map → chunk-ezntd3yy.js.map} +0 -0
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Button, Spinner } from "@sixb/ui/components"
|
|
2
2
|
import { cn } from "@sixb/ui/lib/utils"
|
|
3
3
|
import { Plus } from "lucide-react"
|
|
4
|
-
import type
|
|
4
|
+
import { memo, type ReactNode } from "react"
|
|
5
5
|
import type { ConversationComposerProps } from "../hooks/use-agent-conversation"
|
|
6
6
|
import { useAgentMessages } from "../i18n"
|
|
7
7
|
import { QuestionComposer, type QuestionComposerProps } from "../questions/question-composer"
|
|
8
8
|
import type { Agent, AgentContextInput, AgentThread } from "../types"
|
|
9
9
|
import { Composer, type ComposerProps } from "./composer"
|
|
10
|
+
import { PendingMessages, type PendingMessagesProps } from "./pending-messages"
|
|
10
11
|
import { ThreadsButton } from "./threads-button"
|
|
11
12
|
import { Transcript, type TranscriptProps } from "./transcript"
|
|
12
13
|
|
|
14
|
+
const EMPTY_AMBIENT_CONTEXT: readonly AgentContextInput[] = []
|
|
15
|
+
|
|
13
16
|
export interface ConversationPanelProps {
|
|
14
17
|
readonly sandboxRecovery?: ReactNode
|
|
15
18
|
/** A line above the composer, such as whose shared conversation this is. */
|
|
@@ -22,6 +25,8 @@ export interface ConversationPanelProps {
|
|
|
22
25
|
readonly composer: ConversationComposerProps & Pick<ComposerProps, "newThreadControls">
|
|
23
26
|
/** The Agent's question, which takes the composer's place while set. */
|
|
24
27
|
readonly question?: QuestionComposerProps | null
|
|
28
|
+
/** What waits beside the running turn, above the composer. */
|
|
29
|
+
readonly pending?: PendingMessagesProps
|
|
25
30
|
readonly messagesLoading: boolean
|
|
26
31
|
readonly messagesError: string | null
|
|
27
32
|
/** The selected durable thread, or null while composing a new one. */
|
|
@@ -46,6 +51,7 @@ export function ConversationPanel({
|
|
|
46
51
|
transcript,
|
|
47
52
|
composer,
|
|
48
53
|
question = null,
|
|
54
|
+
pending,
|
|
49
55
|
messagesLoading,
|
|
50
56
|
messagesError,
|
|
51
57
|
currentThread,
|
|
@@ -54,7 +60,7 @@ export function ConversationPanel({
|
|
|
54
60
|
onNewChat,
|
|
55
61
|
onOpenThreads,
|
|
56
62
|
composerPlaceholder,
|
|
57
|
-
ambientContext =
|
|
63
|
+
ambientContext = EMPTY_AMBIENT_CONTEXT,
|
|
58
64
|
compact = false,
|
|
59
65
|
welcomeContent,
|
|
60
66
|
headerActions,
|
|
@@ -72,62 +78,54 @@ export function ConversationPanel({
|
|
|
72
78
|
!messagesLoading && !messagesError && !hasActivity && transcript.messages.length === 0
|
|
73
79
|
// A reader who cannot write here cannot answer: the reply shows the question as waiting.
|
|
74
80
|
const asking = readOnly ? null : question
|
|
75
|
-
const renderComposer = (wideClassName?: string) =>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
const renderComposer = (wideClassName?: string) => (
|
|
82
|
+
<>
|
|
83
|
+
{readOnly ? (
|
|
84
|
+
// Where the composer would end, so the notice keeps its place at the foot of the pane.
|
|
85
|
+
<div aria-hidden className={compact ? "pb-4" : "pb-3"} />
|
|
86
|
+
) : null}
|
|
87
|
+
{asking ? (
|
|
88
|
+
<QuestionComposer
|
|
89
|
+
// The question is the conversation's last message: a new one starts over.
|
|
90
|
+
key={transcript.messages.at(-1)?.key}
|
|
91
|
+
{...asking}
|
|
92
|
+
className={compact ? "px-4 pt-2 pb-4" : wideClassName}
|
|
93
|
+
/>
|
|
94
|
+
) : null}
|
|
95
|
+
{/* Kept while the question asks, or while the reader can only follow, as when its owner moves
|
|
96
|
+
the conversation to their computer: a draft written before is still there after. */}
|
|
97
|
+
<div className="contents" hidden={asking !== null || readOnly}>
|
|
98
|
+
{readOnly ? null : (
|
|
99
|
+
<PendingMessages
|
|
100
|
+
threadId={currentThread?.id ?? null}
|
|
101
|
+
{...pending}
|
|
102
|
+
className={compact ? "px-4 pb-2" : cn("pb-2", wideClassName)}
|
|
97
103
|
/>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
)}
|
|
105
|
+
<Composer
|
|
106
|
+
{...composer}
|
|
107
|
+
// Hidden, it keeps its draft and takes nothing more: not even a file dropped on the page.
|
|
108
|
+
disabled={composer.disabled || readOnly}
|
|
109
|
+
placeholder={composerPlaceholder}
|
|
110
|
+
className={compact ? "px-4 pt-2 pb-4" : wideClassName}
|
|
111
|
+
ambientContext={ambientContext}
|
|
112
|
+
compact={compact}
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</>
|
|
116
|
+
)
|
|
110
117
|
|
|
111
118
|
return (
|
|
112
119
|
<div className="relative flex h-full min-h-0 flex-col" data-thread-id={currentThread?.id}>
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
size="icon-lg"
|
|
123
|
-
onClick={onNewChat}
|
|
124
|
-
aria-label={labels.threads.new}
|
|
125
|
-
className="[&_svg]:size-5"
|
|
126
|
-
>
|
|
127
|
-
<Plus />
|
|
128
|
-
</Button>
|
|
129
|
-
</div>
|
|
130
|
-
</header>
|
|
120
|
+
<ConversationHeader
|
|
121
|
+
compact={compact}
|
|
122
|
+
currentThreadId={currentThread?.id ?? null}
|
|
123
|
+
runningThreadCount={runningThreadCount}
|
|
124
|
+
waitingThreadIds={waitingThreadIds}
|
|
125
|
+
headerActions={headerActions}
|
|
126
|
+
onOpenThreads={onOpenThreads}
|
|
127
|
+
onNewChat={onNewChat}
|
|
128
|
+
/>
|
|
131
129
|
|
|
132
130
|
{showWelcome ? (
|
|
133
131
|
<div
|
|
@@ -235,3 +233,50 @@ function LoadingInline({ label }: { label: string }) {
|
|
|
235
233
|
</div>
|
|
236
234
|
)
|
|
237
235
|
}
|
|
236
|
+
|
|
237
|
+
const ConversationHeader = memo(function ConversationHeader({
|
|
238
|
+
compact,
|
|
239
|
+
currentThreadId,
|
|
240
|
+
runningThreadCount,
|
|
241
|
+
waitingThreadIds,
|
|
242
|
+
headerActions,
|
|
243
|
+
onOpenThreads,
|
|
244
|
+
onNewChat,
|
|
245
|
+
}: {
|
|
246
|
+
readonly compact: boolean
|
|
247
|
+
readonly currentThreadId: string | null
|
|
248
|
+
readonly runningThreadCount: number
|
|
249
|
+
readonly waitingThreadIds?: ReadonlySet<string>
|
|
250
|
+
readonly headerActions?: ReactNode
|
|
251
|
+
readonly onOpenThreads?: () => void
|
|
252
|
+
readonly onNewChat: () => void
|
|
253
|
+
}) {
|
|
254
|
+
const labels = useAgentMessages()
|
|
255
|
+
return (
|
|
256
|
+
<header
|
|
257
|
+
data-agent-conversation-header=""
|
|
258
|
+
className={cn("flex shrink-0 items-center gap-1 px-2.5 py-2.5", compact && "h-11 py-1.5")}
|
|
259
|
+
>
|
|
260
|
+
<div className="ml-auto flex items-center gap-1">
|
|
261
|
+
{headerActions}
|
|
262
|
+
{onOpenThreads ? (
|
|
263
|
+
<ThreadsButton
|
|
264
|
+
currentThreadId={currentThreadId}
|
|
265
|
+
runningThreadCount={runningThreadCount}
|
|
266
|
+
waitingThreadIds={waitingThreadIds}
|
|
267
|
+
onOpen={onOpenThreads}
|
|
268
|
+
/>
|
|
269
|
+
) : null}
|
|
270
|
+
<Button
|
|
271
|
+
variant="ghost"
|
|
272
|
+
size="icon-lg"
|
|
273
|
+
onClick={onNewChat}
|
|
274
|
+
aria-label={labels.threads.new}
|
|
275
|
+
className="[&_svg]:size-5"
|
|
276
|
+
>
|
|
277
|
+
<Plus />
|
|
278
|
+
</Button>
|
|
279
|
+
</div>
|
|
280
|
+
</header>
|
|
281
|
+
)
|
|
282
|
+
})
|
|
@@ -1,8 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Collapsible,
|
|
3
|
+
CollapsibleContent,
|
|
4
|
+
CollapsibleTrigger,
|
|
5
|
+
Drawer,
|
|
6
|
+
DrawerContent,
|
|
7
|
+
DrawerDescription,
|
|
8
|
+
DrawerTitle,
|
|
9
|
+
DrawerTrigger,
|
|
10
|
+
Markdown,
|
|
11
|
+
type MarkdownProps,
|
|
12
|
+
PHONE_QUERY,
|
|
13
|
+
} from "@sixb/ui/components"
|
|
2
14
|
import { useLocale } from "@sixb/ui/lib/i18n"
|
|
3
15
|
import { cn } from "@sixb/ui/lib/utils"
|
|
4
|
-
import {
|
|
5
|
-
|
|
16
|
+
import {
|
|
17
|
+
ArrowDown,
|
|
18
|
+
ArrowUpRight,
|
|
19
|
+
BookmarkCheck,
|
|
20
|
+
ChevronRight,
|
|
21
|
+
FileX,
|
|
22
|
+
Wrench,
|
|
23
|
+
X,
|
|
24
|
+
} from "lucide-react"
|
|
25
|
+
import {
|
|
26
|
+
memo,
|
|
27
|
+
type ReactNode,
|
|
28
|
+
useCallback,
|
|
29
|
+
useEffect,
|
|
30
|
+
useLayoutEffect,
|
|
31
|
+
useRef,
|
|
32
|
+
useState,
|
|
33
|
+
type WheelEvent,
|
|
34
|
+
} from "react"
|
|
6
35
|
import { formatFileSize } from "../../artifacts/file-size"
|
|
7
36
|
import { ReferencingMarkdown } from "../../artifacts/references/references"
|
|
8
37
|
import { viewerTargetKey } from "../../artifacts/target"
|
|
@@ -214,18 +243,48 @@ const FileBlock = memo(function FileBlock({
|
|
|
214
243
|
* the newest step, keeping the main transcript informative without exposing debug detail. Inside,
|
|
215
244
|
* items flow in one indented column and can expand inline when deeper inspection is useful.
|
|
216
245
|
*/
|
|
217
|
-
|
|
218
|
-
parts
|
|
219
|
-
inProgress
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
246
|
+
interface WorkGroupProps {
|
|
247
|
+
readonly parts: readonly NormalizedPart[]
|
|
248
|
+
readonly inProgress: boolean
|
|
249
|
+
/** In a sub-agent's thread: closed like the chat's work line, without an inner scroll. */
|
|
250
|
+
readonly nested?: boolean
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function sameElements<T>(a: readonly T[], b: readonly T[]): boolean {
|
|
254
|
+
if (a === b) return true
|
|
255
|
+
if (a.length !== b.length) return false
|
|
256
|
+
for (let i = 0; i < a.length; i++) {
|
|
257
|
+
if (!Object.is(a[i], b[i])) return false
|
|
258
|
+
}
|
|
259
|
+
return true
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const DETACH_THRESHOLD_PX = 24
|
|
263
|
+
const REATTACH_THRESHOLD_PX = 12
|
|
264
|
+
const REASONING_COMPONENTS: MarkdownProps["components"] = { img: () => null }
|
|
265
|
+
|
|
266
|
+
function usePhoneSheet(enabled: boolean): boolean {
|
|
267
|
+
const [phone, setPhone] = useState(false)
|
|
268
|
+
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
if (!enabled || typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
271
|
+
setPhone(false)
|
|
272
|
+
return
|
|
273
|
+
}
|
|
274
|
+
const mql = window.matchMedia(PHONE_QUERY)
|
|
275
|
+
const onChange = () => setPhone(mql.matches)
|
|
276
|
+
setPhone(mql.matches)
|
|
277
|
+
mql.addEventListener("change", onChange)
|
|
278
|
+
return () => mql.removeEventListener("change", onChange)
|
|
279
|
+
}, [enabled])
|
|
280
|
+
|
|
281
|
+
return enabled && phone
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function WorkGroupView({ parts, inProgress, nested = false }: WorkGroupProps) {
|
|
227
285
|
const messages = useAgentMessages()
|
|
228
286
|
const [open, setOpen] = useState(false)
|
|
287
|
+
const phoneSheet = usePhoneSheet(!nested)
|
|
229
288
|
const sources = collectWebSources(parts)
|
|
230
289
|
const searches = parts.flatMap((part) =>
|
|
231
290
|
part.kind === "tool" && part.tool.toolName === "web_search" ? [part.tool] : []
|
|
@@ -250,39 +309,16 @@ function WorkGroup({
|
|
|
250
309
|
// while it waits on the reader, and once it is done.
|
|
251
310
|
const label = hasTools ? messages.activity.steps(toolCount) : messages.activity.reasoning
|
|
252
311
|
|
|
253
|
-
|
|
254
|
-
<
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
) : (
|
|
264
|
-
<span>{label}</span>
|
|
265
|
-
)}
|
|
266
|
-
<ChevronRight className="size-3.5 shrink-0 opacity-50 transition-all group-hover:opacity-100 group-focus-visible:opacity-100 group-data-[state=open]:rotate-90 group-data-[state=open]:opacity-100" />
|
|
267
|
-
</CollapsibleTrigger>
|
|
268
|
-
<CollapsibleContent>
|
|
269
|
-
<div
|
|
270
|
-
className={cn(
|
|
271
|
-
"mt-2 ml-1 flex flex-col gap-3 border-l border-border py-0.5 pr-2 pl-3.5",
|
|
272
|
-
!nested && "scrollbar-thin max-h-[min(24rem,50vh)] overflow-y-auto overscroll-contain"
|
|
273
|
-
)}
|
|
274
|
-
>
|
|
275
|
-
{parts.map((part, index) => {
|
|
276
|
-
if (part.kind === "reasoning") {
|
|
277
|
-
return <GroupReasoning key={index} text={part.text} streaming={part.streaming} />
|
|
278
|
-
}
|
|
279
|
-
if (part.kind === "tool") {
|
|
280
|
-
return <ToolCallRow key={index} tool={part.tool} parts={parts} />
|
|
281
|
-
}
|
|
282
|
-
return null
|
|
283
|
-
})}
|
|
284
|
-
</div>
|
|
285
|
-
</CollapsibleContent>
|
|
312
|
+
const triggerLabel = inProgress ? (
|
|
313
|
+
<ActivityStatusText label={liveLabel} className="shimmer motion-reduce:animate-none" />
|
|
314
|
+
) : (
|
|
315
|
+
<span>{label}</span>
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
const stepsContent = <WorkStepsList parts={parts} />
|
|
319
|
+
|
|
320
|
+
const afterTrigger = (
|
|
321
|
+
<>
|
|
286
322
|
{made.length > 0 ? (
|
|
287
323
|
<div className="mt-3 flex flex-col gap-5">
|
|
288
324
|
{made.map(({ media, running }, index) => (
|
|
@@ -300,20 +336,287 @@ function WorkGroup({
|
|
|
300
336
|
{searchFailed ? messages.activity.searchFailedHint : messages.activity.noSources}
|
|
301
337
|
</p>
|
|
302
338
|
) : null}
|
|
339
|
+
</>
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
if (phoneSheet) {
|
|
343
|
+
return (
|
|
344
|
+
<div className="max-w-full">
|
|
345
|
+
<Drawer open={open} onOpenChange={setOpen}>
|
|
346
|
+
<DrawerTrigger asChild>
|
|
347
|
+
<button
|
|
348
|
+
type="button"
|
|
349
|
+
data-state={open ? "open" : "closed"}
|
|
350
|
+
className={cn(
|
|
351
|
+
ACTIVITY_STATUS_ROW_CLASS_NAME,
|
|
352
|
+
"outline-none transition-colors hover:bg-muted/50 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
|
|
353
|
+
)}
|
|
354
|
+
>
|
|
355
|
+
{triggerLabel}
|
|
356
|
+
<ChevronRight className="size-3.5 shrink-0 opacity-50 transition-all group-hover:opacity-100 group-focus-visible:opacity-100 group-data-[state=open]:rotate-90 group-data-[state=open]:opacity-100" />
|
|
357
|
+
</button>
|
|
358
|
+
</DrawerTrigger>
|
|
359
|
+
<DrawerContent data-work-sheet="" className="max-h-[82dvh] outline-none">
|
|
360
|
+
<div className="flex shrink-0 items-center justify-between gap-3 border-b border-border/60 px-4 pt-3 pb-2.5">
|
|
361
|
+
<div className="flex min-w-0 flex-1 items-center gap-2">
|
|
362
|
+
<DrawerTitle className="min-w-0 truncate text-sm font-semibold text-foreground">
|
|
363
|
+
{inProgress ? (
|
|
364
|
+
<ActivityStatusText
|
|
365
|
+
label={liveLabel}
|
|
366
|
+
className="shimmer motion-reduce:animate-none"
|
|
367
|
+
/>
|
|
368
|
+
) : (
|
|
369
|
+
label
|
|
370
|
+
)}
|
|
371
|
+
</DrawerTitle>
|
|
372
|
+
{inProgress && hasTools ? (
|
|
373
|
+
<span className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium tabular-nums text-muted-foreground">
|
|
374
|
+
{label}
|
|
375
|
+
</span>
|
|
376
|
+
) : null}
|
|
377
|
+
</div>
|
|
378
|
+
<DrawerDescription className="sr-only">{label}</DrawerDescription>
|
|
379
|
+
<button
|
|
380
|
+
type="button"
|
|
381
|
+
onClick={() => setOpen(false)}
|
|
382
|
+
aria-label={messages.artifacts.close}
|
|
383
|
+
className="flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40"
|
|
384
|
+
>
|
|
385
|
+
<X className="size-4" aria-hidden="true" />
|
|
386
|
+
</button>
|
|
387
|
+
</div>
|
|
388
|
+
<WorkStepsScroll inProgress={inProgress} mobile>
|
|
389
|
+
{stepsContent}
|
|
390
|
+
</WorkStepsScroll>
|
|
391
|
+
</DrawerContent>
|
|
392
|
+
</Drawer>
|
|
393
|
+
{afterTrigger}
|
|
394
|
+
</div>
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return (
|
|
399
|
+
<Collapsible open={open} onOpenChange={setOpen} className="max-w-full">
|
|
400
|
+
<CollapsibleTrigger
|
|
401
|
+
className={cn(
|
|
402
|
+
ACTIVITY_STATUS_ROW_CLASS_NAME,
|
|
403
|
+
"outline-none transition-colors hover:bg-muted/50 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
|
|
404
|
+
)}
|
|
405
|
+
>
|
|
406
|
+
{triggerLabel}
|
|
407
|
+
<ChevronRight className="size-3.5 shrink-0 opacity-50 transition-all group-hover:opacity-100 group-focus-visible:opacity-100 group-data-[state=open]:rotate-90 group-data-[state=open]:opacity-100" />
|
|
408
|
+
</CollapsibleTrigger>
|
|
409
|
+
<CollapsibleContent>
|
|
410
|
+
{nested ? (
|
|
411
|
+
<div className="mt-2 ml-1 flex flex-col gap-3 border-l border-border py-0.5 pr-2 pl-3.5">
|
|
412
|
+
{stepsContent}
|
|
413
|
+
</div>
|
|
414
|
+
) : (
|
|
415
|
+
<WorkStepsScroll inProgress={inProgress}>{stepsContent}</WorkStepsScroll>
|
|
416
|
+
)}
|
|
417
|
+
</CollapsibleContent>
|
|
418
|
+
{afterTrigger}
|
|
303
419
|
</Collapsible>
|
|
304
420
|
)
|
|
305
421
|
}
|
|
306
422
|
|
|
307
|
-
|
|
308
|
-
|
|
423
|
+
function WorkStepsList({ parts }: { readonly parts: readonly NormalizedPart[] }) {
|
|
424
|
+
return (
|
|
425
|
+
<>
|
|
426
|
+
{parts.map((part, index) => {
|
|
427
|
+
if (part.kind === "reasoning") {
|
|
428
|
+
return <GroupReasoning key={index} text={part.text} streaming={part.streaming} />
|
|
429
|
+
}
|
|
430
|
+
if (part.kind === "tool") {
|
|
431
|
+
return <ToolCallRow key={index} tool={part.tool} parts={parts} />
|
|
432
|
+
}
|
|
433
|
+
return null
|
|
434
|
+
})}
|
|
435
|
+
</>
|
|
436
|
+
)
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function WorkStepsScroll({
|
|
440
|
+
inProgress,
|
|
441
|
+
mobile = false,
|
|
442
|
+
children,
|
|
443
|
+
}: {
|
|
444
|
+
readonly inProgress: boolean
|
|
445
|
+
readonly mobile?: boolean
|
|
446
|
+
readonly children: ReactNode
|
|
447
|
+
}) {
|
|
448
|
+
const messages = useAgentMessages().activity
|
|
449
|
+
const scrollRef = useRef<HTMLDivElement>(null)
|
|
450
|
+
const contentRef = useRef<HTMLDivElement>(null)
|
|
451
|
+
const followingRef = useRef(inProgress)
|
|
452
|
+
const lastScrollTopRef = useRef(0)
|
|
453
|
+
const [detached, setDetached] = useState(false)
|
|
454
|
+
|
|
455
|
+
const syncEdges = useCallback((box: HTMLDivElement) => {
|
|
456
|
+
const remaining = box.scrollHeight - box.scrollTop - box.clientHeight
|
|
457
|
+
box.toggleAttribute("data-fade-top", box.scrollTop > 2)
|
|
458
|
+
box.toggleAttribute("data-fade-bottom", remaining > 2)
|
|
459
|
+
return remaining
|
|
460
|
+
}, [])
|
|
461
|
+
|
|
462
|
+
const pinToBottom = useCallback(
|
|
463
|
+
(box: HTMLDivElement) => {
|
|
464
|
+
box.scrollTop = Math.max(0, box.scrollHeight - box.clientHeight)
|
|
465
|
+
lastScrollTopRef.current = box.scrollTop
|
|
466
|
+
syncEdges(box)
|
|
467
|
+
},
|
|
468
|
+
[syncEdges]
|
|
469
|
+
)
|
|
470
|
+
|
|
471
|
+
// Active turns open pinned to the live bottom before paint; settled turns open at the top.
|
|
472
|
+
useLayoutEffect(() => {
|
|
473
|
+
const box = scrollRef.current
|
|
474
|
+
if (!box) return
|
|
475
|
+
if (inProgress) {
|
|
476
|
+
followingRef.current = true
|
|
477
|
+
setDetached(false)
|
|
478
|
+
pinToBottom(box)
|
|
479
|
+
} else {
|
|
480
|
+
followingRef.current = false
|
|
481
|
+
setDetached(false)
|
|
482
|
+
lastScrollTopRef.current = box.scrollTop
|
|
483
|
+
syncEdges(box)
|
|
484
|
+
}
|
|
485
|
+
}, [inProgress, pinToBottom, syncEdges])
|
|
486
|
+
|
|
487
|
+
// Follow newly streamed reasoning deltas and tool rows until the reader scrolls upward.
|
|
488
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: children drives synchronous follow on stream updates
|
|
489
|
+
useLayoutEffect(() => {
|
|
490
|
+
const box = scrollRef.current
|
|
491
|
+
if (!box) return
|
|
492
|
+
if (inProgress && followingRef.current) {
|
|
493
|
+
pinToBottom(box)
|
|
494
|
+
} else {
|
|
495
|
+
syncEdges(box)
|
|
496
|
+
}
|
|
497
|
+
}, [children, inProgress, pinToBottom, syncEdges])
|
|
498
|
+
|
|
499
|
+
useEffect(() => {
|
|
500
|
+
const box = scrollRef.current
|
|
501
|
+
const inner = contentRef.current
|
|
502
|
+
if (!box || !inner) return
|
|
503
|
+
|
|
504
|
+
const onResize = () => {
|
|
505
|
+
if (inProgress && followingRef.current) {
|
|
506
|
+
pinToBottom(box)
|
|
507
|
+
} else {
|
|
508
|
+
const remaining = syncEdges(box)
|
|
509
|
+
if (inProgress && !followingRef.current && remaining > DETACH_THRESHOLD_PX) {
|
|
510
|
+
setDetached((prev) => (prev ? prev : true))
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
const onScroll = () => {
|
|
516
|
+
const movedUp = box.scrollTop < lastScrollTopRef.current - 1
|
|
517
|
+
lastScrollTopRef.current = box.scrollTop
|
|
518
|
+
const remaining = syncEdges(box)
|
|
519
|
+
if (remaining <= REATTACH_THRESHOLD_PX) {
|
|
520
|
+
followingRef.current = true
|
|
521
|
+
setDetached((prev) => (prev ? false : prev))
|
|
522
|
+
} else if (movedUp && remaining > DETACH_THRESHOLD_PX) {
|
|
523
|
+
followingRef.current = false
|
|
524
|
+
if (inProgress) setDetached((prev) => (prev ? prev : true))
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
const observer = new ResizeObserver(onResize)
|
|
529
|
+
observer.observe(inner)
|
|
530
|
+
observer.observe(box)
|
|
531
|
+
box.addEventListener("scroll", onScroll, { passive: true })
|
|
532
|
+
return () => {
|
|
533
|
+
observer.disconnect()
|
|
534
|
+
box.removeEventListener("scroll", onScroll)
|
|
535
|
+
}
|
|
536
|
+
}, [inProgress, pinToBottom, syncEdges])
|
|
537
|
+
|
|
538
|
+
const releaseOnUpwardWheel = (event: WheelEvent<HTMLDivElement>) => {
|
|
539
|
+
if (event.deltaY >= 0) return
|
|
540
|
+
const box = scrollRef.current
|
|
541
|
+
if (!box || box.scrollHeight <= box.clientHeight) return
|
|
542
|
+
followingRef.current = false
|
|
543
|
+
if (inProgress && box.scrollHeight - box.scrollTop - box.clientHeight > REATTACH_THRESHOLD_PX) {
|
|
544
|
+
setDetached(true)
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const jumpToLatest = () => {
|
|
549
|
+
const box = scrollRef.current
|
|
550
|
+
followingRef.current = true
|
|
551
|
+
setDetached(false)
|
|
552
|
+
if (box) pinToBottom(box)
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
return (
|
|
556
|
+
<div className={cn("relative min-h-0", mobile && "flex flex-1 flex-col")}>
|
|
557
|
+
<div
|
|
558
|
+
ref={scrollRef}
|
|
559
|
+
data-work-scroll=""
|
|
560
|
+
onWheel={releaseOnUpwardWheel}
|
|
561
|
+
className={cn(
|
|
562
|
+
"sixb-work-scroll scrollbar-thin overflow-y-auto overscroll-contain",
|
|
563
|
+
mobile
|
|
564
|
+
? "max-h-[min(64dvh,32rem)] px-4 pt-3 pb-[max(1rem,env(safe-area-inset-bottom))]"
|
|
565
|
+
: "mt-2 ml-1 max-h-[min(24rem,50vh)] border-l border-border py-0.5 pr-2 pl-3.5"
|
|
566
|
+
)}
|
|
567
|
+
>
|
|
568
|
+
<div ref={contentRef} className="flex flex-col gap-3">
|
|
569
|
+
{children}
|
|
570
|
+
</div>
|
|
571
|
+
</div>
|
|
572
|
+
{inProgress && detached ? (
|
|
573
|
+
<button
|
|
574
|
+
type="button"
|
|
575
|
+
data-work-latest=""
|
|
576
|
+
onClick={jumpToLatest}
|
|
577
|
+
className="sixb-work-latest absolute bottom-2 left-1/2 z-10 flex h-7 -translate-x-1/2 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium text-foreground outline-none transition-transform hover:scale-[1.02] active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-ring"
|
|
578
|
+
>
|
|
579
|
+
<span
|
|
580
|
+
className="size-1.5 rounded-full bg-sky-500 motion-safe:animate-pulse"
|
|
581
|
+
aria-hidden="true"
|
|
582
|
+
/>
|
|
583
|
+
<span>{messages.latest}</span>
|
|
584
|
+
<ArrowDown className="size-3 text-muted-foreground" aria-hidden="true" />
|
|
585
|
+
</button>
|
|
586
|
+
) : null}
|
|
587
|
+
</div>
|
|
588
|
+
)
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function sameWorkGroup(prev: WorkGroupProps, next: WorkGroupProps): boolean {
|
|
592
|
+
return (
|
|
593
|
+
prev.inProgress === next.inProgress &&
|
|
594
|
+
(prev.nested ?? false) === (next.nested ?? false) &&
|
|
595
|
+
sameElements(prev.parts, next.parts)
|
|
596
|
+
)
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const WorkGroup = memo(WorkGroupView, sameWorkGroup)
|
|
600
|
+
|
|
601
|
+
/** Reasoning inside a work group: structured Markdown notes subordinate to the main answer. */
|
|
602
|
+
const GroupReasoning = memo(function GroupReasoning({
|
|
603
|
+
text,
|
|
604
|
+
streaming,
|
|
605
|
+
}: {
|
|
606
|
+
text: string
|
|
607
|
+
streaming: boolean
|
|
608
|
+
}) {
|
|
309
609
|
if (!text.trim()) return null
|
|
310
610
|
return (
|
|
311
|
-
<
|
|
611
|
+
<Markdown
|
|
612
|
+
className="sixb-reasoning-prose"
|
|
613
|
+
components={REASONING_COMPONENTS}
|
|
614
|
+
data-streaming={streaming ? "true" : undefined}
|
|
615
|
+
>
|
|
312
616
|
{text}
|
|
313
|
-
|
|
314
|
-
</p>
|
|
617
|
+
</Markdown>
|
|
315
618
|
)
|
|
316
|
-
}
|
|
619
|
+
})
|
|
317
620
|
|
|
318
621
|
/**
|
|
319
622
|
* A single tool call within a work group. A project view placed in the work takes the row; else
|
|
@@ -321,14 +624,13 @@ function GroupReasoning({ text, streaming }: { text: string; streaming: boolean
|
|
|
321
624
|
* inspector. All keep their bodies borderless and inline so an expanded result flows within the
|
|
322
625
|
* group rather than reading as a nested dropdown.
|
|
323
626
|
*/
|
|
324
|
-
|
|
325
|
-
tool
|
|
326
|
-
parts,
|
|
327
|
-
}: {
|
|
328
|
-
tool: NormalizedTool
|
|
627
|
+
interface ToolCallRowProps {
|
|
628
|
+
readonly tool: NormalizedTool
|
|
329
629
|
/** The rest of its work, which names the children a wait is for. */
|
|
330
|
-
parts: readonly NormalizedPart[]
|
|
331
|
-
}
|
|
630
|
+
readonly parts: readonly NormalizedPart[]
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
function ToolCallRowView({ tool, parts }: ToolCallRowProps) {
|
|
332
634
|
const view = useAgentToolView(tool.toolName)
|
|
333
635
|
const row =
|
|
334
636
|
view?.placement === "work" ? (
|
|
@@ -350,6 +652,12 @@ function ToolCallRow({
|
|
|
350
652
|
)
|
|
351
653
|
}
|
|
352
654
|
|
|
655
|
+
function sameToolCallRow(prev: ToolCallRowProps, next: ToolCallRowProps): boolean {
|
|
656
|
+
return Object.is(prev.tool, next.tool) && sameElements(prev.parts, next.parts)
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
const ToolCallRow = memo(ToolCallRowView, sameToolCallRow)
|
|
660
|
+
|
|
353
661
|
/**
|
|
354
662
|
* Under a call whose output was too large for the model's context, the whole output it saved: it
|
|
355
663
|
* opens beside the conversation, or in a new tab where there is no panel.
|