@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.
Files changed (167) hide show
  1. package/dist/agent/agent-chat.d.ts +8 -1
  2. package/dist/agent/agent-chat.d.ts.map +1 -1
  3. package/dist/agent/agent-panel.d.ts +8 -1
  4. package/dist/agent/agent-panel.d.ts.map +1 -1
  5. package/dist/agent/agent-surface.d.ts +8 -1
  6. package/dist/agent/agent-surface.d.ts.map +1 -1
  7. package/dist/agent/approvals.d.ts +1 -4
  8. package/dist/agent/approvals.d.ts.map +1 -1
  9. package/dist/agent/artifact-panel.d.ts +21 -2
  10. package/dist/agent/artifact-panel.d.ts.map +1 -1
  11. package/dist/agent/components/activity-status.d.ts +1 -1
  12. package/dist/agent/components/activity-status.d.ts.map +1 -1
  13. package/dist/agent/components/agent-threads.d.ts +15 -0
  14. package/dist/agent/components/agent-threads.d.ts.map +1 -0
  15. package/dist/agent/components/approval-card.d.ts +4 -4
  16. package/dist/agent/components/approval-card.d.ts.map +1 -1
  17. package/dist/agent/components/approval-mode-chip.d.ts +4 -6
  18. package/dist/agent/components/approval-mode-chip.d.ts.map +1 -1
  19. package/dist/agent/components/auto-model-chip.d.ts +2 -3
  20. package/dist/agent/components/auto-model-chip.d.ts.map +1 -1
  21. package/dist/agent/components/composer-menu.d.ts +42 -0
  22. package/dist/agent/components/composer-menu.d.ts.map +1 -0
  23. package/dist/agent/components/composer.d.ts +8 -5
  24. package/dist/agent/components/composer.d.ts.map +1 -1
  25. package/dist/agent/components/conversation-panel.d.ts +3 -12
  26. package/dist/agent/components/conversation-panel.d.ts.map +1 -1
  27. package/dist/agent/components/dictation-bar.d.ts +13 -0
  28. package/dist/agent/components/dictation-bar.d.ts.map +1 -0
  29. package/dist/agent/components/message-parts.d.ts.map +1 -1
  30. package/dist/agent/components/message-view.d.ts +3 -1
  31. package/dist/agent/components/message-view.d.ts.map +1 -1
  32. package/dist/agent/components/model-controls.d.ts +15 -0
  33. package/dist/agent/components/model-controls.d.ts.map +1 -1
  34. package/dist/agent/components/model-picker-row.d.ts +9 -2
  35. package/dist/agent/components/model-picker-row.d.ts.map +1 -1
  36. package/dist/agent/components/participant-input.d.ts +7 -6
  37. package/dist/agent/components/participant-input.d.ts.map +1 -1
  38. package/dist/agent/components/thread-people.d.ts +4 -4
  39. package/dist/agent/components/thread-people.d.ts.map +1 -1
  40. package/dist/agent/components/threads-button.d.ts +14 -0
  41. package/dist/agent/components/threads-button.d.ts.map +1 -0
  42. package/dist/agent/conversation.d.ts +3 -1
  43. package/dist/agent/conversation.d.ts.map +1 -1
  44. package/dist/agent/delegation/child-card.d.ts +24 -11
  45. package/dist/agent/delegation/child-card.d.ts.map +1 -1
  46. package/dist/agent/delegation/child-cards.d.ts +2 -2
  47. package/dist/agent/delegation/child-cards.d.ts.map +1 -1
  48. package/dist/agent/delegation/child-group.d.ts +5 -4
  49. package/dist/agent/delegation/child-group.d.ts.map +1 -1
  50. package/dist/agent/delegation/child-parts.d.ts +17 -18
  51. package/dist/agent/delegation/child-parts.d.ts.map +1 -1
  52. package/dist/agent/delegation/child-work.d.ts +0 -13
  53. package/dist/agent/delegation/child-work.d.ts.map +1 -1
  54. package/dist/agent/delegation/interpret.d.ts +0 -5
  55. package/dist/agent/delegation/interpret.d.ts.map +1 -1
  56. package/dist/agent/delegation/model.d.ts +12 -6
  57. package/dist/agent/delegation/model.d.ts.map +1 -1
  58. package/dist/agent/dictation.d.ts +16 -0
  59. package/dist/agent/dictation.d.ts.map +1 -0
  60. package/dist/agent/hooks/use-agent-conversation.d.ts +3 -270
  61. package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
  62. package/dist/agent/hooks/use-people-suggestions.d.ts +21 -0
  63. package/dist/agent/hooks/use-people-suggestions.d.ts.map +1 -0
  64. package/dist/agent/hooks/use-thread-lists.d.ts +220 -0
  65. package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -0
  66. package/dist/agent/i18n/en.d.ts +47 -36
  67. package/dist/agent/i18n/en.d.ts.map +1 -1
  68. package/dist/agent/i18n/fr.d.ts.map +1 -1
  69. package/dist/agent/i18n/index.d.ts +84 -72
  70. package/dist/agent/i18n/index.d.ts.map +1 -1
  71. package/dist/agent/react-router.d.ts +9 -0
  72. package/dist/agent/react-router.d.ts.map +1 -1
  73. package/dist/agent/run-presentation.d.ts +4 -1
  74. package/dist/agent/run-presentation.d.ts.map +1 -1
  75. package/dist/agent/thread-navigation.d.ts +8 -0
  76. package/dist/agent/thread-navigation.d.ts.map +1 -1
  77. package/dist/agent/thread-pages.d.ts +11 -0
  78. package/dist/agent/thread-pages.d.ts.map +1 -0
  79. package/dist/artifacts/person-avatar.d.ts +2 -2
  80. package/dist/{chunk-aes17xmx.js → chunk-12v6y89k.js} +4180 -3793
  81. package/dist/{chunk-aes17xmx.js.map → chunk-12v6y89k.js.map} +48 -42
  82. package/dist/{chunk-0yb22w6m.js → chunk-2a69ge8h.js} +1 -1
  83. package/dist/{chunk-vtp6nk44.js → chunk-bpj9mg5c.js} +1 -1
  84. package/dist/{chunk-1rhht9y0.js → chunk-hzy2g13h.js} +1 -1
  85. package/dist/createCustomApp.d.ts.map +1 -1
  86. package/dist/index.d.ts +2 -1
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +19 -6
  89. package/dist/index.js.map +6 -6
  90. package/dist/pages/home.d.ts.map +1 -1
  91. package/dist/pages/observability/ai-usage/calls.d.ts.map +1 -1
  92. package/dist/pages/settings/memory-history.d.ts.map +1 -1
  93. package/dist/pages/settings/messages.d.ts.map +1 -1
  94. package/dist/pages/values.d.ts +5 -0
  95. package/dist/pages/values.d.ts.map +1 -1
  96. package/dist/pages.d.ts +1 -1
  97. package/dist/pages.d.ts.map +1 -1
  98. package/dist/pages.js +60 -44
  99. package/dist/pages.js.map +8 -8
  100. package/dist/server.js +12 -6
  101. package/dist/server.js.map +3 -3
  102. package/dist/shell/agent-dock.d.ts.map +1 -1
  103. package/package.json +4 -4
  104. package/src/agent/agent-chat.tsx +15 -23
  105. package/src/agent/agent-panel.tsx +11 -0
  106. package/src/agent/agent-surface.tsx +11 -0
  107. package/src/agent/agent.css +33 -3
  108. package/src/agent/approvals.ts +4 -5
  109. package/src/agent/artifact-panel.tsx +113 -37
  110. package/src/agent/components/activity-status.tsx +1 -1
  111. package/src/agent/components/agent-threads.tsx +377 -0
  112. package/src/agent/components/approval-card.tsx +336 -327
  113. package/src/agent/components/approval-mode-chip.tsx +38 -145
  114. package/src/agent/components/auto-model-chip.tsx +103 -167
  115. package/src/agent/components/composer-menu.tsx +185 -0
  116. package/src/agent/components/composer.tsx +168 -103
  117. package/src/agent/components/context-chips.tsx +1 -1
  118. package/src/agent/components/conversation-panel.tsx +16 -36
  119. package/src/agent/components/dictation-bar.tsx +110 -0
  120. package/src/agent/components/file-attachment-card.tsx +5 -2
  121. package/src/agent/components/message-parts.tsx +27 -11
  122. package/src/agent/components/message-view.tsx +182 -68
  123. package/src/agent/components/model-controls.tsx +133 -125
  124. package/src/agent/components/model-picker-row.tsx +38 -17
  125. package/src/agent/components/participant-input.tsx +159 -31
  126. package/src/agent/components/reasoning-effort-slider.tsx +27 -27
  127. package/src/agent/components/shared-thread-notice.tsx +1 -1
  128. package/src/agent/components/thread-people.tsx +45 -15
  129. package/src/agent/components/threads-button.tsx +70 -0
  130. package/src/agent/components/transcript.tsx +30 -1
  131. package/src/agent/conversation.ts +25 -1
  132. package/src/agent/delegation/child-card.tsx +187 -247
  133. package/src/agent/delegation/child-cards.tsx +4 -7
  134. package/src/agent/delegation/child-group.tsx +179 -98
  135. package/src/agent/delegation/child-parts.tsx +71 -106
  136. package/src/agent/delegation/child-work.tsx +6 -52
  137. package/src/agent/delegation/interpret.ts +0 -28
  138. package/src/agent/delegation/model.ts +115 -39
  139. package/src/agent/dictation.ts +48 -0
  140. package/src/agent/hooks/use-agent-conversation.ts +10 -92
  141. package/src/agent/hooks/use-people-suggestions.ts +90 -0
  142. package/src/agent/hooks/use-thread-lists.ts +77 -0
  143. package/src/agent/i18n/en.ts +100 -83
  144. package/src/agent/i18n/fr.ts +109 -100
  145. package/src/agent/react-router.tsx +48 -5
  146. package/src/agent/run-presentation.ts +6 -2
  147. package/src/agent/thread-navigation.ts +16 -0
  148. package/src/agent/thread-pages.ts +24 -0
  149. package/src/artifacts/person-avatar.tsx +1 -1
  150. package/src/createCustomApp.ts +13 -6
  151. package/src/index.ts +7 -3
  152. package/src/pages/home.tsx +3 -1
  153. package/src/pages/observability/ai-usage/calls.tsx +2 -1
  154. package/src/pages/settings/memory-history.tsx +2 -1
  155. package/src/pages/settings/messages.ts +2 -3
  156. package/src/pages/values.tsx +23 -1
  157. package/src/pages.ts +5 -1
  158. package/src/shell/agent-dock.tsx +4 -2
  159. package/dist/agent/agents-page.d.ts +0 -4
  160. package/dist/agent/agents-page.d.ts.map +0 -1
  161. package/dist/agent/components/agent-thread-switcher.d.ts +0 -37
  162. package/dist/agent/components/agent-thread-switcher.d.ts.map +0 -1
  163. package/src/agent/agents-page.ts +0 -7
  164. package/src/agent/components/agent-thread-switcher.tsx +0 -519
  165. /package/dist/{chunk-0yb22w6m.js.map → chunk-2a69ge8h.js.map} +0 -0
  166. /package/dist/{chunk-vtp6nk44.js.map → chunk-bpj9mg5c.js.map} +0 -0
  167. /package/dist/{chunk-1rhht9y0.js.map → chunk-hzy2g13h.js.map} +0 -0
@@ -4,8 +4,6 @@ import { useLocale } from "@sixb/ui/lib/i18n"
4
4
  import { cn } from "@sixb/ui/lib/utils"
5
5
  import { useQuery, useQueryClient } from "@tanstack/react-query"
6
6
  import {
7
- ArrowUpRight,
8
- Box,
9
7
  ChevronRight,
10
8
  CircleAlert,
11
9
  CircleCheck,
@@ -16,14 +14,13 @@ import {
16
14
  Database,
17
15
  Globe,
18
16
  type LucideIcon,
17
+ RefreshCw,
19
18
  SkipForward,
20
19
  Workflow,
21
20
  } from "lucide-react"
22
- import { Fragment, type ReactNode, type Ref, useId, useMemo, useRef, useState } from "react"
23
- import { Link } from "react-router-dom"
21
+ import { Fragment, useId, useMemo, useRef, useState } from "react"
24
22
  import { humanizeIdentifier } from "../../pages/ontology/lib/labels"
25
- import { actionRunHref, objectHref, workflowRunHref } from "../../pages/routes"
26
- import { useValueTypes, ValueTree, valueSchema } from "../../pages/values"
23
+ import { ObjectRefLinksContext, useValueTypes, ValueTree, valueSchema } from "../../pages/values"
27
24
  import {
28
25
  type AgentApproval,
29
26
  type AgentApprovalDecision,
@@ -36,11 +33,13 @@ import {
36
33
  } from "../approvals"
37
34
  import { capitalize, humanize } from "../bash/interpret"
38
35
  import { useDelegationCards } from "../delegation/context"
36
+ import { childTitle } from "../delegation/interpret"
39
37
  import { formatRelativeTime } from "../format"
40
38
  import { useAgentMessages } from "../i18n"
41
39
  import type { AgentMessages } from "../i18n/en"
42
40
  import { objectContextTitleQuery } from "../object-context-title"
43
41
  import { samePrincipal } from "../sharing"
42
+ import { ACTIVITY_STATUS_ROW_CLASS_NAME } from "./activity-status"
44
43
 
45
44
  const DAY_MS = 24 * 60 * 60 * 1_000
46
45
 
@@ -97,21 +96,26 @@ type DecisionNotice = { readonly tone: "info" | "warning"; readonly text: string
97
96
  * One call the agent made that waits for, or waited for, its requester: what it does, to which
98
97
  * record, with which values, and whether it stays in the project's data. Whoever asked for the turn
99
98
  * approves or denies it here; everyone else reads it, and who decides. A call the thread holds no
100
- * record of shows only when a message reported how it ended. `inCard`: it sits in the card of the
101
- * sub-agent that made it, which names it already.
99
+ * record of shows only when a message reported how it ended.
102
100
  */
103
101
  export function ApprovalCard({
104
102
  held,
105
- inCard = false,
103
+ underCaller = false,
106
104
  }: {
107
105
  readonly held: HeldCall
108
- readonly inCard?: boolean
106
+ /** Right under the line of the sub-agent that asked, which names it already. */
107
+ readonly underCaller?: boolean
109
108
  }) {
110
109
  const messages = useAgentMessages()
111
110
  const labels = messages.approvals
112
111
  const locale = useLocale()
113
112
  const alsoId = useId()
114
- const statusRef = useRef<HTMLParagraphElement>(null)
113
+ const sectionRef = useRef<HTMLElement>(null)
114
+ // The buttons go once a decision lands: the reader's place moves to what now says how it ended.
115
+ const focusStatus = () =>
116
+ requestAnimationFrame(() =>
117
+ sectionRef.current?.querySelector<HTMLElement>("[data-approval-focus]")?.focus()
118
+ )
115
119
  const { approvals: context, outcomes } = useApprovalCards()
116
120
  const delegationCards = useDelegationCards()
117
121
  const approval = context?.approvals.find((candidate) => candidate.id === held.id) ?? null
@@ -134,8 +138,9 @@ export function ApprovalCard({
134
138
 
135
139
  const definition = useCallDefinition(call)
136
140
  const title = definition.name
141
+ const effect = effectOf(call, definition, messages)
137
142
  // A sub-agent's call says which one asked; its own card comes with the sub-agent's.
138
- const caller = approval?.caller ?? reported?.caller
143
+ const caller = underCaller ? undefined : (approval?.caller ?? reported?.caller)
139
144
 
140
145
  const canDecide =
141
146
  state === "pending" && approval !== null && context?.decide !== undefined
@@ -155,8 +160,6 @@ export function ApprovalCard({
155
160
  ?.id === approval.id
156
161
  // A waiting call shows what it runs with; a decided one keeps it a click away.
157
162
  const waiting = state === "pending" || state === "unknown"
158
- const open = waiting || (approval !== null && showInput)
159
- const when = approval ? (approval.decidedAt ?? approval.createdAt) : undefined
160
163
  const expiredDays = approval
161
164
  ? Math.round((Date.parse(approval.expiresAt) - Date.parse(approval.createdAt)) / DAY_MS)
162
165
  : 7
@@ -190,7 +193,7 @@ export function ApprovalCard({
190
193
  .catch(() => setStopFailed(true))
191
194
  .finally(() => {
192
195
  setStopping(false)
193
- requestAnimationFrame(() => statusRef.current?.focus())
196
+ focusStatus()
194
197
  })
195
198
  }
196
199
 
@@ -224,245 +227,299 @@ export function ApprovalCard({
224
227
  )
225
228
  .finally(() => {
226
229
  setDeciding(null)
227
- // The buttons are gone: keep the reader's place on the card, which now says how it ended.
228
- requestAnimationFrame(() => statusRef.current?.focus())
230
+ focusStatus()
229
231
  })
230
232
  }
231
233
 
234
+ const subjectLine =
235
+ (call.kind === "action" && call.subject) || caller ? (
236
+ <>
237
+ {call.kind === "action" && call.subject ? <Subject subject={call.subject} /> : null}
238
+ {call.kind === "action" && call.subject && caller ? (
239
+ <span aria-hidden="true">·</span>
240
+ ) : null}
241
+ {caller ? (
242
+ <span className="truncate">{labels.fromSubagent(childTitle(caller.key))}</span>
243
+ ) : null}
244
+ </>
245
+ ) : null
246
+
247
+ const notes = (
248
+ <>
249
+ {notice ? (
250
+ <p
251
+ role="status"
252
+ className={cn(
253
+ "text-xs",
254
+ notice.tone === "warning" ? "text-amber-700 dark:text-amber-400" : "text-foreground"
255
+ )}
256
+ >
257
+ {notice.text}
258
+ </p>
259
+ ) : null}
260
+ {stopFailed ? (
261
+ <p role="alert" className="text-xs text-destructive">
262
+ {labels.stopFailed}
263
+ </p>
264
+ ) : null}
265
+ {failure ? (
266
+ <p role="alert" className="text-xs text-destructive">
267
+ {labels.failures[failure]}
268
+ </p>
269
+ ) : null}
270
+ </>
271
+ )
272
+
273
+ // Decided, the call is a line of the reply's record, as its work is: how it ended, what it was
274
+ // and to what, its values a click away.
275
+ if (!waiting) {
276
+ const when = approval?.decidedAt
277
+ const detail = outcomeDetail(state, approval?.outcome ?? reported?.outcome, expiredDays, labels)
278
+ const line = (
279
+ <>
280
+ <StatusLine state={state} requester={requester} messages={messages} inline />
281
+ <span className="text-muted-foreground/60" aria-hidden="true">
282
+ ·
283
+ </span>
284
+ <span className="min-w-0 truncate">
285
+ <span className="font-medium text-foreground/85">{title}</span>
286
+ {subjectLine ? (
287
+ <span className="inline-flex min-w-0 items-center gap-1.5">
288
+ <span className="ml-1.5 text-muted-foreground/60" aria-hidden="true">
289
+ ·
290
+ </span>
291
+ {subjectLine}
292
+ </span>
293
+ ) : null}
294
+ </span>
295
+ {when ? (
296
+ <span className="shrink-0 text-muted-foreground/70 tabular-nums">
297
+ <span className="text-muted-foreground/60" aria-hidden="true">
298
+ ·{" "}
299
+ </span>
300
+ {formatRelativeTime(when, locale, messages.time)}
301
+ </span>
302
+ ) : null}
303
+ </>
304
+ )
305
+ return (
306
+ <section
307
+ ref={sectionRef}
308
+ aria-label={labels.card(title)}
309
+ data-approval-state={state}
310
+ data-approval-id={held.id}
311
+ tabIndex={-1}
312
+ className="flex min-w-0 flex-col gap-1 outline-none"
313
+ >
314
+ {approval ? (
315
+ <button
316
+ data-approval-focus=""
317
+ type="button"
318
+ aria-expanded={showInput}
319
+ onClick={() => setShowInput((value) => !value)}
320
+ className={cn(
321
+ ACTIVITY_STATUS_ROW_CLASS_NAME,
322
+ "outline-none transition-colors hover:bg-muted/50 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40"
323
+ )}
324
+ >
325
+ {line}
326
+ <ChevronRight
327
+ className="size-3.5 shrink-0 opacity-50 transition-[opacity,transform] group-hover:opacity-100 group-aria-expanded:rotate-90"
328
+ aria-hidden="true"
329
+ />
330
+ </button>
331
+ ) : (
332
+ // Read without its record, there is nothing more to open.
333
+ <p data-approval-focus="" tabIndex={-1} className={ACTIVITY_STATUS_ROW_CLASS_NAME}>
334
+ {line}
335
+ </p>
336
+ )}
337
+ {detail ? <p className="pl-6 text-xs text-muted-foreground">{detail}</p> : null}
338
+ {showInput && approval ? (
339
+ <div className="pt-1 pb-1 pl-5">
340
+ <CallInput call={call} definition={definition} emptyLabel={labels.noInput} />
341
+ {effect ? (
342
+ <p className="mt-2 text-xs">
343
+ <EffectLine effect={effect} />
344
+ </p>
345
+ ) : null}
346
+ </div>
347
+ ) : null}
348
+ <div className="pl-5 empty:hidden">{notes}</div>
349
+ </section>
350
+ )
351
+ }
352
+
353
+ // Waiting, it is the one thing in the reply to act on: what, to what, with which values, what it
354
+ // reaches, then the decision.
232
355
  return (
233
356
  <section
357
+ ref={sectionRef}
234
358
  aria-label={labels.card(title)}
235
359
  aria-busy={deciding !== null}
236
360
  data-approval-state={state}
237
361
  data-approval-id={held.id}
238
- // A sub-agent's card brings the reader here when the call waits under a later turn.
362
+ // A sub-agent's line brings the reader here when the call waits under a later turn.
239
363
  tabIndex={-1}
240
- className={cn(
241
- "min-w-0 overflow-hidden border bg-card text-card-foreground",
242
- inCard ? "rounded-xl" : "rounded-2xl",
243
- canDecide
244
- ? inCard
245
- ? "border-amber-500/35"
246
- : "border-amber-500/35 shadow-[0_0_0_4px_rgb(245_158_11/0.06),0_1px_2px_0_rgb(0_0_0/0.04)]"
247
- : inCard
248
- ? "border-border"
249
- : "border-border shadow-[0_1px_2px_0_rgb(0_0_0/0.04)]"
250
- )}
364
+ className="min-w-0 rounded-2xl bg-card p-4 text-card-foreground shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_1px_2px_rgb(0_0_0/0.03),0_4px_16px_rgb(0_0_0/0.035)] outline-none sm:p-5 dark:shadow-[0_0_0_1px_rgb(255_255_255/0.09)]"
251
365
  >
252
- <div className="px-4 pt-3 pb-3.5 sm:px-5">
253
- <div className="flex items-center gap-2">
254
- <StatusLine
255
- focusRef={statusRef}
256
- state={state}
257
- requester={requester}
258
- canDecide={canDecide}
259
- messages={messages}
260
- // Its sub-agent's card says already that it waits: said once, for a screen reader.
261
- quiet={inCard && state === "pending"}
262
- />
263
- {when && !(inCard && state === "pending" && !canStop) ? (
264
- <span
265
- className={cn(
266
- "ml-auto shrink-0 text-[11px] tabular-nums text-muted-foreground",
267
- // On a phone, Stop waiting needs the room more than the time does.
268
- canStop && "max-sm:hidden"
269
- )}
270
- >
271
- {formatRelativeTime(when, locale, messages.time)}
272
- </span>
273
- ) : null}
274
- {canStop ? (
275
- <button
276
- type="button"
277
- onClick={stopWaiting}
278
- disabled={stopping || deciding !== null}
279
- title={labels.stopWaitingHint}
280
- className="-my-1 -mr-1.5 shrink-0 rounded-md max-sm:ml-auto px-1.5 py-1 text-[11px] font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40 disabled:opacity-60"
281
- >
282
- {stopping ? labels.stoppingWaiting : labels.stopWaiting}
283
- </button>
284
- ) : null}
366
+ {/* The reader's own to decide: its buttons say so, and the status is for screen readers. For
367
+ anyone else, it says who decides. Under a sub-agent's line, the line says it already. */}
368
+ {underCaller ? null : canDecide ? (
369
+ <p data-approval-focus="" tabIndex={-1} role="status" className="sr-only">
370
+ {labels.waitingYou}
371
+ </p>
372
+ ) : (
373
+ <div className="mb-2">
374
+ <StatusLine state={state} requester={requester} messages={messages} />
285
375
  </div>
376
+ )}
286
377
 
287
- <h3
288
- className={cn(
289
- "text-[15px]",
290
- // Waiting in its sub-agent's card, the card says so: the title leads.
291
- inCard && state === "pending" && !canStop ? "mt-0" : "mt-2",
292
- "leading-snug font-semibold tracking-[-0.01em] text-foreground"
293
- )}
294
- >
295
- {title}
378
+ <div className="flex min-w-0 items-start gap-3">
379
+ <h3 className="flex min-w-0 flex-1 items-center gap-2 text-[15px] leading-snug font-semibold tracking-[-0.01em] text-foreground">
380
+ {canDecide && !underCaller ? (
381
+ <span className="size-1.5 shrink-0 rounded-full bg-amber-500" aria-hidden="true" />
382
+ ) : null}
383
+ <span className="min-w-0">{title}</span>
296
384
  </h3>
297
-
298
- {caller && !inCard ? (
299
- <p className="mt-0.5 truncate text-xs text-muted-foreground">
300
- {labels.fromSubagent(caller.key)}
301
- </p>
302
- ) : null}
303
-
304
- {call.kind === "action" && call.subject ? <Subject subject={call.subject} /> : null}
305
-
306
- {waiting || state === "asked" ? null : (
307
- <Outcome
308
- state={state}
309
- outcome={approval?.outcome ?? reported?.outcome}
310
- expiredDays={expiredDays}
311
- messages={messages}
385
+ {canStop ? (
386
+ <button
387
+ type="button"
388
+ onClick={stopWaiting}
389
+ disabled={stopping || deciding !== null}
390
+ title={labels.stopWaitingHint}
391
+ className="-my-0.5 -mr-2 shrink-0 rounded-full px-2 py-1 text-xs text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40 disabled:opacity-60"
312
392
  >
313
- {approval ? (
314
- <button
315
- type="button"
316
- aria-expanded={showInput}
317
- onClick={() => setShowInput((value) => !value)}
318
- className="-ml-1 flex items-center gap-1 rounded-md px-1 py-0.5 outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40"
319
- >
320
- <ChevronRight
321
- className={cn("size-3.5 transition-transform", showInput && "rotate-90")}
322
- aria-hidden="true"
323
- />
324
- {showInput ? labels.hideInput : labels.showInput}
325
- </button>
326
- ) : null}
327
- </Outcome>
328
- )}
393
+ {stopping ? labels.stoppingWaiting : labels.stopWaiting}
394
+ </button>
395
+ ) : null}
396
+ </div>
397
+ {/* To what; and when it only changes records here, that reassurance, quietly beside it. */}
398
+ <p className="mt-0.5 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-0.5 text-[13px] text-muted-foreground">
399
+ {subjectLine}
400
+ {effect?.reach === "records" ? <EffectLine effect={effect} /> : null}
401
+ </p>
402
+
403
+ <div className="mt-3">
404
+ <CallInput call={call} definition={definition} emptyLabel={labels.noInput} />
329
405
  </div>
330
406
 
331
- {open ? (
332
- <div className="border-t border-border/60 px-4 py-3 sm:px-5">
333
- <CallInput call={call} definition={definition} emptyLabel={labels.noInput} />
334
- </div>
407
+ {/* Reaching past the app is the last thing read before saying yes. */}
408
+ {effect?.reach === "outside" ? (
409
+ <p className="mt-3.5 border-t border-border/60 pt-3 text-[13px]">
410
+ <EffectLine effect={effect} />
411
+ </p>
335
412
  ) : null}
336
413
 
337
- {waiting ? <Effect call={call} external={definition.external} messages={messages} /> : null}
338
-
339
414
  {canDecide ? (
340
- <div className="border-t border-border/60 px-4 py-3 sm:px-5">
341
- <div className="grid grid-cols-2 gap-2 sm:flex sm:items-center">
415
+ <div className={effect?.reach === "outside" ? "mt-3" : "mt-4"}>
416
+ <div className="flex flex-wrap items-center gap-2">
342
417
  <Button
343
418
  type="button"
344
- variant="ghost"
419
+ variant="secondary"
345
420
  size="sm"
346
421
  disabled={deciding !== null}
347
422
  onClick={() => decide("deny")}
348
- className="h-10 text-muted-foreground hover:text-foreground sm:h-8"
423
+ className="h-8 rounded-full px-4 shadow-none"
349
424
  >
350
425
  {deciding === "deny" ? <Spinner className="size-3.5" /> : null}
351
426
  {deciding === "deny" ? labels.denying : labels.deny}
352
427
  </Button>
353
- <span className="hidden sm:block sm:flex-1" />
428
+ <span className="flex-1" />
429
+ {/* Both ways to say yes, side by side: this once, or from now on in this conversation. */}
354
430
  <Button
355
431
  type="button"
356
- variant="outline"
432
+ variant="secondary"
357
433
  size="sm"
358
434
  disabled={deciding !== null}
359
435
  onClick={() => decide("always")}
436
+ title={labels.alwaysAllowHint(alwaysModeLabel)}
360
437
  aria-describedby={alsoApproved > 0 ? alsoId : undefined}
361
- className="order-last col-span-2 h-auto min-h-10 py-2 leading-tight whitespace-normal sm:order-none sm:min-h-8 sm:py-1.5"
438
+ className="h-8 rounded-full px-4 shadow-none"
362
439
  >
363
440
  {deciding === "always" ? <Spinner className="size-3.5" /> : null}
364
- {labels.alwaysAllow(alwaysModeLabel)}
441
+ {/* For a call that reaches outside, it lets every such call run from now on. */}
442
+ {alwaysMode === "auto" ? labels.alwaysAllowAll : labels.alwaysAllow}
365
443
  </Button>
366
444
  <Button
367
445
  type="button"
368
446
  size="sm"
369
447
  disabled={deciding !== null}
370
448
  onClick={() => decide("approve")}
371
- className="h-10 sm:h-8 sm:px-4"
449
+ className="h-8 rounded-full px-4 shadow-none"
372
450
  >
373
451
  {deciding === "approve" ? <Spinner className="size-3.5" /> : null}
374
452
  {deciding === "approve" ? labels.approving : labels.approve}
375
453
  </Button>
376
454
  </div>
377
455
  {alsoApproved > 0 ? (
378
- <p id={alsoId} className="mt-2 text-xs text-muted-foreground sm:text-right">
456
+ <p id={alsoId} className="mt-2 text-xs text-muted-foreground">
379
457
  {labels.alwaysAllowAlso(alsoApproved)}
380
458
  </p>
381
459
  ) : null}
382
460
  </div>
383
461
  ) : state === "pending" && requester !== null ? (
384
- <p className="border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5">
385
- {labels.onlyRequester(requester)}
386
- </p>
462
+ <p className="mt-3 text-xs text-muted-foreground">{labels.onlyRequester(requester)}</p>
387
463
  ) : null}
388
464
 
389
- {notice ? (
390
- <p
391
- role="status"
392
- className={cn(
393
- "border-t border-border/60 px-4 py-2.5 text-xs sm:px-5",
394
- notice.tone === "warning" ? "text-amber-700 dark:text-amber-400" : "text-foreground"
395
- )}
396
- >
397
- {notice.text}
398
- </p>
399
- ) : null}
400
-
401
- {stopFailed ? (
402
- <p
403
- role="alert"
404
- className="border-t border-border/60 px-4 py-2.5 text-xs text-destructive sm:px-5"
405
- >
406
- {labels.stopFailed}
407
- </p>
408
- ) : null}
409
-
410
- {failure ? (
411
- <p
412
- role="alert"
413
- className="border-t border-border/60 px-4 py-2.5 text-xs text-destructive sm:px-5"
414
- >
415
- {labels.failures[failure]}
416
- </p>
417
- ) : null}
465
+ <div className="mt-3 flex flex-col gap-1 empty:hidden">{notes}</div>
418
466
  </section>
419
467
  )
420
468
  }
421
469
 
470
+ /** Where the call stands, for anyone but the one who decides it: their buttons say it already. */
422
471
  function StatusLine({
423
- focusRef,
424
472
  state,
425
473
  requester,
426
- canDecide,
427
474
  messages,
428
- quiet = false,
475
+ inline = false,
429
476
  }: {
430
- /** Where focus goes once a decision removes the buttons. */
431
- readonly focusRef: Ref<HTMLParagraphElement>
432
477
  readonly state: CardState
433
478
  readonly requester: string | null
434
- readonly canDecide: boolean
435
479
  readonly messages: AgentMessages
436
- /** Read to a screen reader only. */
437
- readonly quiet?: boolean
480
+ /** In a decided call's line: its icon in the tone, its words in the line's. */
481
+ readonly inline?: boolean
438
482
  }) {
439
- const labels = messages.approvals
440
- const { Icon, label, tone } = statusOf(state, requester, canDecide, messages)
483
+ const { Icon, label, tone } = statusOf(state, requester, messages)
484
+ const toneClass = cn(
485
+ tone === "waiting" && "text-amber-700 dark:text-amber-400",
486
+ tone === "done" && "text-emerald-600 dark:text-emerald-400",
487
+ tone === "error" && "text-destructive",
488
+ tone === "muted" && "text-muted-foreground"
489
+ )
490
+ const icon =
491
+ state === "running" ? (
492
+ <Spinner className="size-3 shrink-0" />
493
+ ) : tone === "waiting" ? (
494
+ <span className="relative flex size-2 shrink-0" aria-hidden="true">
495
+ <span className="absolute inset-0 rounded-full bg-amber-500/40 motion-safe:animate-ping dark:bg-amber-400/40" />
496
+ <span className="relative size-2 rounded-full bg-amber-500 dark:bg-amber-400" />
497
+ </span>
498
+ ) : (
499
+ <Icon className={cn("size-3.5 shrink-0", inline && toneClass)} aria-hidden="true" />
500
+ )
501
+
502
+ if (inline) {
503
+ return (
504
+ <span className="flex shrink-0 items-center gap-1.5">
505
+ {icon}
506
+ <span className={cn(tone === "error" && "text-destructive")}>{label}</span>
507
+ </span>
508
+ )
509
+ }
441
510
 
442
511
  return (
443
512
  <p
444
- ref={focusRef}
513
+ data-approval-focus=""
445
514
  tabIndex={-1}
446
515
  role="status"
447
516
  className={cn(
448
- "flex min-w-0 items-center gap-1.5 rounded-sm text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
449
- quiet && "sr-only",
450
- tone === "waiting" && "text-amber-700 dark:text-amber-400",
451
- tone === "done" && "text-emerald-700 dark:text-emerald-400",
452
- tone === "error" && "text-destructive",
453
- tone === "muted" && "text-muted-foreground"
517
+ "flex min-w-0 items-center gap-2 rounded-sm text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
518
+ toneClass
454
519
  )}
455
520
  >
456
- {state === "running" ? (
457
- <Spinner className="size-3.5 shrink-0" />
458
- ) : (
459
- <Icon
460
- className={cn("size-3.5 shrink-0", state === "pending" && "motion-safe:animate-pulse")}
461
- aria-hidden="true"
462
- />
463
- )}
521
+ {icon}
464
522
  <span className="truncate">{label}</span>
465
- {state === "running" ? <span className="sr-only">{labels.running}</span> : null}
466
523
  </p>
467
524
  )
468
525
  }
@@ -470,7 +527,6 @@ function StatusLine({
470
527
  function statusOf(
471
528
  state: CardState,
472
529
  requester: string | null,
473
- canDecide: boolean,
474
530
  messages: AgentMessages
475
531
  ): {
476
532
  readonly Icon: LucideIcon
@@ -482,7 +538,7 @@ function statusOf(
482
538
  case "pending":
483
539
  return {
484
540
  Icon: CirclePause,
485
- label: canDecide || requester === null ? labels.waitingYou : labels.waitingOther(requester),
541
+ label: requester === null ? labels.waitingYou : labels.waitingOther(requester),
486
542
  tone: "waiting",
487
543
  }
488
544
  case "unknown":
@@ -490,17 +546,13 @@ function statusOf(
490
546
  case "running":
491
547
  return { Icon: CircleCheck, label: `${labels.approved} · ${labels.running}`, tone: "done" }
492
548
  case "ran":
493
- return { Icon: CircleCheck, label: `${labels.approved} · ${labels.ran}`, tone: "done" }
549
+ return { Icon: CircleCheck, label: labels.approved, tone: "done" }
494
550
  case "failed":
495
551
  return { Icon: CircleAlert, label: labels.failed, tone: "error" }
496
552
  case "lost":
497
553
  return { Icon: CircleAlert, label: labels.notRun, tone: "error" }
498
554
  case "denied":
499
- return {
500
- Icon: CircleSlash,
501
- label: `${labels.denied} · ${labels.deniedDetail}`,
502
- tone: "muted",
503
- }
555
+ return { Icon: CircleSlash, label: labels.denied, tone: "muted" }
504
556
  case "superseded":
505
557
  return { Icon: SkipForward, label: labels.superseded, tone: "muted" }
506
558
  case "cancelled":
@@ -512,13 +564,15 @@ function statusOf(
512
564
  }
513
565
  }
514
566
 
515
- /** The record the action acts on: its type, its title, and a link to its page. */
567
+ /**
568
+ * The record the action acts on: its type and its title. Named, not linked: the card is read by
569
+ * everyone in the conversation, and the record's page is not theirs to be sent to.
570
+ */
516
571
  function Subject({
517
572
  subject,
518
573
  }: {
519
574
  readonly subject: { readonly objectTypeId: string; readonly primaryId: string }
520
575
  }) {
521
- const labels = useAgentMessages().approvals
522
576
  const queryClient = useQueryClient()
523
577
  const objectType = useQuery({
524
578
  ...getObjectTypeOptions({ path: { objectTypeId: subject.objectTypeId } }),
@@ -527,30 +581,18 @@ function Subject({
527
581
  })
528
582
  const title = useQuery(objectContextTitleQuery(queryClient, subject)).data ?? null
529
583
  const typeName = objectType.data?.name ?? humanizeIdentifier(subject.objectTypeId)
530
- const name = title ?? subject.primaryId
531
584
 
532
585
  return (
533
- <Link
534
- to={objectHref(subject.objectTypeId, subject.primaryId)}
535
- aria-label={labels.open(`${typeName} ${name}`)}
536
- className="group mt-2 flex w-fit max-w-full min-w-0 items-center gap-2 rounded-lg bg-muted/60 py-1 pr-2 pl-1.5 text-[13px] outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/40"
537
- >
538
- <span className="flex size-5 shrink-0 items-center justify-center rounded-md bg-background ring-1 ring-border">
539
- <Box className="size-3 text-emerald-600 dark:text-emerald-400" aria-hidden="true" />
540
- </span>
541
- <span className="shrink-0 text-muted-foreground">{typeName}</span>
542
- <span className="min-w-0 truncate font-medium text-foreground">{name}</span>
543
- <ArrowUpRight
544
- className="size-3.5 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground"
545
- aria-hidden="true"
546
- />
547
- </Link>
586
+ <span className="min-w-0 truncate">
587
+ {typeName} <span className="text-foreground">{title ?? subject.primaryId}</span>
588
+ </span>
548
589
  )
549
590
  }
550
591
 
551
592
  /**
552
593
  * The values the call runs with, one per line, labelled and formatted as the action or workflow
553
- * declares them: a date reads as a date, an object reference as a link to it.
594
+ * declares them: a date reads as a date, an object reference by its title. Not as a link: the
595
+ * card is read by everyone in the conversation, and the record's page is not theirs to visit.
554
596
  */
555
597
  function CallInput({
556
598
  call,
@@ -579,35 +621,35 @@ function CallInput({
579
621
  }
580
622
 
581
623
  return (
582
- <dl className="grid grid-cols-[minmax(4.5rem,max-content)_minmax(0,1fr)] gap-x-6 gap-y-2 text-[13px] leading-5">
583
- {entries.map(([key, item]) => {
584
- const field = definition.fields?.[key]
585
- return (
586
- <Fragment key={key}>
587
- <dt className="min-w-0 break-words text-muted-foreground">
588
- {definition.labels?.[key] ?? sentence(key)}
589
- </dt>
590
- <dd className="min-w-0 text-foreground">
591
- {isEnumSchema(fieldSchemaOf(field)) && typeof item === "string" ? (
592
- // A declared choice, shown as the code it is rather than as prose.
593
- <span className="rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium tracking-wide uppercase">
594
- {item}
595
- </span>
596
- ) : (
597
- <ValueTree
598
- value={item}
599
- schema={
600
- definition.fields && field !== undefined
601
- ? valueSchema(fieldSchemaOf(field), valueTypes)
602
- : undefined
603
- }
604
- />
605
- )}
606
- </dd>
607
- </Fragment>
608
- )
609
- })}
610
- </dl>
624
+ <ObjectRefLinksContext.Provider value={false}>
625
+ <dl className="grid grid-cols-[minmax(4.5rem,max-content)_minmax(0,1fr)] gap-x-6 gap-y-1.5 text-[13px] leading-5">
626
+ {entries.map(([key, item]) => {
627
+ const field = definition.fields?.[key]
628
+ return (
629
+ <Fragment key={key}>
630
+ <dt className="min-w-0 break-words text-muted-foreground">
631
+ {definition.labels?.[key] ?? sentence(key)}
632
+ </dt>
633
+ <dd className="min-w-0 text-foreground">
634
+ {isEnumSchema(fieldSchemaOf(field)) && typeof item === "string" ? (
635
+ // A declared choice, shown as the code it is rather than as prose.
636
+ <span className="uppercase">{item}</span>
637
+ ) : (
638
+ <ValueTree
639
+ value={item}
640
+ schema={
641
+ definition.fields && field !== undefined
642
+ ? valueSchema(fieldSchemaOf(field), valueTypes)
643
+ : undefined
644
+ }
645
+ />
646
+ )}
647
+ </dd>
648
+ </Fragment>
649
+ )
650
+ })}
651
+ </dl>
652
+ </ObjectRefLinksContext.Provider>
611
653
  )
612
654
  }
613
655
 
@@ -622,111 +664,72 @@ function fieldSchemaOf(field: unknown): unknown {
622
664
  : field
623
665
  }
624
666
 
625
- /** Whether the call stays in the project's data: the line that tells a reader what is at stake. */
626
- function Effect({
627
- call,
628
- external,
629
- messages,
630
- }: {
631
- readonly call: CardCall
632
- readonly external: boolean | undefined
633
- readonly messages: AgentMessages
634
- }) {
667
+ interface CallEffect {
668
+ readonly Icon: LucideIcon
669
+ readonly text: string
670
+ /** `outside`: it reaches past the app, which is worth a second look before saying yes. */
671
+ readonly reach: "records" | "outside"
672
+ }
673
+
674
+ /**
675
+ * What saying yes does beyond the values: only changes records in this app, or reaches past it —
676
+ * writing back to the system a record comes from, or acting outside (sending, paying, calling).
677
+ * The framework knows which kind, not which system, nor whether it can be undone.
678
+ */
679
+ function effectOf(
680
+ call: CardCall,
681
+ definition: CallDefinition,
682
+ messages: AgentMessages
683
+ ): CallEffect | null {
635
684
  const effects = messages.approvals.effects
636
- const effect =
637
- call.kind === "action" ? (call.effect ?? (external ? "external" : undefined)) : null
638
- if (call.kind === "action" && effect === undefined) return null
639
-
640
- const { Icon, text, tone } =
641
- call.kind === "workflow"
642
- ? {
643
- Icon: Workflow,
644
- text: effects.workflow(sentence(call.workflowId)),
645
- tone: "strong" as const,
646
- }
647
- : effect === "external"
648
- ? { Icon: Globe, text: effects.external, tone: "strong" as const }
649
- : { Icon: Database, text: effects.ontology, tone: "quiet" as const }
685
+ if (call.kind === "workflow") {
686
+ return { Icon: Workflow, text: effects.workflow(sentence(call.workflowId)), reach: "outside" }
687
+ }
688
+ const effect = call.effect ?? (definition.external ? "external" : undefined)
689
+ if (effect === undefined) return null
690
+ if (effect === "ontology") return { Icon: Database, text: effects.ontology, reach: "records" }
691
+ // A write-back alone updates the record's own system; anything else acts outside the app.
692
+ return definition.writeback && !definition.effects
693
+ ? { Icon: RefreshCw, text: effects.writeback, reach: "outside" }
694
+ : { Icon: Globe, text: effects.external, reach: "outside" }
695
+ }
650
696
 
697
+ function EffectLine({ effect }: { readonly effect: CallEffect }) {
698
+ const { Icon, text, reach } = effect
651
699
  return (
652
- <p
700
+ <span
653
701
  className={cn(
654
- "flex items-center gap-2 border-t border-border/60 px-4 py-2.5 text-xs sm:px-5",
655
- tone === "strong" ? "text-foreground" : "text-muted-foreground"
702
+ "inline-flex items-center gap-1.5",
703
+ reach === "outside" ? "text-foreground" : "text-muted-foreground"
656
704
  )}
657
705
  >
658
- <Icon
659
- className={cn(
660
- "size-3.5 shrink-0",
661
- tone === "strong" ? "text-amber-600 dark:text-amber-400" : "text-muted-foreground"
662
- )}
663
- aria-hidden="true"
664
- />
706
+ <Icon className="size-3.5 shrink-0 text-muted-foreground" aria-hidden="true" />
665
707
  {text}
666
- </p>
708
+ </span>
667
709
  )
668
710
  }
669
711
 
670
- /** How a decided call ended, then a way to its values and to the run it started. */
671
- function Outcome({
672
- state,
673
- outcome,
674
- expiredDays,
675
- messages,
676
- children,
677
- }: {
678
- readonly state: CardState
679
- readonly outcome: AgentApproval["outcome"]
680
- readonly expiredDays: number
681
- readonly messages: AgentMessages
682
- /** The disclosure of the call's values, when the card has them. */
683
- readonly children?: ReactNode
684
- }) {
685
- const labels = messages.approvals
686
- const detail =
687
- state === "superseded"
688
- ? labels.supersededDetail
689
- : state === "cancelled"
690
- ? labels.cancelledDetail
691
- : state === "expired"
692
- ? labels.expiredDetail(expiredDays)
693
- : state === "lost"
694
- ? labels.authorityLost
695
- : state === "failed"
696
- ? failureMessage(outcome)
697
- : null
698
-
699
- const runLink =
700
- outcome?.kind === "action-run"
701
- ? actionRunHref(outcome.runId)
702
- : outcome?.kind === "workflow-run"
703
- ? workflowRunHref(outcome.runId)
704
- : null
705
- if (!detail && !runLink && !children) return null
706
-
707
- return (
708
- <div className="mt-2.5 space-y-1.5 text-xs text-muted-foreground">
709
- {detail ? (
710
- <p className={cn((state === "failed" || state === "lost") && "text-destructive")}>
711
- {detail}
712
- </p>
713
- ) : null}
714
- {children || runLink ? (
715
- <div className="flex flex-wrap items-center gap-x-4 gap-y-1">
716
- {children}
717
- {runLink ? (
718
- <Link
719
- to={runLink}
720
- className="inline-flex items-center gap-0.5 rounded-sm font-medium text-foreground underline-offset-4 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/40"
721
- >
722
- {labels.viewRun}
723
- <ArrowUpRight className="size-3" aria-hidden="true" />
724
- </Link>
725
- ) : null}
726
- </div>
727
- ) : null}
728
- </div>
729
- )
712
+ /** Why a decided call ended as it did, when its status alone does not say. */
713
+ function outcomeDetail(
714
+ state: CardState,
715
+ outcome: AgentApproval["outcome"],
716
+ expiredDays: number,
717
+ labels: AgentMessages["approvals"]
718
+ ): string | null {
719
+ switch (state) {
720
+ case "superseded":
721
+ return labels.supersededDetail
722
+ case "cancelled":
723
+ return labels.cancelledDetail
724
+ case "expired":
725
+ return labels.expiredDetail(expiredDays)
726
+ case "lost":
727
+ return labels.authorityLost
728
+ case "failed":
729
+ return failureMessage(outcome)
730
+ default:
731
+ return null
732
+ }
730
733
  }
731
734
 
732
735
  /** An id as the card names it: "payInvoice" reads "Pay invoice". */
@@ -750,6 +753,10 @@ interface CallDefinition {
750
753
  readonly schemas: readonly unknown[]
751
754
  /** From the definition, until the record says it: a writeback or effects reach out. */
752
755
  readonly external?: boolean
756
+ /** It writes back to the system its records come from. */
757
+ readonly writeback?: boolean
758
+ /** It acts outside the app: sends, pays, calls. */
759
+ readonly effects?: boolean
753
760
  }
754
761
 
755
762
  const NO_SCHEMAS: readonly unknown[] = []
@@ -793,6 +800,8 @@ function useCallDefinition(call: CardCall): CallDefinition {
793
800
  ),
794
801
  schemas: action.params.map((param) => param.schema),
795
802
  external: action.phases.writeback || action.phases.effects,
803
+ writeback: action.phases.writeback,
804
+ effects: action.phases.effects,
796
805
  }
797
806
  }, [call.kind, callId, action, workflow])
798
807
  }