@sixb/app 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/activity-label.d.ts.map +1 -1
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/background/background-tool-row.d.ts.map +1 -1
- package/dist/agent/background/interpret.d.ts +1 -1
- package/dist/agent/background/interpret.d.ts.map +1 -1
- package/dist/agent/components/conversation-panel.d.ts +4 -1
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/message-parts.d.ts.map +1 -1
- package/dist/agent/components/transcript.d.ts +5 -0
- package/dist/agent/components/transcript.d.ts.map +1 -1
- package/dist/agent/delegation/agent-exchange.d.ts +16 -0
- package/dist/agent/delegation/agent-exchange.d.ts.map +1 -0
- package/dist/agent/delegation/child-card.d.ts +3 -3
- package/dist/agent/delegation/child-card.d.ts.map +1 -1
- package/dist/agent/delegation/child-parts.d.ts +1 -10
- package/dist/agent/delegation/child-parts.d.ts.map +1 -1
- package/dist/agent/delegation/child-work.d.ts.map +1 -1
- package/dist/agent/delegation/interpret.d.ts +4 -10
- package/dist/agent/delegation/interpret.d.ts.map +1 -1
- package/dist/agent/file-edits/file-edit-tool-view.d.ts +10 -0
- package/dist/agent/file-edits/file-edit-tool-view.d.ts.map +1 -0
- package/dist/agent/file-edits/interpret.d.ts +25 -0
- package/dist/agent/file-edits/interpret.d.ts.map +1 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts +6 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/i18n/en.d.ts +46 -5
- 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 +76 -8
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/message-agent/interpret.d.ts +2 -2
- package/dist/agent/message-agent/interpret.d.ts.map +1 -1
- package/dist/agent/publish-artifact/interpret.d.ts +1 -1
- package/dist/agent/publish-artifact/interpret.d.ts.map +1 -1
- package/dist/agent/questions/interpret.d.ts +31 -0
- package/dist/agent/questions/interpret.d.ts.map +1 -0
- package/dist/agent/questions/question-card.d.ts +16 -0
- package/dist/agent/questions/question-card.d.ts.map +1 -0
- package/dist/agent/questions/question-composer.d.ts +15 -0
- package/dist/agent/questions/question-composer.d.ts.map +1 -0
- package/dist/agent/read/interpret.d.ts +8 -1
- package/dist/agent/read/interpret.d.ts.map +1 -1
- package/dist/agent/read/read-tool-view.d.ts.map +1 -1
- package/dist/agent/tool-views/built-in.d.ts.map +1 -1
- package/dist/agent/waits.d.ts +14 -0
- package/dist/agent/waits.d.ts.map +1 -0
- package/dist/artifacts/edit-session.d.ts +11 -1
- package/dist/artifacts/edit-session.d.ts.map +1 -1
- package/dist/artifacts/frame.d.ts.map +1 -1
- package/dist/artifacts/messages.d.ts +52 -0
- package/dist/artifacts/messages.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/board-editor.d.ts +11 -4
- package/dist/artifacts/renderers/canvas/board-editor.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/board.d.ts +14 -2
- package/dist/artifacts/renderers/canvas/board.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/canvas.d.ts +4 -3
- package/dist/artifacts/renderers/canvas/canvas.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/controls.d.ts +15 -4
- package/dist/artifacts/renderers/canvas/controls.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/focus.d.ts +19 -5
- package/dist/artifacts/renderers/canvas/focus.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/gestures.d.ts +46 -0
- package/dist/artifacts/renderers/canvas/gestures.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-resize.d.ts +21 -0
- package/dist/artifacts/renderers/canvas/page-resize.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-size-controls.d.ts +21 -0
- package/dist/artifacts/renderers/canvas/page-size-controls.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-size.d.ts +93 -0
- package/dist/artifacts/renderers/canvas/page-size.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-zoom.d.ts +64 -0
- package/dist/artifacts/renderers/canvas/page-zoom.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/shown-size.d.ts +26 -0
- package/dist/artifacts/renderers/canvas/shown-size.d.ts.map +1 -0
- package/dist/{chunk-kes4ygmz.js → chunk-970s5nkn.js} +1 -1
- package/dist/{chunk-001c4gnk.js → chunk-kymx9y5e.js} +3117 -2363
- package/dist/{chunk-001c4gnk.js.map → chunk-kymx9y5e.js.map} +36 -29
- package/dist/{chunk-fwb9mxwm.js → chunk-pxd07kvx.js} +1 -1
- package/dist/{chunk-5crvhjp2.js → chunk-yrcm1pbg.js} +1504 -233
- package/dist/chunk-yrcm1pbg.js.map +34 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +3 -3
- package/dist/pages.js +2 -2
- package/package.json +2 -2
- package/src/agent/activity-label.ts +6 -1
- package/src/agent/agent-chat.tsx +1 -0
- package/src/agent/background/background-tool-row.tsx +24 -10
- package/src/agent/background/interpret.ts +60 -51
- package/src/agent/components/conversation-panel.tsx +27 -8
- package/src/agent/components/message-parts.tsx +23 -5
- package/src/agent/components/transcript.tsx +45 -27
- package/src/agent/delegation/agent-exchange.tsx +53 -0
- package/src/agent/delegation/child-card.tsx +6 -40
- package/src/agent/delegation/child-parts.tsx +1 -84
- package/src/agent/delegation/child-work.tsx +19 -5
- package/src/agent/delegation/interpret.ts +33 -54
- package/src/agent/delegation/model.ts +1 -1
- package/src/agent/file-edits/file-edit-tool-view.tsx +126 -0
- package/src/agent/file-edits/interpret.ts +120 -0
- package/src/agent/hooks/use-agent-conversation.ts +20 -0
- package/src/agent/i18n/en.ts +47 -5
- package/src/agent/i18n/fr.ts +39 -4
- package/src/agent/message-agent/interpret.ts +4 -3
- package/src/agent/publish-artifact/interpret.ts +14 -5
- package/src/agent/publish-artifact/publish-artifact-tool-view.tsx +2 -2
- package/src/agent/questions/interpret.ts +90 -0
- package/src/agent/questions/question-card.tsx +57 -0
- package/src/agent/questions/question-composer.tsx +257 -0
- package/src/agent/read/interpret.ts +34 -1
- package/src/agent/read/read-tool-view.tsx +20 -4
- package/src/agent/tool-views/built-in.tsx +19 -8
- package/src/agent/waits.ts +50 -0
- package/src/artifacts/artifacts.css +36 -0
- package/src/artifacts/edit-session.tsx +15 -1
- package/src/artifacts/frame.tsx +3 -2
- package/src/artifacts/messages.ts +54 -0
- package/src/artifacts/renderers/canvas/board-editor.tsx +37 -15
- package/src/artifacts/renderers/canvas/board.tsx +70 -8
- package/src/artifacts/renderers/canvas/canvas.tsx +66 -15
- package/src/artifacts/renderers/canvas/controls.tsx +64 -30
- package/src/artifacts/renderers/canvas/focus.tsx +200 -56
- package/src/artifacts/renderers/canvas/gestures.ts +265 -0
- package/src/artifacts/renderers/canvas/page-resize.tsx +542 -0
- package/src/artifacts/renderers/canvas/page-size-controls.tsx +193 -0
- package/src/artifacts/renderers/canvas/page-size.ts +218 -0
- package/src/artifacts/renderers/canvas/page-zoom.ts +280 -0
- package/src/artifacts/renderers/canvas/shown-size.ts +105 -0
- package/src/artifacts/viewer.tsx +15 -1
- package/src/index.ts +2 -0
- package/dist/chunk-5crvhjp2.js.map +0 -28
- /package/dist/{chunk-kes4ygmz.js.map → chunk-970s5nkn.js.map} +0 -0
- /package/dist/{chunk-fwb9mxwm.js.map → chunk-pxd07kvx.js.map} +0 -0
|
@@ -4,6 +4,7 @@ import { Plus } from "lucide-react"
|
|
|
4
4
|
import type { ReactNode } from "react"
|
|
5
5
|
import type { ConversationComposerProps } from "../hooks/use-agent-conversation"
|
|
6
6
|
import { useAgentMessages } from "../i18n"
|
|
7
|
+
import { QuestionComposer, type QuestionComposerProps } from "../questions/question-composer"
|
|
7
8
|
import type { Agent, AgentContextInput, AgentThread } from "../types"
|
|
8
9
|
import { Composer, type ComposerProps } from "./composer"
|
|
9
10
|
import { ThreadsButton } from "./threads-button"
|
|
@@ -19,6 +20,8 @@ export interface ConversationPanelProps {
|
|
|
19
20
|
readonly transcript: TranscriptProps
|
|
20
21
|
/** The conversation's composer, and the page's choices for a conversation not created yet. */
|
|
21
22
|
readonly composer: ConversationComposerProps & Pick<ComposerProps, "newThreadControls">
|
|
23
|
+
/** The Agent's question, which takes the composer's place while set. */
|
|
24
|
+
readonly question?: QuestionComposerProps | null
|
|
22
25
|
readonly messagesLoading: boolean
|
|
23
26
|
readonly messagesError: string | null
|
|
24
27
|
/** The selected durable thread, or null while composing a new one. */
|
|
@@ -42,6 +45,7 @@ export function ConversationPanel({
|
|
|
42
45
|
agent,
|
|
43
46
|
transcript,
|
|
44
47
|
composer,
|
|
48
|
+
question = null,
|
|
45
49
|
messagesLoading,
|
|
46
50
|
messagesError,
|
|
47
51
|
currentThread,
|
|
@@ -66,18 +70,33 @@ export function ConversationPanel({
|
|
|
66
70
|
transcript.messages.some((message) => message.id === null)
|
|
67
71
|
const showWelcome =
|
|
68
72
|
!messagesLoading && !messagesError && !hasActivity && transcript.messages.length === 0
|
|
73
|
+
// A reader who cannot write here cannot answer: the reply shows the question as waiting.
|
|
74
|
+
const asking = readOnly ? null : question
|
|
69
75
|
const renderComposer = (wideClassName?: string) =>
|
|
70
76
|
readOnly ? (
|
|
71
77
|
// Where the composer would end, so the notice keeps its place at the foot of the pane.
|
|
72
78
|
<div aria-hidden className={compact ? "pb-4" : "pb-3"} />
|
|
73
79
|
) : (
|
|
74
|
-
|
|
75
|
-
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
<>
|
|
81
|
+
{asking ? (
|
|
82
|
+
<QuestionComposer
|
|
83
|
+
// The question is the conversation's last message: a new one starts over.
|
|
84
|
+
key={transcript.messages.at(-1)?.key}
|
|
85
|
+
{...asking}
|
|
86
|
+
className={compact ? "px-4 pt-2 pb-4" : wideClassName}
|
|
87
|
+
/>
|
|
88
|
+
) : null}
|
|
89
|
+
{/* Kept while the question asks, so a draft written before it is still there after. */}
|
|
90
|
+
<div className={asking ? "hidden" : "contents"}>
|
|
91
|
+
<Composer
|
|
92
|
+
{...composer}
|
|
93
|
+
placeholder={composerPlaceholder}
|
|
94
|
+
className={compact ? "px-4 pt-2 pb-4" : wideClassName}
|
|
95
|
+
ambientContext={ambientContext}
|
|
96
|
+
compact={compact}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
</>
|
|
81
100
|
)
|
|
82
101
|
|
|
83
102
|
const threadsButton = onOpenThreads ? (
|
|
@@ -141,7 +160,7 @@ export function ConversationPanel({
|
|
|
141
160
|
<p className="max-w-md text-sm text-destructive">{messagesError}</p>
|
|
142
161
|
</div>
|
|
143
162
|
) : (
|
|
144
|
-
<Transcript onNewThread={onNewChat} {...transcript} />
|
|
163
|
+
<Transcript onNewThread={onNewChat} {...transcript} onAnswer={asking?.onAnswer} />
|
|
145
164
|
)}
|
|
146
165
|
</div>
|
|
147
166
|
|
|
@@ -13,6 +13,7 @@ import { useArtifactPanel } from "../artifact-panel"
|
|
|
13
13
|
import { generatedMedia } from "../bash/bash-tool-view"
|
|
14
14
|
import { savedMemories } from "../bash/interpret"
|
|
15
15
|
import { ModelMediaView } from "../bash/model-media-view"
|
|
16
|
+
import { ChildAsked } from "../delegation/agent-exchange"
|
|
16
17
|
import { ChildCards } from "../delegation/child-cards"
|
|
17
18
|
import { describeDelegationTool, spawnedChildren } from "../delegation/interpret"
|
|
18
19
|
import { useAgentMessages } from "../i18n"
|
|
@@ -24,16 +25,21 @@ import {
|
|
|
24
25
|
toolResultValue,
|
|
25
26
|
} from "../parts"
|
|
26
27
|
import { turnArtifacts, unpublishedTitles } from "../publish-artifact/interpret"
|
|
28
|
+
import { isAskTool } from "../questions/interpret"
|
|
29
|
+
import { QuestionCards } from "../questions/question-card"
|
|
27
30
|
import { builtInToolView } from "../tool-views/built-in"
|
|
28
31
|
import { AnswerToolViews, ProjectToolView, useAgentToolView } from "../tool-views/registry"
|
|
29
32
|
import { coerceWebSearchOutput, collectWebSources } from "../utils/web-search"
|
|
33
|
+
import { waitsForChildren } from "../waits"
|
|
30
34
|
import { ACTIVITY_STATUS_ROW_CLASS_NAME, ActivityStatusText } from "./activity-status"
|
|
31
35
|
import { ApprovalCards } from "./approval-card"
|
|
32
36
|
import { FileAttachmentCard } from "./file-attachment-card"
|
|
33
37
|
import { WebSources } from "./web-sources"
|
|
34
38
|
|
|
35
39
|
/** Calls a sub-agent's row stands for, in the conversation and in its thread. */
|
|
36
|
-
|
|
40
|
+
function isDelegationRow(tool: NormalizedTool): boolean {
|
|
41
|
+
return tool.toolName === "spawn_agent" || waitsForChildren(tool)
|
|
42
|
+
}
|
|
37
43
|
|
|
38
44
|
/**
|
|
39
45
|
* Render an assistant body from normalized parts. Narration text stays on the main reading path;
|
|
@@ -87,9 +93,9 @@ export function AssistantBody({
|
|
|
87
93
|
(part) =>
|
|
88
94
|
!(
|
|
89
95
|
part.kind === "tool" &&
|
|
90
|
-
((
|
|
91
|
-
|
|
92
|
-
(!nested &&
|
|
96
|
+
((isDelegationRow(part.tool) && childQuestions(part.tool).length === 0) ||
|
|
97
|
+
(!nested && heldCallsInParts([part]).length > 0) ||
|
|
98
|
+
(!nested && part.tool.toolName === "ask"))
|
|
93
99
|
)
|
|
94
100
|
)
|
|
95
101
|
if (shown.some((part) => part.kind !== "step-start")) {
|
|
@@ -101,6 +107,11 @@ export function AssistantBody({
|
|
|
101
107
|
|
|
102
108
|
const held = heldCallsInParts(work)
|
|
103
109
|
if (held.length > 0) blocks.push(<ApprovalCards key={`approvals-${key++}`} calls={held} />)
|
|
110
|
+
// The Agent's questions to the user are the reply's last word, each a card to answer.
|
|
111
|
+
const asked = work.flatMap((part) =>
|
|
112
|
+
part.kind === "tool" && part.tool.toolName === "ask" ? [part.tool] : []
|
|
113
|
+
)
|
|
114
|
+
if (asked.length > 0) blocks.push(<QuestionCards key={`questions-${key++}`} tools={asked} />)
|
|
104
115
|
const spawned = spawnedChildren(work)
|
|
105
116
|
if (spawned.length > 0) blocks.push(<ChildCards key={`children-${key++}`} spawned={spawned} />)
|
|
106
117
|
}
|
|
@@ -120,6 +131,13 @@ export function AssistantBody({
|
|
|
120
131
|
blocks.push(<FileBlock key={`block-${key++}`} part={part} />)
|
|
121
132
|
return
|
|
122
133
|
}
|
|
134
|
+
// In a sub-agent's panel, its question to the Agent is part of the conversation, not the work.
|
|
135
|
+
if (nested && part.kind === "tool" && isAskTool(part.tool.toolName)) {
|
|
136
|
+
flushText()
|
|
137
|
+
flushWork(false)
|
|
138
|
+
blocks.push(<ChildAsked key={`block-${key++}`} tool={part.tool} />)
|
|
139
|
+
return
|
|
140
|
+
}
|
|
123
141
|
// reasoning | tool | step-start — buffered together into one work run.
|
|
124
142
|
flushText()
|
|
125
143
|
workBuffer.push(part)
|
|
@@ -425,7 +443,7 @@ export function BuiltInToolRow({
|
|
|
425
443
|
className={cn(
|
|
426
444
|
"min-w-0 font-medium",
|
|
427
445
|
// A sub-agent's question reads in full.
|
|
428
|
-
tool.toolName
|
|
446
|
+
isAskTool(tool.toolName) ? "text-left break-words" : "truncate"
|
|
429
447
|
)}
|
|
430
448
|
>
|
|
431
449
|
{title}
|
|
@@ -27,6 +27,8 @@ import {
|
|
|
27
27
|
import { heldInCard } from "../delegation/model"
|
|
28
28
|
import { useAgentMessages } from "../i18n"
|
|
29
29
|
import { principalKey } from "../message-authors"
|
|
30
|
+
import { openQuestion } from "../questions/interpret"
|
|
31
|
+
import { type QuestionTurn, QuestionTurnContext } from "../questions/question-card"
|
|
30
32
|
import { CONTEXT_LIMIT_EXCEEDED } from "../run-presentation"
|
|
31
33
|
import { ApprovalCards } from "./approval-card"
|
|
32
34
|
import {
|
|
@@ -74,10 +76,18 @@ export interface TranscriptProps {
|
|
|
74
76
|
* that started it. Without it, a command its turn no longer runs reads as last seen running.
|
|
75
77
|
*/
|
|
76
78
|
readonly background?: TranscriptBackground
|
|
79
|
+
/**
|
|
80
|
+
* Given by a chat that shows `QuestionComposer`, from its `onAnswer`: the reply then leaves the
|
|
81
|
+
* question to it. Without it, the question reads in the reply as waiting.
|
|
82
|
+
*/
|
|
83
|
+
readonly onAnswer?: (text: string) => void
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
const NO_OUTCOMES: ReadonlyMap<string, ReportedApprovalOutcome> = new Map()
|
|
80
87
|
|
|
88
|
+
/** A reply whose questions the conversation has moved past. */
|
|
89
|
+
const CLOSED_QUESTION: QuestionTurn = { open: false }
|
|
90
|
+
|
|
81
91
|
/** Nothing said of where the commands run: no card claims how one ended that nobody saw. */
|
|
82
92
|
const UNKNOWN_BACKGROUND: TranscriptBackground = {
|
|
83
93
|
source: { onComputer: true, live: null, online: false },
|
|
@@ -143,6 +153,7 @@ function TranscriptView({
|
|
|
143
153
|
onNewThread,
|
|
144
154
|
approvals,
|
|
145
155
|
moved,
|
|
156
|
+
onAnswer,
|
|
146
157
|
}: TranscriptProps & { readonly threadDelegation: ThreadDelegation }) {
|
|
147
158
|
// Messages one person sends in a row name them once; an answer in between names them again.
|
|
148
159
|
const continuedKeys = useMemo(() => continuedUserMessages(messages), [messages])
|
|
@@ -168,6 +179,9 @@ function TranscriptView({
|
|
|
168
179
|
? currentTurnAnchor(messages, turn.kind === "responding" ? turn.runId : liveReply?.runId)
|
|
169
180
|
: lastKey(messages, (message) => message.status === "pending")
|
|
170
181
|
const newestSavedKey = lastKey(messages, (message) => message.id !== null)
|
|
182
|
+
// The reply whose questions are the conversation's last word, which its cards answer.
|
|
183
|
+
const openQuestionKey = openQuestion(messages, turn)?.messageKey ?? null
|
|
184
|
+
const asking = useMemo(() => ({ open: true, answering: onAnswer !== undefined }), [onAnswer])
|
|
171
185
|
|
|
172
186
|
// A call is answered on the card under the work that made it. One whose command output does not
|
|
173
187
|
// name it, such as output sent elsewhere, still gets a card, after its turn's saved answer, and
|
|
@@ -233,38 +247,42 @@ function TranscriptView({
|
|
|
233
247
|
return (
|
|
234
248
|
<Fragment key={message.key}>
|
|
235
249
|
{index === trailingAt ? trailingCards : null}
|
|
236
|
-
<
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
turn={turn}
|
|
249
|
-
message={message}
|
|
250
|
-
onRetry={onRetry}
|
|
251
|
-
onContinue={onContinue}
|
|
252
|
-
/>
|
|
253
|
-
),
|
|
254
|
-
}
|
|
255
|
-
: message.unfinished
|
|
250
|
+
<QuestionTurnContext.Provider
|
|
251
|
+
value={message.key === openQuestionKey ? asking : CLOSED_QUESTION}
|
|
252
|
+
>
|
|
253
|
+
<TranscriptMessage
|
|
254
|
+
message={message}
|
|
255
|
+
continued={continuedKeys.has(message.key)}
|
|
256
|
+
scrollAnchor={message.key === anchoredKey}
|
|
257
|
+
// Only the newest answer can be continued; older ones keep their notice alone.
|
|
258
|
+
{...(message.key === newestSavedKey && onContinue
|
|
259
|
+
? { onContinue, continuing: turn.continuing }
|
|
260
|
+
: {})}
|
|
261
|
+
{...(message === liveReply
|
|
256
262
|
? {
|
|
257
263
|
after: (
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
{
|
|
261
|
-
|
|
262
|
-
|
|
264
|
+
<TurnEnd
|
|
265
|
+
turn={turn}
|
|
266
|
+
message={message}
|
|
267
|
+
onRetry={onRetry}
|
|
268
|
+
onContinue={onContinue}
|
|
263
269
|
/>
|
|
264
270
|
),
|
|
265
271
|
}
|
|
266
|
-
:
|
|
267
|
-
|
|
272
|
+
: message.unfinished
|
|
273
|
+
? {
|
|
274
|
+
after: (
|
|
275
|
+
<UnfinishedMarker
|
|
276
|
+
unfinished={message.unfinished}
|
|
277
|
+
{...(message.key === newestSavedKey && onContinue
|
|
278
|
+
? { onContinue, continuing: turn.continuing }
|
|
279
|
+
: {})}
|
|
280
|
+
/>
|
|
281
|
+
),
|
|
282
|
+
}
|
|
283
|
+
: {})}
|
|
284
|
+
/>
|
|
285
|
+
</QuestionTurnContext.Provider>
|
|
268
286
|
{calls ? (
|
|
269
287
|
<MessageScrollerItem messageId={`approvals:${message.key}`}>
|
|
270
288
|
<ApprovalCards calls={calls} />
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Bubble, BubbleContent } from "@sixb/ui/components"
|
|
2
|
+
import { useAgentMessages } from "../i18n"
|
|
3
|
+
import type { NormalizedTool } from "../parts"
|
|
4
|
+
import { askedQuestions } from "../questions/interpret"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What the Agent sent a sub-agent, in the sub-agent's panel: its answer or its message, on the
|
|
8
|
+
* other side of the conversation, as a person's message reads in the Agent's own.
|
|
9
|
+
*/
|
|
10
|
+
export function AgentNote({ text }: { readonly text: string }) {
|
|
11
|
+
return (
|
|
12
|
+
<Bubble variant="secondary" align="end" data-agent-note="">
|
|
13
|
+
<BubbleContent className="rounded-2xl px-3.5 py-2 text-[15px] whitespace-pre-wrap">
|
|
14
|
+
{text}
|
|
15
|
+
</BubbleContent>
|
|
16
|
+
</Bubble>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A sub-agent's question to the Agent, in its panel: what it asked, as its own words, then the
|
|
22
|
+
* Agent's answer when it came in the same run. One that came later opens the next run instead.
|
|
23
|
+
*/
|
|
24
|
+
export function ChildAsked({ tool }: { readonly tool: NormalizedTool }) {
|
|
25
|
+
const labels = useAgentMessages().delegation
|
|
26
|
+
const questions = askedQuestions(tool.input)
|
|
27
|
+
if (questions.length === 0) return null
|
|
28
|
+
const output = isRecord(tool.output) ? tool.output : {}
|
|
29
|
+
const answer = typeof output.answer === "string" ? output.answer : null
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className="flex flex-col gap-3">
|
|
33
|
+
<div className="flex flex-col gap-1.5 text-[15px] leading-relaxed text-foreground">
|
|
34
|
+
{questions.map((question) => (
|
|
35
|
+
<div key={question.question}>
|
|
36
|
+
<p className="break-words">{question.question}</p>
|
|
37
|
+
{question.choices.length > 0 ? (
|
|
38
|
+
<p className="text-[13px] text-muted-foreground">{question.choices.join(" · ")}</p>
|
|
39
|
+
) : null}
|
|
40
|
+
</div>
|
|
41
|
+
))}
|
|
42
|
+
</div>
|
|
43
|
+
{answer !== null ? <AgentNote text={answer} /> : null}
|
|
44
|
+
{output.status === "unanswered" ? (
|
|
45
|
+
<p className="text-[13px] text-muted-foreground">{labels.noAnswer}</p>
|
|
46
|
+
) : null}
|
|
47
|
+
</div>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
52
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
53
|
+
}
|
|
@@ -10,17 +10,10 @@ import { heldCallOf } from "../approvals"
|
|
|
10
10
|
import { ApprovalCard } from "../components/approval-card"
|
|
11
11
|
import { FileAttachmentCard } from "../components/file-attachment-card"
|
|
12
12
|
import { useAgentMessages } from "../i18n"
|
|
13
|
-
import {
|
|
14
|
-
AgentAvatar,
|
|
15
|
-
Exchanges,
|
|
16
|
-
ModelChip,
|
|
17
|
-
NEEDS_READER_TEXT,
|
|
18
|
-
statusLabel,
|
|
19
|
-
WorkedFor,
|
|
20
|
-
} from "./child-parts"
|
|
13
|
+
import { AgentAvatar, ModelChip, NEEDS_READER_TEXT, statusLabel, WorkedFor } from "./child-parts"
|
|
21
14
|
import { ChildWork } from "./child-work"
|
|
22
15
|
import { useDelegationCards } from "./context"
|
|
23
|
-
import { type AgentChild, activeRun, childTitle
|
|
16
|
+
import { type AgentChild, activeRun, childTitle } from "./interpret"
|
|
24
17
|
import type { ChildModel } from "./model"
|
|
25
18
|
import { type ChildrenSource, refreshChildren } from "./use-children"
|
|
26
19
|
|
|
@@ -206,12 +199,11 @@ export function ChildDetail({
|
|
|
206
199
|
}
|
|
207
200
|
|
|
208
201
|
/**
|
|
209
|
-
* What waits on the reader from one sub-agent, under the reply's line: the
|
|
210
|
-
*
|
|
202
|
+
* What waits on the reader from one sub-agent, under the reply's line: the calls it holds for
|
|
203
|
+
* approval. What passed between it and the Agent reads in its panel, from its own thread.
|
|
211
204
|
*/
|
|
212
205
|
export function ChildAttention({
|
|
213
206
|
model,
|
|
214
|
-
observed,
|
|
215
207
|
named,
|
|
216
208
|
}: {
|
|
217
209
|
readonly model: ChildModel
|
|
@@ -219,37 +211,11 @@ export function ChildAttention({
|
|
|
219
211
|
readonly named: boolean
|
|
220
212
|
}) {
|
|
221
213
|
const labels = useAgentMessages().delegation
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
const exchanges = cards?.delegation.exchanges.get(child.id) ?? []
|
|
225
|
-
const openQuestion =
|
|
226
|
-
view?.awaiting?.type === "answer"
|
|
227
|
-
? view.awaiting.question.text
|
|
228
|
-
: state === "asking" && live
|
|
229
|
-
? liveQuestion(live.parts)
|
|
230
|
-
: null
|
|
231
|
-
const asks = exchanges.length > 0 || openQuestion !== null
|
|
232
|
-
if (!asks && model.approvals.length === 0 && !model.heldLater) return null
|
|
214
|
+
const { child } = model
|
|
215
|
+
if (model.approvals.length === 0 && !model.heldLater) return null
|
|
233
216
|
|
|
234
217
|
return (
|
|
235
218
|
<div className="flex flex-col gap-2" data-child-key={child.key}>
|
|
236
|
-
{asks ? (
|
|
237
|
-
<div className="pl-[1.875rem]">
|
|
238
|
-
{named ? (
|
|
239
|
-
<p className="mb-1 text-xs font-medium text-muted-foreground">
|
|
240
|
-
{childTitle(child.key)}
|
|
241
|
-
</p>
|
|
242
|
-
) : null}
|
|
243
|
-
<Exchanges
|
|
244
|
-
exchanges={exchanges}
|
|
245
|
-
openQuestion={openQuestion}
|
|
246
|
-
urgent={needsReader || state === "asking"}
|
|
247
|
-
/>
|
|
248
|
-
{state === "answer" && !observed ? (
|
|
249
|
-
<p className="mt-1 text-xs text-muted-foreground">{labels.answerHint}</p>
|
|
250
|
-
) : null}
|
|
251
|
-
</div>
|
|
252
|
-
) : null}
|
|
253
219
|
{model.heldLater ? (
|
|
254
220
|
<button
|
|
255
221
|
type="button"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { listModelsOptions } from "@sixb/client/hooks"
|
|
2
2
|
import { cn } from "@sixb/ui/lib/utils"
|
|
3
3
|
import { useQuery } from "@tanstack/react-query"
|
|
4
|
-
import { Bot
|
|
4
|
+
import { Bot } from "lucide-react"
|
|
5
5
|
import { useEffect, useState } from "react"
|
|
6
6
|
import { latestWorkLabel } from "../activity-label"
|
|
7
7
|
import { ProviderLogo } from "../components/provider-logo"
|
|
@@ -10,7 +10,6 @@ import type { AgentMessages } from "../i18n/en"
|
|
|
10
10
|
import {
|
|
11
11
|
type AgentChild,
|
|
12
12
|
activeRun,
|
|
13
|
-
type ChildExchange,
|
|
14
13
|
type ChildState,
|
|
15
14
|
formatWorked,
|
|
16
15
|
isActive,
|
|
@@ -187,88 +186,6 @@ export function ModelChip({
|
|
|
187
186
|
)
|
|
188
187
|
}
|
|
189
188
|
|
|
190
|
-
/**
|
|
191
|
-
* What the Agent told the child, what the child asked, and what the Agent answered. The question
|
|
192
|
-
* it waits on reads in full, in amber when the reader is the one to answer.
|
|
193
|
-
*/
|
|
194
|
-
export function Exchanges({
|
|
195
|
-
exchanges,
|
|
196
|
-
openQuestion,
|
|
197
|
-
urgent,
|
|
198
|
-
}: {
|
|
199
|
-
readonly exchanges: readonly ChildExchange[]
|
|
200
|
-
readonly openQuestion: string | null
|
|
201
|
-
readonly urgent: boolean
|
|
202
|
-
}) {
|
|
203
|
-
const labels = useAgentMessages().delegation
|
|
204
|
-
const shown = [...exchanges]
|
|
205
|
-
if (openQuestion && !shown.some((each) => each.kind === "asked" && each.text === openQuestion)) {
|
|
206
|
-
shown.push({ kind: "asked", text: openQuestion })
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
let lastAsked = -1
|
|
210
|
-
shown.forEach((each, index) => {
|
|
211
|
-
if (each.kind === "asked" && each.text === openQuestion) lastAsked = index
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
return (
|
|
215
|
-
<ul className="flex flex-col gap-1.5">
|
|
216
|
-
{shown.map((exchange, index) => {
|
|
217
|
-
const open = index === lastAsked
|
|
218
|
-
const amber = open && urgent
|
|
219
|
-
// The question waiting on the reader: its card says so already, so it reads as itself.
|
|
220
|
-
if (amber) {
|
|
221
|
-
return (
|
|
222
|
-
<li key={`${exchange.kind}:${index}`} className="text-sm leading-5 text-foreground">
|
|
223
|
-
<span className="sr-only">{labels.asks} · </span>
|
|
224
|
-
{exchange.text}
|
|
225
|
-
</li>
|
|
226
|
-
)
|
|
227
|
-
}
|
|
228
|
-
const Icon =
|
|
229
|
-
exchange.kind === "asked"
|
|
230
|
-
? MessageCircleQuestion
|
|
231
|
-
: exchange.kind === "answered"
|
|
232
|
-
? Check
|
|
233
|
-
: CornerDownRight
|
|
234
|
-
const label =
|
|
235
|
-
exchange.kind === "asked"
|
|
236
|
-
? labels.asks
|
|
237
|
-
: exchange.kind === "answered"
|
|
238
|
-
? labels.answer
|
|
239
|
-
: labels.fromAgent
|
|
240
|
-
|
|
241
|
-
return (
|
|
242
|
-
<li
|
|
243
|
-
key={`${exchange.kind}:${index}`}
|
|
244
|
-
className={cn(
|
|
245
|
-
"flex min-w-0 items-start gap-2 text-[13px] leading-5",
|
|
246
|
-
exchange.kind === "answered" && "pl-5"
|
|
247
|
-
)}
|
|
248
|
-
>
|
|
249
|
-
<Icon
|
|
250
|
-
className={cn(
|
|
251
|
-
"mt-0.5 size-3.5 shrink-0",
|
|
252
|
-
amber ? "text-amber-600 dark:text-amber-400" : "text-muted-foreground"
|
|
253
|
-
)}
|
|
254
|
-
aria-hidden="true"
|
|
255
|
-
/>
|
|
256
|
-
<p className={cn("min-w-0 break-words", !open && "line-clamp-3")} title={exchange.text}>
|
|
257
|
-
<span
|
|
258
|
-
className={cn("font-medium", amber ? NEEDS_READER_TEXT : "text-muted-foreground")}
|
|
259
|
-
>
|
|
260
|
-
{label}
|
|
261
|
-
</span>
|
|
262
|
-
<span className="text-muted-foreground"> · </span>
|
|
263
|
-
<span className="text-foreground">{exchange.text}</span>
|
|
264
|
-
</p>
|
|
265
|
-
</li>
|
|
266
|
-
)
|
|
267
|
-
})}
|
|
268
|
-
</ul>
|
|
269
|
-
)
|
|
270
|
-
}
|
|
271
|
-
|
|
272
189
|
function tierOf(value: string | undefined): "light" | "standard" | "heavy" | undefined {
|
|
273
190
|
return value === "light" || value === "standard" || value === "heavy" ? value : undefined
|
|
274
191
|
}
|
|
@@ -7,6 +7,7 @@ import { useAgentMessages } from "../i18n"
|
|
|
7
7
|
import type { LiveRunState } from "../live-run"
|
|
8
8
|
import { normalizeDurableParts } from "../parts"
|
|
9
9
|
import type { AgentMessage } from "../types"
|
|
10
|
+
import { AgentNote } from "./agent-exchange"
|
|
10
11
|
import type { AgentChild, WaitedChild } from "./interpret"
|
|
11
12
|
import { type ChildrenSource, useChildMessages } from "./use-children"
|
|
12
13
|
|
|
@@ -107,7 +108,11 @@ export function ChildWork({
|
|
|
107
108
|
{view.runs.map((run, index) => {
|
|
108
109
|
const atWork = run.status === "queued" || run.status === "running"
|
|
109
110
|
const own = byRun.get(run.id) ?? []
|
|
110
|
-
|
|
111
|
+
// Its work, and what the Agent sent it along the way; its task heads the panel already.
|
|
112
|
+
const work = own.filter(
|
|
113
|
+
(message) =>
|
|
114
|
+
message.role === "assistant" || message.parts.some((part) => part.type === "mail")
|
|
115
|
+
)
|
|
111
116
|
|
|
112
117
|
let body: ReactNode
|
|
113
118
|
if (work.length > 0) {
|
|
@@ -166,7 +171,7 @@ function continuedAfterAnswer(
|
|
|
166
171
|
return previous?.finishReason === "awaiting_answer"
|
|
167
172
|
}
|
|
168
173
|
|
|
169
|
-
/** One run's work, as its thread keeps it: its
|
|
174
|
+
/** One run's work, as its thread keeps it: its steps, and what the Agent sent it between them. */
|
|
170
175
|
const RunWork = memo(function RunWork({
|
|
171
176
|
messages,
|
|
172
177
|
threadId,
|
|
@@ -190,9 +195,18 @@ const RunWork = memo(function RunWork({
|
|
|
190
195
|
|
|
191
196
|
return (
|
|
192
197
|
<>
|
|
193
|
-
{bodies.map((parts, position) =>
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
{bodies.map((parts, position) => {
|
|
199
|
+
const message = messages[position]
|
|
200
|
+
// What the Agent sent it, an answer or a message, reads on the Agent's side.
|
|
201
|
+
if (message?.role === "user") {
|
|
202
|
+
return message.parts.flatMap((part, index) =>
|
|
203
|
+
part.type === "mail"
|
|
204
|
+
? [<AgentNote key={`${message.id}:${index}`} text={part.text} />]
|
|
205
|
+
: []
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
return <AssistantBody key={message?.id ?? position} parts={parts} nested />
|
|
209
|
+
})}
|
|
196
210
|
</>
|
|
197
211
|
)
|
|
198
212
|
})
|