@gemies/sdk 9.2.0 → 10.0.1

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 (89) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/README.md +9 -6
  3. package/package.json +4 -11
  4. package/src/accounts.ts +7 -1
  5. package/src/ask-eager.ts +0 -2
  6. package/src/ask-text.ts +0 -1
  7. package/src/ask.ts +0 -1
  8. package/src/components/AmbientField.tsx +13 -2
  9. package/src/components/ComposerDropZone.tsx +20 -4
  10. package/src/components/ComposerSuggestions.tsx +9 -2
  11. package/src/components/GemieActivityLine.tsx +11 -5
  12. package/src/components/GemieBetweenGemies.tsx +23 -10
  13. package/src/components/GemieChatContent.tsx +46 -23
  14. package/src/components/GemieChatScreen.tsx +7 -4
  15. package/src/components/GemieChatSheet.tsx +6 -2
  16. package/src/components/GemieComposer.tsx +17 -7
  17. package/src/components/GemieGroupWelcome.tsx +16 -2
  18. package/src/components/GemieRecentConversations.tsx +13 -10
  19. package/src/components/GemieSharedConversation.tsx +38 -6
  20. package/src/components/GemieWelcomeMessage.tsx +23 -7
  21. package/src/components/IdentityMark.tsx +6 -12
  22. package/src/components/PlanPreviewCard.tsx +18 -7
  23. package/src/components/QuestionCard.tsx +6 -2
  24. package/src/components/ReplyMarkdown.tsx +32 -6
  25. package/src/components/RichBlocks.tsx +20 -15
  26. package/src/components/accounts/GemieAccountGrants.tsx +27 -10
  27. package/src/components/accounts/GemieConnectedAccounts.tsx +87 -51
  28. package/src/components/canvas/CanvasComponent.tsx +6 -2
  29. package/src/components/canvas/DashboardRenderer.tsx +25 -8
  30. package/src/components/canvas/DeckRenderer.tsx +23 -6
  31. package/src/components/canvas/FormRenderer.tsx +8 -3
  32. package/src/components/connectors/ConnectorLogo.tsx +15 -9
  33. package/src/components/connectors/GemieConnectedConnectors.tsx +51 -25
  34. package/src/components/connectors/GemieConnectorsStore.tsx +99 -41
  35. package/src/components/connectors/GrantSwitchRow.tsx +18 -5
  36. package/src/components/thought/ThoughtPanel.tsx +26 -12
  37. package/src/components/thought/ToolStep.tsx +14 -6
  38. package/src/components/thread/AgentResultCard.tsx +10 -4
  39. package/src/components/thread/AgentTaskCard.tsx +8 -3
  40. package/src/components/thread/ApprovalCard.tsx +6 -2
  41. package/src/components/thread/ChatBubble.tsx +66 -25
  42. package/src/components/thread/GemieThread.tsx +32 -10
  43. package/src/components/thread/ThreadRow.tsx +20 -15
  44. package/src/components/thread/ThreadSearch.tsx +27 -10
  45. package/src/components/thread/ThreadSkeleton.tsx +12 -6
  46. package/src/components/thread/ToolResultCard.tsx +10 -4
  47. package/src/components/thread/TurnAttachments.tsx +17 -8
  48. package/src/components/voice/VoiceControls.tsx +9 -6
  49. package/src/connectors.ts +15 -2
  50. package/src/hooks/useAgentRunFailureToast.ts +34 -0
  51. package/src/hooks/useChatVoice.ts +2 -10
  52. package/src/hooks/useMessageReactions.ts +5 -5
  53. package/src/hooks/useThoughtScope.ts +9 -8
  54. package/src/index.ts +2 -3
  55. package/src/lib/tool-call-status.ts +1 -1
  56. package/src/lib/utils.ts +1 -8
  57. package/src/realtime/react.tsx +9 -9
  58. package/src/realtime/reread.ts +28 -0
  59. package/src/realtime/store.ts +123 -0
  60. package/src/runtime/agents.ts +46 -27
  61. package/src/runtime/collections.ts +35 -136
  62. package/src/runtime/connected-accounts.ts +175 -88
  63. package/src/runtime/connectors.ts +244 -127
  64. package/src/runtime/conversations.ts +181 -607
  65. package/src/runtime/data/answer.ts +76 -0
  66. package/src/runtime/data/collections.ts +168 -0
  67. package/src/runtime/data/conversations.ts +626 -0
  68. package/src/runtime/data/reactions.ts +29 -0
  69. package/src/runtime/data/read.ts +37 -0
  70. package/src/runtime/data/threads.ts +149 -0
  71. package/src/runtime/index.ts +72 -8
  72. package/src/runtime/model.ts +0 -2
  73. package/src/runtime/routes.ts +2 -2
  74. package/src/runtime/sharing.ts +69 -56
  75. package/src/runtime/types.ts +8 -16
  76. package/src/runtime/use-bound-action.ts +27 -0
  77. package/src/runtime/use-conversation-stream.ts +8 -31
  78. package/src/runtime/use-conversation-thread.ts +40 -51
  79. package/src/runtime/use-gemie-thread.ts +32 -43
  80. package/src/runtime/use-start-conversation.ts +14 -15
  81. package/src/runtime/use-thread-history.ts +26 -36
  82. package/src/runtime/use-thread-search.ts +29 -76
  83. package/src/text.ts +0 -1
  84. package/src/voice.ts +0 -1
  85. package/src/components/Image.tsx +0 -12
  86. package/src/realtime/cache.ts +0 -257
  87. package/src/runtime/conversation-dates.ts +0 -31
  88. package/src/runtime/query-keys.ts +0 -66
  89. package/src/runtime/reaction-cache.ts +0 -45
@@ -10,6 +10,7 @@ import {
10
10
  } from '../../runtime/connected-accounts';
11
11
  import { GrantSwitchRow } from '../connectors/GrantSwitchRow';
12
12
  import { K, PlatformMark, accountName, statusText } from './account-parts';
13
+ import { createTokenStyles } from '@oxy.so/bloom/theme';
13
14
 
14
15
  export interface GemieAccountGrantsProps {
15
16
  /** The gemie whose grants these are (Alia's id for her locked editor). */
@@ -34,13 +35,15 @@ export function GemieAccountGrants({
34
35
  onManage,
35
36
  t = englishCopy,
36
37
  }: GemieAccountGrantsProps) {
37
- const { data, isPending, isError, isFetching, refetch } = useConnectedAccounts();
38
+ const styles = useStyles();
39
+ const { value: data, isLoading, status, isFetching, refresh } = useConnectedAccounts();
40
+ const isError = status === 'error';
38
41
  const { grant } = useConnectedAccountMutations();
39
42
 
40
- if (isPending) {
43
+ if (isLoading) {
41
44
  return (
42
45
  <Skeleton.Region>
43
- <View className="gap-3 py-2.5">
46
+ <View style={styles.loading}>
44
47
  <Skeleton.Box width={220} height={14} />
45
48
  <Skeleton.Box width={160} height={14} />
46
49
  </View>
@@ -50,8 +53,8 @@ export function GemieAccountGrants({
50
53
 
51
54
  if (isError && data === undefined) {
52
55
  return (
53
- <View className="items-start gap-2 py-2.5 pe-2.5">
54
- <Text variant="body-2-regular" className="text-text-secondary">
56
+ <View style={styles.failure}>
57
+ <Text variant="body-2-regular" style={styles.muted}>
55
58
  {t(`${K}.loadFailed`)}
56
59
  </Text>
57
60
  <Button
@@ -59,7 +62,7 @@ export function GemieAccountGrants({
59
62
  appearance="outline"
60
63
  tone="neutral"
61
64
  loading={isFetching}
62
- onPress={() => void refetch()}
65
+ onPress={() => void refresh()}
63
66
  >
64
67
  {t(`${K}.retry`)}
65
68
  </Button>
@@ -72,7 +75,7 @@ export function GemieAccountGrants({
72
75
 
73
76
  const setGranted = async (accountId: string, granted: boolean) => {
74
77
  try {
75
- await grant.mutateAsync({ accountId, gemieId, granted });
78
+ await grant.run(accountId, gemieId, granted);
76
79
  } catch {
77
80
  toast.error(t(`${K}.saveFailed`));
78
81
  }
@@ -80,8 +83,8 @@ export function GemieAccountGrants({
80
83
 
81
84
  return (
82
85
  <View>
83
- <View className="py-2.5 pe-2.5">
84
- <Text variant="body-2-regular" className="text-text-secondary">
86
+ <View style={styles.intro}>
87
+ <Text variant="body-2-regular" style={styles.muted}>
85
88
  {accounts.length === 0 ? t(`${K}.grants.empty`) : t(`${K}.grants.description`, { name })}
86
89
  </Text>
87
90
  </View>
@@ -107,7 +110,7 @@ export function GemieAccountGrants({
107
110
  />
108
111
  );
109
112
  })}
110
- <View className="flex-row border-t border-border py-2.5 pe-2.5">
113
+ <View style={styles.manageRow}>
111
114
  <Button size="sm" appearance="outline" tone="neutral" onPress={onManage}>
112
115
  {t(`${K}.grants.manage`)}
113
116
  </Button>
@@ -115,3 +118,17 @@ export function GemieAccountGrants({
115
118
  </View>
116
119
  );
117
120
  }
121
+
122
+ const useStyles = createTokenStyles((t) => ({
123
+ loading: { gap: 12, paddingVertical: 10 },
124
+ failure: { alignItems: 'flex-start', gap: 8, paddingVertical: 10, paddingInlineEnd: 10 },
125
+ muted: { color: t.mutedForeground },
126
+ intro: { paddingVertical: 10, paddingInlineEnd: 10 },
127
+ manageRow: {
128
+ flexDirection: 'row',
129
+ borderTopWidth: 1,
130
+ borderColor: t.border,
131
+ paddingVertical: 10,
132
+ paddingInlineEnd: 10,
133
+ },
134
+ }));
@@ -31,17 +31,15 @@ import {
31
31
  } from '../../runtime/connected-accounts';
32
32
  import { GrantSwitchRow } from '../connectors/GrantSwitchRow';
33
33
  import { K, PLATFORM_LABELS, PlatformMark, accountName, statusText } from './account-parts';
34
+ import { createTokenStyles } from '@oxy.so/bloom/theme';
34
35
 
35
36
  /** The value the answering select gives "nobody answers on its own". */
36
37
  const NOBODY = '';
37
38
 
38
39
  /** One row of the list: the same rhythm as a settings row, a divider above all but the first. */
39
40
  function Row({ children, first }: { children: React.ReactNode; first?: boolean }) {
40
- return (
41
- <View className={`gap-3 py-2.5 pe-2.5 ${first ? '' : 'border-t border-border'}`}>
42
- {children}
43
- </View>
44
- );
41
+ const styles = useStyles();
42
+ return <View style={[styles.listRow, !first && styles.divider]}>{children}</View>;
45
43
  }
46
44
 
47
45
  function Choice<T extends string>({
@@ -57,9 +55,10 @@ function Choice<T extends string>({
57
55
  disabled: boolean;
58
56
  onChange: (value: T) => void;
59
57
  }) {
58
+ const styles = useStyles();
60
59
  return (
61
- <View className="gap-1">
62
- <Text variant="body-2-regular" className="text-text-secondary">
60
+ <View style={styles.choice}>
61
+ <Text variant="body-2-regular" style={styles.muted}>
63
62
  {label}
64
63
  </Text>
65
64
  <Select
@@ -107,16 +106,17 @@ function Code({ value }: { value: string | null | undefined }) {
107
106
  * second step is left.
108
107
  */
109
108
  function TelegramSteps({ link, t }: { link: string | null; t: Translate }) {
109
+ const styles = useStyles();
110
110
  return (
111
- <View className="gap-2">
112
- <Text variant="body-2-regular" className="text-text-secondary">
111
+ <View style={styles.steps}>
112
+ <Text variant="body-2-regular" style={styles.muted}>
113
113
  {t(`${K}.telegram.note`)}
114
114
  </Text>
115
115
  {link ? (
116
116
  <>
117
117
  <Text variant="body-2-regular">{t(`${K}.telegram.step1`)}</Text>
118
118
  <Text variant="body-2-regular">{t(`${K}.telegram.step2`)}</Text>
119
- <View className="flex-row">
119
+ <View style={styles.actions}>
120
120
  <Button size="sm" onPress={() => void Linking.openURL(link)}>
121
121
  {t(`${K}.telegram.open`)}
122
122
  </Button>
@@ -147,7 +147,8 @@ function ConnectingAccount({
147
147
  onDone: () => void;
148
148
  onCancel: () => void;
149
149
  }) {
150
- const { data } = useConnectedAccountQr(link);
150
+ const styles = useStyles();
151
+ const { value: data } = useConnectedAccountQr(link);
151
152
  const status = data?.status ?? 'qr-pending';
152
153
  const label = PLATFORM_LABELS[platform];
153
154
 
@@ -170,13 +171,13 @@ function ConnectingAccount({
170
171
  ) : (
171
172
  <>
172
173
  <Text variant="body-2-semibold">{t(`${K}.scanTitle`, { platform: label })}</Text>
173
- <Text variant="body-2-regular" className="text-text-secondary">
174
+ <Text variant="body-2-regular" style={styles.muted}>
174
175
  {t(`${K}.scan.${platform}`)}
175
176
  </Text>
176
177
  <Code value={data?.qr} />
177
178
  </>
178
179
  )}
179
- <View className="flex-row">
180
+ <View style={styles.actions}>
180
181
  <Button size="sm" appearance="outline" tone="neutral" onPress={onCancel}>
181
182
  {t(`${K}.cancel`)}
182
183
  </Button>
@@ -187,7 +188,7 @@ function ConnectingAccount({
187
188
 
188
189
  /** A Telegram account the person left before finishing: its steps, kept until it is connected. */
189
190
  function PendingTelegram({ account, t }: { account: ConnectedAccount; t: Translate }) {
190
- const { data } = useConnectedAccountQr({ accountId: account._id, qr: null });
191
+ const { value: data } = useConnectedAccountQr({ accountId: account._id, qr: null });
191
192
  return <TelegramSteps link={data?.qr ?? null} t={t} />;
192
193
  }
193
194
 
@@ -203,12 +204,13 @@ function ChosenChats({
203
204
  saving: boolean;
204
205
  t: Translate;
205
206
  }) {
206
- const { data: chats, isPending } = useConnectedAccountChats(account._id);
207
+ const styles = useStyles();
208
+ const { value: chats, isLoading } = useConnectedAccountChats(account._id);
207
209
 
208
- if (isPending) {
210
+ if (isLoading) {
209
211
  return (
210
212
  <Skeleton.Region>
211
- <View className="gap-2">
213
+ <View style={styles.steps}>
212
214
  {[0, 1, 2].map((row) => (
213
215
  <Skeleton.Box key={row} width={180} height={14} />
214
216
  ))}
@@ -218,16 +220,16 @@ function ChosenChats({
218
220
  }
219
221
  if (!chats?.length) {
220
222
  return (
221
- <Text variant="body-2-regular" className="text-text-secondary">
223
+ <Text variant="body-2-regular" style={styles.muted}>
222
224
  {t(`${K}.noChats`)}
223
225
  </Text>
224
226
  );
225
227
  }
226
228
  return (
227
- <View className="gap-1">
229
+ <View style={styles.choice}>
228
230
  {chats.map((chat) => (
229
- <View key={chat.chatId} className="flex-row items-center justify-between gap-3 py-1">
230
- <Text variant="body-2-regular" numberOfLines={1} className="flex-1">
231
+ <View key={chat.chatId} style={styles.chat}>
232
+ <Text variant="body-2-regular" numberOfLines={1} style={styles.chatName}>
231
233
  {chat.kind === 'group' ? t(`${K}.groupChat`, { name: chat.name }) : chat.name}
232
234
  </Text>
233
235
  <Switch
@@ -265,10 +267,11 @@ function Answering({
265
267
  saving: boolean;
266
268
  t: Translate;
267
269
  }) {
270
+ const styles = useStyles();
268
271
  const answering = gemies.find((gemie) => gemie.id === account.answeringGemieId) ?? null;
269
272
  const telegram = account.platform === 'telegram';
270
273
  return (
271
- <View className="gap-3">
274
+ <View style={styles.settings}>
272
275
  <Choice
273
276
  label={t(`${K}.answeringLabel`)}
274
277
  value={answering?.id ?? NOBODY}
@@ -280,13 +283,13 @@ function Answering({
280
283
  onChange={(id) => save({ answeringGemieId: id === NOBODY ? null : id })}
281
284
  />
282
285
  {answering === null ? (
283
- <Text variant="body-2-regular" className="text-text-secondary">
286
+ <Text variant="body-2-regular" style={styles.muted}>
284
287
  {t(`${K}.answeringNone`)}
285
288
  </Text>
286
289
  ) : (
287
290
  <>
288
291
  {telegram && account.status === 'connected' && account.canReply === false ? (
289
- <Text variant="body-2-regular" className="text-text-secondary">
292
+ <Text variant="body-2-regular" style={styles.muted}>
290
293
  {t(`${K}.telegram.cannotReply`, { name: answering.name })}
291
294
  </Text>
292
295
  ) : null}
@@ -333,6 +336,7 @@ function AccountRow({
333
336
  gemies: readonly GrantableGemie[];
334
337
  t: Translate;
335
338
  }) {
339
+ const styles = useStyles();
336
340
  const { update, grant, remove } = useConnectedAccountMutations();
337
341
  const platform = PLATFORM_LABELS[account.platform] ?? account.platform;
338
342
  const name = accountName(account);
@@ -345,7 +349,7 @@ function AccountRow({
345
349
  const save = useCallback(
346
350
  async (patch: ConnectedAccountPatch) => {
347
351
  try {
348
- await update.mutateAsync({ accountId: account._id, ...patch });
352
+ await update.run(account._id, patch);
349
353
  } catch {
350
354
  toast.error(t(`${K}.saveFailed`));
351
355
  }
@@ -355,7 +359,7 @@ function AccountRow({
355
359
 
356
360
  const setGranted = async (gemieId: string, granted: boolean) => {
357
361
  try {
358
- await grant.mutateAsync({ accountId: account._id, gemieId, granted });
362
+ await grant.run(account._id, gemieId, granted);
359
363
  } catch {
360
364
  toast.error(t(`${K}.saveFailed`));
361
365
  }
@@ -373,7 +377,7 @@ function AccountRow({
373
377
  });
374
378
  if (!ok) return;
375
379
  try {
376
- await remove.mutateAsync(account._id);
380
+ await remove.run(account._id);
377
381
  toast.success(t(`${K}.removed`, { platform }));
378
382
  } catch {
379
383
  toast.error(t(`${K}.removeFailed`));
@@ -382,12 +386,12 @@ function AccountRow({
382
386
 
383
387
  return (
384
388
  <Row>
385
- <View className="flex-row flex-wrap items-center justify-between gap-3">
389
+ <View style={styles.account}>
386
390
  <PlatformMark platform={account.platform} size={28} />
387
- <View className="flex-1 gap-0.5">
391
+ <View style={styles.accountText}>
388
392
  <Text variant="body-2-semibold">{name}</Text>
389
393
  <Text variant="body-2-regular">{statusText(account, t)}</Text>
390
- <Text variant="body-2-regular" className="text-text-secondary">
394
+ <Text variant="body-2-regular" style={styles.muted}>
391
395
  {account.lastActiveAt
392
396
  ? t(`${K}.lastMessage`, { when: new Date(account.lastActiveAt).toLocaleString() })
393
397
  : t(`${K}.noMessagesYet`)}
@@ -411,7 +415,7 @@ function AccountRow({
411
415
  <>
412
416
  <View>
413
417
  <Text variant="body-2-semibold">{t(`${K}.usedBy`)}</Text>
414
- <Text variant="body-2-regular" className="text-text-secondary">
418
+ <Text variant="body-2-regular" style={styles.muted}>
415
419
  {t(`${K}.usedByHint`)}
416
420
  </Text>
417
421
  {gemies.map((gemie, index) => (
@@ -454,7 +458,9 @@ export interface GemieConnectedAccountsProps {
454
458
  * Alia apps draw this same panel. Only what this deployment can connect is offered.
455
459
  */
456
460
  export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccountsProps) {
457
- const { data, isPending, isError, isFetching, refetch } = useConnectedAccounts();
461
+ const styles = useStyles();
462
+ const { value: data, isLoading, status, isFetching, refresh } = useConnectedAccounts();
463
+ const isError = status === 'error';
458
464
  const { connect, remove } = useConnectedAccountMutations();
459
465
  const [connecting, setConnecting] = useState<{
460
466
  platform: GemieAccountPlatform;
@@ -465,12 +471,14 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
465
471
  platform: GemieAccountPlatform;
466
472
  reason: string;
467
473
  } | null>(null);
474
+ /** The platform the last connection asked for, whose button spins while it runs. */
475
+ const [asked, setAsked] = useState<GemieAccountPlatform | null>(null);
468
476
  const finished = useCallback(() => setConnecting(null), []);
469
477
 
470
- if (isPending) {
478
+ if (isLoading) {
471
479
  return (
472
480
  <Skeleton.Region>
473
- <View className="gap-3 py-2.5">
481
+ <View style={styles.loading}>
474
482
  <Skeleton.Box width={260} height={14} />
475
483
  <Skeleton.Box width={160} height={14} />
476
484
  </View>
@@ -481,7 +489,9 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
481
489
  const handleConnect = async (platform: GemieAccountPlatform) => {
482
490
  setConnectFailure(null);
483
491
  try {
484
- setConnecting({ platform, link: await connect.mutateAsync(platform) });
492
+ setAsked(platform);
493
+ const link = await connect.run(platform);
494
+ if (link) setConnecting({ platform, link });
485
495
  } catch (error) {
486
496
  setConnectFailure({ platform, reason: errorMessage(error, t(`${K}.tryAgain`)) });
487
497
  }
@@ -490,7 +500,7 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
490
500
  const handleCancel = async () => {
491
501
  const pending = connecting;
492
502
  setConnecting(null);
493
- if (pending) await remove.mutateAsync(pending.link.accountId).catch(() => {});
503
+ if (pending) await remove.run(pending.link.accountId).catch(() => {});
494
504
  };
495
505
 
496
506
  /**
@@ -502,16 +512,16 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
502
512
  return (
503
513
  <View>
504
514
  <Row first>
505
- <Text variant="body-2-regular" className="text-text-secondary">
515
+ <Text variant="body-2-regular" style={styles.muted}>
506
516
  {t(`${K}.loadFailed`)}
507
517
  </Text>
508
- <View className="flex-row">
518
+ <View style={styles.actions}>
509
519
  <Button
510
520
  size="sm"
511
521
  appearance="outline"
512
522
  tone="neutral"
513
523
  loading={isFetching}
514
- onPress={() => void refetch()}
524
+ onPress={() => void refresh()}
515
525
  >
516
526
  {t(`${K}.retry`)}
517
527
  </Button>
@@ -531,7 +541,7 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
531
541
  return (
532
542
  <View>
533
543
  <Row first>
534
- <Text variant="body-2-regular" className="text-text-secondary">
544
+ <Text variant="body-2-regular" style={styles.muted}>
535
545
  {t(`${K}.description`)}
536
546
  </Text>
537
547
  </Row>
@@ -550,17 +560,17 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
550
560
  <Row>
551
561
  <Text variant="body-2-semibold">{t(`${K}.connect`)}</Text>
552
562
  {platforms.length === 0 ? (
553
- <Text variant="body-2-regular" className="text-text-secondary">
563
+ <Text variant="body-2-regular" style={styles.muted}>
554
564
  {t(`${K}.unavailable`)}
555
565
  </Text>
556
566
  ) : null}
557
567
  {platforms.includes('telegram') ? (
558
- <Text variant="body-2-regular" className="text-text-secondary">
568
+ <Text variant="body-2-regular" style={styles.muted}>
559
569
  {t(`${K}.telegram.note`)}
560
570
  </Text>
561
571
  ) : null}
562
572
  {platforms.length === 0 ? null : (
563
- <View className="flex-row flex-wrap gap-2">
573
+ <View style={styles.platforms}>
564
574
  {platforms.map((platform) => (
565
575
  <Button
566
576
  key={platform}
@@ -570,7 +580,7 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
570
580
  accessibilityLabel={t(`${K}.connectNamed`, {
571
581
  platform: PLATFORM_LABELS[platform],
572
582
  })}
573
- loading={connect.isPending && connect.variables === platform}
583
+ loading={connect.isPending && asked === platform}
574
584
  disabled={connect.isPending}
575
585
  onPress={() => handleConnect(platform)}
576
586
  >
@@ -580,18 +590,14 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
580
590
  </View>
581
591
  )}
582
592
  {connectFailure ? (
583
- <View className="gap-2">
584
- <Text
585
- variant="body-2-regular"
586
- className="text-error-primary"
587
- accessibilityRole="alert"
588
- >
593
+ <View style={styles.steps}>
594
+ <Text variant="body-2-regular" accessibilityRole="alert" style={styles.failure}>
589
595
  {t(`${K}.connectFailed`, {
590
596
  platform: PLATFORM_LABELS[connectFailure.platform],
591
597
  reason: connectFailure.reason,
592
598
  })}
593
599
  </Text>
594
- <View className="flex-row">
600
+ <View style={styles.actions}>
595
601
  <Button
596
602
  size="sm"
597
603
  appearance="outline"
@@ -609,3 +615,33 @@ export function GemieConnectedAccounts({ t = englishCopy }: GemieConnectedAccoun
609
615
  </View>
610
616
  );
611
617
  }
618
+
619
+ const useStyles = createTokenStyles((t) => ({
620
+ // A connect failure, in Bloom's error role.
621
+ failure: { color: t.destructive },
622
+ choice: { gap: 4 },
623
+ muted: { color: t.mutedForeground },
624
+ steps: { gap: 8 },
625
+ actions: { flexDirection: 'row' },
626
+ chat: {
627
+ flexDirection: 'row',
628
+ alignItems: 'center',
629
+ justifyContent: 'space-between',
630
+ gap: 12,
631
+ paddingVertical: 4,
632
+ },
633
+ chatName: { flexGrow: 1, flexShrink: 1, flexBasis: '0%' },
634
+ settings: { gap: 12 },
635
+ account: {
636
+ flexDirection: 'row',
637
+ flexWrap: 'wrap',
638
+ alignItems: 'center',
639
+ justifyContent: 'space-between',
640
+ gap: 12,
641
+ },
642
+ accountText: { flexGrow: 1, flexShrink: 1, flexBasis: '0%', gap: 2 },
643
+ loading: { gap: 12, paddingVertical: 10 },
644
+ platforms: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 },
645
+ listRow: { gap: 12, paddingVertical: 10, paddingInlineEnd: 10 },
646
+ divider: { borderTopWidth: 1, borderColor: t.border },
647
+ }));
@@ -1,6 +1,6 @@
1
1
  import { useLabels } from '../../lib/labels';
2
2
  import { Muted, Text } from '@oxy.so/bloom/typography';
3
- import { View } from 'react-native';
3
+ import { View, StyleSheet } from 'react-native';
4
4
  import { ChartRenderer } from './ChartRenderer';
5
5
  import { CodeRenderer } from './CodeRenderer';
6
6
  import { DashboardRenderer } from './DashboardRenderer';
@@ -57,9 +57,13 @@ export function CanvasComponent({ component, onFormSubmit }: CanvasComponentProp
57
57
  })();
58
58
 
59
59
  return (
60
- <View className="gap-3">
60
+ <View style={styles.component}>
61
61
  <Text variant="body-semibold">{component.title}</Text>
62
62
  {content}
63
63
  </View>
64
64
  );
65
65
  }
66
+
67
+ const styles = StyleSheet.create({
68
+ component: { gap: 12 },
69
+ });
@@ -3,6 +3,7 @@ import { View } from 'react-native';
3
3
  import { ChartRenderer } from './ChartRenderer';
4
4
  import { MarkdownRenderer } from './MarkdownRenderer';
5
5
  import { TableRenderer } from './TableRenderer';
6
+ import { createTokenStyles } from '@oxy.so/bloom/theme';
6
7
 
7
8
  export type DashboardWidget =
8
9
  | { kind: 'stat'; label: string; value: string; delta?: string }
@@ -22,20 +23,18 @@ interface DashboardRendererProps {
22
23
 
23
24
  /** A dashboard: its stats in a row, then its charts, tables and notes, each drawn by its own renderer. */
24
25
  export function DashboardRenderer({ data }: DashboardRendererProps) {
26
+ const styles = useStyles();
25
27
  const widgets = Array.isArray(data.widgets) ? data.widgets : [];
26
28
  const stats = widgets.filter(
27
29
  (w): w is Extract<DashboardWidget, { kind: 'stat' }> => w.kind === 'stat',
28
30
  );
29
31
  const rest = widgets.filter((w) => w.kind !== 'stat');
30
32
  return (
31
- <View className="gap-3">
33
+ <View style={styles.dashboard}>
32
34
  {stats.length > 0 && (
33
- <View className="flex-row flex-wrap gap-3">
35
+ <View style={styles.stats}>
34
36
  {stats.map((stat, i) => (
35
- <View
36
- key={i}
37
- className="min-w-36 flex-1 gap-1 rounded-2xl border border-border bg-background-tertiary-default p-3"
38
- >
37
+ <View key={i} style={styles.stat}>
39
38
  <Muted>{stat.label}</Muted>
40
39
  <Text variant="headline-semibold">{stat.value}</Text>
41
40
  {stat.delta ? <Muted>{stat.delta}</Muted> : null}
@@ -49,14 +48,14 @@ export function DashboardRenderer({ data }: DashboardRendererProps) {
49
48
  return <ChartRenderer key={i} data={widget} title={widget.title} />;
50
49
  case 'table':
51
50
  return (
52
- <View key={i} className="gap-2">
51
+ <View key={i} style={styles.widget}>
53
52
  {widget.title ? <Text variant="body-semibold">{widget.title}</Text> : null}
54
53
  <TableRenderer data={widget} title={widget.title} />
55
54
  </View>
56
55
  );
57
56
  case 'text':
58
57
  return (
59
- <View key={i} className="gap-2">
58
+ <View key={i} style={styles.widget}>
60
59
  {widget.title ? <Text variant="body-semibold">{widget.title}</Text> : null}
61
60
  <MarkdownRenderer data={{ content: widget.content }} />
62
61
  </View>
@@ -68,3 +67,21 @@ export function DashboardRenderer({ data }: DashboardRendererProps) {
68
67
  </View>
69
68
  );
70
69
  }
70
+
71
+ const useStyles = createTokenStyles((t) => ({
72
+ dashboard: { gap: 12 },
73
+ stats: { flexDirection: 'row', flexWrap: 'wrap', gap: 12 },
74
+ stat: {
75
+ minWidth: 144,
76
+ flexGrow: 1,
77
+ flexShrink: 1,
78
+ flexBasis: '0%',
79
+ gap: 4,
80
+ borderRadius: 16,
81
+ borderWidth: 1,
82
+ borderColor: t.border,
83
+ backgroundColor: t.popover,
84
+ padding: 12,
85
+ },
86
+ widget: { gap: 8 },
87
+ }));
@@ -1,6 +1,7 @@
1
1
  import { Muted, Text } from '@oxy.so/bloom/typography';
2
2
  import { View } from 'react-native';
3
3
  import { MarkdownRenderer } from './MarkdownRenderer';
4
+ import { createTokenStyles } from '@oxy.so/bloom/theme';
4
5
 
5
6
  interface DeckSlide {
6
7
  title: string;
@@ -19,15 +20,13 @@ interface DeckRendererProps {
19
20
  * (Astro opens a deck in a tab of its own); here it is read like a document.
20
21
  */
21
22
  export function DeckRenderer({ data }: DeckRendererProps) {
23
+ const styles = useStyles();
22
24
  const slides = Array.isArray(data.slides) ? data.slides : [];
23
25
  return (
24
- <View className="gap-3">
26
+ <View style={styles.deck}>
25
27
  {slides.map((slide, i) => (
26
- <View
27
- key={i}
28
- className="gap-2 rounded-2xl border border-border bg-background-tertiary-default p-4"
29
- >
30
- <View className="flex-row items-baseline justify-between gap-2">
28
+ <View key={i} style={styles.slide}>
29
+ <View style={styles.slideHeader}>
31
30
  <Text variant="body-semibold">{slide.title}</Text>
32
31
  <Muted>{i + 1}</Muted>
33
32
  </View>
@@ -41,3 +40,21 @@ export function DeckRenderer({ data }: DeckRendererProps) {
41
40
  </View>
42
41
  );
43
42
  }
43
+
44
+ const useStyles = createTokenStyles((t) => ({
45
+ deck: { gap: 12 },
46
+ slide: {
47
+ gap: 8,
48
+ borderRadius: 16,
49
+ borderWidth: 1,
50
+ borderColor: t.border,
51
+ backgroundColor: t.popover,
52
+ padding: 16,
53
+ },
54
+ slideHeader: {
55
+ flexDirection: 'row',
56
+ alignItems: 'baseline',
57
+ justifyContent: 'space-between',
58
+ gap: 8,
59
+ },
60
+ }));
@@ -14,7 +14,7 @@ import {
14
14
  } from '@oxy.so/bloom/select';
15
15
  import { TextFieldInput } from '@oxy.so/bloom/text-field';
16
16
  import { useState } from 'react';
17
- import { View } from 'react-native';
17
+ import { View, StyleSheet } from 'react-native';
18
18
 
19
19
  interface FormField {
20
20
  name: string;
@@ -43,7 +43,7 @@ export function FormRenderer({ data, onSubmit }: FormRendererProps) {
43
43
  };
44
44
 
45
45
  return (
46
- <View className="gap-4">
46
+ <View style={styles.fields}>
47
47
  {fields.map((field, i) =>
48
48
  field.type === 'checkbox' ? (
49
49
  <Checkbox
@@ -92,10 +92,15 @@ export function FormRenderer({ data, onSubmit }: FormRendererProps) {
92
92
  canvas without a path back into the conversation — and the button
93
93
  used to render regardless, a Submit that did nothing (#608, rule 6). */}
94
94
  {onSubmit === undefined ? null : (
95
- <View className="mt-2">
95
+ <View style={styles.submit}>
96
96
  <Button onPress={() => onSubmit(formValues)}>{t('panels.form.submit')}</Button>
97
97
  </View>
98
98
  )}
99
99
  </View>
100
100
  );
101
101
  }
102
+
103
+ const styles = StyleSheet.create({
104
+ fields: { gap: 16 },
105
+ submit: { marginTop: 8 },
106
+ });