@sixb/app 0.1.14 → 0.1.16
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/agent-chat.d.ts +8 -1
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/agent-panel.d.ts +8 -1
- package/dist/agent/agent-panel.d.ts.map +1 -1
- package/dist/agent/agent-surface.d.ts +8 -1
- package/dist/agent/agent-surface.d.ts.map +1 -1
- package/dist/agent/approvals.d.ts +1 -4
- package/dist/agent/approvals.d.ts.map +1 -1
- package/dist/agent/artifact-panel.d.ts +21 -2
- package/dist/agent/artifact-panel.d.ts.map +1 -1
- package/dist/agent/components/activity-status.d.ts +1 -1
- package/dist/agent/components/activity-status.d.ts.map +1 -1
- package/dist/agent/components/agent-threads.d.ts +15 -0
- package/dist/agent/components/agent-threads.d.ts.map +1 -0
- package/dist/agent/components/approval-card.d.ts +4 -4
- package/dist/agent/components/approval-card.d.ts.map +1 -1
- package/dist/agent/components/approval-mode-chip.d.ts +4 -6
- package/dist/agent/components/approval-mode-chip.d.ts.map +1 -1
- package/dist/agent/components/auto-model-chip.d.ts +2 -3
- package/dist/agent/components/auto-model-chip.d.ts.map +1 -1
- package/dist/agent/components/composer-menu.d.ts +42 -0
- package/dist/agent/components/composer-menu.d.ts.map +1 -0
- package/dist/agent/components/composer.d.ts +8 -5
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/conversation-panel.d.ts +3 -12
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/dictation-bar.d.ts +13 -0
- package/dist/agent/components/dictation-bar.d.ts.map +1 -0
- package/dist/agent/components/message-parts.d.ts.map +1 -1
- package/dist/agent/components/message-view.d.ts +3 -1
- package/dist/agent/components/message-view.d.ts.map +1 -1
- package/dist/agent/components/model-controls.d.ts +15 -0
- package/dist/agent/components/model-controls.d.ts.map +1 -1
- package/dist/agent/components/model-picker-row.d.ts +9 -2
- package/dist/agent/components/model-picker-row.d.ts.map +1 -1
- package/dist/agent/components/participant-input.d.ts +7 -6
- package/dist/agent/components/participant-input.d.ts.map +1 -1
- package/dist/agent/components/thread-people.d.ts +4 -4
- package/dist/agent/components/thread-people.d.ts.map +1 -1
- package/dist/agent/components/threads-button.d.ts +14 -0
- package/dist/agent/components/threads-button.d.ts.map +1 -0
- package/dist/agent/conversation.d.ts +3 -1
- package/dist/agent/conversation.d.ts.map +1 -1
- package/dist/agent/delegation/child-card.d.ts +24 -11
- package/dist/agent/delegation/child-card.d.ts.map +1 -1
- package/dist/agent/delegation/child-cards.d.ts +2 -2
- package/dist/agent/delegation/child-cards.d.ts.map +1 -1
- package/dist/agent/delegation/child-group.d.ts +5 -4
- package/dist/agent/delegation/child-group.d.ts.map +1 -1
- package/dist/agent/delegation/child-parts.d.ts +17 -18
- package/dist/agent/delegation/child-parts.d.ts.map +1 -1
- package/dist/agent/delegation/child-work.d.ts +0 -13
- package/dist/agent/delegation/child-work.d.ts.map +1 -1
- package/dist/agent/delegation/interpret.d.ts +0 -5
- package/dist/agent/delegation/interpret.d.ts.map +1 -1
- package/dist/agent/delegation/model.d.ts +12 -6
- package/dist/agent/delegation/model.d.ts.map +1 -1
- package/dist/agent/dictation.d.ts +16 -0
- package/dist/agent/dictation.d.ts.map +1 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts +3 -270
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-people-suggestions.d.ts +21 -0
- package/dist/agent/hooks/use-people-suggestions.d.ts.map +1 -0
- package/dist/agent/hooks/use-thread-lists.d.ts +220 -0
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -0
- package/dist/agent/i18n/en.d.ts +47 -36
- 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 +84 -72
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/react-router.d.ts +9 -0
- package/dist/agent/react-router.d.ts.map +1 -1
- package/dist/agent/run-presentation.d.ts +4 -1
- package/dist/agent/run-presentation.d.ts.map +1 -1
- package/dist/agent/thread-navigation.d.ts +8 -0
- package/dist/agent/thread-navigation.d.ts.map +1 -1
- package/dist/agent/thread-pages.d.ts +11 -0
- package/dist/agent/thread-pages.d.ts.map +1 -0
- package/dist/artifacts/person-avatar.d.ts +2 -2
- package/dist/{chunk-aes17xmx.js → chunk-12v6y89k.js} +4180 -3793
- package/dist/{chunk-aes17xmx.js.map → chunk-12v6y89k.js.map} +48 -42
- package/dist/{chunk-0yb22w6m.js → chunk-2a69ge8h.js} +1 -1
- package/dist/{chunk-vtp6nk44.js → chunk-bpj9mg5c.js} +1 -1
- package/dist/{chunk-1rhht9y0.js → chunk-hzy2g13h.js} +1 -1
- package/dist/createCustomApp.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -6
- package/dist/index.js.map +6 -6
- package/dist/pages/home.d.ts.map +1 -1
- package/dist/pages/observability/ai-usage/calls.d.ts.map +1 -1
- package/dist/pages/settings/memory-history.d.ts.map +1 -1
- package/dist/pages/settings/messages.d.ts.map +1 -1
- package/dist/pages/values.d.ts +5 -0
- package/dist/pages/values.d.ts.map +1 -1
- package/dist/pages.d.ts +1 -1
- package/dist/pages.d.ts.map +1 -1
- package/dist/pages.js +60 -44
- package/dist/pages.js.map +8 -8
- package/dist/server.js +12 -6
- package/dist/server.js.map +3 -3
- package/dist/shell/agent-dock.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/agent/agent-chat.tsx +15 -23
- package/src/agent/agent-panel.tsx +11 -0
- package/src/agent/agent-surface.tsx +11 -0
- package/src/agent/agent.css +33 -3
- package/src/agent/approvals.ts +4 -5
- package/src/agent/artifact-panel.tsx +113 -37
- package/src/agent/components/activity-status.tsx +1 -1
- package/src/agent/components/agent-threads.tsx +377 -0
- package/src/agent/components/approval-card.tsx +336 -327
- package/src/agent/components/approval-mode-chip.tsx +38 -145
- package/src/agent/components/auto-model-chip.tsx +103 -167
- package/src/agent/components/composer-menu.tsx +185 -0
- package/src/agent/components/composer.tsx +168 -103
- package/src/agent/components/context-chips.tsx +1 -1
- package/src/agent/components/conversation-panel.tsx +16 -36
- package/src/agent/components/dictation-bar.tsx +110 -0
- package/src/agent/components/file-attachment-card.tsx +5 -2
- package/src/agent/components/message-parts.tsx +27 -11
- package/src/agent/components/message-view.tsx +182 -68
- package/src/agent/components/model-controls.tsx +133 -125
- package/src/agent/components/model-picker-row.tsx +38 -17
- package/src/agent/components/participant-input.tsx +159 -31
- package/src/agent/components/reasoning-effort-slider.tsx +27 -27
- package/src/agent/components/shared-thread-notice.tsx +1 -1
- package/src/agent/components/thread-people.tsx +45 -15
- package/src/agent/components/threads-button.tsx +70 -0
- package/src/agent/components/transcript.tsx +30 -1
- package/src/agent/conversation.ts +25 -1
- package/src/agent/delegation/child-card.tsx +187 -247
- package/src/agent/delegation/child-cards.tsx +4 -7
- package/src/agent/delegation/child-group.tsx +179 -98
- package/src/agent/delegation/child-parts.tsx +71 -106
- package/src/agent/delegation/child-work.tsx +6 -52
- package/src/agent/delegation/interpret.ts +0 -28
- package/src/agent/delegation/model.ts +115 -39
- package/src/agent/dictation.ts +48 -0
- package/src/agent/hooks/use-agent-conversation.ts +10 -92
- package/src/agent/hooks/use-people-suggestions.ts +90 -0
- package/src/agent/hooks/use-thread-lists.ts +77 -0
- package/src/agent/i18n/en.ts +100 -83
- package/src/agent/i18n/fr.ts +109 -100
- package/src/agent/react-router.tsx +48 -5
- package/src/agent/run-presentation.ts +6 -2
- package/src/agent/thread-navigation.ts +16 -0
- package/src/agent/thread-pages.ts +24 -0
- package/src/artifacts/person-avatar.tsx +1 -1
- package/src/createCustomApp.ts +13 -6
- package/src/index.ts +7 -3
- package/src/pages/home.tsx +3 -1
- package/src/pages/observability/ai-usage/calls.tsx +2 -1
- package/src/pages/settings/memory-history.tsx +2 -1
- package/src/pages/settings/messages.ts +2 -3
- package/src/pages/values.tsx +23 -1
- package/src/pages.ts +5 -1
- package/src/shell/agent-dock.tsx +4 -2
- package/dist/agent/agents-page.d.ts +0 -4
- package/dist/agent/agents-page.d.ts.map +0 -1
- package/dist/agent/components/agent-thread-switcher.d.ts +0 -37
- package/dist/agent/components/agent-thread-switcher.d.ts.map +0 -1
- package/src/agent/agents-page.ts +0 -7
- package/src/agent/components/agent-thread-switcher.tsx +0 -519
- /package/dist/{chunk-0yb22w6m.js.map → chunk-2a69ge8h.js.map} +0 -0
- /package/dist/{chunk-vtp6nk44.js.map → chunk-bpj9mg5c.js.map} +0 -0
- /package/dist/{chunk-1rhht9y0.js.map → chunk-hzy2g13h.js.map} +0 -0
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import { useLocale } from "@sixb/ui/lib/i18n"
|
|
2
1
|
import { cn } from "@sixb/ui/lib/utils"
|
|
3
|
-
import {
|
|
4
|
-
import { Fragment,
|
|
2
|
+
import { ChevronRight } from "lucide-react"
|
|
3
|
+
import { Fragment, useEffect, useId, useState } from "react"
|
|
4
|
+
import { createPortal } from "react-dom"
|
|
5
|
+
import { panelTargetKey, type SlotTarget, useArtifactPanel } from "../artifact-panel"
|
|
5
6
|
import { useAgentMessages } from "../i18n"
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { type ChildModel,
|
|
7
|
+
import { ChildAttention, ChildDetail, ChildRow } from "./child-card"
|
|
8
|
+
import { AgentAvatar, WorkedFor } from "./child-parts"
|
|
9
|
+
import { childTitle, isActive } from "./interpret"
|
|
10
|
+
import { type ChildModel, isSettled, lineClauses } from "./model"
|
|
10
11
|
import type { ChildrenSource } from "./use-children"
|
|
11
12
|
|
|
13
|
+
/** How many avatars the line stacks; the sentence names the rest. */
|
|
14
|
+
const STACKED = 3
|
|
15
|
+
|
|
12
16
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
+
* The sub-agents of one reply, as one line of it: their avatars, then a sentence that names them and
|
|
18
|
+
* says how they stand ("Terms, History and Disputes finished · 48s"). The line opens them beside the
|
|
19
|
+
* conversation (over the app from the dock, as a sheet on a phone): one straight to its thread,
|
|
20
|
+
* several as a list that opens each. What waits on the reader, its questions and its calls held
|
|
21
|
+
* for approval, stays in the reply under the line.
|
|
17
22
|
*/
|
|
18
23
|
export function ChildGroup({
|
|
19
24
|
models,
|
|
@@ -26,125 +31,201 @@ export function ChildGroup({
|
|
|
26
31
|
}) {
|
|
27
32
|
const messages = useAgentMessages()
|
|
28
33
|
const labels = messages.delegation
|
|
29
|
-
const
|
|
30
|
-
const
|
|
34
|
+
const panel = useArtifactPanel()
|
|
35
|
+
const inlineId = useId()
|
|
36
|
+
const [first] = models
|
|
37
|
+
const single = models.length === 1 ? first : undefined
|
|
38
|
+
const [chosen, setChosen] = useState<string | null>(null)
|
|
39
|
+
const [inlineOpen, setInlineOpen] = useState(false)
|
|
40
|
+
|
|
41
|
+
const slotId = `agents:${source.runId ?? first?.child.id ?? ""}`
|
|
42
|
+
const listTitle = labels.panel(models.length)
|
|
43
|
+
const panelOpen =
|
|
44
|
+
panel !== null && panel.openKey === panelTargetKey({ type: "slot", id: slotId, title: "" })
|
|
45
|
+
const shownId = single ? single.child.id : chosen
|
|
46
|
+
const shown = models.find((model) => model.child.id === shownId)
|
|
31
47
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
const target = (childId: string | null): SlotTarget => {
|
|
49
|
+
const model = models.find((candidate) => candidate.child.id === childId)
|
|
50
|
+
return {
|
|
51
|
+
type: "slot",
|
|
52
|
+
id: slotId,
|
|
53
|
+
title: model ? childTitle(model.child.key) : listTitle,
|
|
54
|
+
...(model && !single ? { back: { label: labels.back, onBack: () => show(null) } } : {}),
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const show = (childId: string | null) => {
|
|
58
|
+
setChosen(childId)
|
|
59
|
+
if (panel) panel.open(target(childId))
|
|
60
|
+
else setInlineOpen(true)
|
|
61
|
+
}
|
|
62
|
+
const toggle = () => {
|
|
63
|
+
if (!panel) return setInlineOpen((open) => !open)
|
|
64
|
+
if (panelOpen) panel.close()
|
|
65
|
+
else show(single ? single.child.id : null)
|
|
66
|
+
}
|
|
43
67
|
|
|
44
|
-
|
|
45
|
-
|
|
68
|
+
// A list the panel shows keeps its count as children join it.
|
|
69
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: the title follows the count
|
|
46
70
|
useEffect(() => {
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
}, [forReader])
|
|
71
|
+
if (panelOpen && !shown && panel) panel.open(target(null))
|
|
72
|
+
}, [models.length])
|
|
50
73
|
|
|
74
|
+
const clauses = lineClauses(models, messages)
|
|
51
75
|
const settled = models.every((model) => isSettled(model.state))
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// The
|
|
76
|
+
const urgent = clauses.some((clause) => clause.tone === "urgent")
|
|
77
|
+
const firstLive = clauses.find((clause) => clause.tone === "live")
|
|
78
|
+
const live = firstLive !== undefined
|
|
79
|
+
const sentence = clauses
|
|
80
|
+
.map((clause) => [clause.names, clause.verb].filter(Boolean).join(" "))
|
|
81
|
+
.join(" · ")
|
|
82
|
+
// The ones waiting on the reader lead the stack.
|
|
59
83
|
const ordered = [
|
|
60
84
|
...models.filter((model) => model.needsReader),
|
|
61
85
|
...models.filter((model) => !model.needsReader),
|
|
62
86
|
]
|
|
87
|
+
const stack = ordered.slice(0, STACKED)
|
|
88
|
+
const open = panel ? panelOpen : inlineOpen
|
|
89
|
+
|
|
90
|
+
const view = shown ? (
|
|
91
|
+
<ChildDetail model={shown} source={source} unavailable={unavailable} />
|
|
92
|
+
) : (
|
|
93
|
+
<ul className="flex flex-col gap-0.5 pt-1">
|
|
94
|
+
{ordered.map((model) => (
|
|
95
|
+
<li key={model.child.id}>
|
|
96
|
+
<ChildRow
|
|
97
|
+
model={model}
|
|
98
|
+
tint={models.indexOf(model)}
|
|
99
|
+
observed={source.observed}
|
|
100
|
+
onOpen={() => show(model.child.id)}
|
|
101
|
+
/>
|
|
102
|
+
</li>
|
|
103
|
+
))}
|
|
104
|
+
</ul>
|
|
105
|
+
)
|
|
63
106
|
|
|
64
107
|
return (
|
|
65
108
|
<section
|
|
66
109
|
aria-label={labels.group}
|
|
67
110
|
data-delegation-group=""
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
forReader > 0 ? "border-amber-500/35" : "border-border"
|
|
71
|
-
)}
|
|
111
|
+
data-child-state={single?.state}
|
|
112
|
+
className="flex min-w-0 flex-col gap-2"
|
|
72
113
|
>
|
|
114
|
+
{/* Said once per change of how they stand, never per step. */}
|
|
115
|
+
<span className="sr-only" aria-live="polite">
|
|
116
|
+
{sentence}
|
|
117
|
+
</span>
|
|
118
|
+
|
|
73
119
|
<button
|
|
74
120
|
type="button"
|
|
75
121
|
aria-expanded={open}
|
|
76
|
-
aria-controls={
|
|
77
|
-
|
|
78
|
-
|
|
122
|
+
aria-controls={panel ? undefined : inlineId}
|
|
123
|
+
aria-label={labels.open(sentence || listTitle)}
|
|
124
|
+
onClick={toggle}
|
|
125
|
+
className={cn(
|
|
126
|
+
"group/line -ml-1 flex w-fit max-w-full min-w-0 items-center gap-2.5 rounded-lg px-1 py-1 text-left text-[13px] leading-normal outline-none transition-colors",
|
|
127
|
+
"hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
128
|
+
open && "bg-muted/50"
|
|
129
|
+
)}
|
|
79
130
|
>
|
|
80
|
-
<span className="flex shrink-0 -
|
|
81
|
-
{
|
|
82
|
-
<
|
|
131
|
+
<span className="flex shrink-0 items-center pl-0.5">
|
|
132
|
+
{stack.map((model, index) => (
|
|
133
|
+
<AgentAvatar
|
|
83
134
|
key={model.child.id}
|
|
135
|
+
name={childTitle(model.child.key)}
|
|
84
136
|
state={model.state}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
137
|
+
needsReader={model.needsReader}
|
|
138
|
+
tint={models.indexOf(model)}
|
|
139
|
+
stacked={index > 0}
|
|
88
140
|
/>
|
|
89
141
|
))}
|
|
142
|
+
{models.length > STACKED ? (
|
|
143
|
+
<span
|
|
144
|
+
aria-hidden="true"
|
|
145
|
+
className="-ml-1 flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[9px] font-semibold text-muted-foreground ring-2 ring-background"
|
|
146
|
+
>
|
|
147
|
+
+{models.length - STACKED}
|
|
148
|
+
</span>
|
|
149
|
+
) : null}
|
|
90
150
|
</span>
|
|
91
|
-
<span className="min-w-0
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
151
|
+
<span className="min-w-0">
|
|
152
|
+
{clauses.length === 0 ? (
|
|
153
|
+
<span className="text-muted-foreground">{listTitle}</span>
|
|
154
|
+
) : (
|
|
155
|
+
clauses.map((clause, index) => (
|
|
156
|
+
<Fragment key={`${clause.tone}:${clause.verb}`}>
|
|
157
|
+
{index > 0 ? <span className="text-muted-foreground/60"> · </span> : null}
|
|
158
|
+
{clause.names ? (
|
|
159
|
+
<span className="font-medium text-foreground/85">{clause.names}</span>
|
|
160
|
+
) : null}
|
|
161
|
+
{clause.names && clause.verb ? " " : null}
|
|
162
|
+
{clause.verb ? (
|
|
163
|
+
<span
|
|
164
|
+
className={cn(
|
|
165
|
+
"whitespace-nowrap",
|
|
166
|
+
clause.tone === "urgent" ? "text-foreground/85" : "text-muted-foreground",
|
|
167
|
+
clause.tone === "live" && "shimmer motion-reduce:animate-none"
|
|
168
|
+
)}
|
|
169
|
+
>
|
|
170
|
+
{clause.verb}
|
|
171
|
+
{clause.tone === "live" ? "…" : ""}
|
|
172
|
+
</span>
|
|
173
|
+
) : null}
|
|
174
|
+
{/* The time belongs to who is at work, or, once all settled, to all of them. */}
|
|
175
|
+
{clause === firstLive ? (
|
|
176
|
+
<span className="whitespace-nowrap text-muted-foreground/70 tabular-nums">
|
|
177
|
+
<span className="text-muted-foreground/60"> · </span>
|
|
178
|
+
<WorkedFor
|
|
179
|
+
views={models
|
|
180
|
+
.filter((model) => isActive(model.state))
|
|
181
|
+
.map((model) => model.view)}
|
|
182
|
+
/>
|
|
183
|
+
</span>
|
|
184
|
+
) : null}
|
|
185
|
+
</Fragment>
|
|
186
|
+
))
|
|
187
|
+
)}
|
|
188
|
+
{settled && !urgent ? (
|
|
189
|
+
<span className="whitespace-nowrap text-muted-foreground/70 tabular-nums">
|
|
190
|
+
<span className="text-muted-foreground/60"> · </span>
|
|
191
|
+
<WorkedFor views={models.map((model) => model.view)} />
|
|
192
|
+
</span>
|
|
193
|
+
) : null}
|
|
113
194
|
</span>
|
|
114
|
-
<
|
|
195
|
+
<ChevronRight
|
|
115
196
|
className={cn(
|
|
116
|
-
"size-
|
|
117
|
-
|
|
197
|
+
"size-3.5 shrink-0 text-muted-foreground opacity-50 transition-[opacity,transform] group-hover/line:opacity-100 motion-reduce:transition-none",
|
|
198
|
+
!panel && inlineOpen && "rotate-90",
|
|
199
|
+
live && "opacity-40"
|
|
118
200
|
)}
|
|
119
201
|
aria-hidden="true"
|
|
120
202
|
/>
|
|
121
203
|
</button>
|
|
122
204
|
|
|
123
|
-
{
|
|
124
|
-
<
|
|
125
|
-
{
|
|
126
|
-
|
|
127
|
-
|
|
205
|
+
{models.map((model) => (
|
|
206
|
+
<ChildAttention
|
|
207
|
+
key={model.child.id}
|
|
208
|
+
model={model}
|
|
209
|
+
observed={source.observed}
|
|
210
|
+
named={models.length > 1}
|
|
211
|
+
/>
|
|
212
|
+
))}
|
|
128
213
|
|
|
129
|
-
{
|
|
130
|
-
|
|
131
|
-
id={
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/>
|
|
145
|
-
</li>
|
|
146
|
-
))}
|
|
147
|
-
</ul>
|
|
214
|
+
{panelOpen && panel?.slotHost ? createPortal(view, panel.slotHost) : null}
|
|
215
|
+
{!panel && inlineOpen ? (
|
|
216
|
+
<div id={inlineId} className="rounded-2xl bg-muted/40 px-4 py-3">
|
|
217
|
+
{shown && !single ? (
|
|
218
|
+
<button
|
|
219
|
+
type="button"
|
|
220
|
+
onClick={() => setChosen(null)}
|
|
221
|
+
className="mb-2 text-xs font-medium text-muted-foreground outline-none hover:text-foreground focus-visible:underline"
|
|
222
|
+
>
|
|
223
|
+
‹ {labels.back}
|
|
224
|
+
</button>
|
|
225
|
+
) : null}
|
|
226
|
+
{view}
|
|
227
|
+
</div>
|
|
228
|
+
) : null}
|
|
148
229
|
</section>
|
|
149
230
|
)
|
|
150
231
|
}
|
|
@@ -1,21 +1,8 @@
|
|
|
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 {
|
|
5
|
-
|
|
6
|
-
Check,
|
|
7
|
-
CircleDashed,
|
|
8
|
-
CirclePause,
|
|
9
|
-
CircleSlash,
|
|
10
|
-
Clock3,
|
|
11
|
-
CornerDownRight,
|
|
12
|
-
LoaderCircle,
|
|
13
|
-
type LucideIcon,
|
|
14
|
-
MessageCircleQuestion,
|
|
15
|
-
Square,
|
|
16
|
-
X,
|
|
17
|
-
} from "lucide-react"
|
|
18
|
-
import { type ReactNode, useEffect, useState } from "react"
|
|
4
|
+
import { Bot, Check, CornerDownRight, MessageCircleQuestion } from "lucide-react"
|
|
5
|
+
import { useEffect, useState } from "react"
|
|
19
6
|
import { latestWorkLabel } from "../activity-label"
|
|
20
7
|
import { ProviderLogo } from "../components/provider-logo"
|
|
21
8
|
import { useAgentMessages } from "../i18n"
|
|
@@ -26,6 +13,7 @@ import {
|
|
|
26
13
|
type ChildExchange,
|
|
27
14
|
type ChildState,
|
|
28
15
|
formatWorked,
|
|
16
|
+
isActive,
|
|
29
17
|
type SpawnedChild,
|
|
30
18
|
workedMs,
|
|
31
19
|
} from "./interpret"
|
|
@@ -33,84 +21,71 @@ import type { ChildModel, WaitingOn } from "./model"
|
|
|
33
21
|
|
|
34
22
|
// The pieces a sub-agent's card and its group are made of.
|
|
35
23
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
spin: true,
|
|
47
|
-
},
|
|
48
|
-
asking: {
|
|
49
|
-
Icon: MessageCircleQuestion,
|
|
50
|
-
className: "bg-amber-500/12 text-amber-600 dark:text-amber-400",
|
|
51
|
-
},
|
|
52
|
-
approval: { Icon: CirclePause, className: "bg-amber-500/12 text-amber-600 dark:text-amber-400" },
|
|
53
|
-
answer: {
|
|
54
|
-
Icon: MessageCircleQuestion,
|
|
55
|
-
className: "bg-amber-500/12 text-amber-600 dark:text-amber-400",
|
|
56
|
-
},
|
|
57
|
-
resume: { Icon: Clock3, className: "bg-muted text-muted-foreground" },
|
|
58
|
-
done: { Icon: Check, className: "bg-emerald-500/12 text-emerald-600 dark:text-emerald-400" },
|
|
59
|
-
failed: { Icon: X, className: "bg-muted text-muted-foreground" },
|
|
60
|
-
stopped: { Icon: Square, className: "bg-muted text-muted-foreground/70" },
|
|
61
|
-
ended: { Icon: CircleSlash, className: "bg-muted text-muted-foreground" },
|
|
62
|
-
unknown: { Icon: Bot, className: "bg-muted text-muted-foreground" },
|
|
63
|
-
}
|
|
24
|
+
/**
|
|
25
|
+
* Soft, opaque tints, given in the order a reply started its agents: two of one reply never share
|
|
26
|
+
* one, and each keeps its own in the line and the list.
|
|
27
|
+
*/
|
|
28
|
+
const TINTS = [
|
|
29
|
+
"bg-sky-100 text-sky-700 dark:bg-sky-950 dark:text-sky-300",
|
|
30
|
+
"bg-violet-100 text-violet-700 dark:bg-violet-950 dark:text-violet-300",
|
|
31
|
+
"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",
|
|
32
|
+
"bg-pink-100 text-pink-700 dark:bg-pink-950 dark:text-pink-300",
|
|
33
|
+
] as const
|
|
64
34
|
|
|
65
35
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
36
|
+
* A sub-agent at a glance: its initial on a tinted disc. It breathes while it works,
|
|
37
|
+
* an amber dot says it waits on the reader, and one that failed or was stopped turns grey. Several
|
|
38
|
+
* overlap in a stack.
|
|
68
39
|
*/
|
|
69
|
-
export function
|
|
40
|
+
export function AgentAvatar({
|
|
41
|
+
name,
|
|
70
42
|
state,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
43
|
+
needsReader,
|
|
44
|
+
size = "sm",
|
|
45
|
+
stacked = false,
|
|
46
|
+
tint,
|
|
74
47
|
}: {
|
|
48
|
+
readonly name: string
|
|
49
|
+
/** Its place among its reply's agents, which picks its tint. */
|
|
50
|
+
readonly tint: number
|
|
75
51
|
readonly state: ChildState
|
|
52
|
+
readonly needsReader: boolean
|
|
76
53
|
readonly size?: "sm" | "md"
|
|
77
|
-
/** Overlapping
|
|
78
|
-
readonly
|
|
79
|
-
readonly calm?: boolean
|
|
54
|
+
/** Overlapping the one before it in a stack. */
|
|
55
|
+
readonly stacked?: boolean
|
|
80
56
|
}) {
|
|
81
|
-
const
|
|
57
|
+
const quiet = state === "failed" || state === "stopped" || state === "ended"
|
|
82
58
|
return (
|
|
83
59
|
<span
|
|
84
60
|
aria-hidden="true"
|
|
85
61
|
className={cn(
|
|
86
|
-
"flex shrink-0 items-center justify-center rounded-full",
|
|
87
|
-
size === "
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
: className
|
|
62
|
+
"relative flex shrink-0 items-center justify-center rounded-full font-semibold ring-2 ring-background select-none",
|
|
63
|
+
size === "sm" ? "size-5 text-[10px]" : "size-7 text-[12px]",
|
|
64
|
+
stacked && (size === "sm" ? "-ml-1" : "-ml-2"),
|
|
65
|
+
quiet ? "bg-muted text-muted-foreground" : (TINTS[tint % TINTS.length] ?? TINTS[0]),
|
|
66
|
+
isActive(state) && "motion-safe:animate-pulse"
|
|
92
67
|
)}
|
|
93
68
|
>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
69
|
+
{initial(name)}
|
|
70
|
+
{needsReader ? (
|
|
71
|
+
<span
|
|
72
|
+
className={cn(
|
|
73
|
+
"absolute -right-0.5 -bottom-0.5 rounded-full bg-amber-500 ring-2 ring-background",
|
|
74
|
+
size === "sm" ? "size-[7px]" : "size-2.5"
|
|
75
|
+
)}
|
|
76
|
+
/>
|
|
77
|
+
) : null}
|
|
102
78
|
</span>
|
|
103
79
|
)
|
|
104
80
|
}
|
|
105
81
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (needsReader || state === "asking") return "text-amber-700 dark:text-amber-400"
|
|
109
|
-
if (state === "done") return "text-emerald-700 dark:text-emerald-400"
|
|
110
|
-
if (state === "working") return "text-foreground"
|
|
111
|
-
return "text-muted-foreground"
|
|
82
|
+
function initial(name: string): string {
|
|
83
|
+
return Array.from(name.trim())[0]?.toUpperCase() ?? "·"
|
|
112
84
|
}
|
|
113
85
|
|
|
86
|
+
/** The text of what waits on the reader: the amber their attention goes to. */
|
|
87
|
+
export const NEEDS_READER_TEXT = "text-amber-700 dark:text-amber-400"
|
|
88
|
+
|
|
114
89
|
/** The status line: what it does right now while it works, else where it stands. */
|
|
115
90
|
export function statusLabel(
|
|
116
91
|
model: ChildModel,
|
|
@@ -137,7 +112,7 @@ export function statusLabel(
|
|
|
137
112
|
}
|
|
138
113
|
|
|
139
114
|
/** Where a child stands, in words: also what a screen reader hears when it changes. */
|
|
140
|
-
|
|
115
|
+
function stateLabel(
|
|
141
116
|
state: ChildState,
|
|
142
117
|
waitingOn: WaitingOn,
|
|
143
118
|
observed: boolean,
|
|
@@ -159,13 +134,16 @@ export function stateLabel(
|
|
|
159
134
|
}
|
|
160
135
|
}
|
|
161
136
|
|
|
162
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* How long a child worked, its waits left out, ticking while it works. Children work side by side,
|
|
139
|
+
* so a group says how long its longest took, not their sum.
|
|
140
|
+
*/
|
|
163
141
|
export function WorkedFor({ views }: { readonly views: readonly (AgentChild | undefined)[] }) {
|
|
164
142
|
const labels = useAgentMessages().delegation
|
|
165
143
|
const now = useNow(views.some((view) => activeRun(view) !== undefined))
|
|
166
|
-
const worked = views.
|
|
144
|
+
const worked = Math.max(0, ...views.map((view) => (view ? workedMs(view, now) : 0)))
|
|
167
145
|
if (worked <= 0) return null
|
|
168
|
-
return <>{
|
|
146
|
+
return <>{formatWorked(worked, labels)}</>
|
|
169
147
|
}
|
|
170
148
|
|
|
171
149
|
/** The model a child runs on: its provider's logo, its name, and the tier it came from. */
|
|
@@ -192,42 +170,23 @@ export function ModelChip({
|
|
|
192
170
|
return (
|
|
193
171
|
<span
|
|
194
172
|
className={cn(
|
|
195
|
-
"inline-flex
|
|
173
|
+
"inline-flex max-w-full min-w-0 items-center gap-1.5 text-muted-foreground",
|
|
196
174
|
className
|
|
197
175
|
)}
|
|
198
176
|
title={`${ref.provider} · ${ref.modelId}`}
|
|
199
177
|
>
|
|
200
178
|
{model ? (
|
|
201
|
-
<ProviderLogo model={model} className="size-3" />
|
|
179
|
+
<ProviderLogo model={model} className="size-3 opacity-80" />
|
|
202
180
|
) : (
|
|
203
|
-
<Bot className="size-3 shrink-0
|
|
181
|
+
<Bot className="size-3 shrink-0" aria-hidden="true" />
|
|
204
182
|
)}
|
|
205
|
-
<span className="min-w-0 truncate"
|
|
206
|
-
|
|
183
|
+
<span className="min-w-0 truncate" title={tier ? labels.tiers[tier] : undefined}>
|
|
184
|
+
{name}
|
|
185
|
+
</span>
|
|
207
186
|
</span>
|
|
208
187
|
)
|
|
209
188
|
}
|
|
210
189
|
|
|
211
|
-
/** A band of the card below its header, its content aligned with the title. */
|
|
212
|
-
export function Section({
|
|
213
|
-
label,
|
|
214
|
-
children,
|
|
215
|
-
}: {
|
|
216
|
-
readonly label?: string
|
|
217
|
-
readonly children: ReactNode
|
|
218
|
-
}) {
|
|
219
|
-
return (
|
|
220
|
-
<div className="border-t border-border/60 px-4 py-3 sm:pl-14">
|
|
221
|
-
{label ? (
|
|
222
|
-
<p className="mb-2 text-[11px] font-medium tracking-wide text-muted-foreground uppercase">
|
|
223
|
-
{label}
|
|
224
|
-
</p>
|
|
225
|
-
) : null}
|
|
226
|
-
{children}
|
|
227
|
-
</div>
|
|
228
|
-
)
|
|
229
|
-
}
|
|
230
|
-
|
|
231
190
|
/**
|
|
232
191
|
* What the Agent told the child, what the child asked, and what the Agent answered. The question
|
|
233
192
|
* it waits on reads in full, in amber when the reader is the one to answer.
|
|
@@ -257,6 +216,15 @@ export function Exchanges({
|
|
|
257
216
|
{shown.map((exchange, index) => {
|
|
258
217
|
const open = index === lastAsked
|
|
259
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
|
+
}
|
|
260
228
|
const Icon =
|
|
261
229
|
exchange.kind === "asked"
|
|
262
230
|
? MessageCircleQuestion
|
|
@@ -287,10 +255,7 @@ export function Exchanges({
|
|
|
287
255
|
/>
|
|
288
256
|
<p className={cn("min-w-0 break-words", !open && "line-clamp-3")} title={exchange.text}>
|
|
289
257
|
<span
|
|
290
|
-
className={cn(
|
|
291
|
-
"font-medium",
|
|
292
|
-
amber ? "text-amber-700 dark:text-amber-400" : "text-muted-foreground"
|
|
293
|
-
)}
|
|
258
|
+
className={cn("font-medium", amber ? NEEDS_READER_TEXT : "text-muted-foreground")}
|
|
294
259
|
>
|
|
295
260
|
{label}
|
|
296
261
|
</span>
|