@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
|
@@ -30,7 +30,6 @@ import { ScrollToBottomButton } from '@oxy.so/bloom/chat-screen';
|
|
|
30
30
|
import { RiEditLine } from '@oxy.so/bloom/icons/RiEditLine';
|
|
31
31
|
import { toast } from '@oxy.so/bloom/toast';
|
|
32
32
|
import { Text } from '@oxy.so/bloom/typography';
|
|
33
|
-
import { useQueryClient } from '@tanstack/react-query';
|
|
34
33
|
import {
|
|
35
34
|
type ReactNode,
|
|
36
35
|
useCallback,
|
|
@@ -68,8 +67,8 @@ import { GEMIE_FEATURES, featureOffer, useAgentFeatures, useAgentProfile } from
|
|
|
68
67
|
import { type GemieRuntimeHost, GemieRuntimeProvider, useGemieRuntime } from '../runtime/config';
|
|
69
68
|
import { type GemieHostTools, APP_SLUG } from '../runtime/host-tools';
|
|
70
69
|
import { useCreateConversation } from '../runtime/conversations';
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
70
|
+
import { useRefreshGemieThread } from '../runtime/use-gemie-thread';
|
|
71
|
+
import type { GemieThreadAddress } from '../runtime/routes';
|
|
73
72
|
import type { Message } from '../runtime/types';
|
|
74
73
|
import { useAgentActivity } from '../runtime/use-agent-activity';
|
|
75
74
|
import { useConversationThread } from '../runtime/use-conversation-thread';
|
|
@@ -86,6 +85,7 @@ import { GemieThread } from './thread/GemieThread';
|
|
|
86
85
|
import { ThreadSearch } from './thread/ThreadSearch';
|
|
87
86
|
import { VoiceModeIcon } from './VoiceModeIcon';
|
|
88
87
|
import { VoiceCallContext } from './voice/VoiceCallContext';
|
|
88
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
89
89
|
|
|
90
90
|
/** The agent a chat is opened on: its lead instead of Alia. */
|
|
91
91
|
export interface GemieChatAgentRef {
|
|
@@ -358,22 +358,22 @@ function GemieConversationView({
|
|
|
358
358
|
onStopReady,
|
|
359
359
|
onDetachReady,
|
|
360
360
|
}: ConversationViewProps) {
|
|
361
|
+
const styles = useStyles();
|
|
361
362
|
const ownFlights = useAvatarFlights();
|
|
362
363
|
const flights = sharedFlights ?? ownFlights;
|
|
363
364
|
const labels = useLabels();
|
|
364
365
|
const { t } = labels;
|
|
365
366
|
const runtime = useGemieRuntime();
|
|
366
|
-
const queryClient = useQueryClient();
|
|
367
367
|
const { user, isAuthenticated } = useOxy();
|
|
368
368
|
const agentId = agent?.id;
|
|
369
369
|
|
|
370
370
|
// ── Who leads: the agent the chat was opened on, or Alia ──
|
|
371
|
-
const {
|
|
371
|
+
const { value: profile, isLoading: profileLoading } = useAgentProfile(agentId);
|
|
372
372
|
const lead = useMemo(
|
|
373
373
|
() => (group === undefined ? leadOf(profile) : groupParticipants(group).lead),
|
|
374
374
|
[group, profile],
|
|
375
375
|
);
|
|
376
|
-
const {
|
|
376
|
+
const { value: features } = useAgentFeatures(agentId);
|
|
377
377
|
|
|
378
378
|
// A failure reaches the host's handler when it has one, and Bloom's toast otherwise.
|
|
379
379
|
const reportError = useCallback(
|
|
@@ -407,6 +407,8 @@ function GemieConversationView({
|
|
|
407
407
|
suggestedNewConversation,
|
|
408
408
|
dismissSuggestedNewConversation,
|
|
409
409
|
agentRun,
|
|
410
|
+
approvals,
|
|
411
|
+
settleApproval,
|
|
410
412
|
failedTurn,
|
|
411
413
|
retryFailedTurn,
|
|
412
414
|
} = thread;
|
|
@@ -579,7 +581,7 @@ function GemieConversationView({
|
|
|
579
581
|
const welcome = useMemo(
|
|
580
582
|
() =>
|
|
581
583
|
profileLoading ? null : (
|
|
582
|
-
<View
|
|
584
|
+
<View style={styles.welcome}>
|
|
583
585
|
{group === undefined ? (
|
|
584
586
|
<GemieWelcomeMessage greeting={greeting} subtitle={welcomeSubtitle} lead={lead} />
|
|
585
587
|
) : (
|
|
@@ -588,11 +590,12 @@ function GemieConversationView({
|
|
|
588
590
|
{welcomeAccessory}
|
|
589
591
|
</View>
|
|
590
592
|
),
|
|
591
|
-
[profileLoading, greeting, welcomeSubtitle, lead, group, welcomeAccessory],
|
|
593
|
+
[profileLoading, greeting, welcomeSubtitle, lead, group, welcomeAccessory, styles],
|
|
592
594
|
);
|
|
593
595
|
|
|
594
596
|
// ── The agent's offer to start the next stretch fresh ──
|
|
595
|
-
const createConversation = useCreateConversation();
|
|
597
|
+
const { run: createConversation } = useCreateConversation();
|
|
598
|
+
const refreshThread = useRefreshGemieThread();
|
|
596
599
|
/**
|
|
597
600
|
* Take the agent up on its offer: start the next stretch of this thread.
|
|
598
601
|
*
|
|
@@ -614,21 +617,17 @@ function GemieConversationView({
|
|
|
614
617
|
void startOver();
|
|
615
618
|
return;
|
|
616
619
|
}
|
|
617
|
-
|
|
618
|
-
createConversation.
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
// one is active, and the pages held were fetched before its last turns existed.
|
|
623
|
-
void queryClient.invalidateQueries({ queryKey: gemieQueryKeys.threads.messages(key) });
|
|
624
|
-
},
|
|
625
|
-
});
|
|
620
|
+
// Created, the thread is read again and moves onto it; a refusal was already told.
|
|
621
|
+
createConversation(next).then(
|
|
622
|
+
() => refreshThread(threadAddress),
|
|
623
|
+
() => undefined,
|
|
624
|
+
);
|
|
626
625
|
}, [
|
|
627
626
|
agentId,
|
|
628
627
|
threadAddress,
|
|
629
628
|
threadRowId,
|
|
630
629
|
createConversation,
|
|
631
|
-
|
|
630
|
+
refreshThread,
|
|
632
631
|
dismissSuggestedNewConversation,
|
|
633
632
|
startOver,
|
|
634
633
|
]);
|
|
@@ -644,6 +643,22 @@ function GemieConversationView({
|
|
|
644
643
|
[suggestedNewConversation, acceptNewConversation, dismissSuggestedNewConversation],
|
|
645
644
|
);
|
|
646
645
|
|
|
646
|
+
// A coding CLI's question to its own user (ADR 0043 §5): the host carries the answer to Gemies.
|
|
647
|
+
const decideApproval = runtime.host.onApprovalDecision;
|
|
648
|
+
const approvalCards = useMemo(
|
|
649
|
+
() => ({
|
|
650
|
+
entries: approvals,
|
|
651
|
+
agentName: lead.name,
|
|
652
|
+
onDecide:
|
|
653
|
+
decideApproval === undefined
|
|
654
|
+
? undefined
|
|
655
|
+
: (entry: (typeof approvals)[number], decision: 'allow' | 'deny') =>
|
|
656
|
+
decideApproval(entry.requestId, entry.agentId, decision),
|
|
657
|
+
onSettled: settleApproval,
|
|
658
|
+
}),
|
|
659
|
+
[approvals, lead.name, decideApproval, settleApproval],
|
|
660
|
+
);
|
|
661
|
+
|
|
647
662
|
// ── The chrome ──
|
|
648
663
|
const latestMessages = useRef(messages);
|
|
649
664
|
latestMessages.current = messages;
|
|
@@ -689,9 +704,9 @@ function GemieConversationView({
|
|
|
689
704
|
// What is happening while a question is rewritten, and the way out of it. Drawn as the
|
|
690
705
|
// status tab it replaces: the thread scrolls behind the composer, and a strip without the
|
|
691
706
|
// tab's surface printed its words over the transcript's.
|
|
692
|
-
<View
|
|
707
|
+
<View style={styles.editingBar}>
|
|
693
708
|
<RiEditLine size="sm" />
|
|
694
|
-
<Text
|
|
709
|
+
<Text style={styles.editingLabel} numberOfLines={1}>
|
|
695
710
|
{t('composer.editingMessage')}
|
|
696
711
|
</Text>
|
|
697
712
|
<Button appearance="subtle" tone="accent" size="xs" onPress={edit.cancel}>
|
|
@@ -800,6 +815,7 @@ function GemieConversationView({
|
|
|
800
815
|
onRegenerate={composer.regenerate}
|
|
801
816
|
onStartEdit={edit.start}
|
|
802
817
|
newConversationOffer={newConversationOffer}
|
|
818
|
+
approvals={approvalCards}
|
|
803
819
|
agentActivity={agentRun === null ? null : agentActivity}
|
|
804
820
|
call={voice.isActive ? { agentState: voice.agentState } : undefined}
|
|
805
821
|
empty={welcome}
|
|
@@ -811,7 +827,7 @@ function GemieConversationView({
|
|
|
811
827
|
</GemieConversationOpenerProvider>
|
|
812
828
|
</BubblesProvider>
|
|
813
829
|
{!showsPast ? null : (
|
|
814
|
-
<View
|
|
830
|
+
<View style={styles.backToLatest} pointerEvents="box-none">
|
|
815
831
|
<Button appearance="outline" tone="neutral" size="sm" onPress={view.backToLatest}>
|
|
816
832
|
{t('chat.backToLatest')}
|
|
817
833
|
</Button>
|
|
@@ -823,7 +839,7 @@ function GemieConversationView({
|
|
|
823
839
|
</AiChatContainer>
|
|
824
840
|
</InertWhen>
|
|
825
841
|
{betweenGemies === null ? null : (
|
|
826
|
-
<View
|
|
842
|
+
<View style={styles.betweenGemies}>
|
|
827
843
|
<GemieBetweenGemies conversationId={betweenGemies} onBack={closeBetweenGemies} />
|
|
828
844
|
</View>
|
|
829
845
|
)}
|
|
@@ -896,3 +912,29 @@ export function GemieChatContent({
|
|
|
896
912
|
</GemieChatLabelsProvider>
|
|
897
913
|
);
|
|
898
914
|
}
|
|
915
|
+
|
|
916
|
+
const useStyles = createTokenStyles((t) => ({
|
|
917
|
+
welcome: { alignItems: 'center', gap: 32 },
|
|
918
|
+
editingBar: {
|
|
919
|
+
marginHorizontal: 28,
|
|
920
|
+
height: 34,
|
|
921
|
+
flexDirection: 'row',
|
|
922
|
+
alignItems: 'center',
|
|
923
|
+
gap: 8,
|
|
924
|
+
borderTopLeftRadius: 16,
|
|
925
|
+
borderTopRightRadius: 16,
|
|
926
|
+
backgroundColor: t.popover,
|
|
927
|
+
paddingHorizontal: 8,
|
|
928
|
+
paddingVertical: 4,
|
|
929
|
+
},
|
|
930
|
+
editingLabel: {
|
|
931
|
+
flexGrow: 1,
|
|
932
|
+
flexShrink: 1,
|
|
933
|
+
flexBasis: '0%',
|
|
934
|
+
fontSize: 12,
|
|
935
|
+
color: t.mutedForeground,
|
|
936
|
+
lineHeight: 16,
|
|
937
|
+
},
|
|
938
|
+
backToLatest: { position: 'absolute', insetInline: 0, top: 64, zIndex: 10, alignItems: 'center' },
|
|
939
|
+
betweenGemies: { position: 'absolute', inset: 0, zIndex: 20 },
|
|
940
|
+
}));
|
|
@@ -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
|
+
}));
|