@alia.onl/sdk 3.0.0 → 3.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alia.onl/sdk",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "description": "Alia AI chat SDK — reusable chat UI, voice, and streaming components for Oxy apps",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -17,7 +17,7 @@
17
17
  "peerDependencies": {
18
18
  "react": ">=18",
19
19
  "react-native": ">=0.73",
20
- "@oxyhq/services": ">=6.0.0",
20
+ "@oxyhq/services": "6.10.7",
21
21
  "expo-blur": "*",
22
22
  "react-native-reanimated": ">=3",
23
23
  "react-native-gesture-handler": ">=2",
@@ -39,22 +39,50 @@
39
39
  "@radix-ui/react-dropdown-menu": ">=2"
40
40
  },
41
41
  "peerDependenciesMeta": {
42
- "livekit-client": { "optional": true },
43
- "expo-audio": { "optional": true },
44
- "react-native-svg": { "optional": true },
45
- "nativewind": { "optional": true },
46
- "clsx": { "optional": true },
47
- "tailwind-merge": { "optional": true },
48
- "class-variance-authority": { "optional": true },
49
- "zeego": { "optional": true },
50
- "expo-image": { "optional": true },
51
- "expo-image-picker": { "optional": true },
52
- "expo-document-picker": { "optional": true },
53
- "expo-clipboard": { "optional": true },
54
- "lucide-react-native": { "optional": true },
55
- "@radix-ui/react-dropdown-menu": { "optional": true }
42
+ "livekit-client": {
43
+ "optional": true
56
44
  },
57
- "devDependencies": {
58
- "typescript": "^5.9.3"
59
- }
45
+ "expo-audio": {
46
+ "optional": true
47
+ },
48
+ "react-native-svg": {
49
+ "optional": true
50
+ },
51
+ "nativewind": {
52
+ "optional": true
53
+ },
54
+ "clsx": {
55
+ "optional": true
56
+ },
57
+ "tailwind-merge": {
58
+ "optional": true
59
+ },
60
+ "class-variance-authority": {
61
+ "optional": true
62
+ },
63
+ "zeego": {
64
+ "optional": true
65
+ },
66
+ "expo-image": {
67
+ "optional": true
68
+ },
69
+ "expo-image-picker": {
70
+ "optional": true
71
+ },
72
+ "expo-document-picker": {
73
+ "optional": true
74
+ },
75
+ "expo-clipboard": {
76
+ "optional": true
77
+ },
78
+ "lucide-react-native": {
79
+ "optional": true
80
+ },
81
+ "@radix-ui/react-dropdown-menu": {
82
+ "optional": true
83
+ }
84
+ },
85
+ "devDependencies": {
86
+ "typescript": "^5.9.3"
87
+ }
60
88
  }
@@ -14,7 +14,7 @@ import React, {
14
14
  useMemo,
15
15
  useRef,
16
16
  } from 'react';
17
- import { View, Pressable, StyleSheet } from 'react-native';
17
+ import { View, StyleSheet } from 'react-native';
18
18
  import { useSharedValue, withTiming, Easing } from 'react-native-reanimated';
19
19
  import type { SharedValue } from 'react-native-reanimated';
20
20
  import { Volume2 } from 'lucide-react-native';
@@ -27,17 +27,15 @@ import { useSTTStore } from '../hooks/useSpeechToText';
27
27
  import { VoiceOverlay } from './voice/VoiceOverlay';
28
28
  import { VoiceControls } from './voice/VoiceControls';
29
29
  import { AliaChatMessageList } from './AliaChatMessageList';
30
+ import { AliaWelcomeMessage, type WelcomeSuggestion } from './AliaWelcomeMessage';
30
31
  import { PromptInput } from './ui/prompt-input/prompt-input';
31
32
  import { Button } from './ui/button';
32
- import { AliaChatSuggestions } from './AliaChatSuggestions';
33
33
  import type { AliaExpression } from './AliaFace';
34
- import type { AliaChatSuggestion } from '../types';
35
34
  import type { ChatMessage } from '../types';
36
35
  import type { Completion } from './ui/prompt-input/context';
37
36
 
38
37
  export interface AliaChatContentProps {
39
38
  clientContext?: string;
40
- suggestions?: AliaChatSuggestion[];
41
39
  model?: string;
42
40
  apiUrl?: string;
43
41
  /** Shared value for scroll offset (used by sheet for pan-to-dismiss) */
@@ -48,6 +46,19 @@ export interface AliaChatContentProps {
48
46
  onSuggestionUsed?: (suggestionId: string) => void;
49
47
  /** Error handler (e.g. toast) */
50
48
  onError?: (message: string) => void;
49
+ // Welcome message
50
+ welcomeGreeting?: string;
51
+ welcomeSubtitle?: string;
52
+ welcomeSuggestions?: WelcomeSuggestion[];
53
+ // Message action callbacks
54
+ onEditMessage?: (messageId: string, newContent: string) => void;
55
+ onThumbsUp?: (messageId: string) => void;
56
+ onThumbsDown?: (messageId: string) => void;
57
+ onApprovePlan?: (planId: string) => void;
58
+ onRejectPlan?: (planId: string) => void;
59
+ onToolResultPress?: (messageId: string) => void;
60
+ /** Override markdown renderer (app passes CustomMarkdown) */
61
+ renderMarkdown?: (content: string) => React.ReactNode;
51
62
  }
52
63
 
53
64
  export interface AliaChatContentRef {
@@ -72,7 +83,25 @@ function adaptVoiceMessage(vm: any): ChatMessage {
72
83
  }
73
84
 
74
85
  export const AliaChatContent = forwardRef<AliaChatContentRef, AliaChatContentProps>(
75
- ({ clientContext, suggestions = [], model, apiUrl, scrollOffsetY: externalScrollOffsetY, useSuggestions, onSuggestionUsed, onError }, ref) => {
86
+ ({
87
+ clientContext,
88
+ model,
89
+ apiUrl,
90
+ scrollOffsetY: externalScrollOffsetY,
91
+ useSuggestions,
92
+ onSuggestionUsed,
93
+ onError,
94
+ welcomeGreeting,
95
+ welcomeSubtitle,
96
+ welcomeSuggestions,
97
+ onEditMessage,
98
+ onThumbsUp,
99
+ onThumbsDown,
100
+ onApprovePlan,
101
+ onRejectPlan,
102
+ onToolResultPress,
103
+ renderMarkdown,
104
+ }, ref) => {
76
105
  // ── Chat ──
77
106
  const chatOptions: UseAliaChatOptions = { apiUrl, model, clientContext };
78
107
  const { messages, setMessages, send, isStreaming, stop, clear } = useAliaChat(chatOptions);
@@ -187,7 +216,17 @@ export const AliaChatContent = forwardRef<AliaChatContentRef, AliaChatContentPro
187
216
  return 'Writing E';
188
217
  }, [messages, isStreaming, isVoiceActive, voiceRoom.agentState]);
189
218
 
190
- const showSuggestions = messages.length === 0 && suggestions.length > 0;
219
+ const welcomeComponent = useMemo(() => {
220
+ if (!welcomeGreeting || messages.length > 0) return undefined;
221
+ return (
222
+ <AliaWelcomeMessage
223
+ greeting={welcomeGreeting}
224
+ subtitle={welcomeSubtitle}
225
+ suggestions={welcomeSuggestions}
226
+ onSuggestionPress={send}
227
+ />
228
+ );
229
+ }, [welcomeGreeting, welcomeSubtitle, welcomeSuggestions, send, messages.length]);
191
230
 
192
231
  // ── Overlay state ──
193
232
  const showVoiceOverlay = isVoiceActive;
@@ -246,19 +285,23 @@ export const AliaChatContent = forwardRef<AliaChatContentRef, AliaChatContentPro
246
285
  />
247
286
  )}
248
287
 
249
- {/* Suggestions or Messages */}
250
- {showSuggestions ? (
251
- <AliaChatSuggestions suggestions={suggestions} onSelect={send} />
252
- ) : (
253
- <AliaChatMessageList
254
- messages={messages}
255
- isStreaming={isStreaming}
256
- scrollOffsetY={scrollOffsetY}
257
- onReadAloud={handleReadAloud}
258
- ttsActiveMessageId={tts.activeMessageId}
259
- ttsPlaybackState={tts.playbackState}
260
- />
261
- )}
288
+ {/* Welcome or Messages */}
289
+ <AliaChatMessageList
290
+ messages={messages}
291
+ isStreaming={isStreaming}
292
+ scrollOffsetY={scrollOffsetY}
293
+ onReadAloud={handleReadAloud}
294
+ ttsActiveMessageId={tts.activeMessageId}
295
+ ttsPlaybackState={tts.playbackState}
296
+ onEditMessage={onEditMessage}
297
+ onThumbsUp={onThumbsUp}
298
+ onThumbsDown={onThumbsDown}
299
+ onApprovePlan={onApprovePlan}
300
+ onRejectPlan={onRejectPlan}
301
+ onToolResultPress={onToolResultPress}
302
+ renderMarkdown={renderMarkdown}
303
+ welcomeComponent={welcomeComponent}
304
+ />
262
305
 
263
306
  {/* Input or Voice Controls */}
264
307
  {isVoiceActive ? (