@alia.onl/sdk 10.1.1 → 11.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +24 -0
  3. package/package.json +4 -6
  4. package/src/components/AliaAvatar.tsx +66 -0
  5. package/src/components/AliaChatContent.tsx +235 -112
  6. package/src/components/AliaChatHeader.tsx +118 -0
  7. package/src/components/AliaChatMessageList.tsx +171 -260
  8. package/src/components/AliaChatScreen.tsx +23 -24
  9. package/src/components/AliaChatSheet.tsx +70 -316
  10. package/src/components/AliaWelcomeMessage.tsx +47 -50
  11. package/src/components/AmbientField.tsx +577 -0
  12. package/src/components/IdentityMark.tsx +10 -2
  13. package/src/components/Markdown.tsx +116 -40
  14. package/src/components/PlanPreviewCard.tsx +71 -55
  15. package/src/components/ThinkingBlock.tsx +47 -0
  16. package/src/components/VoiceModeIcon.tsx +10 -0
  17. package/src/components/voice/VoiceControls.tsx +22 -73
  18. package/src/components/voice/VoiceSession.tsx +2 -1
  19. package/src/hooks/useAliaChat.ts +22 -15
  20. package/src/hooks/useAmbientWave.ts +35 -5
  21. package/src/hooks/useSoundEffects.ts +14 -11
  22. package/src/hooks/useSpeechToText.ts +9 -2
  23. package/src/hooks/useTTS.ts +163 -156
  24. package/src/hooks/useVoiceRoom.ts +228 -170
  25. package/src/index.ts +18 -6
  26. package/src/lib/catalogue.ts +17 -4
  27. package/src/lib/chat-stream.ts +25 -7
  28. package/src/lib/chat-transport.ts +2 -1
  29. package/src/lib/citations.ts +63 -0
  30. package/src/lib/content-utils.ts +3 -2
  31. package/src/lib/image-data-url.ts +15 -0
  32. package/src/lib/keyboard.tsx +1 -1
  33. package/src/lib/labels.tsx +81 -0
  34. package/src/lib/speech-recognition.native.ts +15 -4
  35. package/src/lib/speech-recognition.ts +27 -7
  36. package/src/lib/task-labels.ts +67 -0
  37. package/src/lib/tool-call-status.ts +28 -0
  38. package/src/lib/tool-registry.ts +14 -14
  39. package/src/lib/voice-text.ts +12 -6
  40. package/src/lib/voice-turn.ts +4 -1
  41. package/src/lib/work-log-copy.ts +61 -0
  42. package/src/lib/work-log.ts +378 -0
  43. package/src/tools.ts +11 -0
  44. package/src/types.ts +5 -2
  45. package/src/voice.ts +12 -4
  46. package/src/components/Reasoning.tsx +0 -152
  47. package/src/components/ResearchProgressCard.tsx +0 -159
  48. package/src/components/ThinkingIndicator.tsx +0 -98
  49. package/src/components/ui/button.tsx +0 -104
  50. package/src/components/ui/chat-text-input.tsx +0 -184
  51. package/src/components/ui/dropdown-menu.tsx +0 -2
  52. package/src/components/ui/dropdown-menu.web.tsx +0 -383
  53. package/src/components/ui/prompt-input/actions.tsx +0 -28
  54. package/src/components/ui/prompt-input/add-menu.tsx +0 -83
  55. package/src/components/ui/prompt-input/attachments.tsx +0 -181
  56. package/src/components/ui/prompt-input/autocomplete.tsx +0 -168
  57. package/src/components/ui/prompt-input/context.tsx +0 -71
  58. package/src/components/ui/prompt-input/mic-button.tsx +0 -53
  59. package/src/components/ui/prompt-input/prompt-input.tsx +0 -279
  60. package/src/components/ui/prompt-input/submit-button.tsx +0 -50
  61. package/src/components/ui/prompt-input/textarea.tsx +0 -80
  62. package/src/components/ui/text.tsx +0 -29
  63. package/src/components/voice/AudioWaveVisualizer.tsx +0 -444
  64. package/src/components/voice/VoiceOverlay.tsx +0 -75
@@ -0,0 +1,118 @@
1
+ import { ButtonGroup, ButtonGroupItem } from '@oxy.so/bloom/button-group';
2
+ import { RiCloseLine, RiDeleteBin6Line } from '@oxy.so/bloom/icons';
3
+ import { PageHeader } from '@oxy.so/bloom/page-header';
4
+ import { useTheme } from '@oxy.so/bloom/theme';
5
+ import { Text } from '@oxy.so/bloom/typography';
6
+ import { type ReactNode, useState } from 'react';
7
+ import { Pressable, StyleSheet, View } from 'react-native';
8
+ import { useLabels } from '../lib/labels';
9
+ import { AliaChatMark } from './AliaChatContent';
10
+
11
+ export interface AliaChatHeaderProps {
12
+ /** The chat has messages to clear. */
13
+ hasMessages: boolean;
14
+ onClear: () => void;
15
+ /** Draws the close island; omit where the chat is not dismissible. */
16
+ onClose?: () => void;
17
+ /** After the avatar, before the title — a host's back button. */
18
+ leading?: ReactNode;
19
+ /** The host's own actions, kept before clear and close. */
20
+ trailing?: ReactNode;
21
+ /** Pressing Alia's avatar or name. Omitted, the avatar waves. */
22
+ onProfilePress?: () => void;
23
+ }
24
+
25
+ /**
26
+ * Alia's avatar above a name capsule, the conversation header of Bloom's `MultiAgentChat`.
27
+ *
28
+ * TODO(bloom): `ChatAgentProfile` draws exactly this (a 56px avatar over a 28px capsule
29
+ * of radius 14, `backgroundSecondary` with a hairline border) but is not exported, so
30
+ * this repeats its geometry. Use Bloom's component when it is.
31
+ */
32
+ function AliaProfile({ onPress }: { onPress?: () => void }) {
33
+ const { colors } = useTheme();
34
+ const [hovered, setHovered] = useState(false);
35
+ const [reactionKey, setReactionKey] = useState(0);
36
+
37
+ // Without a host action the profile is still a button: the avatar waves back.
38
+ const handlePress = () => {
39
+ if (onPress) onPress();
40
+ else setReactionKey((key) => key + 1);
41
+ };
42
+
43
+ return (
44
+ <Pressable
45
+ accessibilityRole="button"
46
+ accessibilityLabel="Alia"
47
+ onPress={handlePress}
48
+ onHoverIn={() => setHovered(true)}
49
+ onHoverOut={() => setHovered(false)}
50
+ className="items-center"
51
+ >
52
+ <View pointerEvents="none" style={{ marginBottom: -2, zIndex: 1 }}>
53
+ <AliaChatMark size={56} reactionKey={reactionKey} />
54
+ </View>
55
+ <View
56
+ pointerEvents="none"
57
+ className="items-center justify-center rounded-[14px] px-2.5 py-1"
58
+ style={{
59
+ backgroundColor: hovered ? colors.backgroundTertiary : colors.backgroundSecondary,
60
+ borderWidth: StyleSheet.hairlineWidth,
61
+ borderColor: colors.border,
62
+ }}
63
+ >
64
+ <Text numberOfLines={1} className="text-[16px] font-medium leading-5 text-text-primary">
65
+ Alia
66
+ </Text>
67
+ </View>
68
+ </Pressable>
69
+ );
70
+ }
71
+
72
+ /**
73
+ * The chat's top bar: Bloom's `PageHeader`, set up as the shell sets it up for the
74
+ * agents' screens (inline, no scrim, no safe area), with Alia's profile as its title.
75
+ */
76
+ export function AliaChatHeader({
77
+ hasMessages,
78
+ onClear,
79
+ onClose,
80
+ leading,
81
+ trailing,
82
+ onProfilePress,
83
+ }: AliaChatHeaderProps) {
84
+ const labels = useLabels();
85
+ return (
86
+ <PageHeader
87
+ leading={leading}
88
+ title={<AliaProfile onPress={onProfilePress} />}
89
+ titleAlign="center"
90
+ actions={
91
+ <>
92
+ {trailing}
93
+ <ButtonGroup accessibilityLabel={labels.chatActions}>
94
+ {hasMessages ? (
95
+ <ButtonGroupItem
96
+ iconOnly
97
+ leadingIcon={RiDeleteBin6Line}
98
+ accessibilityLabel={labels.clear}
99
+ onPress={onClear}
100
+ />
101
+ ) : null}
102
+ {onClose ? (
103
+ <ButtonGroupItem
104
+ iconOnly
105
+ leadingIcon={RiCloseLine}
106
+ accessibilityLabel={labels.close}
107
+ onPress={onClose}
108
+ />
109
+ ) : null}
110
+ </ButtonGroup>
111
+ </>
112
+ }
113
+ scrim="none"
114
+ sticky={false}
115
+ safeArea={false}
116
+ />
117
+ );
118
+ }