@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
|
@@ -6,7 +6,16 @@ import {
|
|
|
6
6
|
MessageScrollerProvider,
|
|
7
7
|
MessageScrollerViewport,
|
|
8
8
|
} from "@sixb/ui/components"
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Fragment,
|
|
11
|
+
memo,
|
|
12
|
+
type ReactNode,
|
|
13
|
+
useCallback,
|
|
14
|
+
useEffect,
|
|
15
|
+
useMemo,
|
|
16
|
+
useRef,
|
|
17
|
+
useState,
|
|
18
|
+
} from "react"
|
|
10
19
|
import {
|
|
11
20
|
ApprovalCardsContext,
|
|
12
21
|
type HeldCall,
|
|
@@ -20,16 +29,20 @@ import { BACKGROUND_TOOLS, readThreadBackground } from "../background/interpret"
|
|
|
20
29
|
import type { AgentConversationMessage, AgentConversationTurn } from "../conversation"
|
|
21
30
|
import { DelegationCardsContext, type TranscriptDelegation } from "../delegation/context"
|
|
22
31
|
import {
|
|
23
|
-
|
|
32
|
+
type DelegationTurn,
|
|
33
|
+
delegationTurnEntry,
|
|
24
34
|
readThreadDelegation,
|
|
25
35
|
type ThreadDelegation,
|
|
26
36
|
} from "../delegation/interpret"
|
|
27
37
|
import { heldInCard } from "../delegation/model"
|
|
38
|
+
import type { AgentMessageEditDraft } from "../hooks/use-agent-conversation"
|
|
28
39
|
import { useAgentMessages } from "../i18n"
|
|
29
40
|
import { principalKey } from "../message-authors"
|
|
41
|
+
import type { TranscriptMove } from "../moves"
|
|
30
42
|
import { openQuestion } from "../questions/interpret"
|
|
31
43
|
import { type QuestionTurn, QuestionTurnContext } from "../questions/question-card"
|
|
32
44
|
import { CONTEXT_LIMIT_EXCEEDED } from "../run-presentation"
|
|
45
|
+
import type { AgentContextEntryInput, AgentFileRef } from "../types"
|
|
33
46
|
import { ApprovalCards } from "./approval-card"
|
|
34
47
|
import {
|
|
35
48
|
CompactionMarker,
|
|
@@ -54,6 +67,18 @@ export interface TranscriptProps {
|
|
|
54
67
|
readonly anchorCurrentTurn?: boolean
|
|
55
68
|
readonly onRetry?: () => void
|
|
56
69
|
readonly onContinue?: () => void
|
|
70
|
+
/** Saved user message ids the reader may edit in place. */
|
|
71
|
+
readonly editableMessageIds?: ReadonlySet<string>
|
|
72
|
+
/** Controlled inline-edit draft, when managed by `useAgentConversation`. */
|
|
73
|
+
readonly editingMessage?: AgentMessageEditDraft | null
|
|
74
|
+
readonly onStartEditMessage?: (messageId: string) => void
|
|
75
|
+
readonly onCancelEditMessage?: () => void
|
|
76
|
+
readonly onSubmitEditMessage?: (
|
|
77
|
+
messageId: string,
|
|
78
|
+
text: string,
|
|
79
|
+
attachments: readonly AgentFileRef[],
|
|
80
|
+
context: readonly AgentContextEntryInput[]
|
|
81
|
+
) => void
|
|
57
82
|
/** Start a new thread: the way on from a conversation too long for its model. */
|
|
58
83
|
readonly onNewThread?: () => void
|
|
59
84
|
/**
|
|
@@ -70,7 +95,13 @@ export interface TranscriptProps {
|
|
|
70
95
|
*/
|
|
71
96
|
readonly delegation?: TranscriptDelegation
|
|
72
97
|
/** Where the conversation moved, after which saved message: the files from before stayed. */
|
|
73
|
-
readonly moved?: {
|
|
98
|
+
readonly moved?: {
|
|
99
|
+
readonly afterMessageId: string
|
|
100
|
+
readonly label: string
|
|
101
|
+
readonly place?: "cloud" | "computer"
|
|
102
|
+
} | null
|
|
103
|
+
/** Every workspace transition across the conversation, keyed by the message before the move. */
|
|
104
|
+
readonly moves?: ReadonlyMap<string, TranscriptMove>
|
|
74
105
|
/**
|
|
75
106
|
* Where its background commands run and what is known of them now, each a card under the work
|
|
76
107
|
* that started it. Without it, a command its turn no longer runs reads as last seen running.
|
|
@@ -87,6 +118,23 @@ const NO_OUTCOMES: ReadonlyMap<string, ReportedApprovalOutcome> = new Map()
|
|
|
87
118
|
|
|
88
119
|
/** A reply whose questions the conversation has moved past. */
|
|
89
120
|
const CLOSED_QUESTION: QuestionTurn = { open: false }
|
|
121
|
+
const OPEN_ANSWERING_QUESTION: QuestionTurn = { open: true, answering: true }
|
|
122
|
+
const OPEN_WAITING_QUESTION: QuestionTurn = { open: true, answering: false }
|
|
123
|
+
|
|
124
|
+
const backgroundSigEntries = new WeakMap<AgentConversationMessage, string>()
|
|
125
|
+
|
|
126
|
+
function messageBackgroundSignature(message: AgentConversationMessage): string {
|
|
127
|
+
const cached = backgroundSigEntries.get(message)
|
|
128
|
+
if (cached !== undefined) return cached
|
|
129
|
+
let sig = ""
|
|
130
|
+
for (const part of message.parts) {
|
|
131
|
+
if (part.type === "tool" && BACKGROUND_TOOLS.has(part.toolName)) {
|
|
132
|
+
sig += `${part.toolCallId ?? ""}@${part.state};`
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
backgroundSigEntries.set(message, sig)
|
|
136
|
+
return sig
|
|
137
|
+
}
|
|
90
138
|
|
|
91
139
|
/** Nothing said of where the commands run: no card claims how one ended that nobody saw. */
|
|
92
140
|
const UNKNOWN_BACKGROUND: TranscriptBackground = {
|
|
@@ -101,10 +149,19 @@ export function Transcript(props: TranscriptProps) {
|
|
|
101
149
|
)
|
|
102
150
|
|
|
103
151
|
// The reply streaming now changes with every chunk; its delegation calls far less often.
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
152
|
+
// Each saved message caches its delegation & background signature by object identity.
|
|
153
|
+
const turns: DelegationTurn[] = []
|
|
154
|
+
let signature = ""
|
|
155
|
+
let backgroundSignature = ""
|
|
156
|
+
for (const message of messages) {
|
|
157
|
+
const entry = delegationTurnEntry(message)
|
|
158
|
+
if (entry) {
|
|
159
|
+
turns.push(entry.turn)
|
|
160
|
+
signature += `${entry.signature}|`
|
|
161
|
+
}
|
|
162
|
+
const bgSig = messageBackgroundSignature(message)
|
|
163
|
+
if (bgSig) backgroundSignature += `${bgSig}|`
|
|
164
|
+
}
|
|
108
165
|
// biome-ignore lint/correctness/useExhaustiveDependencies: the signature stands for the turns
|
|
109
166
|
const delegation = useMemo(() => readThreadDelegation(turns), [signature])
|
|
110
167
|
const liveRunId = turn.kind === "responding" ? turn.runId : null
|
|
@@ -113,16 +170,6 @@ export function Transcript(props: TranscriptProps) {
|
|
|
113
170
|
[threadId, delegation, liveRunId, actions]
|
|
114
171
|
)
|
|
115
172
|
|
|
116
|
-
// Its background commands change as their calls do, not with every chunk of the reply.
|
|
117
|
-
const backgroundSignature = JSON.stringify(
|
|
118
|
-
messages.flatMap((message) =>
|
|
119
|
-
message.parts.flatMap((part) =>
|
|
120
|
-
part.type === "tool" && BACKGROUND_TOOLS.has(part.toolName)
|
|
121
|
-
? [[part.toolCallId, part.state]]
|
|
122
|
-
: []
|
|
123
|
-
)
|
|
124
|
-
)
|
|
125
|
-
)
|
|
126
173
|
// biome-ignore lint/correctness/useExhaustiveDependencies: the signature stands for the calls
|
|
127
174
|
const thread = useMemo(() => readThreadBackground(messages), [backgroundSignature])
|
|
128
175
|
const { background = UNKNOWN_BACKGROUND } = props
|
|
@@ -150,11 +197,71 @@ function TranscriptView({
|
|
|
150
197
|
anchorCurrentTurn,
|
|
151
198
|
onRetry,
|
|
152
199
|
onContinue,
|
|
200
|
+
editableMessageIds,
|
|
201
|
+
editingMessage,
|
|
202
|
+
onStartEditMessage,
|
|
203
|
+
onCancelEditMessage,
|
|
204
|
+
onSubmitEditMessage,
|
|
153
205
|
onNewThread,
|
|
154
206
|
approvals,
|
|
155
207
|
moved,
|
|
208
|
+
moves,
|
|
156
209
|
onAnswer,
|
|
157
210
|
}: TranscriptProps & { readonly threadDelegation: ThreadDelegation }) {
|
|
211
|
+
const [uncontrolledEdit, setUncontrolledEdit] = useState<AgentMessageEditDraft | null>(null)
|
|
212
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: reset uncontrolled inline edit when switching threads
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
setUncontrolledEdit(null)
|
|
215
|
+
}, [threadId])
|
|
216
|
+
|
|
217
|
+
const controlledEditing = editingMessage !== undefined
|
|
218
|
+
const activeEdit = controlledEditing ? editingMessage : uncontrolledEdit
|
|
219
|
+
|
|
220
|
+
// Read at click time: the handler stays the same while a reply streams, so the memoized
|
|
221
|
+
// messages keep their props.
|
|
222
|
+
const messagesRef = useRef(messages)
|
|
223
|
+
messagesRef.current = messages
|
|
224
|
+
|
|
225
|
+
const handleStartEdit = useCallback(
|
|
226
|
+
(messageId: string) => {
|
|
227
|
+
if (onStartEditMessage) {
|
|
228
|
+
onStartEditMessage(messageId)
|
|
229
|
+
return
|
|
230
|
+
}
|
|
231
|
+
const target = messagesRef.current.find(
|
|
232
|
+
(entry) => entry.id === messageId && entry.role === "user"
|
|
233
|
+
)
|
|
234
|
+
if (!target) return
|
|
235
|
+
const text = target.parts
|
|
236
|
+
.map((part) => (part.type === "text" ? part.text : ""))
|
|
237
|
+
.join("")
|
|
238
|
+
.trim()
|
|
239
|
+
const attachments = target.parts.flatMap((part) =>
|
|
240
|
+
part.type === "file" ? [part.fileRef] : []
|
|
241
|
+
)
|
|
242
|
+
setUncontrolledEdit({ messageId, text, attachments, context: target.context, nonce: 1 })
|
|
243
|
+
},
|
|
244
|
+
[onStartEditMessage]
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
const handleCancelEdit = useCallback(() => {
|
|
248
|
+
if (onCancelEditMessage) onCancelEditMessage()
|
|
249
|
+
else setUncontrolledEdit(null)
|
|
250
|
+
}, [onCancelEditMessage])
|
|
251
|
+
|
|
252
|
+
const handleSubmitEdit = useCallback(
|
|
253
|
+
(
|
|
254
|
+
messageId: string,
|
|
255
|
+
text: string,
|
|
256
|
+
attachments: readonly AgentFileRef[],
|
|
257
|
+
context: readonly AgentContextEntryInput[]
|
|
258
|
+
) => {
|
|
259
|
+
if (!controlledEditing) setUncontrolledEdit(null)
|
|
260
|
+
onSubmitEditMessage?.(messageId, text, attachments, context)
|
|
261
|
+
},
|
|
262
|
+
[controlledEditing, onSubmitEditMessage]
|
|
263
|
+
)
|
|
264
|
+
|
|
158
265
|
// Messages one person sends in a row name them once; an answer in between names them again.
|
|
159
266
|
const continuedKeys = useMemo(() => continuedUserMessages(messages), [messages])
|
|
160
267
|
|
|
@@ -162,11 +269,14 @@ function TranscriptView({
|
|
|
162
269
|
const last = messages.at(-1)
|
|
163
270
|
const liveReply = last?.role === "assistant" && last.id === null ? last : undefined
|
|
164
271
|
|
|
165
|
-
// Bridge the gap between sending and the reply's first content with a thinking shimmer
|
|
272
|
+
// Bridge the gap between sending and the reply's first content with a thinking shimmer, and
|
|
273
|
+
// between a message the turn just read and the reply to it.
|
|
274
|
+
const justRead = last?.role === "user" && last.status === "streaming"
|
|
166
275
|
const showThinking =
|
|
167
276
|
turn.kind === "responding" &&
|
|
168
277
|
!liveReply &&
|
|
169
|
-
|
|
278
|
+
(justRead ||
|
|
279
|
+
!messages.some((message) => message.role === "assistant" && message.runId === turn.runId))
|
|
170
280
|
|
|
171
281
|
// A saved thread should open at the newest content, not at the first or last user turn. Only mark
|
|
172
282
|
// a row as a scroll anchor while the current UI-initiated turn is in flight: the pending row
|
|
@@ -179,9 +289,14 @@ function TranscriptView({
|
|
|
179
289
|
? currentTurnAnchor(messages, turn.kind === "responding" ? turn.runId : liveReply?.runId)
|
|
180
290
|
: lastKey(messages, (message) => message.status === "pending")
|
|
181
291
|
const newestSavedKey = lastKey(messages, (message) => message.id !== null)
|
|
292
|
+
const onContinueRef = useRef(onContinue)
|
|
293
|
+
onContinueRef.current = onContinue
|
|
294
|
+
const stableOnContinue = useCallback(() => onContinueRef.current?.(), [])
|
|
295
|
+
const hasOnContinue = onContinue !== undefined
|
|
296
|
+
|
|
182
297
|
// The reply whose questions are the conversation's last word, which its cards answer.
|
|
183
298
|
const openQuestionKey = openQuestion(messages, turn)?.messageKey ?? null
|
|
184
|
-
const asking =
|
|
299
|
+
const asking = onAnswer !== undefined ? OPEN_ANSWERING_QUESTION : OPEN_WAITING_QUESTION
|
|
185
300
|
|
|
186
301
|
// A call is answered on the card under the work that made it. One whose command output does not
|
|
187
302
|
// name it, such as output sent elsewhere, still gets a card, after its turn's saved answer, and
|
|
@@ -244,6 +359,10 @@ function TranscriptView({
|
|
|
244
359
|
message.runId && lastOfRun.get(message.runId) === message.key
|
|
245
360
|
? unshown.byRun.get(message.runId)
|
|
246
361
|
: undefined
|
|
362
|
+
// Where the conversation moved after this message: the files it worked on stayed.
|
|
363
|
+
const move =
|
|
364
|
+
(message.id ? moves?.get(message.id) : undefined) ??
|
|
365
|
+
(moved && message.id === moved.afterMessageId ? moved : undefined)
|
|
247
366
|
return (
|
|
248
367
|
<Fragment key={message.key}>
|
|
249
368
|
{index === trailingAt ? trailingCards : null}
|
|
@@ -254,9 +373,26 @@ function TranscriptView({
|
|
|
254
373
|
message={message}
|
|
255
374
|
continued={continuedKeys.has(message.key)}
|
|
256
375
|
scrollAnchor={message.key === anchoredKey}
|
|
376
|
+
canEdit={
|
|
377
|
+
onSubmitEditMessage !== undefined &&
|
|
378
|
+
message.id !== null &&
|
|
379
|
+
(editableMessageIds === undefined || editableMessageIds.has(message.id))
|
|
380
|
+
}
|
|
381
|
+
editing={
|
|
382
|
+
activeEdit !== null && message.id === activeEdit.messageId
|
|
383
|
+
? activeEdit
|
|
384
|
+
: null
|
|
385
|
+
}
|
|
386
|
+
{...(onSubmitEditMessage
|
|
387
|
+
? {
|
|
388
|
+
onStartEdit: handleStartEdit,
|
|
389
|
+
onCancelEdit: handleCancelEdit,
|
|
390
|
+
onSubmitEdit: handleSubmitEdit,
|
|
391
|
+
}
|
|
392
|
+
: {})}
|
|
257
393
|
// Only the newest answer can be continued; older ones keep their notice alone.
|
|
258
|
-
{...(message.key === newestSavedKey &&
|
|
259
|
-
? { onContinue, continuing: turn.continuing }
|
|
394
|
+
{...(message.key === newestSavedKey && hasOnContinue
|
|
395
|
+
? { onContinue: stableOnContinue, continuing: turn.continuing }
|
|
260
396
|
: {})}
|
|
261
397
|
{...(message === liveReply
|
|
262
398
|
? {
|
|
@@ -269,18 +405,7 @@ function TranscriptView({
|
|
|
269
405
|
/>
|
|
270
406
|
),
|
|
271
407
|
}
|
|
272
|
-
:
|
|
273
|
-
? {
|
|
274
|
-
after: (
|
|
275
|
-
<UnfinishedMarker
|
|
276
|
-
unfinished={message.unfinished}
|
|
277
|
-
{...(message.key === newestSavedKey && onContinue
|
|
278
|
-
? { onContinue, continuing: turn.continuing }
|
|
279
|
-
: {})}
|
|
280
|
-
/>
|
|
281
|
-
),
|
|
282
|
-
}
|
|
283
|
-
: {})}
|
|
408
|
+
: {})}
|
|
284
409
|
/>
|
|
285
410
|
</QuestionTurnContext.Provider>
|
|
286
411
|
{calls ? (
|
|
@@ -288,9 +413,9 @@ function TranscriptView({
|
|
|
288
413
|
<ApprovalCards calls={calls} />
|
|
289
414
|
</MessageScrollerItem>
|
|
290
415
|
) : null}
|
|
291
|
-
{
|
|
292
|
-
<MessageScrollerItem messageId=
|
|
293
|
-
<MovedMarker label={
|
|
416
|
+
{move ? (
|
|
417
|
+
<MessageScrollerItem messageId={`moved:${message.id ?? message.key}`}>
|
|
418
|
+
<MovedMarker label={move.label} place={move.place} />
|
|
294
419
|
</MessageScrollerItem>
|
|
295
420
|
) : null}
|
|
296
421
|
</Fragment>
|
|
@@ -427,6 +552,11 @@ const TranscriptMessage = memo(function TranscriptMessage({
|
|
|
427
552
|
message,
|
|
428
553
|
continued,
|
|
429
554
|
scrollAnchor,
|
|
555
|
+
canEdit = false,
|
|
556
|
+
editing = null,
|
|
557
|
+
onStartEdit,
|
|
558
|
+
onCancelEdit,
|
|
559
|
+
onSubmitEdit,
|
|
430
560
|
onContinue,
|
|
431
561
|
continuing,
|
|
432
562
|
after,
|
|
@@ -434,18 +564,42 @@ const TranscriptMessage = memo(function TranscriptMessage({
|
|
|
434
564
|
readonly message: AgentConversationMessage
|
|
435
565
|
readonly continued: boolean
|
|
436
566
|
readonly scrollAnchor: boolean
|
|
567
|
+
readonly canEdit?: boolean
|
|
568
|
+
readonly editing?: AgentMessageEditDraft | null
|
|
569
|
+
readonly onStartEdit?: (messageId: string) => void
|
|
570
|
+
readonly onCancelEdit?: () => void
|
|
571
|
+
readonly onSubmitEdit?: (
|
|
572
|
+
messageId: string,
|
|
573
|
+
text: string,
|
|
574
|
+
attachments: readonly AgentFileRef[],
|
|
575
|
+
context: readonly AgentContextEntryInput[]
|
|
576
|
+
) => void
|
|
437
577
|
readonly onContinue?: () => void
|
|
438
578
|
readonly continuing?: boolean
|
|
439
579
|
readonly after?: ReactNode
|
|
440
580
|
}) {
|
|
581
|
+
const trailing =
|
|
582
|
+
after ??
|
|
583
|
+
(message.unfinished ? (
|
|
584
|
+
<UnfinishedMarker
|
|
585
|
+
unfinished={message.unfinished}
|
|
586
|
+
{...(onContinue ? { onContinue, continuing } : {})}
|
|
587
|
+
/>
|
|
588
|
+
) : undefined)
|
|
589
|
+
|
|
441
590
|
return (
|
|
442
591
|
<MessageScrollerItem messageId={message.key} scrollAnchor={scrollAnchor}>
|
|
443
592
|
<MessageView
|
|
444
593
|
message={message}
|
|
445
594
|
continued={continued}
|
|
595
|
+
canEdit={canEdit}
|
|
596
|
+
editing={editing}
|
|
597
|
+
onStartEdit={onStartEdit}
|
|
598
|
+
onCancelEdit={onCancelEdit}
|
|
599
|
+
onSubmitEdit={onSubmitEdit}
|
|
446
600
|
onContinue={onContinue}
|
|
447
601
|
continuing={continuing}
|
|
448
|
-
after={
|
|
602
|
+
after={trailing}
|
|
449
603
|
/>
|
|
450
604
|
</MessageScrollerItem>
|
|
451
605
|
)
|
|
@@ -484,9 +638,15 @@ function currentTurnAnchor(
|
|
|
484
638
|
messages: readonly AgentConversationMessage[],
|
|
485
639
|
turnRunId: string | null | undefined
|
|
486
640
|
): string | undefined {
|
|
641
|
+
// A message the turn read as it answered comes after its first reply: the turn still answers the
|
|
642
|
+
// one before, and the view stays where it is.
|
|
643
|
+
const firstReply = messages.findIndex(
|
|
644
|
+
(message) => message.role === "assistant" && message.runId === (turnRunId ?? null)
|
|
645
|
+
)
|
|
487
646
|
for (let index = messages.length - 1; index >= 0; index--) {
|
|
488
647
|
const message = messages[index]
|
|
489
648
|
if (!message) continue
|
|
649
|
+
if (message.role === "user" && firstReply !== -1 && index > firstReply) continue
|
|
490
650
|
if (message.role === "user") return message.key
|
|
491
651
|
|
|
492
652
|
const earlierAnswer = message.id !== null && message.runId !== (turnRunId ?? null)
|