@sixb/app 0.1.14 → 0.1.15

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.
Files changed (70) hide show
  1. package/dist/{chunk-vtp6nk44.js → chunk-736c9akn.js} +1 -1
  2. package/dist/{chunk-1rhht9y0.js → chunk-n0cxwvej.js} +1 -1
  3. package/dist/{chunk-0yb22w6m.js → chunk-qh1panvd.js} +1 -1
  4. package/dist/{chunk-aes17xmx.js → chunk-twjs2sb9.js} +3928 -3717
  5. package/dist/{chunk-aes17xmx.js.map → chunk-twjs2sb9.js.map} +46 -42
  6. package/dist/index.js +15 -6
  7. package/dist/index.js.map +6 -6
  8. package/dist/pages.js +60 -44
  9. package/dist/pages.js.map +8 -8
  10. package/dist/server.js +12 -6
  11. package/dist/server.js.map +3 -3
  12. package/package.json +3 -3
  13. package/src/agent/agent-chat.tsx +4 -22
  14. package/src/agent/agent-panel.tsx +4 -0
  15. package/src/agent/agent-surface.tsx +4 -0
  16. package/src/agent/agent.css +33 -3
  17. package/src/agent/approvals.ts +4 -5
  18. package/src/agent/artifact-panel.tsx +113 -37
  19. package/src/agent/components/activity-status.tsx +1 -1
  20. package/src/agent/components/agent-threads.tsx +377 -0
  21. package/src/agent/components/approval-card.tsx +336 -327
  22. package/src/agent/components/approval-mode-chip.tsx +38 -145
  23. package/src/agent/components/auto-model-chip.tsx +103 -167
  24. package/src/agent/components/composer-menu.tsx +185 -0
  25. package/src/agent/components/composer.tsx +38 -43
  26. package/src/agent/components/context-chips.tsx +1 -1
  27. package/src/agent/components/conversation-panel.tsx +16 -36
  28. package/src/agent/components/file-attachment-card.tsx +5 -2
  29. package/src/agent/components/message-parts.tsx +27 -11
  30. package/src/agent/components/message-view.tsx +182 -68
  31. package/src/agent/components/model-controls.tsx +133 -125
  32. package/src/agent/components/model-picker-row.tsx +38 -17
  33. package/src/agent/components/participant-input.tsx +159 -31
  34. package/src/agent/components/reasoning-effort-slider.tsx +27 -27
  35. package/src/agent/components/shared-thread-notice.tsx +1 -1
  36. package/src/agent/components/thread-people.tsx +45 -15
  37. package/src/agent/components/threads-button.tsx +70 -0
  38. package/src/agent/components/transcript.tsx +30 -1
  39. package/src/agent/conversation.ts +25 -1
  40. package/src/agent/delegation/child-card.tsx +187 -247
  41. package/src/agent/delegation/child-cards.tsx +4 -7
  42. package/src/agent/delegation/child-group.tsx +179 -98
  43. package/src/agent/delegation/child-parts.tsx +71 -106
  44. package/src/agent/delegation/child-work.tsx +6 -52
  45. package/src/agent/delegation/interpret.ts +0 -28
  46. package/src/agent/delegation/model.ts +115 -39
  47. package/src/agent/hooks/use-agent-conversation.ts +7 -92
  48. package/src/agent/hooks/use-people-suggestions.ts +90 -0
  49. package/src/agent/hooks/use-thread-lists.ts +77 -0
  50. package/src/agent/i18n/en.ts +96 -83
  51. package/src/agent/i18n/fr.ts +105 -100
  52. package/src/agent/react-router.tsx +48 -5
  53. package/src/agent/run-presentation.ts +6 -2
  54. package/src/agent/thread-navigation.ts +16 -0
  55. package/src/agent/thread-pages.ts +24 -0
  56. package/src/artifacts/person-avatar.tsx +1 -1
  57. package/src/createCustomApp.ts +13 -6
  58. package/src/index.ts +7 -3
  59. package/src/pages/home.tsx +3 -1
  60. package/src/pages/observability/ai-usage/calls.tsx +2 -1
  61. package/src/pages/settings/memory-history.tsx +2 -1
  62. package/src/pages/settings/messages.ts +2 -3
  63. package/src/pages/values.tsx +23 -1
  64. package/src/pages.ts +5 -1
  65. package/src/shell/agent-dock.tsx +4 -2
  66. package/src/agent/agents-page.ts +0 -7
  67. package/src/agent/components/agent-thread-switcher.tsx +0 -519
  68. /package/dist/{chunk-vtp6nk44.js.map → chunk-736c9akn.js.map} +0 -0
  69. /package/dist/{chunk-1rhht9y0.js.map → chunk-n0cxwvej.js.map} +0 -0
  70. /package/dist/{chunk-0yb22w6m.js.map → chunk-qh1panvd.js.map} +0 -0
@@ -0,0 +1,70 @@
1
+ import { Button } from "@sixb/ui/components"
2
+ import { History } from "lucide-react"
3
+ import { useAgentMessages } from "../i18n"
4
+
5
+ const NO_WAITING_THREADS: ReadonlySet<string> = new Set()
6
+
7
+ export interface ThreadsButtonProps {
8
+ /** The thread open beside it, whose own cards say what waits in it. */
9
+ readonly currentThreadId: string | null
10
+ readonly runningThreadCount?: number
11
+ /** The threads where a call waits for the reader: the button counts the others. */
12
+ readonly waitingThreadIds?: ReadonlySet<string>
13
+ readonly onOpen: () => void
14
+ }
15
+
16
+ /**
17
+ * The way from a thread to all of them: a button in its header. It counts the other threads
18
+ * waiting for the reader, in amber, or shows a dot while one is at work.
19
+ */
20
+ export function ThreadsButton({
21
+ currentThreadId,
22
+ runningThreadCount = 0,
23
+ waitingThreadIds = NO_WAITING_THREADS,
24
+ onOpen,
25
+ }: ThreadsButtonProps) {
26
+ const agentMessages = useAgentMessages()
27
+ const messages = agentMessages.threads
28
+ const waitingElsewhere = [...waitingThreadIds].filter(
29
+ (threadId) => threadId !== currentThreadId
30
+ ).length
31
+ const waitingLabel =
32
+ waitingElsewhere > 0 ? agentMessages.approvals.waitingThreads(waitingElsewhere) : null
33
+ const label = [
34
+ messages.open,
35
+ runningThreadCount > 0 ? messages.running(runningThreadCount) : null,
36
+ waitingLabel,
37
+ ]
38
+ .filter(Boolean)
39
+ .join(". ")
40
+
41
+ return (
42
+ <Button
43
+ type="button"
44
+ variant="ghost"
45
+ size="icon-lg"
46
+ aria-label={label}
47
+ title={waitingLabel ?? messages.open}
48
+ onClick={onOpen}
49
+ className="relative [&_svg]:size-5"
50
+ >
51
+ <History />
52
+ {waitingElsewhere > 0 ? (
53
+ // What waits on the reader outranks what is merely running.
54
+ <span
55
+ data-waiting-approval-count={waitingElsewhere}
56
+ aria-hidden="true"
57
+ className="absolute top-1 right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-amber-500 px-1 text-[10px] leading-none font-semibold text-white tabular-nums ring-2 ring-background"
58
+ >
59
+ {waitingElsewhere > 9 ? "9+" : waitingElsewhere}
60
+ </span>
61
+ ) : runningThreadCount > 0 ? (
62
+ <span
63
+ data-active-thread-count={runningThreadCount}
64
+ aria-hidden="true"
65
+ className="absolute top-1.5 right-1.5 size-2 rounded-full bg-sky-500 ring-2 ring-background motion-safe:animate-pulse"
66
+ />
67
+ ) : null}
68
+ </Button>
69
+ )
70
+ }
@@ -211,7 +211,18 @@ function TranscriptView({
211
211
  />
212
212
  ),
213
213
  }
214
- : {})}
214
+ : message.unfinished
215
+ ? {
216
+ after: (
217
+ <UnfinishedMarker
218
+ unfinished={message.unfinished}
219
+ {...(message.key === newestSavedKey && onContinue
220
+ ? { onContinue, continuing: turn.continuing }
221
+ : {})}
222
+ />
223
+ ),
224
+ }
225
+ : {})}
215
226
  />
216
227
  {calls ? (
217
228
  <MessageScrollerItem messageId={`approvals:${message.key}`}>
@@ -273,6 +284,24 @@ function TranscriptView({
273
284
  )
274
285
  }
275
286
 
287
+ /** A saved reply whose run failed or was stopped before it finished; the newest can go on. */
288
+ function UnfinishedMarker({
289
+ unfinished,
290
+ onContinue,
291
+ continuing = false,
292
+ }: {
293
+ readonly unfinished: "failed" | "cancelled"
294
+ readonly onContinue?: () => void
295
+ readonly continuing?: boolean
296
+ }) {
297
+ const labels = useAgentMessages().transcript
298
+ return unfinished === "failed" ? (
299
+ <RunErrorMarker message={labels.notFinished} onContinue={onContinue} continuing={continuing} />
300
+ ) : (
301
+ <RunCancelledMarker />
302
+ )
303
+ }
304
+
276
305
  /** How the turn of a reply that was never saved ended, below what it streamed. */
277
306
  function TurnEnd({
278
307
  turn,
@@ -16,6 +16,7 @@ import type {
16
16
  AgentContextInput,
17
17
  AgentFileRef,
18
18
  AgentMessage,
19
+ AgentRun,
19
20
  AgentThread,
20
21
  } from "./types"
21
22
 
@@ -128,6 +129,8 @@ export interface ConversationMessagesInput {
128
129
  readonly pending?: PendingUserMessage | null
129
130
  /** The key each message the reader sent had while pending, by its saved id. */
130
131
  readonly sentKeys?: ReadonlyMap<string, string>
132
+ /** The conversation's runs: a saved reply whose run failed or was stopped says it did not finish. */
133
+ readonly runs?: readonly AgentRun[]
131
134
  /** The run followed live; an observer follows none. */
132
135
  readonly live?: LiveRunState | null
133
136
  readonly presentation: ActiveTurnPresentation
@@ -144,6 +147,10 @@ export function conversationMessages(input: ConversationMessagesInput): AgentCon
144
147
  const keys = new Set<string>()
145
148
  const savedIds = new Set<string>()
146
149
  const answeredRuns = new Set<string>()
150
+ const ended = new Map<string, "failed" | "cancelled">()
151
+ for (const run of input.runs ?? []) {
152
+ if (run.status === "failed" || run.status === "cancelled") ended.set(run.id, run.status)
153
+ }
147
154
 
148
155
  for (const message of input.messages) {
149
156
  if (message.role === "system") continue
@@ -161,7 +168,10 @@ export function conversationMessages(input: ConversationMessagesInput): AgentCon
161
168
  const key = keys.has(preferred) ? `message:${message.id}` : preferred
162
169
  keys.add(key)
163
170
 
164
- result.push(savedMessage(message, key, authorOf(message.authorPrincipal, input), input))
171
+ const saved = savedMessage(message, key, authorOf(message.authorPrincipal, input), input)
172
+ const unfinished =
173
+ message.role === "assistant" && message.runId !== null ? ended.get(message.runId) : undefined
174
+ result.push(unfinished ? unfinishedMessage(saved, unfinished) : saved)
165
175
  }
166
176
 
167
177
  const pending = input.pending
@@ -175,6 +185,20 @@ export function conversationMessages(input: ConversationMessagesInput): AgentCon
175
185
  return result
176
186
  }
177
187
 
188
+ const unfinishedEntries = new WeakMap<AgentConversationMessage, AgentConversationMessage>()
189
+
190
+ /** The same saved reply, marked as one its run ended before finishing; kept stable across renders. */
191
+ function unfinishedMessage(
192
+ message: AgentConversationMessage,
193
+ unfinished: "failed" | "cancelled"
194
+ ): AgentConversationMessage {
195
+ const cached = unfinishedEntries.get(message)
196
+ if (cached?.unfinished === unfinished) return cached
197
+ const marked = { ...message, unfinished }
198
+ unfinishedEntries.set(message, marked)
199
+ return marked
200
+ }
201
+
178
202
  function isContinuation(message: AgentMessage): boolean {
179
203
  return message.role === "user" && message.parts.some((part) => part.type === "continuation")
180
204
  }