@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,7 +10,7 @@ import { Loading } from '@oxy.so/bloom/loading';
10
10
  import { useTheme } from '@oxy.so/bloom/theme';
11
11
  import { Muted } from '@oxy.so/bloom/typography';
12
12
  import type { ReactNode } from 'react';
13
- import { ScrollView, View } from 'react-native';
13
+ import { ScrollView, View, StyleSheet } from 'react-native';
14
14
 
15
15
  /**
16
16
  * One execution row: a tool call, its state, and — expanded — what went in
@@ -79,7 +79,7 @@ export function ToolStep({
79
79
  subtitle={description}
80
80
  destructive={status === 'error'}
81
81
  trailing={
82
- <View className="flex-row items-center gap-1.5">
82
+ <View style={styles.trailing}>
83
83
  {statusWord === null ? null : <Muted>{statusWord}</Muted>}
84
84
  <Chevron size="sm" fill={colors.textSecondary} />
85
85
  </View>
@@ -90,11 +90,11 @@ export function ToolStep({
90
90
  />
91
91
 
92
92
  {expanded ? (
93
- <View className="gap-2 pb-2">
93
+ <View style={styles.details}>
94
94
  {input.length > 0 || output.length > 0 ? (
95
95
  <ScrollView
96
- className="max-h-[200px]"
97
- contentContainerClassName="gap-2"
96
+ style={styles.detailsScroll}
97
+ contentContainerStyle={styles.detailsContent}
98
98
  nestedScrollEnabled
99
99
  >
100
100
  {input.length > 0 ? (
@@ -118,7 +118,7 @@ export function ToolStep({
118
118
  </ScrollView>
119
119
  ) : null}
120
120
  {chips.length > 0 ? (
121
- <View className="flex-row flex-wrap gap-1.5">
121
+ <View style={styles.chips}>
122
122
  {chips.map((source) => (
123
123
  <Chip key={source.url} size="sm" leadingIcon={RiGlobalLine}>
124
124
  {source.domain}
@@ -132,3 +132,11 @@ export function ToolStep({
132
132
  </View>
133
133
  );
134
134
  }
135
+
136
+ const styles = StyleSheet.create({
137
+ trailing: { flexDirection: 'row', alignItems: 'center', gap: 6 },
138
+ details: { gap: 8, paddingBottom: 8 },
139
+ detailsScroll: { maxHeight: 200 },
140
+ detailsContent: { gap: 8 },
141
+ chips: { flexDirection: 'row', flexWrap: 'wrap', gap: 6 },
142
+ });
@@ -15,7 +15,7 @@ import { RiCloseCircleLine } from '@oxy.so/bloom/icons/RiCloseCircleLine';
15
15
  import { Item } from '@oxy.so/bloom/item';
16
16
  import { Muted, Text } from '@oxy.so/bloom/typography';
17
17
  import React, { useState } from 'react';
18
- import { View } from 'react-native';
18
+ import { View, StyleSheet } from 'react-native';
19
19
 
20
20
  /**
21
21
  * AgentResultCard — the summary an agent run leaves in the chat when it ends.
@@ -76,7 +76,7 @@ export const AgentResultCard = React.memo(function AgentResultCard({
76
76
  return (
77
77
  <Card>
78
78
  <CardHeader>
79
- <View className="flex-row items-center gap-2">
79
+ <View style={styles.header}>
80
80
  <Badge
81
81
  variant="subtle"
82
82
  color={isSuccess ? 'success' : hasError ? 'error' : 'default'}
@@ -88,7 +88,7 @@ export const AgentResultCard = React.memo(function AgentResultCard({
88
88
  : 'chat.agentRun.unknown',
89
89
  )}
90
90
  />
91
- <View className="min-w-0 flex-1">
91
+ <View style={styles.title}>
92
92
  <Text variant="headline-semibold">
93
93
  {t(isSuccess ? 'chat.agentRun.taskComplete' : 'chat.agentRun.taskFailed')}
94
94
  </Text>
@@ -97,7 +97,7 @@ export const AgentResultCard = React.memo(function AgentResultCard({
97
97
  </View>
98
98
  </CardHeader>
99
99
  <CardBody>
100
- <View className="gap-3">
100
+ <View style={styles.body}>
101
101
  <Muted>{stats.join(' · ')}</Muted>
102
102
 
103
103
  {hasError && lastError ? <Admonition type="error">{lastError}</Admonition> : null}
@@ -123,3 +123,9 @@ export const AgentResultCard = React.memo(function AgentResultCard({
123
123
  </Card>
124
124
  );
125
125
  });
126
+
127
+ const styles = StyleSheet.create({
128
+ header: { flexDirection: 'row', alignItems: 'center', gap: 8 },
129
+ title: { minWidth: 0, flexGrow: 1, flexShrink: 1, flexBasis: '0%' },
130
+ body: { gap: 12 },
131
+ });
@@ -8,7 +8,7 @@ import { Badge } from '@oxy.so/bloom/badge';
8
8
  import { Card, CardBody, CardHeader } from '@oxy.so/bloom/card';
9
9
  import { Muted } from '@oxy.so/bloom/typography';
10
10
  import React, { useEffect, useState } from 'react';
11
- import { View } from 'react-native';
11
+ import { View, StyleSheet } from 'react-native';
12
12
 
13
13
  /**
14
14
  * AgentTaskCard — an agent run in progress, inline in the chat.
@@ -80,7 +80,7 @@ export const AgentTaskCard = React.memo(function AgentTaskCard({ activity }: Age
80
80
  return (
81
81
  <Card>
82
82
  <CardHeader>
83
- <View className="flex-row items-center justify-between gap-2">
83
+ <View style={styles.header}>
84
84
  <Badge variant="subtle" color={status.color} content={status.label} />
85
85
  <Muted>
86
86
  {[elapsed, plan && plan.total > 0 ? `${plan.completed}/${plan.total}` : '']
@@ -90,7 +90,7 @@ export const AgentTaskCard = React.memo(function AgentTaskCard({ activity }: Age
90
90
  </View>
91
91
  </CardHeader>
92
92
  <CardBody>
93
- <View className="gap-3">
93
+ <View style={styles.body}>
94
94
  {plan && plan.items.length > 0 ? (
95
95
  <AgentProgress
96
96
  steps={uniqueStepLabels(plan.items.map((item) => item.text))}
@@ -125,3 +125,8 @@ export const AgentTaskCard = React.memo(function AgentTaskCard({ activity }: Age
125
125
  </Card>
126
126
  );
127
127
  });
128
+
129
+ const styles = StyleSheet.create({
130
+ header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 8 },
131
+ body: { gap: 12 },
132
+ });
@@ -1,7 +1,7 @@
1
1
  import { Notification } from '@oxy.so/bloom/notification';
2
2
  import { Muted } from '@oxy.so/bloom/typography';
3
3
  import React, { useCallback, useState } from 'react';
4
- import { View } from 'react-native';
4
+ import { StyleSheet, View } from 'react-native';
5
5
  import { useLabels } from '../../lib/labels';
6
6
  import {
7
7
  ApprovalExpiredError,
@@ -85,7 +85,7 @@ function ApprovalCard({
85
85
 
86
86
  if (entry.outcome !== 'pending') {
87
87
  return (
88
- <View className="px-4 py-1" accessibilityRole="text">
88
+ <View style={styles.resolved} accessibilityRole="text">
89
89
  <Muted>{t(`chat.approval.resolved.${entry.outcome}`, { tool: entry.tool })}</Muted>
90
90
  </View>
91
91
  );
@@ -112,3 +112,7 @@ function ApprovalCard({
112
112
  />
113
113
  );
114
114
  }
115
+
116
+ const styles = StyleSheet.create({
117
+ resolved: { paddingHorizontal: 16, paddingVertical: 4 },
118
+ });
@@ -7,7 +7,7 @@ import {
7
7
  DropdownMenuTrigger,
8
8
  } from '@oxy.so/bloom/dropdown-menu';
9
9
  import { useInteractionState } from '@oxy.so/bloom/hooks';
10
- import { useTheme, withAlpha } from '@oxy.so/bloom/theme';
10
+ import { createTokenStyles, useTheme, withAlpha } from '@oxy.so/bloom/theme';
11
11
  import { type ComponentProps, type ReactNode, useState } from 'react';
12
12
  import { Platform, Pressable, Text, View } from 'react-native';
13
13
  import { useLabels } from '../../lib/labels';
@@ -48,6 +48,7 @@ export function ChatBubble({
48
48
  /** The words. A function is handed the colour text takes on the person's bubble (the theme's). */
49
49
  children: ReactNode | ((foreground: string | undefined) => ReactNode);
50
50
  }) {
51
+ const styles = useStyles();
51
52
  const { t } = useLabels();
52
53
  const theme = useTheme();
53
54
  const { state: hovered, onIn, onOut } = useInteractionState();
@@ -62,8 +63,7 @@ export function ChatBubble({
62
63
  const hasIcons = onReact !== undefined || onReply !== undefined || menu.length > 0;
63
64
  const icons = !hasIcons ? null : (
64
65
  <View
65
- className="shrink-0 flex-row items-center gap-0.5"
66
- style={{ opacity: shown ? 1 : 0 }}
66
+ style={[styles.icons, { opacity: shown ? 1 : 0 }]}
67
67
  pointerEvents={shown ? 'auto' : 'none'}
68
68
  >
69
69
  {onReact === undefined ? null : (
@@ -89,18 +89,17 @@ export function ChatBubble({
89
89
  );
90
90
  return (
91
91
  <View
92
- className="w-full py-2"
92
+ style={styles.turn}
93
93
  {...(Platform.OS === 'web' ? { onPointerEnter: onIn, onPointerLeave: onOut } : {})}
94
94
  >
95
- <View
96
- className={`w-full flex-row items-center gap-2 ${mine ? 'justify-end' : 'justify-start'}`}
97
- >
95
+ <View style={[styles.bubbleRow, mine && styles.mineBubbleRow]}>
98
96
  {mine ? icons : null}
99
97
  <View
100
- className={`min-w-0 max-w-[80%] rounded-3xl px-4 ${
101
- mine ? 'py-3' : 'bg-background-tertiary-default py-2'
102
- }`}
103
- style={mineColors ? { backgroundColor: mineColors.background } : undefined}
98
+ style={[
99
+ styles.bubble,
100
+ mine ? styles.mineBubble : styles.theirBubble,
101
+ mineColors ? { backgroundColor: mineColors.background } : undefined,
102
+ ]}
104
103
  >
105
104
  {typeof children === 'function' ? children(mineColors?.foreground) : children}
106
105
  </View>
@@ -108,11 +107,7 @@ export function ChatBubble({
108
107
  </View>
109
108
  {reactions.length === 0 ? null : (
110
109
  // The reactions sit on the bubble's lower edge, as the chat this is modelled on draws them.
111
- <View
112
- className={`-mt-2.5 flex-row flex-wrap items-center gap-1 ${
113
- mine ? 'justify-end me-2.5' : 'justify-start ms-2.5'
114
- }`}
115
- >
110
+ <View style={[styles.reactions, mine ? styles.mineReactions : styles.theirReactions]}>
116
111
  {reactions.map((emoji) => (
117
112
  <ReactionPill
118
113
  key={emoji}
@@ -128,6 +123,7 @@ export function ChatBubble({
128
123
 
129
124
  /** One reaction under a bubble: the emoji on a wash of the theme's primary, ringed in the surface. */
130
125
  function ReactionPill({ emoji, onPress }: { emoji: string; onPress?: () => void }) {
126
+ const styles = useStyles();
131
127
  const theme = useTheme();
132
128
  const { t } = useLabels();
133
129
  const { state: hovered, onIn, onOut } = useInteractionState();
@@ -140,14 +136,16 @@ function ReactionPill({ emoji, onPress }: { emoji: string; onPress?: () => void
140
136
  accessibilityState={{ selected: true }}
141
137
  disabled={onPress === undefined}
142
138
  onPress={onPress}
143
- className="h-[22px] flex-row items-center rounded-full px-2"
144
- style={{
145
- backgroundColor: withAlpha(theme.colors.primary, hovered ? 0.16 : 0.12),
146
- borderWidth: 2,
147
- borderColor: theme.colors.background,
148
- }}
139
+ style={[
140
+ styles.reaction,
141
+ {
142
+ backgroundColor: withAlpha(theme.colors.primary, hovered ? 0.16 : 0.12),
143
+ borderWidth: 2,
144
+ borderColor: theme.colors.background,
145
+ },
146
+ ]}
149
147
  >
150
- <Text className="text-sm leading-none">{emoji}</Text>
148
+ <Text style={styles.reactionEmoji}>{emoji}</Text>
151
149
  </Pressable>
152
150
  );
153
151
  }
@@ -233,6 +231,7 @@ function IconButton({
233
231
  onPress,
234
232
  ...rest
235
233
  }: { label: string; icon: Glyph } & Omit<ComponentProps<typeof Pressable>, 'children'>) {
234
+ const styles = useStyles();
236
235
  const theme = useTheme();
237
236
  const { state: hovered, onIn, onOut } = useInteractionState();
238
237
  return (
@@ -243,8 +242,10 @@ function IconButton({
243
242
  onPress={onPress}
244
243
  onHoverIn={onIn}
245
244
  onHoverOut={onOut}
246
- className="size-6 items-center justify-center rounded-full"
247
- style={{ backgroundColor: hovered ? theme.colors.backgroundSecondary : undefined }}
245
+ style={[
246
+ styles.iconButton,
247
+ { backgroundColor: hovered ? theme.colors.backgroundSecondary : undefined },
248
+ ]}
248
249
  >
249
250
  <Icon
250
251
  width={16}
@@ -254,3 +255,43 @@ function IconButton({
254
255
  </Pressable>
255
256
  );
256
257
  }
258
+
259
+ const useStyles = createTokenStyles((t) => ({
260
+ icons: { flexShrink: 0, flexDirection: 'row', alignItems: 'center', gap: 2 },
261
+ turn: { width: '100%', paddingVertical: 8 },
262
+ reaction: {
263
+ height: 22,
264
+ flexDirection: 'row',
265
+ alignItems: 'center',
266
+ borderRadius: 9999,
267
+ paddingHorizontal: 8,
268
+ },
269
+ reactionEmoji: { fontSize: 14, lineHeight: 14 },
270
+ iconButton: {
271
+ width: 24,
272
+ height: 24,
273
+ alignItems: 'center',
274
+ justifyContent: 'center',
275
+ borderRadius: 9999,
276
+ },
277
+ bubbleRow: {
278
+ width: '100%',
279
+ flexDirection: 'row',
280
+ alignItems: 'center',
281
+ justifyContent: 'flex-start',
282
+ gap: 8,
283
+ },
284
+ mineBubbleRow: { justifyContent: 'flex-end' },
285
+ bubble: { minWidth: 0, maxWidth: '80%', borderRadius: 24, paddingHorizontal: 16 },
286
+ mineBubble: { paddingVertical: 12 },
287
+ theirBubble: { backgroundColor: t.popover, paddingVertical: 8 },
288
+ reactions: {
289
+ marginTop: -10,
290
+ flexDirection: 'row',
291
+ flexWrap: 'wrap',
292
+ alignItems: 'center',
293
+ gap: 4,
294
+ },
295
+ mineReactions: { justifyContent: 'flex-end', marginInlineEnd: 10 },
296
+ theirReactions: { justifyContent: 'flex-start', marginInlineStart: 10 },
297
+ }));
@@ -10,6 +10,7 @@ import {
10
10
  type NativeScrollEvent,
11
11
  type NativeSyntheticEvent,
12
12
  View,
13
+ StyleSheet,
13
14
  } from 'react-native';
14
15
  import { AT_BOTTOM_THRESHOLD } from '../../hooks/useAtBottom';
15
16
  import { useMessageVote } from '../../hooks/useMessageVote';
@@ -19,6 +20,7 @@ import { useReadAloud } from '../../hooks/useReadAloud';
19
20
  import { useThoughtScope } from '../../hooks/useThoughtScope';
20
21
  import { useThreadRows } from '../../hooks/useThreadRows';
21
22
  import { useTimelineWindow } from '../../hooks/useTimelineWindow';
23
+ import { useAgentRunFailureToast } from '../../hooks/useAgentRunFailureToast';
22
24
  import { useFailedTurnToast } from '../../hooks/useFailedTurnToast';
23
25
  import { copyText } from '../../lib/clipboard';
24
26
  import { messageText } from '../../lib/content-utils';
@@ -104,7 +106,7 @@ export interface GemieThreadProps {
104
106
  onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
105
107
  /** Quote a turn's words into the composer (a bubble's reply button). Omitted, the button is not drawn. */
106
108
  onReply?: (text: string) => void;
107
- /** A saved reaction updates the live message as well as the query cache. */
109
+ /** A saved reaction updates the live message as well as the account's store. */
108
110
  onReactionChange?: (update: MessageReactionSnapshot) => void;
109
111
  /** A conversation read by somebody it was shared with: no votes, no read-aloud, no regenerate. */
110
112
  readOnly?: boolean;
@@ -158,6 +160,7 @@ export const GemieThread = memo(function GemieThread({
158
160
  const { messages: pastMessages, loading: loadingHistory = false, loadMore } = historyProps ?? {};
159
161
 
160
162
  useFailedTurnToast(failedTurn, onRetryTurn);
163
+ useAgentRunFailureToast(agentActivity, failedTurn);
161
164
 
162
165
  const { rows, live, history, ids, arrived, dayLabels, seamIds, lastReplyIndex, timingOf } =
163
166
  useThreadRows({
@@ -280,8 +283,8 @@ export const GemieThread = memo(function GemieThread({
280
283
  if (nothingToShow) {
281
284
  return (
282
285
  // Screen reserves the composer; the empty state only owns its alignment.
283
- <View className="flex-1 justify-center px-4">
284
- <View className="w-full max-w-[768px] self-center">{empty}</View>
286
+ <View style={styles.empty}>
287
+ <View style={styles.emptyContent}>{empty}</View>
285
288
  </View>
286
289
  );
287
290
  }
@@ -338,7 +341,7 @@ export const GemieThread = memo(function GemieThread({
338
341
  * controller at all.
339
342
  */
340
343
  return (
341
- <View className="flex-1">
344
+ <View style={styles.thread}>
342
345
  <AiChatThread
343
346
  ref={threadRef}
344
347
  followAnimated={false}
@@ -350,18 +353,18 @@ export const GemieThread = memo(function GemieThread({
350
353
  >
351
354
  {/* The transcript column, centred: a little wider than the composer (896 against its
352
355
  768), so the answer has room to breathe. */}
353
- <View className="w-full max-w-4xl self-center">
356
+ <View style={styles.column}>
354
357
  {rows.length === 0 && conversationLoading ? <ThreadSkeleton /> : null}
355
358
 
356
- <View className="relative" onLayout={timeline.onListLayout}>
359
+ <View style={styles.list} onLayout={timeline.onListLayout}>
357
360
  {/* The slot the history loader shows in, held open for as long as there is history to
358
361
  load. The thread anchors ONE growth per request — the first after
359
362
  `onStartReached` — so a loader that appeared on request would spend that anchor on
360
363
  itself and leave the page that follows it to push the reader down. */}
361
364
  {loadMore === undefined && !loadingHistory ? null : (
362
- <View className="h-14 items-center justify-center">
365
+ <View style={styles.historySlot}>
363
366
  {loadingHistory ? (
364
- <Skeleton.Region className="w-full gap-2.5">
367
+ <Skeleton.Region style={styles.historyLoading}>
365
368
  <Skeleton.Box width="70%" height={14} borderRadius={8} />
366
369
  <Skeleton.Box width="45%" height={14} borderRadius={8} />
367
370
  </Skeleton.Region>
@@ -373,10 +376,13 @@ export const GemieThread = memo(function GemieThread({
373
376
  .map((message, offset) => renderRow(message, timeline.start + offset))}
374
377
  </View>
375
378
 
376
- {/* Agent execution — in-progress card or completed result card */}
379
+ {/* Agent execution — in-progress card or completed result card. A run that failed has no
380
+ card: it is told with a toast (`useAgentRunFailureToast`). */}
377
381
  {agentActivity && agentActivity.eventCount > 0 ? (
378
382
  agentActivity.isComplete ? (
379
- <AgentResultCard activity={agentActivity} />
383
+ agentActivity.hasError ? null : (
384
+ <AgentResultCard activity={agentActivity} />
385
+ )
380
386
  ) : (
381
387
  <AgentTaskCard activity={agentActivity} />
382
388
  )
@@ -414,3 +420,19 @@ export const GemieThread = memo(function GemieThread({
414
420
  </View>
415
421
  );
416
422
  });
423
+
424
+ const styles = StyleSheet.create({
425
+ empty: {
426
+ flexGrow: 1,
427
+ flexShrink: 1,
428
+ flexBasis: '0%',
429
+ justifyContent: 'center',
430
+ paddingHorizontal: 16,
431
+ },
432
+ emptyContent: { width: '100%', maxWidth: 768, alignSelf: 'center' },
433
+ thread: { flexGrow: 1, flexShrink: 1, flexBasis: '0%' },
434
+ column: { width: '100%', maxWidth: 896, alignSelf: 'center' },
435
+ list: { position: 'relative' },
436
+ historySlot: { height: 56, alignItems: 'center', justifyContent: 'center' },
437
+ historyLoading: { width: '100%', gap: 10 },
438
+ });
@@ -45,6 +45,7 @@ import { ToolResultCard } from './ToolResultCard';
45
45
  import { ChatBubble } from './ChatBubble';
46
46
  import { TurnMenu } from './TurnMenu';
47
47
  import { TurnStatusLine } from './TurnStatusLine';
48
+ import { createTokenStyles } from '@oxy.so/bloom/theme';
48
49
 
49
50
  /**
50
51
  * What a row can do, built once by the thread so every memoised row sees the same object: the
@@ -128,6 +129,7 @@ export const ThreadRow = memo(function ThreadRow({
128
129
  workStartedAt,
129
130
  workEndedAt,
130
131
  }: ThreadRowProps) {
132
+ const styles = useStyles();
131
133
  const { t } = useLabels();
132
134
  const text = messageText(message);
133
135
  const isReply = message.role === 'assistant';
@@ -166,7 +168,7 @@ export const ThreadRow = memo(function ThreadRow({
166
168
  <Animated.View onLayout={onLayout}>
167
169
  {text.length === 0 && !attached ? null : (
168
170
  // Bloom's user turn, with the breathing room above it the thread has always had.
169
- <View className="mt-2 w-full flex-col items-end">
171
+ <View style={styles.question}>
170
172
  <TurnMenu actions={questionActions} label={t('chat.turnActions')}>
171
173
  {bubbles ? (
172
174
  // An agent's thread: the person's turn is a bubble in the theme's primary, never Bloom's
@@ -253,6 +255,7 @@ function ReplyTurn({
253
255
  workStartedAt,
254
256
  workEndedAt,
255
257
  }: ReplyTurnProps) {
258
+ const styles = useStyles();
256
259
  const { t } = useLabels();
257
260
  const { faviconUrl } = useGemieRuntime().host;
258
261
  const renderers = useToolRenderers();
@@ -425,11 +428,7 @@ function ReplyTurn({
425
428
 
426
429
  const replyBody =
427
430
  message.source === 'voice' ? (
428
- <Text
429
- className={
430
- bubbled ? 'text-sm leading-5 text-foreground' : 'text-base leading-7 text-foreground'
431
- }
432
- >
431
+ <Text style={bubbled ? styles.bubbledVoiceReply : styles.voiceReply}>
433
432
  {text}
434
433
  {message.isStreaming ? '▌' : ''}
435
434
  </Text>
@@ -466,9 +465,9 @@ function ReplyTurn({
466
465
  words, while a text turn's placeholder — stamped `isStreaming` too — is the thinking
467
466
  indicator's until its first token arrives. */}
468
467
  {showsContent && (
469
- <View className="w-full flex-col">
468
+ <View style={styles.reply}>
470
469
  {agent && agentAnchor ? (
471
- <View className="mb-0.5">
470
+ <View style={styles.replyIdentity}>
472
471
  <AgentReplyIdentity
473
472
  character={agentCharacterOf(agent)}
474
473
  name={agent.name}
@@ -547,7 +546,7 @@ function ReplyTurn({
547
546
  ))}
548
547
  {inlineCanvases.map(({ key, canvas }) => (
549
548
  <MessageBlockBoundary key={key}>
550
- <View className="rounded-2xl border border-border p-4" testID="shared-canvas">
549
+ <View style={styles.canvas} testID="shared-canvas">
551
550
  <CanvasComponent component={{ id: key, ...canvas }} />
552
551
  </View>
553
552
  </MessageBlockBoundary>
@@ -573,15 +572,11 @@ function ReplyTurn({
573
572
  </MessageBlockBoundary>
574
573
  )}
575
574
  {agent && message.turnOutcome === 'failed' && text.length === 0 ? (
576
- <Text className="text-sm text-muted-foreground">
577
- {t('chat.agentFailed', { name: agent.name })}
578
- </Text>
575
+ <Text style={styles.muted}>{t('chat.agentFailed', { name: agent.name })}</Text>
579
576
  ) : null}
580
577
  {/* A requested run that ended with no answer: the app's words, never the run's. */}
581
578
  {agent && messageFailureOf(message.content) === 'task_unfinished' ? (
582
- <Text className="text-sm text-muted-foreground">
583
- {t('chat.taskUnfinished', { name: agent.name })}
584
- </Text>
579
+ <Text style={styles.muted}>{t('chat.taskUnfinished', { name: agent.name })}</Text>
585
580
  ) : null}
586
581
  {bubbled ? (
587
582
  // Only the words are the bubble: the work log and the cards stay above it, whole.
@@ -605,3 +600,13 @@ function ReplyTurn({
605
600
  </>
606
601
  );
607
602
  }
603
+
604
+ const useStyles = createTokenStyles((t) => ({
605
+ question: { marginTop: 8, width: '100%', flexDirection: 'column', alignItems: 'flex-end' },
606
+ reply: { width: '100%', flexDirection: 'column' },
607
+ replyIdentity: { marginBottom: 2 },
608
+ canvas: { borderRadius: 16, borderWidth: 1, borderColor: t.border, padding: 16 },
609
+ muted: { fontSize: 14, color: t.mutedForeground, lineHeight: 20 },
610
+ voiceReply: { fontSize: 16, lineHeight: 28, color: t.foreground },
611
+ bubbledVoiceReply: { fontSize: 14, lineHeight: 20, color: t.foreground },
612
+ }));
@@ -9,7 +9,7 @@ import { ListItem } from '@oxy.so/bloom/list';
9
9
  import { Search } from '@oxy.so/bloom/search';
10
10
  import { Muted } from '@oxy.so/bloom/typography';
11
11
  import { useState } from 'react';
12
- import { ScrollView, View } from 'react-native';
12
+ import { ScrollView, View, StyleSheet } from 'react-native';
13
13
 
14
14
  /**
15
15
  * Searching what was said in this thread, across every conversation in it.
@@ -49,7 +49,8 @@ function hitDay(createdAt: string, locale: string): string {
49
49
  export const ThreadSearch = ({ thread, onJump, onClose }: ThreadSearchProps) => {
50
50
  const { t, locale } = useLabels();
51
51
  const [query, setQuery] = useState('');
52
- const { data: hits, isFetching, isError } = useThreadSearch(thread, query);
52
+ const { value: hits, isFetching, status } = useThreadSearch(thread, query);
53
+ const isError = status === 'error';
53
54
 
54
55
  /**
55
56
  * Told apart deliberately: nothing typed is not a search that found nothing.
@@ -60,12 +61,12 @@ export const ThreadSearch = ({ thread, onJump, onClose }: ThreadSearchProps) =>
60
61
  const found = hits ?? [];
61
62
 
62
63
  return (
63
- <View className="absolute inset-x-0 top-0 z-20 px-4 pt-4" pointerEvents="box-none">
64
- <View className="w-full max-w-[768px] self-center">
64
+ <View style={styles.overlay} pointerEvents="box-none">
65
+ <View style={styles.column}>
65
66
  <Card elevation="m">
66
67
  <CardBody>
67
- <View className="flex-row items-center gap-2">
68
- <View className="flex-1">
68
+ <View style={styles.searchRow}>
69
+ <View style={styles.search}>
69
70
  <Search
70
71
  label={t('chat.searchThreadPlaceholder')}
71
72
  value={query}
@@ -87,15 +88,15 @@ export const ThreadSearch = ({ thread, onJump, onClose }: ThreadSearchProps) =>
87
88
  </View>
88
89
 
89
90
  {!asked ? (
90
- <View className="px-1 py-4">
91
+ <View style={styles.hint}>
91
92
  <Muted>{t('chat.searchThreadHint')}</Muted>
92
93
  </View>
93
94
  ) : isError ? (
94
- <View className="px-1 py-4">
95
+ <View style={styles.hint}>
95
96
  <Muted>{t('chat.searchThreadFailed')}</Muted>
96
97
  </View>
97
98
  ) : found.length === 0 ? (
98
- <View className="px-1 py-4">
99
+ <View style={styles.hint}>
99
100
  <Muted>
100
101
  {isFetching ? t('chat.searchThreadSearching') : t('chat.searchThreadEmpty')}
101
102
  </Muted>
@@ -105,7 +106,7 @@ export const ThreadSearch = ({ thread, onJump, onClose }: ThreadSearchProps) =>
105
106
  // A height in px, not a percentage of a parent that has none:
106
107
  // measured in Chromium, the list otherwise sized itself to its
107
108
  // content and spilled the results over the thread behind it.
108
- className="mt-2 max-h-96"
109
+ style={styles.results}
109
110
  keyboardShouldPersistTaps="handled"
110
111
  >
111
112
  {found.map((hit) => (
@@ -128,3 +129,19 @@ export const ThreadSearch = ({ thread, onJump, onClose }: ThreadSearchProps) =>
128
129
  </View>
129
130
  );
130
131
  };
132
+
133
+ const styles = StyleSheet.create({
134
+ overlay: {
135
+ position: 'absolute',
136
+ insetInline: 0,
137
+ top: 0,
138
+ zIndex: 20,
139
+ paddingHorizontal: 16,
140
+ paddingTop: 16,
141
+ },
142
+ column: { width: '100%', maxWidth: 768, alignSelf: 'center' },
143
+ searchRow: { flexDirection: 'row', alignItems: 'center', gap: 8 },
144
+ search: { flexGrow: 1, flexShrink: 1, flexBasis: '0%' },
145
+ hint: { paddingHorizontal: 4, paddingVertical: 16 },
146
+ results: { marginTop: 8, maxHeight: 384 },
147
+ });
@@ -1,5 +1,5 @@
1
1
  import * as Skeleton from '@oxy.so/bloom/skeleton';
2
- import { View } from 'react-native';
2
+ import { View, StyleSheet } from 'react-native';
3
3
 
4
4
  /**
5
5
  * A conversation's turns that are on their way: the person's bubbles at the end, the replies as
@@ -9,22 +9,28 @@ import { View } from 'react-native';
9
9
  */
10
10
  export function ThreadSkeleton() {
11
11
  return (
12
- <Skeleton.Region className="gap-5 py-4">
13
- <View className="items-end">
12
+ <Skeleton.Region style={styles.skeleton}>
13
+ <View style={styles.question}>
14
14
  <Skeleton.Box width="65%" height={48} borderRadius={24} />
15
15
  </View>
16
- <View className="items-start gap-2.5">
16
+ <View style={styles.reply}>
17
17
  <Skeleton.Box width="80%" height={14} borderRadius={8} />
18
18
  <Skeleton.Box width="70%" height={14} borderRadius={8} />
19
19
  <Skeleton.Box width="45%" height={14} borderRadius={8} />
20
20
  </View>
21
- <View className="items-end">
21
+ <View style={styles.question}>
22
22
  <Skeleton.Box width="50%" height={40} borderRadius={24} />
23
23
  </View>
24
- <View className="items-start gap-2.5">
24
+ <View style={styles.reply}>
25
25
  <Skeleton.Box width="85%" height={14} borderRadius={8} />
26
26
  <Skeleton.Box width="60%" height={14} borderRadius={8} />
27
27
  </View>
28
28
  </Skeleton.Region>
29
29
  );
30
30
  }
31
+
32
+ const styles = StyleSheet.create({
33
+ skeleton: { gap: 20, paddingVertical: 16 },
34
+ question: { alignItems: 'flex-end' },
35
+ reply: { alignItems: 'flex-start', gap: 10 },
36
+ });