@gemies/sdk 9.1.0 → 10.0.0

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 (92) 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 +65 -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 +118 -0
  41. package/src/components/thread/ChatBubble.tsx +66 -25
  42. package/src/components/thread/GemieThread.tsx +36 -8
  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/useChatVoice.ts +2 -10
  51. package/src/hooks/useMessageReactions.ts +5 -5
  52. package/src/hooks/useThoughtScope.ts +9 -8
  53. package/src/index.ts +2 -3
  54. package/src/lib/copy-en.ts +7 -0
  55. package/src/lib/copy-es.ts +7 -0
  56. package/src/lib/tool-call-status.ts +1 -1
  57. package/src/lib/utils.ts +1 -8
  58. package/src/realtime/react.tsx +9 -9
  59. package/src/realtime/reread.ts +28 -0
  60. package/src/realtime/store.ts +123 -0
  61. package/src/runtime/agents.ts +46 -27
  62. package/src/runtime/approvals.ts +99 -0
  63. package/src/runtime/collections.ts +35 -136
  64. package/src/runtime/config.tsx +10 -0
  65. package/src/runtime/connected-accounts.ts +175 -88
  66. package/src/runtime/connectors.ts +244 -127
  67. package/src/runtime/conversations.ts +181 -607
  68. package/src/runtime/data/answer.ts +76 -0
  69. package/src/runtime/data/collections.ts +168 -0
  70. package/src/runtime/data/conversations.ts +626 -0
  71. package/src/runtime/data/reactions.ts +29 -0
  72. package/src/runtime/data/read.ts +37 -0
  73. package/src/runtime/data/threads.ts +149 -0
  74. package/src/runtime/index.ts +74 -8
  75. package/src/runtime/model.ts +0 -2
  76. package/src/runtime/routes.ts +2 -2
  77. package/src/runtime/sharing.ts +69 -56
  78. package/src/runtime/types.ts +8 -16
  79. package/src/runtime/use-bound-action.ts +27 -0
  80. package/src/runtime/use-conversation-stream.ts +47 -31
  81. package/src/runtime/use-conversation-thread.ts +44 -51
  82. package/src/runtime/use-gemie-thread.ts +32 -43
  83. package/src/runtime/use-start-conversation.ts +14 -15
  84. package/src/runtime/use-thread-history.ts +26 -36
  85. package/src/runtime/use-thread-search.ts +29 -76
  86. package/src/text.ts +0 -1
  87. package/src/voice.ts +0 -1
  88. package/src/components/Image.tsx +0 -12
  89. package/src/realtime/cache.ts +0 -257
  90. package/src/runtime/conversation-dates.ts +0 -31
  91. package/src/runtime/query-keys.ts +0 -66
  92. package/src/runtime/reaction-cache.ts +0 -45
@@ -1,6 +1,6 @@
1
1
  import { Questionnaire, type QuestionnaireAnswers } from '@oxy.so/bloom/questionnaire';
2
2
  import { Muted } from '@oxy.so/bloom/typography';
3
- import { View } from 'react-native';
3
+ import { View, StyleSheet } from 'react-native';
4
4
  import { type AskedQuestion, formatAnswers } from '../lib/questions';
5
5
 
6
6
  interface QuestionCardProps {
@@ -53,7 +53,7 @@ export function QuestionCard({ questions, onSubmit, onDismiss }: QuestionCardPro
53
53
  /** The questions Alia asked, as plain lines: the thread's record of them once they are answered. */
54
54
  export function AskedQuestions({ questions }: { questions: AskedQuestion[] }) {
55
55
  return (
56
- <View className="my-2 gap-1">
56
+ <View style={styles.questions}>
57
57
  {questions.map((q, i) => (
58
58
  // The model's questions never reorder: the position is the identity.
59
59
  // biome-ignore lint/suspicious/noArrayIndexKey: see above
@@ -62,3 +62,7 @@ export function AskedQuestions({ questions }: { questions: AskedQuestion[] }) {
62
62
  </View>
63
63
  );
64
64
  }
65
+
66
+ const styles = StyleSheet.create({
67
+ questions: { marginVertical: 8, gap: 4 },
68
+ });
@@ -14,6 +14,7 @@ import {
14
14
  import { useLabels } from '../lib/labels';
15
15
  import type { ToolInvocation } from '../runtime/types';
16
16
  import { Banner, CompactList, Comparison, Credibility, RichImage, Timeline } from './RichBlocks';
17
+ import { createTokenStyles } from '@oxy.so/bloom/theme';
17
18
 
18
19
  // Cheap pre-check: plain markdown (the overwhelmingly common case) skips the
19
20
  // six per-pattern regex scans below with a single pass.
@@ -239,10 +240,11 @@ function ReferenceList({
239
240
  entries: ReferenceEntry[];
240
241
  onCitationPress?: (source: CitationSource) => void;
241
242
  }) {
243
+ const styles = useStyles();
242
244
  const { t } = useLabels();
243
245
  return (
244
- <View className="mt-3 gap-1 border-t border-border pt-3" accessibilityRole="list">
245
- <Text className="text-xs font-medium text-muted-foreground">{t('thought.references')}</Text>
246
+ <View style={styles.references} accessibilityRole="list">
247
+ <Text style={styles.referencesHeading}>{t('thought.references')}</Text>
246
248
  {entries.map((entry) => {
247
249
  const press = () => {
248
250
  if (onCitationPress) onCitationPress(entry);
@@ -272,15 +274,15 @@ function ReferenceList({
272
274
  key={entry.id}
273
275
  accessibilityRole="link"
274
276
  accessibilityLabel={t('thought.sourceLabel', { n: entry.id, title: entry.title })}
275
- className="flex-row items-start gap-2 rounded-md py-0.5 active:opacity-70"
277
+ style={({ pressed }) => [styles.reference, pressed ? styles.referencePressed : null]}
276
278
  onPress={onPress}
277
279
  {...webAnchor}
278
280
  >
279
- <Text className="text-sm text-muted-foreground">[{entry.id}]</Text>
280
- <Text className="flex-1 text-sm text-primary underline" numberOfLines={2}>
281
+ <Text style={styles.referenceId}>[{entry.id}]</Text>
282
+ <Text style={styles.referenceTitle} numberOfLines={2}>
281
283
  {entry.title}
282
284
  </Text>
283
- <Text className="text-xs text-muted-foreground" numberOfLines={1}>
285
+ <Text style={styles.referenceDomain} numberOfLines={1}>
284
286
  {entry.domain}
285
287
  </Text>
286
288
  </Pressable>
@@ -371,3 +373,27 @@ export function ReplyMarkdown({
371
373
  </View>
372
374
  );
373
375
  }
376
+
377
+ const useStyles = createTokenStyles((t) => ({
378
+ references: { marginTop: 12, gap: 4, borderTopWidth: 1, borderColor: t.border, paddingTop: 12 },
379
+ referencesHeading: { fontSize: 12, fontWeight: 500, color: t.mutedForeground, lineHeight: 16 },
380
+ reference: {
381
+ flexDirection: 'row',
382
+ alignItems: 'flex-start',
383
+ gap: 8,
384
+ borderRadius: 6,
385
+ paddingVertical: 2,
386
+ },
387
+ referencePressed: { opacity: 0.7 },
388
+ referenceId: { fontSize: 14, color: t.mutedForeground, lineHeight: 20 },
389
+ referenceTitle: {
390
+ flexGrow: 1,
391
+ flexShrink: 1,
392
+ flexBasis: '0%',
393
+ fontSize: 14,
394
+ color: t.primary,
395
+ textDecorationLine: 'underline',
396
+ lineHeight: 20,
397
+ },
398
+ referenceDomain: { fontSize: 12, color: t.mutedForeground, lineHeight: 16 },
399
+ }));
@@ -12,8 +12,8 @@ import { RiExternalLinkLine } from '@oxy.so/bloom/icons/RiExternalLinkLine';
12
12
  import { ListItem } from '@oxy.so/bloom/list';
13
13
  import { Rating } from '@oxy.so/bloom/rating';
14
14
  import { Muted, Text } from '@oxy.so/bloom/typography';
15
- import { Image } from './Image';
16
- import { Linking, View } from 'react-native';
15
+ import { Image } from 'expo-image';
16
+ import { Linking, View, StyleSheet } from 'react-native';
17
17
 
18
18
  /**
19
19
  * The rich blocks a reply can carry (```compactlist, ```banner, …), drawn with
@@ -30,7 +30,7 @@ type CompactListItem = {
30
30
 
31
31
  export function CompactList({ title, items }: { title: string; items: CompactListItem[] }) {
32
32
  return (
33
- <Card appearance="outline" className="my-2">
33
+ <Card appearance="outline" style={styles.block}>
34
34
  <CardHeader>
35
35
  <CardTitle>{title}</CardTitle>
36
36
  </CardHeader>
@@ -44,11 +44,7 @@ export function CompactList({ title, items }: { title: string; items: CompactLis
44
44
  supporting={item.meta}
45
45
  leading={
46
46
  item.image ? (
47
- <Image
48
- source={{ uri: item.image }}
49
- className="h-10 w-10 rounded"
50
- contentFit="cover"
51
- />
47
+ <Image source={{ uri: item.image }} style={styles.thumbnail} contentFit="cover" />
52
48
  ) : undefined
53
49
  }
54
50
  trailing={item.href ? <RiExternalLinkLine size="sm" /> : undefined}
@@ -76,7 +72,7 @@ export function Banner({
76
72
  content: string;
77
73
  }) {
78
74
  return (
79
- <View className="my-2">
75
+ <View style={styles.block}>
80
76
  <AdmonitionRoot type={Object.hasOwn(ADMONITION, type) ? ADMONITION[type] : 'info'}>
81
77
  <AdmonitionRow>
82
78
  <AdmonitionIcon />
@@ -121,12 +117,12 @@ export function Comparison({
121
117
  conclusion?: string;
122
118
  }) {
123
119
  return (
124
- <Card appearance="outline" className="my-2">
120
+ <Card appearance="outline" style={styles.block}>
125
121
  <CardHeader>
126
122
  <CardTitle>{title}</CardTitle>
127
123
  </CardHeader>
128
124
  <CardBody>
129
- <View className="gap-2">
125
+ <View style={styles.sides}>
130
126
  <ComparisonSideCard side={left} />
131
127
  <ComparisonSideCard side={right} />
132
128
  {conclusion ? <Admonition type="tip">{conclusion}</Admonition> : null}
@@ -144,7 +140,7 @@ type TimelineItem = {
144
140
 
145
141
  export function Timeline({ title, items }: { title: string; items: TimelineItem[] }) {
146
142
  return (
147
- <Card appearance="outline" className="my-2">
143
+ <Card appearance="outline" style={styles.block}>
148
144
  <CardHeader>
149
145
  <CardTitle>{title}</CardTitle>
150
146
  </CardHeader>
@@ -176,8 +172,8 @@ export function RichImage({
176
172
  caption?: string;
177
173
  }) {
178
174
  return (
179
- <View className="my-2 gap-1">
180
- <Image source={{ uri: url }} className="aspect-video w-full rounded-lg" contentFit="cover" />
175
+ <View style={styles.figure}>
176
+ <Image source={{ uri: url }} style={styles.figureImage} contentFit="cover" />
181
177
  {title ? <Text variant="body-medium">{title}</Text> : null}
182
178
  {caption ? <Muted>{caption}</Muted> : null}
183
179
  </View>
@@ -188,9 +184,18 @@ export function RichImage({
188
184
  export function Credibility({ level, source }: { level: number; source: string }) {
189
185
  const { t } = useLabels();
190
186
  return (
191
- <View className="my-2 flex-row items-center gap-2">
187
+ <View style={styles.rating}>
192
188
  <Rating value={Math.max(0, Math.min(5, level))} size="sm" />
193
189
  <Muted>{t('chat.richBlocks.source', { source })}</Muted>
194
190
  </View>
195
191
  );
196
192
  }
193
+
194
+ const styles = StyleSheet.create({
195
+ block: { marginVertical: 8 },
196
+ thumbnail: { height: 40, width: 40, borderRadius: 4 },
197
+ sides: { gap: 8 },
198
+ figure: { marginVertical: 8, gap: 4 },
199
+ figureImage: { aspectRatio: '16/9', width: '100%', borderRadius: 8 },
200
+ rating: { marginVertical: 8, flexDirection: 'row', alignItems: 'center', gap: 8 },
201
+ });
@@ -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
+ }));