@gemies/sdk 0.0.0-stage → 1.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 +1662 -0
- package/LICENSE +202 -0
- package/NOTICE +15 -0
- package/README.md +516 -2
- package/package.json +102 -4
- package/src/animations.ts +5 -0
- package/src/ask-eager.ts +8 -0
- package/src/ask-text.ts +11 -0
- package/src/ask.ts +12 -0
- package/src/avatar.ts +13 -0
- package/src/character.ts +1 -0
- package/src/components/AmbientField.tsx +580 -0
- package/src/components/ComposerDropZone.tsx +235 -0
- package/src/components/ComposerSuggestions.tsx +45 -0
- package/src/components/GemieAskCore.tsx +184 -0
- package/src/components/GemieAskProvider.tsx +18 -0
- package/src/components/GemieAskProviderLazy.tsx +27 -0
- package/src/components/GemieAskProviderText.tsx +25 -0
- package/src/components/GemieAskSheet.tsx +51 -0
- package/src/components/GemieAskSheetWithVoice.tsx +10 -0
- package/src/components/GemieAvatar.tsx +57 -0
- package/src/components/GemieAvatarIcon.tsx +35 -0
- package/src/components/GemieChatContent.tsx +900 -0
- package/src/components/GemieChatHeader.tsx +123 -0
- package/src/components/GemieChatScreen.tsx +170 -0
- package/src/components/GemieChatSheet.tsx +368 -0
- package/src/components/GemieChatWithVoice.tsx +13 -0
- package/src/components/GemieComposer.tsx +388 -0
- package/src/components/GemieGroupWelcome.tsx +37 -0
- package/src/components/GemieParticipants.tsx +133 -0
- package/src/components/GemieParticipantsHeader.tsx +27 -0
- package/src/components/GemieRecentConversations.tsx +65 -0
- package/src/components/GemieSharedConversation.tsx +87 -0
- package/src/components/GemieWelcomeMessage.tsx +58 -0
- package/src/components/IdentityMark.tsx +225 -0
- package/src/components/Image.tsx +12 -0
- package/src/components/InertWhen.tsx +48 -0
- package/src/components/PlanPreviewCard.tsx +53 -0
- package/src/components/QuestionCard.tsx +64 -0
- package/src/components/ReplyMarkdown.tsx +373 -0
- package/src/components/RichBlocks.tsx +195 -0
- package/src/components/VoiceModeIcon.tsx +18 -0
- package/src/components/canvas/CanvasComponent.tsx +65 -0
- package/src/components/canvas/ChartRenderer.tsx +73 -0
- package/src/components/canvas/CodeRenderer.tsx +20 -0
- package/src/components/canvas/DashboardRenderer.tsx +70 -0
- package/src/components/canvas/DeckRenderer.tsx +43 -0
- package/src/components/canvas/FormRenderer.tsx +101 -0
- package/src/components/canvas/MarkdownRenderer.tsx +14 -0
- package/src/components/canvas/TableRenderer.tsx +47 -0
- package/src/components/icons/RiEmojiPicker.tsx +39 -0
- package/src/components/icons/RiMoreDots.tsx +32 -0
- package/src/components/icons/RiReplyLine.tsx +25 -0
- package/src/components/thought/FilesAndSources.tsx +120 -0
- package/src/components/thought/ThoughtPanel.tsx +426 -0
- package/src/components/thought/ToolStep.tsx +134 -0
- package/src/components/thread/AgentExchangeView.tsx +112 -0
- package/src/components/thread/AgentResultCard.tsx +125 -0
- package/src/components/thread/AgentTaskCard.tsx +127 -0
- package/src/components/thread/ChatBubble.tsx +256 -0
- package/src/components/thread/GemieThread.tsx +455 -0
- package/src/components/thread/MessageBlockBoundary.tsx +78 -0
- package/src/components/thread/NewConversationOffer.tsx +54 -0
- package/src/components/thread/ThreadRow.tsx +598 -0
- package/src/components/thread/ThreadSearch.tsx +130 -0
- package/src/components/thread/ThreadSkeleton.tsx +30 -0
- package/src/components/thread/ToolResultCard.tsx +254 -0
- package/src/components/thread/TurnMenu.tsx +54 -0
- package/src/components/thread/TurnStatusLine.tsx +34 -0
- package/src/components/voice/GemieVoiceCall.tsx +21 -0
- package/src/components/voice/GemieVoiceCall.web.tsx +17 -0
- package/src/components/voice/VoiceCallContext.ts +13 -0
- package/src/components/voice/VoiceControls.tsx +106 -0
- package/src/components/voice/VoiceSession.tsx +120 -0
- package/src/components/voice/withVoiceCall.tsx +25 -0
- package/src/csp.ts +50 -0
- package/src/dictation.ts +40 -0
- package/src/hooks/useAmbientWave.ts +184 -0
- package/src/hooks/useAtBottom.ts +51 -0
- package/src/hooks/useAttachMenu.ts +93 -0
- package/src/hooks/useAttachmentIntake.ts +401 -0
- package/src/hooks/useAudioLevelMonitor.ts +46 -0
- package/src/hooks/useAudioLevels.ts +51 -0
- package/src/hooks/useChatComposer.ts +309 -0
- package/src/hooks/useChatVoice.ts +129 -0
- package/src/hooks/useComposerSuggestions.ts +84 -0
- package/src/hooks/useDictation.ts +292 -0
- package/src/hooks/useDocumentPicker.ts +11 -0
- package/src/hooks/useFailedTurnToast.ts +43 -0
- package/src/hooks/useFocusWhenPresented.ts +41 -0
- package/src/hooks/useGemieActivity.ts +31 -0
- package/src/hooks/useImagePicker.ts +38 -0
- package/src/hooks/useMessageReactions.ts +119 -0
- package/src/hooks/useMessageVote.ts +50 -0
- package/src/hooks/useOpenThought.ts +79 -0
- package/src/hooks/usePendingQuestions.ts +19 -0
- package/src/hooks/useReadAloud.ts +92 -0
- package/src/hooks/useShareHandler.ts +24 -0
- package/src/hooks/useSoundEffects.ts +137 -0
- package/src/hooks/useTTS.ts +303 -0
- package/src/hooks/useThoughtScope.ts +59 -0
- package/src/hooks/useThreadRows.ts +157 -0
- package/src/hooks/useThreadView.ts +67 -0
- package/src/hooks/useTimelineWindow.ts +256 -0
- package/src/hooks/useVoiceLauncher.ts +180 -0
- package/src/hooks/useVoiceRoom.ts +212 -0
- package/src/index.ts +140 -0
- package/src/lib/activity-socket.ts +102 -0
- package/src/lib/activity-store.ts +53 -0
- package/src/lib/add-menu.ts +7 -0
- package/src/lib/agent-character.ts +28 -0
- package/src/lib/alia-character.ts +14 -0
- package/src/lib/attachment-intake.ts +154 -0
- package/src/lib/attachment-tiles.ts +74 -0
- package/src/lib/audio-level.ts +130 -0
- package/src/lib/audio-request-auth.ts +4 -0
- package/src/lib/audio-session-binding.ts +27 -0
- package/src/lib/bubbles.tsx +16 -0
- package/src/lib/call-thread.ts +33 -0
- package/src/lib/canvas-result.ts +21 -0
- package/src/lib/catalogue-tool.ts +22 -0
- package/src/lib/citations.ts +192 -0
- package/src/lib/clipboard.ts +23 -0
- package/src/lib/content-utils.ts +46 -0
- package/src/lib/copy-en.ts +291 -0
- package/src/lib/copy-es.ts +287 -0
- package/src/lib/copy.ts +38 -0
- package/src/lib/deferred/document-picker.ts +2 -0
- package/src/lib/deferred/document-picker.web.ts +12 -0
- package/src/lib/deferred/expo-audio.ts +2 -0
- package/src/lib/deferred/expo-audio.web.ts +12 -0
- package/src/lib/deferred/image-data-url.ts +5 -0
- package/src/lib/deferred/image-data-url.web.ts +12 -0
- package/src/lib/dictation-protocol.ts +142 -0
- package/src/lib/dictation-recorder-types.ts +37 -0
- package/src/lib/dictation-recorder.native.ts +90 -0
- package/src/lib/dictation-recorder.ts +131 -0
- package/src/lib/dictation-stream.ts +238 -0
- package/src/lib/dictation.ts +216 -0
- package/src/lib/document-picker.ts +31 -0
- package/src/lib/domain.ts +12 -0
- package/src/lib/flights.ts +33 -0
- package/src/lib/focus-return.ts +66 -0
- package/src/lib/greeting.ts +15 -0
- package/src/lib/image-data-url.ts +35 -0
- package/src/lib/keyboard.native.tsx +25 -0
- package/src/lib/keyboard.tsx +55 -0
- package/src/lib/labels-es.ts +113 -0
- package/src/lib/labels.tsx +207 -0
- package/src/lib/origins.ts +28 -0
- package/src/lib/participants.ts +97 -0
- package/src/lib/pcm.ts +57 -0
- package/src/lib/power-level-options.ts +66 -0
- package/src/lib/questions.ts +92 -0
- package/src/lib/speech-language.ts +20 -0
- package/src/lib/speech-messages.ts +54 -0
- package/src/lib/speech-synthesis.ts +156 -0
- package/src/lib/suggestions.ts +53 -0
- package/src/lib/task-labels.ts +35 -0
- package/src/lib/text-input.ts +10 -0
- package/src/lib/tool-call-status.ts +28 -0
- package/src/lib/tool-icons.ts +36 -0
- package/src/lib/tool-registry.ts +71 -0
- package/src/lib/tool-renderers.tsx +32 -0
- package/src/lib/turn-state.ts +15 -0
- package/src/lib/utils.ts +35 -0
- package/src/lib/voice-audio-engine-types.ts +59 -0
- package/src/lib/voice-audio-engine.native.ts +232 -0
- package/src/lib/voice-audio-engine.ts +206 -0
- package/src/lib/voice-call-request.ts +49 -0
- package/src/lib/voice-call.ts +627 -0
- package/src/lib/voice-controls-labels.ts +31 -0
- package/src/lib/voice-levels.ts +64 -0
- package/src/lib/voice-protocol.ts +328 -0
- package/src/lib/voice-worklets.ts +19 -0
- package/src/lib/work-log.ts +370 -0
- package/src/metro/chart-importers.json +18 -0
- package/src/metro/granular-charts.js +3 -0
- package/src/metro/index.cjs +227 -0
- package/src/metro/index.d.cts +5 -0
- package/src/runtime/agents.ts +151 -0
- package/src/runtime/api.ts +144 -0
- package/src/runtime/app-assertion.ts +51 -0
- package/src/runtime/attachment-utils.ts +97 -0
- package/src/runtime/chat-turn-control.ts +74 -0
- package/src/runtime/composer-draft-store.ts +270 -0
- package/src/runtime/config.tsx +222 -0
- package/src/runtime/conversation-dates.ts +31 -0
- package/src/runtime/conversation-store.ts +49 -0
- package/src/runtime/conversations.ts +633 -0
- package/src/runtime/error-utils.ts +144 -0
- package/src/runtime/host-tools.ts +290 -0
- package/src/runtime/index.ts +137 -0
- package/src/runtime/message-history.ts +124 -0
- package/src/runtime/message-reactions.ts +214 -0
- package/src/runtime/model.ts +39 -0
- package/src/runtime/oxy-files.ts +37 -0
- package/src/runtime/power-levels.ts +66 -0
- package/src/runtime/query-keys.ts +49 -0
- package/src/runtime/random-uuid.ts +25 -0
- package/src/runtime/reaction-cache.ts +45 -0
- package/src/runtime/room-events.ts +333 -0
- package/src/runtime/routes.ts +81 -0
- package/src/runtime/sharing.ts +217 -0
- package/src/runtime/sse-frame-reader.ts +88 -0
- package/src/runtime/stream-events.ts +154 -0
- package/src/runtime/stream-outcome.ts +21 -0
- package/src/runtime/thought-store.ts +103 -0
- package/src/runtime/thread/agent-activity.ts +261 -0
- package/src/runtime/thread/agent-exchange.ts +94 -0
- package/src/runtime/thread/automation-labels.ts +79 -0
- package/src/runtime/thread/conversation-export.ts +135 -0
- package/src/runtime/thread/message-days.ts +120 -0
- package/src/runtime/thread/message-processor.ts +93 -0
- package/src/runtime/thread/speaker-changes.ts +66 -0
- package/src/runtime/thread/task-utils.ts +11 -0
- package/src/runtime/thread/thought-utils.ts +750 -0
- package/src/runtime/thread/thread-history.ts +139 -0
- package/src/runtime/thread/timeline.ts +202 -0
- package/src/runtime/thread/title-tags.ts +8 -0
- package/src/runtime/thread/tool-cards.ts +387 -0
- package/src/runtime/turn-failure.ts +108 -0
- package/src/runtime/turn-preparation.ts +21 -0
- package/src/runtime/types.ts +172 -0
- package/src/runtime/usage-limit-error.ts +44 -0
- package/src/runtime/use-agent-activity.ts +80 -0
- package/src/runtime/use-conversation-stream.ts +1669 -0
- package/src/runtime/use-conversation-thread.ts +590 -0
- package/src/runtime/use-gemie-thread.ts +54 -0
- package/src/runtime/use-room-events.ts +75 -0
- package/src/runtime/use-start-conversation.ts +107 -0
- package/src/runtime/use-thread-history.ts +73 -0
- package/src/runtime/use-thread-search.ts +100 -0
- package/src/runtime/use-turn-edit.ts +99 -0
- package/src/text.ts +19 -0
- package/src/theme.ts +16 -0
- package/src/tools.ts +27 -0
- package/src/types.ts +161 -0
- package/src/voice-messages.ts +2 -0
- package/src/voice.ts +67 -0
- package/tsconfig.json +17 -0
- package/worklets/voice-processors.js +152 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { ThreadSearchHit } from '../../runtime/thread/thread-history';
|
|
2
|
+
import type { GemieThreadAddress } from '../../runtime/routes';
|
|
3
|
+
import { useThreadSearch } from '../../runtime/use-thread-search';
|
|
4
|
+
import { useLabels } from '../../lib/labels';
|
|
5
|
+
import { Button } from '@oxy.so/bloom/button';
|
|
6
|
+
import { Card, CardBody } from '@oxy.so/bloom/card';
|
|
7
|
+
import { RiCloseLine } from '@oxy.so/bloom/icons/RiCloseLine';
|
|
8
|
+
import { Item } from '@oxy.so/bloom/item';
|
|
9
|
+
import { Search } from '@oxy.so/bloom/search';
|
|
10
|
+
import { Muted } from '@oxy.so/bloom/typography';
|
|
11
|
+
import { useState } from 'react';
|
|
12
|
+
import { ScrollView, View } from 'react-native';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Searching what was said in this thread, across every conversation in it.
|
|
16
|
+
*
|
|
17
|
+
* Not the app-wide palette on ⌘K, and the difference is the point: that one
|
|
18
|
+
* finds a chat, this one finds a SENTENCE, and it looks past the stretch on
|
|
19
|
+
* screen into every one before it. `GET /conversations/:id/…` could not serve
|
|
20
|
+
* this — it would stop at the current conversation, which is the one thing the
|
|
21
|
+
* reader can already see.
|
|
22
|
+
*
|
|
23
|
+
* Each result carries the cursor that opens the thread around it. A result you
|
|
24
|
+
* can read and not reach is a wall, so `onJump` is not an extra: it is what the
|
|
25
|
+
* hit is for.
|
|
26
|
+
*
|
|
27
|
+
* Bloom's `Search` for the field and an `Item` per hit, on a `Card` floating
|
|
28
|
+
* over the top of the thread in its 768 column: the card is the surface, so
|
|
29
|
+
* nothing here paints one of its own.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
interface ThreadSearchProps {
|
|
33
|
+
/** The thread searched: by its gemie's handle, or by the gemie's id. */
|
|
34
|
+
thread: GemieThreadAddress;
|
|
35
|
+
/** Open the thread around this message. */
|
|
36
|
+
onJump: (hit: ThreadSearchHit) => void;
|
|
37
|
+
onClose: () => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The day a hit was written, in the reader's own locale and timezone. */
|
|
41
|
+
function hitDay(createdAt: string, locale: string): string {
|
|
42
|
+
return new Date(createdAt).toLocaleDateString(locale, {
|
|
43
|
+
day: 'numeric',
|
|
44
|
+
month: 'short',
|
|
45
|
+
year: 'numeric',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const ThreadSearch = ({ thread, onJump, onClose }: ThreadSearchProps) => {
|
|
50
|
+
const { t, locale } = useLabels();
|
|
51
|
+
const [query, setQuery] = useState('');
|
|
52
|
+
const { data: hits, isFetching, isError } = useThreadSearch(thread, query);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Told apart deliberately: nothing typed is not a search that found nothing.
|
|
56
|
+
* One is an invitation and the other is an answer, and saying "no results"
|
|
57
|
+
* over an empty field answers a question nobody asked.
|
|
58
|
+
*/
|
|
59
|
+
const asked = query.trim().length > 0;
|
|
60
|
+
const found = hits ?? [];
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<View className="absolute inset-x-0 top-0 z-20 px-4 pt-4" pointerEvents="box-none">
|
|
64
|
+
<View className="w-full max-w-[768px] self-center">
|
|
65
|
+
<Card elevation="m">
|
|
66
|
+
<CardBody>
|
|
67
|
+
<View className="flex-row items-center gap-2">
|
|
68
|
+
<View className="flex-1">
|
|
69
|
+
<Search
|
|
70
|
+
label={t('chat.searchThreadPlaceholder')}
|
|
71
|
+
value={query}
|
|
72
|
+
onChangeText={setQuery}
|
|
73
|
+
onClearText={() => setQuery('')}
|
|
74
|
+
autoFocus
|
|
75
|
+
returnKeyType="search"
|
|
76
|
+
/>
|
|
77
|
+
</View>
|
|
78
|
+
<Button
|
|
79
|
+
size="md"
|
|
80
|
+
appearance="plain"
|
|
81
|
+
tone="neutral"
|
|
82
|
+
iconOnly
|
|
83
|
+
leadingIcon={RiCloseLine}
|
|
84
|
+
accessibilityLabel={t('common.close')}
|
|
85
|
+
onPress={onClose}
|
|
86
|
+
/>
|
|
87
|
+
</View>
|
|
88
|
+
|
|
89
|
+
{!asked ? (
|
|
90
|
+
<View className="px-1 py-4">
|
|
91
|
+
<Muted>{t('chat.searchThreadHint')}</Muted>
|
|
92
|
+
</View>
|
|
93
|
+
) : isError ? (
|
|
94
|
+
<View className="px-1 py-4">
|
|
95
|
+
<Muted>{t('chat.searchThreadFailed')}</Muted>
|
|
96
|
+
</View>
|
|
97
|
+
) : found.length === 0 ? (
|
|
98
|
+
<View className="px-1 py-4">
|
|
99
|
+
<Muted>
|
|
100
|
+
{isFetching ? t('chat.searchThreadSearching') : t('chat.searchThreadEmpty')}
|
|
101
|
+
</Muted>
|
|
102
|
+
</View>
|
|
103
|
+
) : (
|
|
104
|
+
<ScrollView
|
|
105
|
+
// A height in px, not a percentage of a parent that has none:
|
|
106
|
+
// measured in Chromium, the list otherwise sized itself to its
|
|
107
|
+
// content and spilled the results over the thread behind it.
|
|
108
|
+
className="mt-2 max-h-96"
|
|
109
|
+
keyboardShouldPersistTaps="handled"
|
|
110
|
+
>
|
|
111
|
+
{found.map((hit) => (
|
|
112
|
+
<Item
|
|
113
|
+
// The cursor, never `messageId`: a message the server wrote
|
|
114
|
+
// has no client id, and `null` is not a key.
|
|
115
|
+
key={hit.cursor}
|
|
116
|
+
title={hit.snippet}
|
|
117
|
+
subtitle={`${t(
|
|
118
|
+
hit.role === 'user' ? 'chat.searchThreadYou' : 'chat.searchThreadAgent',
|
|
119
|
+
)} · ${hitDay(hit.createdAt, locale)}`}
|
|
120
|
+
onPress={() => onJump(hit)}
|
|
121
|
+
/>
|
|
122
|
+
))}
|
|
123
|
+
</ScrollView>
|
|
124
|
+
)}
|
|
125
|
+
</CardBody>
|
|
126
|
+
</Card>
|
|
127
|
+
</View>
|
|
128
|
+
</View>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as Skeleton from '@oxy.so/bloom/skeleton';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A conversation's turns that are on their way: the person's bubbles at the end, the replies as
|
|
6
|
+
* lines at the start, with the shape and the uneven widths of the real thread, so nothing moves
|
|
7
|
+
* when it arrives. The one placeholder of every surface that waits for a thread (the chat, a
|
|
8
|
+
* shared conversation).
|
|
9
|
+
*/
|
|
10
|
+
export function ThreadSkeleton() {
|
|
11
|
+
return (
|
|
12
|
+
<Skeleton.Region className="gap-5 py-4">
|
|
13
|
+
<View className="items-end">
|
|
14
|
+
<Skeleton.Box width="65%" height={48} borderRadius={24} />
|
|
15
|
+
</View>
|
|
16
|
+
<View className="items-start gap-2.5">
|
|
17
|
+
<Skeleton.Box width="80%" height={14} borderRadius={8} />
|
|
18
|
+
<Skeleton.Box width="70%" height={14} borderRadius={8} />
|
|
19
|
+
<Skeleton.Box width="45%" height={14} borderRadius={8} />
|
|
20
|
+
</View>
|
|
21
|
+
<View className="items-end">
|
|
22
|
+
<Skeleton.Box width="50%" height={40} borderRadius={24} />
|
|
23
|
+
</View>
|
|
24
|
+
<View className="items-start gap-2.5">
|
|
25
|
+
<Skeleton.Box width="85%" height={14} borderRadius={8} />
|
|
26
|
+
<Skeleton.Box width="60%" height={14} borderRadius={8} />
|
|
27
|
+
</View>
|
|
28
|
+
</Skeleton.Region>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type FairCoinCardData,
|
|
3
|
+
type MarketCardData,
|
|
4
|
+
type PriceChart,
|
|
5
|
+
type ScheduledTaskCardData,
|
|
6
|
+
type TemperatureUnit,
|
|
7
|
+
type ToolCard,
|
|
8
|
+
type WeatherCardData,
|
|
9
|
+
degrees,
|
|
10
|
+
faircoinChart,
|
|
11
|
+
forecastWeekday,
|
|
12
|
+
formatPrice,
|
|
13
|
+
marketChart,
|
|
14
|
+
triggerLabel,
|
|
15
|
+
} from '../../runtime/model';
|
|
16
|
+
import { useLabels } from '../../lib/labels';
|
|
17
|
+
import { useGemieRuntime } from '../../runtime/config';
|
|
18
|
+
import { AiChatMessageLine } from '@oxy.so/bloom/ai-chat';
|
|
19
|
+
import { Badge } from '@oxy.so/bloom/badge';
|
|
20
|
+
import { Card, CardBody, CardHeader } from '@oxy.so/bloom/card';
|
|
21
|
+
import { LineChartCard } from '@oxy.so/bloom/chart-cards';
|
|
22
|
+
import { IconCircle } from '@oxy.so/bloom/icon-circle';
|
|
23
|
+
import { RiArrowRightSLine } from '@oxy.so/bloom/icons/RiArrowRightSLine';
|
|
24
|
+
import { RiCalendarScheduleLine } from '@oxy.so/bloom/icons/RiCalendarScheduleLine';
|
|
25
|
+
import { RiCloudLine } from '@oxy.so/bloom/icons/RiCloudLine';
|
|
26
|
+
import { RiDropLine } from '@oxy.so/bloom/icons/RiDropLine';
|
|
27
|
+
import { RiSnowflakeLine } from '@oxy.so/bloom/icons/RiSnowflakeLine';
|
|
28
|
+
import { RiSunFoggyLine } from '@oxy.so/bloom/icons/RiSunFoggyLine';
|
|
29
|
+
import { RiSunLine } from '@oxy.so/bloom/icons/RiSunLine';
|
|
30
|
+
import { Item } from '@oxy.so/bloom/item';
|
|
31
|
+
import {
|
|
32
|
+
SegmentedControl,
|
|
33
|
+
SegmentedControlItem,
|
|
34
|
+
SegmentedControlItemText,
|
|
35
|
+
} from '@oxy.so/bloom/segmented-control';
|
|
36
|
+
import { Muted, Text } from '@oxy.so/bloom/typography';
|
|
37
|
+
import { useState } from 'react';
|
|
38
|
+
import { View } from 'react-native';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A tool result drawn inside the assistant turn, each card one block line of
|
|
42
|
+
* the reply (`AiChatMessageLine block`) so it reveals with the turn.
|
|
43
|
+
*
|
|
44
|
+
* - market, FairCoin → Bloom `LineChartCard`, one range per stored period
|
|
45
|
+
* - weather → `Card` with an `IconCircle` and the forecast as `Item`s
|
|
46
|
+
* - scheduled task → `Card` with an `Item` that opens the automation
|
|
47
|
+
*/
|
|
48
|
+
export function ToolResultCard({ card }: { card: ToolCard }) {
|
|
49
|
+
switch (card.type) {
|
|
50
|
+
case 'market':
|
|
51
|
+
return <MarketResult data={card.data} />;
|
|
52
|
+
case 'faircoin':
|
|
53
|
+
return <FairCoinResult data={card.data} />;
|
|
54
|
+
case 'weather':
|
|
55
|
+
return <WeatherResult data={card.data} />;
|
|
56
|
+
case 'scheduled-task':
|
|
57
|
+
return <ScheduledTaskResult data={card.data} />;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function PriceLineChart({ chart }: { chart: PriceChart }) {
|
|
62
|
+
return (
|
|
63
|
+
<LineChartCard
|
|
64
|
+
title={chart.title}
|
|
65
|
+
ranges={chart.ranges}
|
|
66
|
+
defaultRange={chart.defaultRange}
|
|
67
|
+
rangesLabel={chart.title}
|
|
68
|
+
format={chart.format}
|
|
69
|
+
formatAxisValue={chart.formatAxisValue}
|
|
70
|
+
accessibilityLabel={chart.title}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function Notes({ lines }: { lines: readonly string[] }) {
|
|
76
|
+
return (
|
|
77
|
+
<>
|
|
78
|
+
{lines.map((line) => (
|
|
79
|
+
<AiChatMessageLine key={line} tone="secondary">
|
|
80
|
+
{line}
|
|
81
|
+
</AiChatMessageLine>
|
|
82
|
+
))}
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** A quote with no line to draw still says its price, in words. */
|
|
88
|
+
function PriceInWords({ title, price, hint }: { title: string; price: string; hint?: string }) {
|
|
89
|
+
return (
|
|
90
|
+
<Card>
|
|
91
|
+
<CardBody>
|
|
92
|
+
<Muted>{title}</Muted>
|
|
93
|
+
<Text variant="title-1-medium">{price}</Text>
|
|
94
|
+
{hint === undefined ? null : <Muted>{hint}</Muted>}
|
|
95
|
+
</CardBody>
|
|
96
|
+
</Card>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function MarketResult({ data }: { data: MarketCardData }) {
|
|
101
|
+
const { t, locale } = useLabels();
|
|
102
|
+
const chart = marketChart(data, t, locale);
|
|
103
|
+
return (
|
|
104
|
+
<>
|
|
105
|
+
<AiChatMessageLine block>
|
|
106
|
+
{chart !== null ? (
|
|
107
|
+
<PriceLineChart chart={chart} />
|
|
108
|
+
) : (
|
|
109
|
+
<PriceInWords
|
|
110
|
+
title={`${data.name} · ${data.symbol}`}
|
|
111
|
+
price={
|
|
112
|
+
typeof data.price === 'number'
|
|
113
|
+
? formatPrice(data.price, data.currency, locale)
|
|
114
|
+
: t('market.noPrice')
|
|
115
|
+
}
|
|
116
|
+
hint={t('market.noChart')}
|
|
117
|
+
/>
|
|
118
|
+
)}
|
|
119
|
+
</AiChatMessageLine>
|
|
120
|
+
{chart === null ? null : <Notes lines={chart.notes} />}
|
|
121
|
+
</>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function FairCoinResult({ data }: { data: FairCoinCardData }) {
|
|
126
|
+
const { t, locale } = useLabels();
|
|
127
|
+
const { chart, notes } = faircoinChart(data, t, locale);
|
|
128
|
+
return (
|
|
129
|
+
<>
|
|
130
|
+
<AiChatMessageLine block>
|
|
131
|
+
{chart !== null ? (
|
|
132
|
+
<PriceLineChart chart={chart} />
|
|
133
|
+
) : (
|
|
134
|
+
<PriceInWords
|
|
135
|
+
title={`${t('faircoin.name')} · ${t('faircoin.symbol')}`}
|
|
136
|
+
price={
|
|
137
|
+
typeof data.price === 'number' && Number.isFinite(data.price)
|
|
138
|
+
? formatPrice(data.price, 'USD', locale)
|
|
139
|
+
: t('faircoin.noPrice')
|
|
140
|
+
}
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
143
|
+
</AiChatMessageLine>
|
|
144
|
+
<Notes lines={notes} />
|
|
145
|
+
</>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const CONDITION_ICON: Record<string, typeof RiSunLine> = {
|
|
150
|
+
clear: RiSunLine,
|
|
151
|
+
'partly-cloudy': RiSunFoggyLine,
|
|
152
|
+
cloudy: RiCloudLine,
|
|
153
|
+
fog: RiSunFoggyLine,
|
|
154
|
+
drizzle: RiDropLine,
|
|
155
|
+
rain: RiDropLine,
|
|
156
|
+
showers: RiDropLine,
|
|
157
|
+
snow: RiSnowflakeLine,
|
|
158
|
+
'snow-showers': RiSnowflakeLine,
|
|
159
|
+
thunderstorm: RiCloudLine,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const conditionIcon = (condition: string) => CONDITION_ICON[condition] ?? RiCloudLine;
|
|
163
|
+
|
|
164
|
+
function WeatherResult({ data }: { data: WeatherCardData }) {
|
|
165
|
+
const { t, locale } = useLabels();
|
|
166
|
+
/** View state, deliberately not persisted: nobody reopens a chat for its unit. */
|
|
167
|
+
const [unit, setUnit] = useState<TemperatureUnit>('C');
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<AiChatMessageLine block>
|
|
171
|
+
<Card>
|
|
172
|
+
<CardHeader>
|
|
173
|
+
<View className="flex-row items-center gap-3">
|
|
174
|
+
<IconCircle icon={conditionIcon(data.current.condition)} size="lg" />
|
|
175
|
+
<View className="min-w-0 flex-1">
|
|
176
|
+
<Muted>{data.place}</Muted>
|
|
177
|
+
<Text variant="title-1-medium">{degrees(data.current.temperature, unit)}</Text>
|
|
178
|
+
<Muted>{t(`weather.condition.${data.current.condition}`)}</Muted>
|
|
179
|
+
</View>
|
|
180
|
+
<SegmentedControl
|
|
181
|
+
label={t('weather.toggleUnit')}
|
|
182
|
+
type="radio"
|
|
183
|
+
value={unit}
|
|
184
|
+
onValueChange={(next: string) => setUnit(next === 'F' ? 'F' : 'C')}
|
|
185
|
+
>
|
|
186
|
+
<SegmentedControlItem value="C">
|
|
187
|
+
<SegmentedControlItemText>°C</SegmentedControlItemText>
|
|
188
|
+
</SegmentedControlItem>
|
|
189
|
+
<SegmentedControlItem value="F">
|
|
190
|
+
<SegmentedControlItemText>°F</SegmentedControlItemText>
|
|
191
|
+
</SegmentedControlItem>
|
|
192
|
+
</SegmentedControl>
|
|
193
|
+
</View>
|
|
194
|
+
</CardHeader>
|
|
195
|
+
{data.daily.length === 0 ? null : (
|
|
196
|
+
<CardBody>
|
|
197
|
+
{data.daily.map((day) => {
|
|
198
|
+
const Icon = conditionIcon(day.condition);
|
|
199
|
+
return (
|
|
200
|
+
<Item
|
|
201
|
+
key={day.date}
|
|
202
|
+
density="compact"
|
|
203
|
+
role="listitem"
|
|
204
|
+
leading={<Icon size="sm" />}
|
|
205
|
+
title={forecastWeekday(day.date, locale)}
|
|
206
|
+
subtitle={t(`weather.condition.${day.condition}`)}
|
|
207
|
+
trailing={
|
|
208
|
+
<Text variant="body-medium">
|
|
209
|
+
{`${degrees(day.high, unit)} / ${degrees(day.low, unit)}`}
|
|
210
|
+
</Text>
|
|
211
|
+
}
|
|
212
|
+
/>
|
|
213
|
+
);
|
|
214
|
+
})}
|
|
215
|
+
</CardBody>
|
|
216
|
+
)}
|
|
217
|
+
</Card>
|
|
218
|
+
</AiChatMessageLine>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function ScheduledTaskResult({ data }: { data: ScheduledTaskCardData }) {
|
|
223
|
+
const { t } = useLabels();
|
|
224
|
+
const { openAutomation } = useGemieRuntime().host;
|
|
225
|
+
return (
|
|
226
|
+
<AiChatMessageLine block>
|
|
227
|
+
<Card>
|
|
228
|
+
<Item
|
|
229
|
+
leading={<RiCalendarScheduleLine size="md" />}
|
|
230
|
+
title={data.objective}
|
|
231
|
+
subtitle={triggerLabel(data.trigger, t)}
|
|
232
|
+
trailing={
|
|
233
|
+
<View className="flex-row items-center gap-2">
|
|
234
|
+
<Badge
|
|
235
|
+
variant="subtle"
|
|
236
|
+
color={data.enabled ? 'success' : 'default'}
|
|
237
|
+
content={t(data.enabled ? 'chat.toolCard.scheduled' : 'chat.toolCard.paused')}
|
|
238
|
+
/>
|
|
239
|
+
{openAutomation === undefined ? null : <RiArrowRightSLine size="sm" />}
|
|
240
|
+
</View>
|
|
241
|
+
}
|
|
242
|
+
// Pressable only where the host has a place to show the task.
|
|
243
|
+
{...(openAutomation === undefined
|
|
244
|
+
? {}
|
|
245
|
+
: {
|
|
246
|
+
accessibilityRole: 'link' as const,
|
|
247
|
+
accessibilityLabel: t('chat.toolCard.openTask', { objective: data.objective }),
|
|
248
|
+
onPress: () => openAutomation(data.id),
|
|
249
|
+
})}
|
|
250
|
+
/>
|
|
251
|
+
</Card>
|
|
252
|
+
</AiChatMessageLine>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { AiChatTurnAction } from '@oxy.so/bloom/ai-chat';
|
|
2
|
+
import {
|
|
3
|
+
ContextMenu,
|
|
4
|
+
ContextMenuContent,
|
|
5
|
+
ContextMenuItem,
|
|
6
|
+
ContextMenuTrigger,
|
|
7
|
+
} from '@oxy.so/bloom/context-menu';
|
|
8
|
+
import type { ReactNode } from 'react';
|
|
9
|
+
import { Platform } from 'react-native';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The turn's actions as a long-press menu, on native.
|
|
13
|
+
*
|
|
14
|
+
* What a turn can do besides being read — copy, read aloud, regenerate, edit — is drawn by the
|
|
15
|
+
* row with Bloom's turn actions: the feedback row under a reply, the action row under a question.
|
|
16
|
+
* A phone has no hover, and those rows are small targets under a long reply; a long press anywhere
|
|
17
|
+
* on the turn is where people look for them. Web keeps the rows alone: there a right-click on a
|
|
18
|
+
* reply is the browser's own menu, with the text selection in it, and taking that away to show
|
|
19
|
+
* the same buttons again would be a loss.
|
|
20
|
+
*/
|
|
21
|
+
const STRETCH = { alignSelf: 'stretch' } as const;
|
|
22
|
+
|
|
23
|
+
export function TurnMenu({
|
|
24
|
+
actions,
|
|
25
|
+
label,
|
|
26
|
+
children,
|
|
27
|
+
}: {
|
|
28
|
+
actions: ReadonlyArray<AiChatTurnAction>;
|
|
29
|
+
label: string;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}) {
|
|
32
|
+
if (Platform.OS === 'web' || actions.length === 0) return <>{children}</>;
|
|
33
|
+
return (
|
|
34
|
+
<ContextMenu>
|
|
35
|
+
{/* Stretched: Bloom's trigger hugs its content by default, and a turn measures the column
|
|
36
|
+
it is in (a question is half of it). */}
|
|
37
|
+
<ContextMenuTrigger label={label} style={STRETCH}>
|
|
38
|
+
{children}
|
|
39
|
+
</ContextMenuTrigger>
|
|
40
|
+
<ContextMenuContent>
|
|
41
|
+
{actions.map(({ key, label: rowLabel, icon: Icon, onPress, disabled }) => (
|
|
42
|
+
<ContextMenuItem
|
|
43
|
+
key={key}
|
|
44
|
+
onPress={onPress}
|
|
45
|
+
disabled={disabled}
|
|
46
|
+
leading={<Icon size="sm" />}
|
|
47
|
+
>
|
|
48
|
+
{rowLabel}
|
|
49
|
+
</ContextMenuItem>
|
|
50
|
+
))}
|
|
51
|
+
</ContextMenuContent>
|
|
52
|
+
</ContextMenu>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AiChatMessageLine } from '@oxy.so/bloom/ai-chat';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A turn's status line — "Worked for 5m 32s", "Reasoning" — in the template's
|
|
6
|
+
* secondary tone, and the way into that turn's thought panel.
|
|
7
|
+
*
|
|
8
|
+
* The press target is a nested `Text`, so the line keeps Bloom's paragraph
|
|
9
|
+
* (its reveal, its tone) and only the words become the control. It works for
|
|
10
|
+
* any turn, not only the one in flight: the panel is opened on this message,
|
|
11
|
+
* in the conversation it belongs to.
|
|
12
|
+
*/
|
|
13
|
+
export function TurnStatusLine({
|
|
14
|
+
label,
|
|
15
|
+
hint,
|
|
16
|
+
onPress,
|
|
17
|
+
}: {
|
|
18
|
+
label: string;
|
|
19
|
+
/** What pressing it does, for assistive technology. */
|
|
20
|
+
hint?: string;
|
|
21
|
+
onPress?: () => void;
|
|
22
|
+
}) {
|
|
23
|
+
return (
|
|
24
|
+
<AiChatMessageLine tone="secondary" selectable={false}>
|
|
25
|
+
{onPress === undefined ? (
|
|
26
|
+
label
|
|
27
|
+
) : (
|
|
28
|
+
<Text accessibilityRole="button" accessibilityHint={hint} onPress={onPress}>
|
|
29
|
+
{label}
|
|
30
|
+
</Text>
|
|
31
|
+
)}
|
|
32
|
+
</AiChatMessageLine>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The call of a conversation screen: its bar, while a call is open.
|
|
3
|
+
*
|
|
4
|
+
* The call and its audio engine load on the first call, not with the chat, so a screen that
|
|
5
|
+
* never calls never evaluates `react-native-audio-api`.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { lazy, Suspense } from 'react';
|
|
9
|
+
import type { VoiceSessionProps } from '../../types';
|
|
10
|
+
|
|
11
|
+
const VoiceSession = lazy(() =>
|
|
12
|
+
import('./VoiceSession').then((module) => ({ default: module.VoiceSession })),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export function GemieVoiceCall(props: VoiceSessionProps) {
|
|
16
|
+
return (
|
|
17
|
+
<Suspense fallback={null}>
|
|
18
|
+
<VoiceSession {...props} />
|
|
19
|
+
</Suspense>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The call of a conversation screen, on web: its bar, while a call is open.
|
|
3
|
+
*
|
|
4
|
+
* Native loads the call lazily (`GemieVoiceCall.tsx`) so a screen that never calls never evaluates
|
|
5
|
+
* `react-native-audio-api`. Web never reaches that engine (`lib/voice-audio-engine.ts` is the Web
|
|
6
|
+
* Audio one), and a lazy `import()` here would be an async chunk boundary inside the SDK: Metro
|
|
7
|
+
* hoists every module two async chunks share into `__common.js`, loaded at first paint, so an app
|
|
8
|
+
* that lazy-loads its Alia sheet would get the chat in its first paint. On web the call is a
|
|
9
|
+
* static import and travels in whatever chunk holds the chat.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { VoiceSessionProps } from '../../types';
|
|
13
|
+
import { VoiceSession } from './VoiceSession';
|
|
14
|
+
|
|
15
|
+
export function GemieVoiceCall(props: VoiceSessionProps) {
|
|
16
|
+
return <VoiceSession {...props} />;
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The voice call a conversation can open, handed down by the entry that bundles it.
|
|
3
|
+
*
|
|
4
|
+
* `GemieChatContent` draws the call through this rather than importing it, so a text-only entry
|
|
5
|
+
* (`@gemies/sdk/text`, `@gemies/sdk/ask/text`) never reaches the call's modules — its socket,
|
|
6
|
+
* protocol and audio engine. The root and `@gemies/sdk/ask` provide `GemieVoiceCall` around their
|
|
7
|
+
* chat (`withVoiceCall`); without a provider the chat is text-only, whatever its `voice` prop says.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { type ComponentType, createContext } from 'react';
|
|
11
|
+
import type { VoiceSessionProps } from '../../types';
|
|
12
|
+
|
|
13
|
+
export const VoiceCallContext = createContext<ComponentType<VoiceSessionProps> | null>(null);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bottom voice control bar that replaces the composer when voice mode is active: the status
|
|
3
|
+
* text over Bloom's own `VoiceControls` (microphone and end), the controls of Bloom's voice
|
|
4
|
+
* mode, not a call's.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Loading } from '@oxy.so/bloom/loading';
|
|
8
|
+
import { Text } from '@oxy.so/bloom/typography';
|
|
9
|
+
import { VoiceControls as BloomVoiceControls, type VoiceState } from '@oxy.so/bloom/voice';
|
|
10
|
+
import { View } from 'react-native';
|
|
11
|
+
import { VOICE_CONTROLS_LABELS, type VoiceControlsLabels } from '../../lib/voice-controls-labels';
|
|
12
|
+
import type { RoomState, AgentState, VoiceCallState } from '../../types';
|
|
13
|
+
|
|
14
|
+
export { VOICE_CONTROLS_LABELS, type VoiceControlsLabels };
|
|
15
|
+
|
|
16
|
+
export interface VoiceControlsProps {
|
|
17
|
+
roomState: RoomState;
|
|
18
|
+
agentState: AgentState;
|
|
19
|
+
isMuted: boolean;
|
|
20
|
+
onToggleMute: () => void;
|
|
21
|
+
onEnd: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Something the person should know while the call listens — e.g. that the
|
|
24
|
+
* call is about to reach its time limit. Shown in place of "Listening…".
|
|
25
|
+
*/
|
|
26
|
+
notice?: string | null;
|
|
27
|
+
/**
|
|
28
|
+
* The call's full state, when the host has it: a tool running reads as such
|
|
29
|
+
* rather than as "Thinking…".
|
|
30
|
+
*/
|
|
31
|
+
callState?: VoiceCallState;
|
|
32
|
+
/** Overrides for any of {@link VOICE_CONTROLS_LABELS}. */
|
|
33
|
+
labels?: Partial<VoiceControlsLabels>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getStatusText(
|
|
37
|
+
roomState: RoomState,
|
|
38
|
+
agentState: AgentState,
|
|
39
|
+
isMuted: boolean,
|
|
40
|
+
notice: string | null,
|
|
41
|
+
labels: VoiceControlsLabels,
|
|
42
|
+
callState: VoiceCallState | undefined,
|
|
43
|
+
): string {
|
|
44
|
+
if (roomState === 'connecting') return labels.connecting;
|
|
45
|
+
if (roomState === 'reconnecting') return labels.reconnecting;
|
|
46
|
+
if (roomState === 'connected') {
|
|
47
|
+
if (agentState === 'listening') return isMuted ? labels.muted : (notice ?? labels.listening);
|
|
48
|
+
if (callState?.kind === 'using-tool') return labels.usingTool;
|
|
49
|
+
if (agentState === 'thinking') return labels.thinking;
|
|
50
|
+
if (agentState === 'speaking') return labels.speaking;
|
|
51
|
+
return labels.connected;
|
|
52
|
+
}
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** What Bloom's voice controls call the call's state: the microphone is only live while it is. */
|
|
57
|
+
function voiceStateOf(roomState: RoomState, agentState: AgentState): VoiceState {
|
|
58
|
+
if (roomState === 'error') return 'error';
|
|
59
|
+
if (roomState !== 'connected') return 'idle';
|
|
60
|
+
return agentState === 'idle' ? 'listening' : agentState;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function VoiceControls({
|
|
64
|
+
roomState,
|
|
65
|
+
agentState,
|
|
66
|
+
isMuted,
|
|
67
|
+
onToggleMute,
|
|
68
|
+
onEnd,
|
|
69
|
+
notice = null,
|
|
70
|
+
callState,
|
|
71
|
+
labels: labelOverrides,
|
|
72
|
+
}: VoiceControlsProps) {
|
|
73
|
+
const labels = { ...VOICE_CONTROLS_LABELS, ...labelOverrides };
|
|
74
|
+
const statusText = getStatusText(roomState, agentState, isMuted, notice, labels, callState);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<View className="items-center gap-4 pb-6 pt-4">
|
|
78
|
+
{statusText ? (
|
|
79
|
+
<Text
|
|
80
|
+
className="text-lg font-medium text-text-primary"
|
|
81
|
+
accessibilityLiveRegion="polite"
|
|
82
|
+
aria-live="polite"
|
|
83
|
+
>
|
|
84
|
+
{statusText}
|
|
85
|
+
</Text>
|
|
86
|
+
) : null}
|
|
87
|
+
|
|
88
|
+
{roomState === 'connected' ? (
|
|
89
|
+
<BloomVoiceControls
|
|
90
|
+
state={voiceStateOf(roomState, agentState)}
|
|
91
|
+
muted={isMuted}
|
|
92
|
+
// Called with nothing: Bloom hands its handlers the next value or the press, and
|
|
93
|
+
// `onToggleMute` / `onEnd` of a session take optional arguments of their own.
|
|
94
|
+
onMutedChange={() => onToggleMute()}
|
|
95
|
+
onEnd={() => onEnd()}
|
|
96
|
+
/>
|
|
97
|
+
) : null}
|
|
98
|
+
|
|
99
|
+
{roomState === 'connecting' || roomState === 'reconnecting' ? (
|
|
100
|
+
<Loading
|
|
101
|
+
accessibilityLabel={roomState === 'connecting' ? labels.connecting : labels.reconnecting}
|
|
102
|
+
/>
|
|
103
|
+
) : null}
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
106
|
+
}
|