@gemies/sdk 9.2.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.
- package/CHANGELOG.md +103 -0
- package/README.md +9 -6
- package/package.json +4 -11
- package/src/accounts.ts +7 -1
- package/src/ask-eager.ts +0 -2
- package/src/ask-text.ts +0 -1
- package/src/ask.ts +0 -1
- package/src/components/AmbientField.tsx +13 -2
- package/src/components/ComposerDropZone.tsx +20 -4
- package/src/components/ComposerSuggestions.tsx +9 -2
- package/src/components/GemieActivityLine.tsx +11 -5
- package/src/components/GemieBetweenGemies.tsx +23 -10
- package/src/components/GemieChatContent.tsx +46 -23
- package/src/components/GemieChatScreen.tsx +7 -4
- package/src/components/GemieChatSheet.tsx +6 -2
- package/src/components/GemieComposer.tsx +17 -7
- package/src/components/GemieGroupWelcome.tsx +16 -2
- package/src/components/GemieRecentConversations.tsx +13 -10
- package/src/components/GemieSharedConversation.tsx +38 -6
- package/src/components/GemieWelcomeMessage.tsx +23 -7
- package/src/components/IdentityMark.tsx +6 -12
- package/src/components/PlanPreviewCard.tsx +18 -7
- package/src/components/QuestionCard.tsx +6 -2
- package/src/components/ReplyMarkdown.tsx +32 -6
- package/src/components/RichBlocks.tsx +20 -15
- package/src/components/accounts/GemieAccountGrants.tsx +27 -10
- package/src/components/accounts/GemieConnectedAccounts.tsx +87 -51
- package/src/components/canvas/CanvasComponent.tsx +6 -2
- package/src/components/canvas/DashboardRenderer.tsx +25 -8
- package/src/components/canvas/DeckRenderer.tsx +23 -6
- package/src/components/canvas/FormRenderer.tsx +8 -3
- package/src/components/connectors/ConnectorLogo.tsx +15 -9
- package/src/components/connectors/GemieConnectedConnectors.tsx +51 -25
- package/src/components/connectors/GemieConnectorsStore.tsx +99 -41
- package/src/components/connectors/GrantSwitchRow.tsx +18 -5
- package/src/components/thought/ThoughtPanel.tsx +26 -12
- package/src/components/thought/ToolStep.tsx +14 -6
- package/src/components/thread/AgentResultCard.tsx +10 -4
- package/src/components/thread/AgentTaskCard.tsx +8 -3
- package/src/components/thread/ApprovalCard.tsx +6 -2
- package/src/components/thread/ChatBubble.tsx +66 -25
- package/src/components/thread/GemieThread.tsx +25 -8
- package/src/components/thread/ThreadRow.tsx +20 -15
- package/src/components/thread/ThreadSearch.tsx +27 -10
- package/src/components/thread/ThreadSkeleton.tsx +12 -6
- package/src/components/thread/ToolResultCard.tsx +10 -4
- package/src/components/thread/TurnAttachments.tsx +17 -8
- package/src/components/voice/VoiceControls.tsx +9 -6
- package/src/connectors.ts +15 -2
- package/src/hooks/useChatVoice.ts +2 -10
- package/src/hooks/useMessageReactions.ts +5 -5
- package/src/hooks/useThoughtScope.ts +9 -8
- package/src/index.ts +2 -3
- package/src/lib/tool-call-status.ts +1 -1
- package/src/lib/utils.ts +1 -8
- package/src/realtime/react.tsx +9 -9
- package/src/realtime/reread.ts +28 -0
- package/src/realtime/store.ts +123 -0
- package/src/runtime/agents.ts +46 -27
- package/src/runtime/collections.ts +35 -136
- package/src/runtime/connected-accounts.ts +175 -88
- package/src/runtime/connectors.ts +244 -127
- package/src/runtime/conversations.ts +181 -607
- package/src/runtime/data/answer.ts +76 -0
- package/src/runtime/data/collections.ts +168 -0
- package/src/runtime/data/conversations.ts +626 -0
- package/src/runtime/data/reactions.ts +29 -0
- package/src/runtime/data/read.ts +37 -0
- package/src/runtime/data/threads.ts +149 -0
- package/src/runtime/index.ts +72 -8
- package/src/runtime/model.ts +0 -2
- package/src/runtime/routes.ts +2 -2
- package/src/runtime/sharing.ts +69 -56
- package/src/runtime/types.ts +8 -16
- package/src/runtime/use-bound-action.ts +27 -0
- package/src/runtime/use-conversation-stream.ts +8 -31
- package/src/runtime/use-conversation-thread.ts +40 -51
- package/src/runtime/use-gemie-thread.ts +32 -43
- package/src/runtime/use-start-conversation.ts +14 -15
- package/src/runtime/use-thread-history.ts +26 -36
- package/src/runtime/use-thread-search.ts +29 -76
- package/src/text.ts +0 -1
- package/src/voice.ts +0 -1
- package/src/components/Image.tsx +0 -12
- package/src/realtime/cache.ts +0 -257
- package/src/runtime/conversation-dates.ts +0 -31
- package/src/runtime/query-keys.ts +0 -66
- package/src/runtime/reaction-cache.ts +0 -45
|
@@ -35,6 +35,7 @@ import type { GemieToolRenderers } from '../lib/tool-renderers';
|
|
|
35
35
|
import { useShareHandler } from '../hooks/useShareHandler';
|
|
36
36
|
import type { GemieHostTools } from '../runtime/host-tools';
|
|
37
37
|
import type { GemieConversationShare } from '../runtime/sharing';
|
|
38
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
38
39
|
|
|
39
40
|
export interface GemieChatScreenProps {
|
|
40
41
|
/** The agent the screen is with, any agent the person can reach; omitted, Alia. */
|
|
@@ -107,6 +108,7 @@ export function GemieChatScreen({
|
|
|
107
108
|
voice,
|
|
108
109
|
labels,
|
|
109
110
|
}: GemieChatScreenProps) {
|
|
111
|
+
const styles = useStyles();
|
|
110
112
|
const insets = useSafeAreaInsets();
|
|
111
113
|
// The screen owns the whole window, so it keeps its composer out of both
|
|
112
114
|
// system bars: the top inset clears the status bar, the bottom one the
|
|
@@ -139,10 +141,7 @@ export function GemieChatScreen({
|
|
|
139
141
|
|
|
140
142
|
return (
|
|
141
143
|
<AgentAvatarProvider>
|
|
142
|
-
<View
|
|
143
|
-
className="flex-1 bg-background-full"
|
|
144
|
-
style={{ paddingTop: insets.top, paddingBottom: insets.bottom }}
|
|
145
|
-
>
|
|
144
|
+
<View style={[styles.screen, { paddingTop: insets.top, paddingBottom: insets.bottom }]}>
|
|
146
145
|
<KeyboardAvoidingView behavior="padding" automaticOffset style={{ flex: 1 }}>
|
|
147
146
|
<GemieChatContent
|
|
148
147
|
agent={agent}
|
|
@@ -168,3 +167,7 @@ export function GemieChatScreen({
|
|
|
168
167
|
</AgentAvatarProvider>
|
|
169
168
|
);
|
|
170
169
|
}
|
|
170
|
+
|
|
171
|
+
const useStyles = createTokenStyles((t) => ({
|
|
172
|
+
screen: { flexGrow: 1, flexShrink: 1, flexBasis: '0%', backgroundColor: t.background },
|
|
173
|
+
}));
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useState,
|
|
12
12
|
} from 'react';
|
|
13
13
|
import { useTheme } from '@oxy.so/bloom/theme';
|
|
14
|
-
import { useWindowDimensions, View } from 'react-native';
|
|
14
|
+
import { useWindowDimensions, View, StyleSheet } from 'react-native';
|
|
15
15
|
import { useSharedValue } from 'react-native-reanimated';
|
|
16
16
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
17
17
|
import { BREAKPOINTS } from '@oxy.so/bloom/styles';
|
|
@@ -257,7 +257,7 @@ const GemieChatSheetBody = forwardRef<GemieChatSheetRef, GemieChatSheetProps>(
|
|
|
257
257
|
const conversationChrome = useCallback<NonNullable<GemieChatContentProps['chrome']>>(
|
|
258
258
|
({ participants, conversationId }) => ({
|
|
259
259
|
header: (
|
|
260
|
-
<View
|
|
260
|
+
<View style={styles.header}>
|
|
261
261
|
<GemieChatHeader
|
|
262
262
|
participants={participants}
|
|
263
263
|
hasMessages
|
|
@@ -366,3 +366,7 @@ const GemieChatSheetBody = forwardRef<GemieChatSheetRef, GemieChatSheetProps>(
|
|
|
366
366
|
);
|
|
367
367
|
|
|
368
368
|
GemieChatSheet.displayName = 'GemieChatSheet';
|
|
369
|
+
|
|
370
|
+
const styles = StyleSheet.create({
|
|
371
|
+
header: { paddingTop: 32 },
|
|
372
|
+
});
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
} from './ComposerDropZone';
|
|
37
37
|
import { ComposerSuggestions } from './ComposerSuggestions';
|
|
38
38
|
import { QuestionCard } from './QuestionCard';
|
|
39
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* Alia's composer: the ONE composer of the sheet, the screen and the Alia app, Bloom's
|
|
@@ -160,6 +161,7 @@ function GemieComposerBody<T extends GemieSuggestion>({
|
|
|
160
161
|
apiUrl,
|
|
161
162
|
onError,
|
|
162
163
|
}: Omit<GemieComposerProps<T>, 'labels'>) {
|
|
164
|
+
const styles = useStyles();
|
|
163
165
|
const labels = useLabels();
|
|
164
166
|
const report = useCallback(
|
|
165
167
|
(message: string) => (onError ? onError(message) : toast.error(message)),
|
|
@@ -293,13 +295,9 @@ function GemieComposerBody<T extends GemieSuggestion>({
|
|
|
293
295
|
const host = (
|
|
294
296
|
// The transcript's column (Bloom's `AgentChat`: 768 at most, centred), so
|
|
295
297
|
// the composer and the conversation share one edge.
|
|
296
|
-
<View id={hostId}
|
|
298
|
+
<View id={hostId} style={styles.composer}>
|
|
297
299
|
{remainingSeconds !== null ? (
|
|
298
|
-
<Text
|
|
299
|
-
className="mb-1 self-center text-sm text-text-secondary"
|
|
300
|
-
accessibilityLiveRegion="polite"
|
|
301
|
-
aria-live="polite"
|
|
302
|
-
>
|
|
300
|
+
<Text style={styles.countdown} accessibilityLiveRegion="polite" aria-live="polite">
|
|
303
301
|
{labels.dictationRemaining(remainingSeconds)}
|
|
304
302
|
</Text>
|
|
305
303
|
) : null}
|
|
@@ -351,7 +349,7 @@ function GemieComposerBody<T extends GemieSuggestion>({
|
|
|
351
349
|
</ComposerLoader>
|
|
352
350
|
<ComposerDropOverlay visible={takesFiles && isDragOver} enabled={acceptsFiles} />
|
|
353
351
|
{accessory ? (
|
|
354
|
-
<View pointerEvents="box-none"
|
|
352
|
+
<View pointerEvents="box-none" style={styles.accessory}>
|
|
355
353
|
{accessory}
|
|
356
354
|
</View>
|
|
357
355
|
) : null}
|
|
@@ -386,3 +384,15 @@ export function GemieComposer<T extends GemieSuggestion = GemieSuggestion>({
|
|
|
386
384
|
</GemieChatLabelsProvider>
|
|
387
385
|
);
|
|
388
386
|
}
|
|
387
|
+
|
|
388
|
+
const useStyles = createTokenStyles((t) => ({
|
|
389
|
+
composer: { width: '100%', maxWidth: 768, alignSelf: 'center' },
|
|
390
|
+
countdown: {
|
|
391
|
+
marginBottom: 4,
|
|
392
|
+
alignSelf: 'center',
|
|
393
|
+
fontSize: 14,
|
|
394
|
+
color: t.mutedForeground,
|
|
395
|
+
lineHeight: 20,
|
|
396
|
+
},
|
|
397
|
+
accessory: { position: 'absolute', right: 0, bottom: '100%', marginBottom: 8 },
|
|
398
|
+
}));
|
|
@@ -5,6 +5,7 @@ import { useMemo } from 'react';
|
|
|
5
5
|
import { useGemieFlights } from '../lib/flights';
|
|
6
6
|
import { useLabels } from '../lib/labels';
|
|
7
7
|
import type { GemieParticipant } from '../lib/participants';
|
|
8
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* The empty chat of a GROUP: its members together, as Bloom's multi-agent chat draws them (one
|
|
@@ -12,6 +13,7 @@ import type { GemieParticipant } from '../lib/participants';
|
|
|
12
13
|
* `empty:<agent id>` for the chat's flights, the anchor Bloom's own group chat flies from.
|
|
13
14
|
*/
|
|
14
15
|
export function GemieGroupWelcome({ members }: { members: readonly GemieParticipant[] }) {
|
|
16
|
+
const styles = useStyles();
|
|
15
17
|
const { t } = useLabels();
|
|
16
18
|
const shared = useGemieFlights();
|
|
17
19
|
const own = useAvatarFlights();
|
|
@@ -29,11 +31,23 @@ export function GemieGroupWelcome({ members }: { members: readonly GemieParticip
|
|
|
29
31
|
[members],
|
|
30
32
|
);
|
|
31
33
|
return (
|
|
32
|
-
<View
|
|
34
|
+
<View style={styles.welcome}>
|
|
33
35
|
<SelectedAgentPreview agents={agents} flights={shared ?? own} anchor="empty" />
|
|
34
|
-
<Text selectable={false}
|
|
36
|
+
<Text selectable={false} style={styles.greeting}>
|
|
35
37
|
{t('chat.groupWelcome')}
|
|
36
38
|
</Text>
|
|
37
39
|
</View>
|
|
38
40
|
);
|
|
39
41
|
}
|
|
42
|
+
|
|
43
|
+
const useStyles = createTokenStyles((t) => ({
|
|
44
|
+
welcome: { alignItems: 'center', gap: 16 },
|
|
45
|
+
greeting: {
|
|
46
|
+
maxWidth: 448,
|
|
47
|
+
flexShrink: 1,
|
|
48
|
+
textAlign: 'center',
|
|
49
|
+
fontSize: 36,
|
|
50
|
+
color: t.foreground,
|
|
51
|
+
lineHeight: 40,
|
|
52
|
+
},
|
|
53
|
+
}));
|
|
@@ -5,6 +5,7 @@ import { View } from 'react-native';
|
|
|
5
5
|
import { useLabels } from '../lib/labels';
|
|
6
6
|
import { useGemieRuntime } from '../runtime/config';
|
|
7
7
|
import { useConversations } from '../runtime/conversations';
|
|
8
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
8
9
|
|
|
9
10
|
/** How many of the lead's conversations the sheet offers to pick up again. */
|
|
10
11
|
const RECENT_CONVERSATIONS_SHOWN = 3;
|
|
@@ -24,24 +25,22 @@ export function GemieRecentConversations({
|
|
|
24
25
|
agentId?: string;
|
|
25
26
|
onOpen: (conversationId: string) => void;
|
|
26
27
|
}) {
|
|
28
|
+
const styles = useStyles();
|
|
27
29
|
const labels = useLabels();
|
|
28
30
|
const { app } = useGemieRuntime();
|
|
29
|
-
const {
|
|
31
|
+
const { conversations } = useConversations({
|
|
30
32
|
...(agentId === undefined ? {} : { agentId }),
|
|
31
33
|
...(app === undefined ? {} : { app }),
|
|
32
34
|
});
|
|
33
|
-
const recent = useMemo(
|
|
34
|
-
() => data?.pages[0]?.conversations.slice(0, RECENT_CONVERSATIONS_SHOWN) ?? [],
|
|
35
|
-
[data],
|
|
36
|
-
);
|
|
35
|
+
const recent = useMemo(() => conversations.slice(0, RECENT_CONVERSATIONS_SHOWN), [conversations]);
|
|
37
36
|
const when = useMemo(
|
|
38
37
|
() => new Intl.DateTimeFormat(labels.locale, { day: 'numeric', month: 'short' }),
|
|
39
38
|
[labels.locale],
|
|
40
39
|
);
|
|
41
40
|
if (recent.length === 0) return null;
|
|
42
41
|
return (
|
|
43
|
-
<View accessibilityRole="list"
|
|
44
|
-
<Text
|
|
42
|
+
<View accessibilityRole="list" style={styles.list}>
|
|
43
|
+
<Text style={styles.heading}>{labels.recentConversations}</Text>
|
|
45
44
|
{recent.map((conversation) => {
|
|
46
45
|
const title = conversation.title || labels.newChat;
|
|
47
46
|
return (
|
|
@@ -52,9 +51,7 @@ export function GemieRecentConversations({
|
|
|
52
51
|
onPress={() => onOpen(conversation.id)}
|
|
53
52
|
title={<Text numberOfLines={1}>{title}</Text>}
|
|
54
53
|
trailing={
|
|
55
|
-
<Text
|
|
56
|
-
{when.format(new Date(conversation.updatedAt))}
|
|
57
|
-
</Text>
|
|
54
|
+
<Text style={styles.updatedAt}>{when.format(new Date(conversation.updatedAt))}</Text>
|
|
58
55
|
}
|
|
59
56
|
/>
|
|
60
57
|
);
|
|
@@ -62,3 +59,9 @@ export function GemieRecentConversations({
|
|
|
62
59
|
</View>
|
|
63
60
|
);
|
|
64
61
|
}
|
|
62
|
+
|
|
63
|
+
const useStyles = createTokenStyles((t) => ({
|
|
64
|
+
list: { width: '100%', maxWidth: 480, gap: 4, alignSelf: 'center' },
|
|
65
|
+
heading: { paddingHorizontal: 12, fontSize: 14, color: t.mutedForeground, lineHeight: 20 },
|
|
66
|
+
updatedAt: { fontSize: 12, color: t.mutedForeground, lineHeight: 16 },
|
|
67
|
+
}));
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from '../runtime/sharing';
|
|
21
21
|
import { GemieThread } from './thread/GemieThread';
|
|
22
22
|
import { ThreadSkeleton } from './thread/ThreadSkeleton';
|
|
23
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
23
24
|
|
|
24
25
|
export interface GemieSharedConversationProps {
|
|
25
26
|
/** The share link's token. */
|
|
@@ -31,22 +32,23 @@ export interface GemieSharedConversationProps {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
function SharedThread({ token }: { token: string }) {
|
|
35
|
+
const styles = useStyles();
|
|
34
36
|
const { t } = useLabels();
|
|
35
|
-
const { data, error, isLoading } = useSharedConversation(token);
|
|
37
|
+
const { value: data, error, isLoading } = useSharedConversation(token);
|
|
36
38
|
const threadRef = useRef<AiChatThreadHandle | null>(null);
|
|
37
39
|
const messages = useMemo(() => (data ? sharedMessages(data) : []), [data]);
|
|
38
40
|
|
|
39
41
|
if (isLoading) {
|
|
40
42
|
return (
|
|
41
|
-
<View
|
|
43
|
+
<View style={styles.loading}>
|
|
42
44
|
<ThreadSkeleton />
|
|
43
45
|
</View>
|
|
44
46
|
);
|
|
45
47
|
}
|
|
46
48
|
if (error || !data) {
|
|
47
49
|
return (
|
|
48
|
-
<View
|
|
49
|
-
<Text
|
|
50
|
+
<View style={styles.failure}>
|
|
51
|
+
<Text style={styles.failureText}>
|
|
50
52
|
{error instanceof SharedConversationGoneError
|
|
51
53
|
? t('chat.sharedGone')
|
|
52
54
|
: t('chat.sharedFailed')}
|
|
@@ -55,9 +57,9 @@ function SharedThread({ token }: { token: string }) {
|
|
|
55
57
|
);
|
|
56
58
|
}
|
|
57
59
|
return (
|
|
58
|
-
<View
|
|
60
|
+
<View style={styles.conversation}>
|
|
59
61
|
{data.title ? (
|
|
60
|
-
<Text
|
|
62
|
+
<Text style={styles.title} numberOfLines={2}>
|
|
61
63
|
{data.title}
|
|
62
64
|
</Text>
|
|
63
65
|
) : null}
|
|
@@ -77,3 +79,33 @@ export function GemieSharedConversation({ token, apiUrl, labels }: GemieSharedCo
|
|
|
77
79
|
</AgentAvatarProvider>
|
|
78
80
|
);
|
|
79
81
|
}
|
|
82
|
+
|
|
83
|
+
const useStyles = createTokenStyles((t) => ({
|
|
84
|
+
loading: {
|
|
85
|
+
width: '100%',
|
|
86
|
+
maxWidth: 896,
|
|
87
|
+
flexGrow: 1,
|
|
88
|
+
flexShrink: 1,
|
|
89
|
+
flexBasis: '0%',
|
|
90
|
+
alignSelf: 'center',
|
|
91
|
+
paddingHorizontal: 16,
|
|
92
|
+
},
|
|
93
|
+
failure: {
|
|
94
|
+
flexGrow: 1,
|
|
95
|
+
flexShrink: 1,
|
|
96
|
+
flexBasis: '0%',
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
justifyContent: 'center',
|
|
99
|
+
paddingHorizontal: 24,
|
|
100
|
+
},
|
|
101
|
+
failureText: { textAlign: 'center', fontSize: 16, color: t.mutedForeground, lineHeight: 24 },
|
|
102
|
+
conversation: { flexGrow: 1, flexShrink: 1, flexBasis: '0%' },
|
|
103
|
+
title: {
|
|
104
|
+
paddingHorizontal: 16,
|
|
105
|
+
paddingTop: 16,
|
|
106
|
+
fontSize: 18,
|
|
107
|
+
fontWeight: 600,
|
|
108
|
+
color: t.foreground,
|
|
109
|
+
lineHeight: 28,
|
|
110
|
+
},
|
|
111
|
+
}));
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AgentAvatar } from '@oxy.so/bloom/agent-avatar';
|
|
2
2
|
import { AvatarAnchor } from '@oxy.so/bloom/avatar-flight';
|
|
3
|
-
import { Text } from '@oxy.so/bloom/typography';
|
|
3
|
+
import { Text, fontFamilyStyle } from '@oxy.so/bloom/typography';
|
|
4
4
|
import { View } from 'react-native';
|
|
5
5
|
import { ANCHORS, useGemieFlights } from '../lib/flights';
|
|
6
6
|
import { greetingLines } from '../lib/greeting';
|
|
7
7
|
import { ALIA_LEAD, type GemieLead } from '../lib/participants';
|
|
8
8
|
import { GemieAvatar } from './GemieAvatar';
|
|
9
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
9
10
|
|
|
10
11
|
export interface GemieWelcomeMessageProps {
|
|
11
12
|
/** The greeting, e.g. "Hi Nate, what's on your mind?". */
|
|
@@ -29,6 +30,7 @@ export function GemieWelcomeMessage({
|
|
|
29
30
|
markSize = 88,
|
|
30
31
|
lead = ALIA_LEAD,
|
|
31
32
|
}: GemieWelcomeMessageProps) {
|
|
33
|
+
const styles = useStyles();
|
|
32
34
|
const flights = useGemieFlights();
|
|
33
35
|
const avatar = lead.isAlia ? (
|
|
34
36
|
<GemieAvatar size={markSize} interactive />
|
|
@@ -36,8 +38,8 @@ export function GemieWelcomeMessage({
|
|
|
36
38
|
<AgentAvatar character={lead.character} size={markSize} label={lead.name} interactive />
|
|
37
39
|
);
|
|
38
40
|
return (
|
|
39
|
-
<View
|
|
40
|
-
<View
|
|
41
|
+
<View style={styles.welcome}>
|
|
42
|
+
<View style={styles.lead}>
|
|
41
43
|
{/* It flies up into the header's profile when the conversation begins. */}
|
|
42
44
|
{flights ? (
|
|
43
45
|
<AvatarAnchor flights={flights} anchor={ANCHORS.welcome}>
|
|
@@ -46,13 +48,27 @@ export function GemieWelcomeMessage({
|
|
|
46
48
|
) : (
|
|
47
49
|
avatar
|
|
48
50
|
)}
|
|
49
|
-
<Text selectable={false}
|
|
51
|
+
<Text selectable={false} style={styles.greeting}>
|
|
50
52
|
{greetingLines(greeting).join('\n')}
|
|
51
53
|
</Text>
|
|
52
54
|
</View>
|
|
53
|
-
{subtitle ?
|
|
54
|
-
<Text className="text-center text-lg text-text-secondary">{subtitle}</Text>
|
|
55
|
-
) : null}
|
|
55
|
+
{subtitle ? <Text style={styles.subtitle}>{subtitle}</Text> : null}
|
|
56
56
|
</View>
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
const useStyles = createTokenStyles((t) => ({
|
|
61
|
+
welcome: { alignItems: 'center', gap: 8 },
|
|
62
|
+
lead: { alignItems: 'center', justifyContent: 'center', gap: 16 },
|
|
63
|
+
// A title this size is set in the display face, as Bloom's Text set a `text-4xl` class.
|
|
64
|
+
greeting: {
|
|
65
|
+
...fontFamilyStyle('display'),
|
|
66
|
+
maxWidth: 448,
|
|
67
|
+
flexShrink: 1,
|
|
68
|
+
textAlign: 'center',
|
|
69
|
+
fontSize: 36,
|
|
70
|
+
lineHeight: 40,
|
|
71
|
+
color: t.foreground,
|
|
72
|
+
},
|
|
73
|
+
subtitle: { textAlign: 'center', fontSize: 18, color: t.mutedForeground, lineHeight: 28 },
|
|
74
|
+
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useHaptics } from '@oxy.so/bloom/hooks';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { Pressable, View } from 'react-native';
|
|
3
|
+
import { Pressable, type StyleProp, View, type ViewStyle } from 'react-native';
|
|
4
4
|
import type { GemieAvatarState } from './GemieAvatar';
|
|
5
5
|
import Svg, { Path } from 'react-native-svg';
|
|
6
6
|
import Animated, {
|
|
@@ -22,8 +22,8 @@ export interface IdentityMarkProps {
|
|
|
22
22
|
size?: number;
|
|
23
23
|
/** Animation state — spins while thinking/working, opacity-pulses while writing, still when idle. Default 'idle'. */
|
|
24
24
|
state?: IdentityMarkState;
|
|
25
|
-
/** Layout
|
|
26
|
-
|
|
25
|
+
/** Layout for the outer box (its size comes from `size`, its colour from `color`). */
|
|
26
|
+
style?: StyleProp<ViewStyle>;
|
|
27
27
|
/**
|
|
28
28
|
* Who the mark stands for, as a colour. An agent passes its own colour and
|
|
29
29
|
* gets the same artwork at the same size, which is the whole of the
|
|
@@ -96,7 +96,7 @@ const GLYPH_PATH =
|
|
|
96
96
|
export function IdentityMark({
|
|
97
97
|
size = 24,
|
|
98
98
|
state = 'idle',
|
|
99
|
-
|
|
99
|
+
style,
|
|
100
100
|
color,
|
|
101
101
|
onPress,
|
|
102
102
|
spinOnPress = false,
|
|
@@ -194,12 +194,7 @@ export function IdentityMark({
|
|
|
194
194
|
// the flourish for its own sake.
|
|
195
195
|
if (onPress === undefined && !spinOnPress) {
|
|
196
196
|
return (
|
|
197
|
-
<View
|
|
198
|
-
accessibilityRole="image"
|
|
199
|
-
accessibilityLabel={accessibilityLabel}
|
|
200
|
-
className={className}
|
|
201
|
-
style={box}
|
|
202
|
-
>
|
|
197
|
+
<View accessibilityRole="image" accessibilityLabel={accessibilityLabel} style={[box, style]}>
|
|
203
198
|
{glyph}
|
|
204
199
|
</View>
|
|
205
200
|
);
|
|
@@ -216,8 +211,7 @@ export function IdentityMark({
|
|
|
216
211
|
// Nor a Tab stop: on web a Pressable is focusable by default, so the
|
|
217
212
|
// flourish was an unlabelled stop in the keyboard order that did nothing.
|
|
218
213
|
focusable={onPress !== undefined}
|
|
219
|
-
|
|
220
|
-
style={box}
|
|
214
|
+
style={[box, style]}
|
|
221
215
|
>
|
|
222
216
|
{glyph}
|
|
223
217
|
</Pressable>
|
|
@@ -8,6 +8,7 @@ import Animated from 'react-native-reanimated';
|
|
|
8
8
|
import { planPreviewEnter } from '../animations';
|
|
9
9
|
import { useLabels } from '../lib/labels';
|
|
10
10
|
import type { PlanStep } from '../types';
|
|
11
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
11
12
|
|
|
12
13
|
interface PlanPreviewCardProps {
|
|
13
14
|
steps: PlanStep[];
|
|
@@ -18,14 +19,15 @@ interface PlanPreviewCardProps {
|
|
|
18
19
|
* nobody is asked to approve it.
|
|
19
20
|
*/
|
|
20
21
|
export function PlanPreviewCard({ steps }: PlanPreviewCardProps) {
|
|
22
|
+
const styles = useStyles();
|
|
21
23
|
const labels = useLabels();
|
|
22
24
|
const { colors } = useTheme();
|
|
23
25
|
|
|
24
26
|
return (
|
|
25
|
-
<Animated.View entering={planPreviewEnter}
|
|
27
|
+
<Animated.View entering={planPreviewEnter} style={styles.card}>
|
|
26
28
|
<Card appearance="outline">
|
|
27
29
|
<CardHeader>
|
|
28
|
-
<View
|
|
30
|
+
<View style={styles.titleRow}>
|
|
29
31
|
<RiListCheck3 width={16} height={16} fill={colors.icon} />
|
|
30
32
|
<CardTitle>{labels.planTitle}</CardTitle>
|
|
31
33
|
</View>
|
|
@@ -37,11 +39,7 @@ export function PlanPreviewCard({ steps }: PlanPreviewCardProps) {
|
|
|
37
39
|
// biome-ignore lint/suspicious/noArrayIndexKey: see above
|
|
38
40
|
key={index}
|
|
39
41
|
density="compact"
|
|
40
|
-
leading={
|
|
41
|
-
<Text className="w-5 text-center text-xs font-bold text-text-secondary">
|
|
42
|
-
{index + 1}
|
|
43
|
-
</Text>
|
|
44
|
-
}
|
|
42
|
+
leading={<Text style={styles.stepNumber}>{index + 1}</Text>}
|
|
45
43
|
title={step.action}
|
|
46
44
|
subtitle={step.description || undefined}
|
|
47
45
|
/>
|
|
@@ -51,3 +49,16 @@ export function PlanPreviewCard({ steps }: PlanPreviewCardProps) {
|
|
|
51
49
|
</Animated.View>
|
|
52
50
|
);
|
|
53
51
|
}
|
|
52
|
+
|
|
53
|
+
const useStyles = createTokenStyles((t) => ({
|
|
54
|
+
card: { marginVertical: 8 },
|
|
55
|
+
titleRow: { flexDirection: 'row', alignItems: 'center', gap: 8 },
|
|
56
|
+
stepNumber: {
|
|
57
|
+
width: 20,
|
|
58
|
+
textAlign: 'center',
|
|
59
|
+
fontSize: 12,
|
|
60
|
+
fontWeight: 700,
|
|
61
|
+
color: t.mutedForeground,
|
|
62
|
+
lineHeight: 16,
|
|
63
|
+
},
|
|
64
|
+
}));
|
|
@@ -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
|
|
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
|
|
245
|
-
<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
|
-
|
|
277
|
+
style={({ pressed }) => [styles.reference, pressed ? styles.referencePressed : null]}
|
|
276
278
|
onPress={onPress}
|
|
277
279
|
{...webAnchor}
|
|
278
280
|
>
|
|
279
|
-
<Text
|
|
280
|
-
<Text
|
|
281
|
+
<Text style={styles.referenceId}>[{entry.id}]</Text>
|
|
282
|
+
<Text style={styles.referenceTitle} numberOfLines={2}>
|
|
281
283
|
{entry.title}
|
|
282
284
|
</Text>
|
|
283
|
-
<Text
|
|
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 '
|
|
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"
|
|
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
|
|
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"
|
|
120
|
+
<Card appearance="outline" style={styles.block}>
|
|
125
121
|
<CardHeader>
|
|
126
122
|
<CardTitle>{title}</CardTitle>
|
|
127
123
|
</CardHeader>
|
|
128
124
|
<CardBody>
|
|
129
|
-
<View
|
|
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"
|
|
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
|
|
180
|
-
<Image source={{ uri: url }}
|
|
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
|
|
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
|
+
});
|