@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,73 @@
|
|
|
1
|
+
import { useLabels } from '../../lib/labels';
|
|
2
|
+
import { BarListCard, LineChartCard } from '@oxy.so/bloom/chart-cards';
|
|
3
|
+
import { formatNumber } from '@oxy.so/bloom/locale';
|
|
4
|
+
|
|
5
|
+
interface ChartData {
|
|
6
|
+
chartType: 'bar' | 'line' | 'pie';
|
|
7
|
+
labels: string[];
|
|
8
|
+
datasets: { label: string; values: number[] }[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface ChartRendererProps {
|
|
12
|
+
data: ChartData;
|
|
13
|
+
/** The canvas component's title, used as the chart's name. */
|
|
14
|
+
title?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const format = (value: number) => formatNumber(value);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A generated chart on Bloom's chart cards, painted from Bloom's chart palette.
|
|
21
|
+
*
|
|
22
|
+
* - one `line` series → `LineChartCard`;
|
|
23
|
+
* - a `pie` → `BarListCard` in shares of the whole, which is what a pie says;
|
|
24
|
+
* - bars, or several series → `BarListCard` in raw values, one tab per series.
|
|
25
|
+
*/
|
|
26
|
+
export function ChartRenderer({ data, title }: ChartRendererProps) {
|
|
27
|
+
const { t } = useLabels();
|
|
28
|
+
const { chartType, labels, datasets } = data;
|
|
29
|
+
const itemsOf = (values: number[]) =>
|
|
30
|
+
labels.map((label, i) => ({ label, value: values[i] || 0 }));
|
|
31
|
+
|
|
32
|
+
if (chartType === 'line' && datasets.length === 1) {
|
|
33
|
+
const series = datasets[0] as (typeof datasets)[number];
|
|
34
|
+
return (
|
|
35
|
+
<LineChartCard
|
|
36
|
+
title={series.label || title}
|
|
37
|
+
data={itemsOf(series.values)}
|
|
38
|
+
format={format}
|
|
39
|
+
formatAxisValue={format}
|
|
40
|
+
getPointTitle={(point) => point.label}
|
|
41
|
+
accessibilityLabel={title ?? series.label}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (chartType === 'pie' || datasets.length <= 1) {
|
|
47
|
+
const series = datasets[0];
|
|
48
|
+
return (
|
|
49
|
+
<BarListCard
|
|
50
|
+
title={series?.label || title}
|
|
51
|
+
metricLabel={chartType === 'pie' ? t('panels.chart.share') : t('panels.chart.value')}
|
|
52
|
+
metric={chartType === 'pie' ? 'share' : 'value'}
|
|
53
|
+
format={format}
|
|
54
|
+
items={itemsOf(series?.values ?? [])}
|
|
55
|
+
limit={labels.length}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<BarListCard
|
|
62
|
+
metricLabel={t('panels.chart.value')}
|
|
63
|
+
metric="value"
|
|
64
|
+
format={format}
|
|
65
|
+
tabs={datasets.map((series, i) => ({
|
|
66
|
+
id: `series-${i}`,
|
|
67
|
+
label: series.label,
|
|
68
|
+
items: itemsOf(series.values),
|
|
69
|
+
}))}
|
|
70
|
+
limit={labels.length}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useLabels } from '../../lib/labels';
|
|
2
|
+
import { CodeBlock } from '@oxy.so/bloom/code';
|
|
3
|
+
|
|
4
|
+
interface CodeData {
|
|
5
|
+
language: string;
|
|
6
|
+
code: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Shared code surface and copy feedback. */
|
|
10
|
+
export function CodeRenderer({ data, filename }: { data: CodeData; filename?: string }) {
|
|
11
|
+
const { t } = useLabels();
|
|
12
|
+
return (
|
|
13
|
+
<CodeBlock
|
|
14
|
+
code={data.code}
|
|
15
|
+
language={data.language}
|
|
16
|
+
filename={filename}
|
|
17
|
+
labels={{ copy: t('panels.code.copy'), copied: t('panels.code.copied') }}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Muted, Text } from '@oxy.so/bloom/typography';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { ChartRenderer } from './ChartRenderer';
|
|
4
|
+
import { MarkdownRenderer } from './MarkdownRenderer';
|
|
5
|
+
import { TableRenderer } from './TableRenderer';
|
|
6
|
+
|
|
7
|
+
export type DashboardWidget =
|
|
8
|
+
| { kind: 'stat'; label: string; value: string; delta?: string }
|
|
9
|
+
| {
|
|
10
|
+
kind: 'chart';
|
|
11
|
+
title?: string;
|
|
12
|
+
chartType: 'bar' | 'line' | 'pie';
|
|
13
|
+
labels: string[];
|
|
14
|
+
datasets: { label: string; values: number[] }[];
|
|
15
|
+
}
|
|
16
|
+
| { kind: 'table'; title?: string; headers: string[]; rows: string[][] }
|
|
17
|
+
| { kind: 'text'; title?: string; content: string };
|
|
18
|
+
|
|
19
|
+
interface DashboardRendererProps {
|
|
20
|
+
data: { widgets?: DashboardWidget[] };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A dashboard: its stats in a row, then its charts, tables and notes, each drawn by its own renderer. */
|
|
24
|
+
export function DashboardRenderer({ data }: DashboardRendererProps) {
|
|
25
|
+
const widgets = Array.isArray(data.widgets) ? data.widgets : [];
|
|
26
|
+
const stats = widgets.filter(
|
|
27
|
+
(w): w is Extract<DashboardWidget, { kind: 'stat' }> => w.kind === 'stat',
|
|
28
|
+
);
|
|
29
|
+
const rest = widgets.filter((w) => w.kind !== 'stat');
|
|
30
|
+
return (
|
|
31
|
+
<View className="gap-3">
|
|
32
|
+
{stats.length > 0 && (
|
|
33
|
+
<View className="flex-row flex-wrap gap-3">
|
|
34
|
+
{stats.map((stat, i) => (
|
|
35
|
+
<View
|
|
36
|
+
key={i}
|
|
37
|
+
className="min-w-36 flex-1 gap-1 rounded-2xl border border-border bg-background-tertiary-default p-3"
|
|
38
|
+
>
|
|
39
|
+
<Muted>{stat.label}</Muted>
|
|
40
|
+
<Text variant="headline-semibold">{stat.value}</Text>
|
|
41
|
+
{stat.delta ? <Muted>{stat.delta}</Muted> : null}
|
|
42
|
+
</View>
|
|
43
|
+
))}
|
|
44
|
+
</View>
|
|
45
|
+
)}
|
|
46
|
+
{rest.map((widget, i) => {
|
|
47
|
+
switch (widget.kind) {
|
|
48
|
+
case 'chart':
|
|
49
|
+
return <ChartRenderer key={i} data={widget} title={widget.title} />;
|
|
50
|
+
case 'table':
|
|
51
|
+
return (
|
|
52
|
+
<View key={i} className="gap-2">
|
|
53
|
+
{widget.title ? <Text variant="body-semibold">{widget.title}</Text> : null}
|
|
54
|
+
<TableRenderer data={widget} title={widget.title} />
|
|
55
|
+
</View>
|
|
56
|
+
);
|
|
57
|
+
case 'text':
|
|
58
|
+
return (
|
|
59
|
+
<View key={i} className="gap-2">
|
|
60
|
+
{widget.title ? <Text variant="body-semibold">{widget.title}</Text> : null}
|
|
61
|
+
<MarkdownRenderer data={{ content: widget.content }} />
|
|
62
|
+
</View>
|
|
63
|
+
);
|
|
64
|
+
default:
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
})}
|
|
68
|
+
</View>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Muted, Text } from '@oxy.so/bloom/typography';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { MarkdownRenderer } from './MarkdownRenderer';
|
|
4
|
+
|
|
5
|
+
interface DeckSlide {
|
|
6
|
+
title: string;
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
bullets?: string[];
|
|
9
|
+
body?: string;
|
|
10
|
+
notes?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface DeckRendererProps {
|
|
14
|
+
data: { slides?: DeckSlide[] };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A slide deck, one card per slide in reading order. Presenting it is the host's
|
|
19
|
+
* (Astro opens a deck in a tab of its own); here it is read like a document.
|
|
20
|
+
*/
|
|
21
|
+
export function DeckRenderer({ data }: DeckRendererProps) {
|
|
22
|
+
const slides = Array.isArray(data.slides) ? data.slides : [];
|
|
23
|
+
return (
|
|
24
|
+
<View className="gap-3">
|
|
25
|
+
{slides.map((slide, i) => (
|
|
26
|
+
<View
|
|
27
|
+
key={i}
|
|
28
|
+
className="gap-2 rounded-2xl border border-border bg-background-tertiary-default p-4"
|
|
29
|
+
>
|
|
30
|
+
<View className="flex-row items-baseline justify-between gap-2">
|
|
31
|
+
<Text variant="body-semibold">{slide.title}</Text>
|
|
32
|
+
<Muted>{i + 1}</Muted>
|
|
33
|
+
</View>
|
|
34
|
+
{slide.subtitle ? <Muted>{slide.subtitle}</Muted> : null}
|
|
35
|
+
{slide.bullets?.length ? (
|
|
36
|
+
<MarkdownRenderer data={{ content: slide.bullets.map((b) => `- ${b}`).join('\n') }} />
|
|
37
|
+
) : null}
|
|
38
|
+
{slide.body ? <MarkdownRenderer data={{ content: slide.body }} /> : null}
|
|
39
|
+
</View>
|
|
40
|
+
))}
|
|
41
|
+
</View>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useLabels } from '../../lib/labels';
|
|
2
|
+
import { Button } from '@oxy.so/bloom/button';
|
|
3
|
+
import { Checkbox } from '@oxy.so/bloom/checkbox';
|
|
4
|
+
import { Field } from '@oxy.so/bloom/field';
|
|
5
|
+
import {
|
|
6
|
+
Select,
|
|
7
|
+
SelectContent,
|
|
8
|
+
SelectIcon,
|
|
9
|
+
SelectItem,
|
|
10
|
+
SelectItemIndicator,
|
|
11
|
+
SelectItemText,
|
|
12
|
+
SelectTrigger,
|
|
13
|
+
SelectValue,
|
|
14
|
+
} from '@oxy.so/bloom/select';
|
|
15
|
+
import { TextFieldInput } from '@oxy.so/bloom/text-field';
|
|
16
|
+
import { useState } from 'react';
|
|
17
|
+
import { View } from 'react-native';
|
|
18
|
+
|
|
19
|
+
interface FormField {
|
|
20
|
+
name: string;
|
|
21
|
+
type: 'text' | 'select' | 'checkbox';
|
|
22
|
+
label: string;
|
|
23
|
+
options?: string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface FormData {
|
|
27
|
+
fields: FormField[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface FormRendererProps {
|
|
31
|
+
data: FormData;
|
|
32
|
+
onSubmit?: (formData: Record<string, any>) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** A generated form on Bloom's own controls: `Field` + `TextFieldInput`, `Select`, `Checkbox`. */
|
|
36
|
+
export function FormRenderer({ data, onSubmit }: FormRendererProps) {
|
|
37
|
+
const { t } = useLabels();
|
|
38
|
+
const { fields } = data;
|
|
39
|
+
const [formValues, setFormValues] = useState<Record<string, any>>({});
|
|
40
|
+
|
|
41
|
+
const updateValue = (name: string, value: any) => {
|
|
42
|
+
setFormValues((prev) => ({ ...prev, [name]: value }));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<View className="gap-4">
|
|
47
|
+
{fields.map((field, i) =>
|
|
48
|
+
field.type === 'checkbox' ? (
|
|
49
|
+
<Checkbox
|
|
50
|
+
key={i}
|
|
51
|
+
label={field.label}
|
|
52
|
+
checked={!!formValues[field.name]}
|
|
53
|
+
onCheckedChange={(v) => updateValue(field.name, v)}
|
|
54
|
+
/>
|
|
55
|
+
) : (
|
|
56
|
+
<Field key={i} label={field.label}>
|
|
57
|
+
{field.type === 'select' ? (
|
|
58
|
+
<Select
|
|
59
|
+
value={formValues[field.name]}
|
|
60
|
+
onValueChange={(v) => updateValue(field.name, v)}
|
|
61
|
+
>
|
|
62
|
+
<SelectTrigger label={field.label}>
|
|
63
|
+
<SelectValue placeholder={t('panels.form.select')} />
|
|
64
|
+
<SelectIcon />
|
|
65
|
+
</SelectTrigger>
|
|
66
|
+
<SelectContent
|
|
67
|
+
label={field.label}
|
|
68
|
+
items={(field.options ?? []).map((option) => ({ value: option, label: option }))}
|
|
69
|
+
valueExtractor={(item) => item.value}
|
|
70
|
+
renderItem={(item) => (
|
|
71
|
+
<SelectItem value={item.value} label={item.label}>
|
|
72
|
+
<SelectItemIndicator />
|
|
73
|
+
<SelectItemText>{item.label}</SelectItemText>
|
|
74
|
+
</SelectItem>
|
|
75
|
+
)}
|
|
76
|
+
/>
|
|
77
|
+
</Select>
|
|
78
|
+
) : (
|
|
79
|
+
<TextFieldInput
|
|
80
|
+
label={field.label}
|
|
81
|
+
value={formValues[field.name] || ''}
|
|
82
|
+
onValueChange={(v) => updateValue(field.name, v)}
|
|
83
|
+
placeholder={t('panels.form.enter', { field: field.label.toLowerCase() })}
|
|
84
|
+
/>
|
|
85
|
+
)}
|
|
86
|
+
</Field>
|
|
87
|
+
),
|
|
88
|
+
)}
|
|
89
|
+
|
|
90
|
+
{/* Only a form with somewhere to send its values offers to send them.
|
|
91
|
+
No caller passes `onSubmit` today — the workspace panel renders the
|
|
92
|
+
canvas without a path back into the conversation — and the button
|
|
93
|
+
used to render regardless, a Submit that did nothing (#608, rule 6). */}
|
|
94
|
+
{onSubmit === undefined ? null : (
|
|
95
|
+
<View className="mt-2">
|
|
96
|
+
<Button onPress={() => onSubmit(formValues)}>{t('panels.form.submit')}</Button>
|
|
97
|
+
</View>
|
|
98
|
+
)}
|
|
99
|
+
</View>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReplyMarkdown } from '../ReplyMarkdown';
|
|
2
|
+
|
|
3
|
+
interface MarkdownData {
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface MarkdownRendererProps {
|
|
8
|
+
data: MarkdownData;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** A generated document, written by the same Markdown renderer as a chat reply. */
|
|
12
|
+
export function MarkdownRenderer({ data }: MarkdownRendererProps) {
|
|
13
|
+
return <ReplyMarkdown content={data.content} />;
|
|
14
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table,
|
|
3
|
+
TableBody,
|
|
4
|
+
TableCell,
|
|
5
|
+
TableColumn,
|
|
6
|
+
TableHeader,
|
|
7
|
+
TableRow,
|
|
8
|
+
} from '@oxy.so/bloom/table';
|
|
9
|
+
|
|
10
|
+
interface TableData {
|
|
11
|
+
headers: string[];
|
|
12
|
+
rows: string[][];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface TableRendererProps {
|
|
16
|
+
data: TableData;
|
|
17
|
+
/** Names the table for assistive tech — the canvas component's title. */
|
|
18
|
+
title?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Below this width per column the table scrolls sideways instead of squeezing. */
|
|
22
|
+
const COLUMN_MIN_WIDTH = 100;
|
|
23
|
+
|
|
24
|
+
export function TableRenderer({ data, title }: TableRendererProps) {
|
|
25
|
+
const { headers, rows } = data;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Table size="sm" accessibilityLabel={title} minWidth={headers.length * COLUMN_MIN_WIDTH}>
|
|
29
|
+
<TableHeader>
|
|
30
|
+
{headers.map((header, i) => (
|
|
31
|
+
<TableColumn key={i} minWidth={COLUMN_MIN_WIDTH}>
|
|
32
|
+
{header}
|
|
33
|
+
</TableColumn>
|
|
34
|
+
))}
|
|
35
|
+
</TableHeader>
|
|
36
|
+
<TableBody>
|
|
37
|
+
{rows.map((row, rowIdx) => (
|
|
38
|
+
<TableRow key={rowIdx}>
|
|
39
|
+
{row.map((cell, cellIdx) => (
|
|
40
|
+
<TableCell key={cellIdx}>{cell}</TableCell>
|
|
41
|
+
))}
|
|
42
|
+
</TableRow>
|
|
43
|
+
))}
|
|
44
|
+
</TableBody>
|
|
45
|
+
</Table>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Svg, { Path } from 'react-native-svg';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The "react to message" glyph of the agent chat this thread is modelled on: a smiley with a ring.
|
|
5
|
+
* Drawn like a Bloom icon (a component taking `width`, `height` and `fill`), so it can move into
|
|
6
|
+
* Bloom unchanged, as `RiReplyLine` can.
|
|
7
|
+
*/
|
|
8
|
+
export function RiEmojiPicker({
|
|
9
|
+
width = 24,
|
|
10
|
+
height = 24,
|
|
11
|
+
fill = 'currentColor',
|
|
12
|
+
}: {
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
fill?: string;
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<Svg width={width} height={height} viewBox="0 0 24 24" fill="none">
|
|
19
|
+
<Path
|
|
20
|
+
d="M10.2178 14.0449C10.7169 14.7542 11.3705 15.1023 11.9941 15.0996C12.6176 15.1036 13.2696 14.7581 13.7666 14.0479C13.8226 13.9676 13.8738 13.8894 13.9258 13.8018C14.3034 13.9338 14.681 14.0662 15.0586 14.1982C15.0329 14.3318 15.0042 14.4569 14.9639 14.5898C14.6572 15.7516 13.4632 16.9244 11.9922 16.9004C10.5217 16.9202 9.33299 15.7505 9.02246 14.5908C8.98181 14.4582 8.95282 14.3336 8.92676 14.2002C9.30379 14.067 9.68059 13.933 10.0576 13.7998C10.1098 13.8872 10.1616 13.965 10.2178 14.0449Z"
|
|
21
|
+
fill={fill}
|
|
22
|
+
/>
|
|
23
|
+
<Path
|
|
24
|
+
d="M8.49219 9C9.32047 9 9.99195 9.63612 9.99219 10.5195C9.99219 11.4032 9.32061 12 8.49219 12C7.66376 12 6.99219 11.4032 6.99219 10.5195C6.99242 9.63612 7.66391 9 8.49219 9Z"
|
|
25
|
+
fill={fill}
|
|
26
|
+
/>
|
|
27
|
+
<Path
|
|
28
|
+
d="M15.4922 9C16.3205 9 16.992 9.63612 16.9922 10.5195C16.9922 11.4032 16.3206 12 15.4922 12C14.6638 12 13.9922 11.4032 13.9922 10.5195C13.9924 9.63612 14.6639 9 15.4922 9Z"
|
|
29
|
+
fill={fill}
|
|
30
|
+
/>
|
|
31
|
+
<Path
|
|
32
|
+
fillRule="evenodd"
|
|
33
|
+
clipRule="evenodd"
|
|
34
|
+
d="M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2ZM12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4Z"
|
|
35
|
+
fill={fill}
|
|
36
|
+
/>
|
|
37
|
+
</Svg>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Svg, { Path } from 'react-native-svg';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The three horizontal dots of "more message actions" in the agent chat this thread is modelled
|
|
5
|
+
* on. Drawn like a Bloom icon (a component taking `width`, `height` and `fill`).
|
|
6
|
+
*/
|
|
7
|
+
export function RiMoreDots({
|
|
8
|
+
width = 24,
|
|
9
|
+
height = 24,
|
|
10
|
+
fill = 'currentColor',
|
|
11
|
+
}: {
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
fill?: string;
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<Svg width={width} height={height} viewBox="0 0 24 24" fill="none">
|
|
18
|
+
<Path
|
|
19
|
+
d="M14 12C14 13.1046 13.1046 14 12 14C10.8954 14 10 13.1046 10 12C10 10.8954 10.8954 10 12 10C13.1046 10 14 10.8954 14 12Z"
|
|
20
|
+
fill={fill}
|
|
21
|
+
/>
|
|
22
|
+
<Path
|
|
23
|
+
d="M21 12C21 13.1046 20.1046 14 19 14C17.8954 14 17 13.1046 17 12C17 10.8954 17.8954 10 19 10C20.1046 10 21 10.8954 21 12Z"
|
|
24
|
+
fill={fill}
|
|
25
|
+
/>
|
|
26
|
+
<Path
|
|
27
|
+
d="M7 12C7 13.1046 6.10457 14 5 14C3.89543 14 3 13.1046 3 12C3 10.8954 3.89543 10 5 10C6.10457 10 7 10.8954 7 12Z"
|
|
28
|
+
fill={fill}
|
|
29
|
+
/>
|
|
30
|
+
</Svg>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Svg, { Path } from 'react-native-svg';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Remix Icon `reply-line` (Communication), the arrow of "reply to message". Bloom's icon set has
|
|
5
|
+
* every neighbour of it but not this one; the path is Remix's own, drawn like a Bloom icon (a
|
|
6
|
+
* component taking `width`, `height` and `fill`), so it can move into Bloom unchanged.
|
|
7
|
+
*/
|
|
8
|
+
export function RiReplyLine({
|
|
9
|
+
width = 24,
|
|
10
|
+
height = 24,
|
|
11
|
+
fill = 'currentColor',
|
|
12
|
+
}: {
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
fill?: string;
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<Svg width={width} height={height} viewBox="0 0 24 24" fill="none">
|
|
19
|
+
<Path
|
|
20
|
+
d="M12.0001 5.6416C15.8107 6.3358 18.3595 8.30993 19.922 11.082C21.5661 13.9991 22.0688 17.7084 22.0001 21.5176L20.0001 21.5C20.0001 18.8183 18.9552 17.1882 17.3995 16.1572C15.9999 15.2297 14.1119 14.7411 12.0001 14.5625V19.6348L0.437622 10L12.0001 0.365234V5.6416ZM3.56262 10L10.0001 15.3643V12.4619L11.0372 12.501C13.7135 12.6016 16.4305 13.1162 18.504 14.4902C18.8153 14.6965 19.1077 14.9232 19.3839 15.166C19.0964 14.032 18.7014 12.9899 18.1798 12.0645C16.8255 9.6616 14.5759 7.95467 10.8761 7.49219L10.0001 7.38281V4.63574L3.56262 10Z"
|
|
21
|
+
fill={fill}
|
|
22
|
+
/>
|
|
23
|
+
</Svg>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useLabels } from '../../lib/labels';
|
|
2
|
+
import type { OutputFile, Source } from '../../runtime/model';
|
|
3
|
+
import {
|
|
4
|
+
Accordion,
|
|
5
|
+
AccordionContent,
|
|
6
|
+
AccordionItem,
|
|
7
|
+
AccordionTrigger,
|
|
8
|
+
} from '@oxy.so/bloom/accordion';
|
|
9
|
+
import { EmptyState } from '@oxy.so/bloom/empty-state';
|
|
10
|
+
import { RiFileTextLine } from '@oxy.so/bloom/icons/RiFileTextLine';
|
|
11
|
+
import { RiGlobalLine } from '@oxy.so/bloom/icons/RiGlobalLine';
|
|
12
|
+
import { Item } from '@oxy.so/bloom/item';
|
|
13
|
+
import { useTheme } from '@oxy.so/bloom/theme';
|
|
14
|
+
import { useState } from 'react';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* "Files and sources": what a turn produced and what it read, as two Bloom
|
|
18
|
+
* `Accordion` sections of `Item` rows.
|
|
19
|
+
*
|
|
20
|
+
* An output row is pressable only when the canvas holds its artifact to open;
|
|
21
|
+
* otherwise it is a labelled row and says so to assistive tech. A name is
|
|
22
|
+
* truncated on screen and whole in the row's accessible label.
|
|
23
|
+
*
|
|
24
|
+
* An empty section stays, with its header and one muted line, so the tab can
|
|
25
|
+
* never look like it failed to load and never hides that a persisted turn
|
|
26
|
+
* produced nothing (#542).
|
|
27
|
+
*/
|
|
28
|
+
export interface FilesAndSourcesProps {
|
|
29
|
+
outputs: OutputFile[];
|
|
30
|
+
sources: Source[];
|
|
31
|
+
/** What the host can do with a generated file; absent, no output is pressable. */
|
|
32
|
+
outputActions?: OutputActions;
|
|
33
|
+
onOpenSource: (source: Source) => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Where a generated file opens: the host's canvas, for as long as it holds the file. */
|
|
37
|
+
export interface OutputActions {
|
|
38
|
+
/**
|
|
39
|
+
* Whether `open` can show this output. A host that keeps the files it was told about answers
|
|
40
|
+
* `false` for one it no longer holds, so a reloaded thread lists the file by name with no
|
|
41
|
+
* press, rather than a press that opens nothing.
|
|
42
|
+
*/
|
|
43
|
+
canOpen: (output: OutputFile) => boolean;
|
|
44
|
+
open: (output: OutputFile) => void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const ALL_OPEN = ['outputs', 'sources'];
|
|
48
|
+
|
|
49
|
+
export function FilesAndSources({
|
|
50
|
+
outputs,
|
|
51
|
+
sources,
|
|
52
|
+
outputActions,
|
|
53
|
+
onOpenSource,
|
|
54
|
+
}: FilesAndSourcesProps) {
|
|
55
|
+
const { t } = useLabels();
|
|
56
|
+
const { colors } = useTheme();
|
|
57
|
+
const [open, setOpen] = useState<string[]>(ALL_OPEN);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Accordion
|
|
61
|
+
type="multiple"
|
|
62
|
+
value={open}
|
|
63
|
+
onValueChange={(next) =>
|
|
64
|
+
setOpen(Array.isArray(next) ? next : next === undefined ? [] : [next])
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
<AccordionItem value="outputs">
|
|
68
|
+
<AccordionTrigger>{t('thought.outputs')}</AccordionTrigger>
|
|
69
|
+
<AccordionContent>
|
|
70
|
+
{outputs.length === 0 ? (
|
|
71
|
+
<EmptyState variant="compact" description={t('thought.noOutputs')} />
|
|
72
|
+
) : (
|
|
73
|
+
outputs.map((output) => {
|
|
74
|
+
// A row is a control only when the canvas can actually show
|
|
75
|
+
// the file — the caller says so per output, so a persisted
|
|
76
|
+
// turn whose artifact is gone lists the name without a dead
|
|
77
|
+
// button under it.
|
|
78
|
+
const openable = outputActions?.canOpen(output) === true;
|
|
79
|
+
return (
|
|
80
|
+
<Item
|
|
81
|
+
key={output.id}
|
|
82
|
+
role="listitem"
|
|
83
|
+
density="compact"
|
|
84
|
+
leading={<RiFileTextLine size="md" fill={colors.textSecondary} />}
|
|
85
|
+
title={output.name}
|
|
86
|
+
accessibilityLabel={
|
|
87
|
+
openable ? t('thought.openOutput', { name: output.name }) : output.name
|
|
88
|
+
}
|
|
89
|
+
onPress={openable ? () => outputActions?.open(output) : undefined}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
})
|
|
93
|
+
)}
|
|
94
|
+
</AccordionContent>
|
|
95
|
+
</AccordionItem>
|
|
96
|
+
|
|
97
|
+
<AccordionItem value="sources">
|
|
98
|
+
<AccordionTrigger>{t('thought.sources')}</AccordionTrigger>
|
|
99
|
+
<AccordionContent>
|
|
100
|
+
{sources.length === 0 ? (
|
|
101
|
+
<EmptyState variant="compact" description={t('thought.noSources')} />
|
|
102
|
+
) : (
|
|
103
|
+
sources.map((source, index) => (
|
|
104
|
+
<Item
|
|
105
|
+
key={source.url}
|
|
106
|
+
role="listitem"
|
|
107
|
+
density="compact"
|
|
108
|
+
leading={<RiGlobalLine size="sm" fill={colors.textSecondary} />}
|
|
109
|
+
title={source.title}
|
|
110
|
+
subtitle={source.domain}
|
|
111
|
+
accessibilityLabel={t('thought.sourceLabel', { n: index + 1, title: source.title })}
|
|
112
|
+
onPress={() => onOpenSource(source)}
|
|
113
|
+
/>
|
|
114
|
+
))
|
|
115
|
+
)}
|
|
116
|
+
</AccordionContent>
|
|
117
|
+
</AccordionItem>
|
|
118
|
+
</Accordion>
|
|
119
|
+
);
|
|
120
|
+
}
|