@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.
- 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 +65 -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 +118 -0
- package/src/components/thread/ChatBubble.tsx +66 -25
- package/src/components/thread/GemieThread.tsx +36 -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/copy-en.ts +7 -0
- package/src/lib/copy-es.ts +7 -0
- 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/approvals.ts +99 -0
- package/src/runtime/collections.ts +35 -136
- package/src/runtime/config.tsx +10 -0
- 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 +74 -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 +47 -31
- package/src/runtime/use-conversation-thread.ts +44 -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
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Notification } from '@oxy.so/bloom/notification';
|
|
2
|
+
import { Muted } from '@oxy.so/bloom/typography';
|
|
3
|
+
import React, { useCallback, useState } from 'react';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { useLabels } from '../../lib/labels';
|
|
6
|
+
import {
|
|
7
|
+
ApprovalExpiredError,
|
|
8
|
+
type ApprovalDecision,
|
|
9
|
+
type ApprovalEntry,
|
|
10
|
+
type ApprovalOutcome,
|
|
11
|
+
} from '../../runtime/approvals';
|
|
12
|
+
|
|
13
|
+
export interface ApprovalsProps {
|
|
14
|
+
readonly entries: readonly ApprovalEntry[];
|
|
15
|
+
/** Who is asking: the agent's name, as the thread names it. */
|
|
16
|
+
readonly agentName: string;
|
|
17
|
+
/**
|
|
18
|
+
* Carries the person's answer to Gemies. Rejects with `ApprovalExpiredError` when the question is
|
|
19
|
+
* no longer open. Omitted, a question is shown with no way to answer it.
|
|
20
|
+
*/
|
|
21
|
+
readonly onDecide?: (entry: ApprovalEntry, decision: ApprovalDecision) => Promise<void>;
|
|
22
|
+
/** The answer is known here (the person's own, or the question closed): show it now. */
|
|
23
|
+
readonly onSettled: (requestId: string, outcome: ApprovalOutcome) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A coding CLI asking its own user for permission to run something on their computer, in the
|
|
28
|
+
* conversation (Gemies ADR 0043 §5): who is asking, what for, and the two answers. The CLI waits
|
|
29
|
+
* for the person; once answered the card shrinks to one line saying how it ended.
|
|
30
|
+
*
|
|
31
|
+
* This is the CLI's prompt to the person who runs it, not a permission Gemies or Oxy asks for.
|
|
32
|
+
*/
|
|
33
|
+
export const ApprovalCards = React.memo(function ApprovalCards({
|
|
34
|
+
entries,
|
|
35
|
+
agentName,
|
|
36
|
+
onDecide,
|
|
37
|
+
onSettled,
|
|
38
|
+
}: ApprovalsProps) {
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
{entries.map((entry) => (
|
|
42
|
+
<ApprovalCard
|
|
43
|
+
key={entry.requestId}
|
|
44
|
+
entry={entry}
|
|
45
|
+
agentName={agentName}
|
|
46
|
+
onDecide={onDecide}
|
|
47
|
+
onSettled={onSettled}
|
|
48
|
+
/>
|
|
49
|
+
))}
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
function ApprovalCard({
|
|
55
|
+
entry,
|
|
56
|
+
agentName,
|
|
57
|
+
onDecide,
|
|
58
|
+
onSettled,
|
|
59
|
+
}: {
|
|
60
|
+
entry: ApprovalEntry;
|
|
61
|
+
agentName: string;
|
|
62
|
+
onDecide: ApprovalsProps['onDecide'];
|
|
63
|
+
onSettled: ApprovalsProps['onSettled'];
|
|
64
|
+
}) {
|
|
65
|
+
const { t } = useLabels();
|
|
66
|
+
const [sending, setSending] = useState(false);
|
|
67
|
+
const [failed, setFailed] = useState(false);
|
|
68
|
+
|
|
69
|
+
const decide = useCallback(
|
|
70
|
+
(decision: ApprovalDecision) => {
|
|
71
|
+
if (sending || !onDecide) return;
|
|
72
|
+
setSending(true);
|
|
73
|
+
setFailed(false);
|
|
74
|
+
onDecide(entry, decision).then(
|
|
75
|
+
() => onSettled(entry.requestId, decision),
|
|
76
|
+
(error: unknown) => {
|
|
77
|
+
setSending(false);
|
|
78
|
+
if (error instanceof ApprovalExpiredError) onSettled(entry.requestId, 'expired');
|
|
79
|
+
else setFailed(true);
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
[sending, onDecide, entry, onSettled],
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
if (entry.outcome !== 'pending') {
|
|
87
|
+
return (
|
|
88
|
+
<View style={styles.resolved} accessibilityRole="text">
|
|
89
|
+
<Muted>{t(`chat.approval.resolved.${entry.outcome}`, { tool: entry.tool })}</Muted>
|
|
90
|
+
</View>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const description = [entry.summary, failed ? t('chat.approval.sendFailed') : undefined]
|
|
95
|
+
.filter(Boolean)
|
|
96
|
+
.join('\n');
|
|
97
|
+
return (
|
|
98
|
+
<Notification
|
|
99
|
+
status="warning"
|
|
100
|
+
title={t('chat.approval.title', { agent: agentName, tool: entry.tool })}
|
|
101
|
+
description={description === '' ? undefined : description}
|
|
102
|
+
// While an answer is on its way there is nothing to press: a second tap must not send another.
|
|
103
|
+
actions={
|
|
104
|
+
onDecide && !sending
|
|
105
|
+
? [
|
|
106
|
+
{ label: t('chat.approval.deny'), onPress: () => decide('deny') },
|
|
107
|
+
{ label: t('chat.approval.allow'), onPress: () => decide('allow') },
|
|
108
|
+
]
|
|
109
|
+
: undefined
|
|
110
|
+
}
|
|
111
|
+
dismissible={false}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
|
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
|
-
|
|
247
|
-
|
|
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';
|
|
@@ -32,6 +33,7 @@ import type { ThreadHistory } from '../../runtime/thread/thread-history';
|
|
|
32
33
|
import type { AgentState } from '../../types';
|
|
33
34
|
import { AgentResultCard } from './AgentResultCard';
|
|
34
35
|
import { AgentTaskCard } from './AgentTaskCard';
|
|
36
|
+
import { type ApprovalsProps, ApprovalCards } from './ApprovalCard';
|
|
35
37
|
import { NewConversationOffer } from './NewConversationOffer';
|
|
36
38
|
import { type ThreadActions, ThreadRow } from './ThreadRow';
|
|
37
39
|
|
|
@@ -81,6 +83,11 @@ export interface GemieThreadProps {
|
|
|
81
83
|
/** Load one of this conversation's questions into the composer to rewrite it. */
|
|
82
84
|
onStartEdit?: (userMessageId: string) => void;
|
|
83
85
|
newConversationOffer?: NewConversationOfferProps;
|
|
86
|
+
/**
|
|
87
|
+
* A coding CLI asking its own user for permission to run something on their computer, while the
|
|
88
|
+
* turn waits (ADR 0043 §5). Drawn after the turns, where the person is looking.
|
|
89
|
+
*/
|
|
90
|
+
approvals?: ApprovalsProps;
|
|
84
91
|
/** The run an agent is on for this conversation: in progress, or the card it leaves. */
|
|
85
92
|
agentActivity?: AgentActivityState | null;
|
|
86
93
|
/**
|
|
@@ -98,7 +105,7 @@ export interface GemieThreadProps {
|
|
|
98
105
|
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
99
106
|
/** Quote a turn's words into the composer (a bubble's reply button). Omitted, the button is not drawn. */
|
|
100
107
|
onReply?: (text: string) => void;
|
|
101
|
-
/** A saved reaction updates the live message as well as the
|
|
108
|
+
/** A saved reaction updates the live message as well as the account's store. */
|
|
102
109
|
onReactionChange?: (update: MessageReactionSnapshot) => void;
|
|
103
110
|
/** A conversation read by somebody it was shared with: no votes, no read-aloud, no regenerate. */
|
|
104
111
|
readOnly?: boolean;
|
|
@@ -136,6 +143,7 @@ export const GemieThread = memo(function GemieThread({
|
|
|
136
143
|
onRegenerate,
|
|
137
144
|
onStartEdit,
|
|
138
145
|
newConversationOffer,
|
|
146
|
+
approvals,
|
|
139
147
|
agentActivity,
|
|
140
148
|
call,
|
|
141
149
|
empty,
|
|
@@ -273,8 +281,8 @@ export const GemieThread = memo(function GemieThread({
|
|
|
273
281
|
if (nothingToShow) {
|
|
274
282
|
return (
|
|
275
283
|
// Screen reserves the composer; the empty state only owns its alignment.
|
|
276
|
-
<View
|
|
277
|
-
<View
|
|
284
|
+
<View style={styles.empty}>
|
|
285
|
+
<View style={styles.emptyContent}>{empty}</View>
|
|
278
286
|
</View>
|
|
279
287
|
);
|
|
280
288
|
}
|
|
@@ -331,7 +339,7 @@ export const GemieThread = memo(function GemieThread({
|
|
|
331
339
|
* controller at all.
|
|
332
340
|
*/
|
|
333
341
|
return (
|
|
334
|
-
<View
|
|
342
|
+
<View style={styles.thread}>
|
|
335
343
|
<AiChatThread
|
|
336
344
|
ref={threadRef}
|
|
337
345
|
followAnimated={false}
|
|
@@ -343,18 +351,18 @@ export const GemieThread = memo(function GemieThread({
|
|
|
343
351
|
>
|
|
344
352
|
{/* The transcript column, centred: a little wider than the composer (896 against its
|
|
345
353
|
768), so the answer has room to breathe. */}
|
|
346
|
-
<View
|
|
354
|
+
<View style={styles.column}>
|
|
347
355
|
{rows.length === 0 && conversationLoading ? <ThreadSkeleton /> : null}
|
|
348
356
|
|
|
349
|
-
<View
|
|
357
|
+
<View style={styles.list} onLayout={timeline.onListLayout}>
|
|
350
358
|
{/* The slot the history loader shows in, held open for as long as there is history to
|
|
351
359
|
load. The thread anchors ONE growth per request — the first after
|
|
352
360
|
`onStartReached` — so a loader that appeared on request would spend that anchor on
|
|
353
361
|
itself and leave the page that follows it to push the reader down. */}
|
|
354
362
|
{loadMore === undefined && !loadingHistory ? null : (
|
|
355
|
-
<View
|
|
363
|
+
<View style={styles.historySlot}>
|
|
356
364
|
{loadingHistory ? (
|
|
357
|
-
<Skeleton.Region
|
|
365
|
+
<Skeleton.Region style={styles.historyLoading}>
|
|
358
366
|
<Skeleton.Box width="70%" height={14} borderRadius={8} />
|
|
359
367
|
<Skeleton.Box width="45%" height={14} borderRadius={8} />
|
|
360
368
|
</Skeleton.Region>
|
|
@@ -375,6 +383,10 @@ export const GemieThread = memo(function GemieThread({
|
|
|
375
383
|
)
|
|
376
384
|
) : null}
|
|
377
385
|
|
|
386
|
+
{approvals === undefined || approvals.entries.length === 0 ? null : (
|
|
387
|
+
<ApprovalCards {...approvals} />
|
|
388
|
+
)}
|
|
389
|
+
|
|
378
390
|
{/* The agent's offer to start the next stretch fresh. Last in the list on purpose: it
|
|
379
391
|
must not cover what is being read, and ignoring it has to leave the thread exactly as
|
|
380
392
|
it was. */}
|
|
@@ -403,3 +415,19 @@ export const GemieThread = memo(function GemieThread({
|
|
|
403
415
|
</View>
|
|
404
416
|
);
|
|
405
417
|
});
|
|
418
|
+
|
|
419
|
+
const styles = StyleSheet.create({
|
|
420
|
+
empty: {
|
|
421
|
+
flexGrow: 1,
|
|
422
|
+
flexShrink: 1,
|
|
423
|
+
flexBasis: '0%',
|
|
424
|
+
justifyContent: 'center',
|
|
425
|
+
paddingHorizontal: 16,
|
|
426
|
+
},
|
|
427
|
+
emptyContent: { width: '100%', maxWidth: 768, alignSelf: 'center' },
|
|
428
|
+
thread: { flexGrow: 1, flexShrink: 1, flexBasis: '0%' },
|
|
429
|
+
column: { width: '100%', maxWidth: 896, alignSelf: 'center' },
|
|
430
|
+
list: { position: 'relative' },
|
|
431
|
+
historySlot: { height: 56, alignItems: 'center', justifyContent: 'center' },
|
|
432
|
+
historyLoading: { width: '100%', gap: 10 },
|
|
433
|
+
});
|
|
@@ -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
|
|
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
|
|
468
|
+
<View style={styles.reply}>
|
|
470
469
|
{agent && agentAnchor ? (
|
|
471
|
-
<View
|
|
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
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
64
|
-
<View
|
|
64
|
+
<View style={styles.overlay} pointerEvents="box-none">
|
|
65
|
+
<View style={styles.column}>
|
|
65
66
|
<Card elevation="m">
|
|
66
67
|
<CardBody>
|
|
67
|
-
<View
|
|
68
|
-
<View
|
|
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
|
|
91
|
+
<View style={styles.hint}>
|
|
91
92
|
<Muted>{t('chat.searchThreadHint')}</Muted>
|
|
92
93
|
</View>
|
|
93
94
|
) : isError ? (
|
|
94
|
-
<View
|
|
95
|
+
<View style={styles.hint}>
|
|
95
96
|
<Muted>{t('chat.searchThreadFailed')}</Muted>
|
|
96
97
|
</View>
|
|
97
98
|
) : found.length === 0 ? (
|
|
98
|
-
<View
|
|
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
|
-
|
|
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
|
|
13
|
-
<View
|
|
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
|
|
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
|
|
21
|
+
<View style={styles.question}>
|
|
22
22
|
<Skeleton.Box width="50%" height={40} borderRadius={24} />
|
|
23
23
|
</View>
|
|
24
|
-
<View
|
|
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
|
+
});
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
} from '@oxy.so/bloom/segmented-control';
|
|
36
36
|
import { Muted, Text } from '@oxy.so/bloom/typography';
|
|
37
37
|
import { useState } from 'react';
|
|
38
|
-
import { View } from 'react-native';
|
|
38
|
+
import { View, StyleSheet } from 'react-native';
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* A tool result drawn inside the assistant turn, each card one block line of
|
|
@@ -170,9 +170,9 @@ function WeatherResult({ data }: { data: WeatherCardData }) {
|
|
|
170
170
|
<AiChatMessageLine block>
|
|
171
171
|
<Card>
|
|
172
172
|
<CardHeader>
|
|
173
|
-
<View
|
|
173
|
+
<View style={styles.weatherHeader}>
|
|
174
174
|
<IconCircle icon={conditionIcon(data.current.condition)} size="lg" />
|
|
175
|
-
<View
|
|
175
|
+
<View style={styles.weatherText}>
|
|
176
176
|
<Muted>{data.place}</Muted>
|
|
177
177
|
<Text variant="title-1-medium">{degrees(data.current.temperature, unit)}</Text>
|
|
178
178
|
<Muted>{t(`weather.condition.${data.current.condition}`)}</Muted>
|
|
@@ -230,7 +230,7 @@ function ScheduledTaskResult({ data }: { data: ScheduledTaskCardData }) {
|
|
|
230
230
|
title={data.objective}
|
|
231
231
|
subtitle={triggerLabel(data.trigger, t)}
|
|
232
232
|
trailing={
|
|
233
|
-
<View
|
|
233
|
+
<View style={styles.trailing}>
|
|
234
234
|
<Badge
|
|
235
235
|
variant="subtle"
|
|
236
236
|
color={data.enabled ? 'success' : 'default'}
|
|
@@ -252,3 +252,9 @@ function ScheduledTaskResult({ data }: { data: ScheduledTaskCardData }) {
|
|
|
252
252
|
</AiChatMessageLine>
|
|
253
253
|
);
|
|
254
254
|
}
|
|
255
|
+
|
|
256
|
+
const styles = StyleSheet.create({
|
|
257
|
+
weatherHeader: { flexDirection: 'row', alignItems: 'center', gap: 12 },
|
|
258
|
+
weatherText: { minWidth: 0, flexGrow: 1, flexShrink: 1, flexBasis: '0%' },
|
|
259
|
+
trailing: { flexDirection: 'row', alignItems: 'center', gap: 8 },
|
|
260
|
+
});
|