@alia.onl/sdk 1.0.0 → 3.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/package.json +37 -3
- package/src/components/AliaChatContent.tsx +313 -0
- package/src/components/AliaChatInput.tsx +174 -27
- package/src/components/AliaChatMessageList.tsx +220 -34
- package/src/components/AliaChatScreen.tsx +132 -0
- package/src/components/AliaChatSheet.tsx +36 -49
- package/src/components/AliaChatSuggestions.tsx +1 -1
- package/src/components/AliaFace.tsx +402 -0
- package/src/components/Markdown.tsx +288 -0
- package/src/components/Reasoning.tsx +154 -0
- package/src/components/ThinkingIndicator.tsx +134 -0
- package/src/components/ui/button.tsx +104 -0
- package/src/components/ui/chat-text-input.tsx +164 -0
- package/src/components/ui/dropdown-menu.tsx +2 -0
- package/src/components/ui/dropdown-menu.web.tsx +355 -0
- package/src/components/ui/prompt-input/actions.tsx +28 -0
- package/src/components/ui/prompt-input/add-menu.tsx +83 -0
- package/src/components/ui/prompt-input/attachments.tsx +183 -0
- package/src/components/ui/prompt-input/autocomplete.tsx +168 -0
- package/src/components/ui/prompt-input/context.tsx +71 -0
- package/src/components/ui/prompt-input/mic-button.tsx +53 -0
- package/src/components/ui/prompt-input/prompt-input.tsx +276 -0
- package/src/components/ui/prompt-input/submit-button.tsx +49 -0
- package/src/components/ui/prompt-input/textarea.tsx +64 -0
- package/src/components/ui/text.tsx +29 -0
- package/src/components/voice/AudioWaveVisualizer.tsx +377 -0
- package/src/components/voice/VoiceControls.tsx +180 -0
- package/src/components/voice/VoiceOverlay.tsx +43 -0
- package/src/hooks/useAliaChat.ts +278 -91
- package/src/hooks/useAudioLevelMonitor.ts +142 -0
- package/src/hooks/useAudioLevels.ts +51 -0
- package/src/hooks/useDocumentPicker.ts +37 -0
- package/src/hooks/useImagePicker.ts +38 -0
- package/src/hooks/useSoundEffects.ts +128 -0
- package/src/hooks/useSpeechToText.ts +182 -0
- package/src/hooks/useTTS.ts +233 -0
- package/src/hooks/useVoiceRoom.ts +420 -0
- package/src/index.ts +71 -6
- package/src/lib/keyboard.native.tsx +6 -0
- package/src/lib/keyboard.tsx +25 -0
- package/src/lib/utils.ts +14 -0
- package/src/optional-deps.d.ts +86 -0
- package/src/theme.ts +25 -2
- package/src/types.ts +63 -1
package/src/types.ts
CHANGED
|
@@ -1,16 +1,56 @@
|
|
|
1
|
+
// ── Chat Message Types ──
|
|
2
|
+
|
|
3
|
+
export interface ResearchProgress {
|
|
4
|
+
phase?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
subQuestions?: string[];
|
|
7
|
+
sourcesFound?: number;
|
|
8
|
+
currentQuery?: string;
|
|
9
|
+
iteration?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface PlanStep {
|
|
13
|
+
action: string;
|
|
14
|
+
description: string;
|
|
15
|
+
toolName?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface PendingPlan {
|
|
19
|
+
planId: string;
|
|
20
|
+
steps: PlanStep[];
|
|
21
|
+
approved: boolean;
|
|
22
|
+
rejected: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
1
25
|
export interface ChatMessage {
|
|
2
26
|
id: string;
|
|
3
27
|
role: 'user' | 'assistant' | 'system';
|
|
4
28
|
content: string;
|
|
5
29
|
toolInvocations?: ToolInvocation[];
|
|
6
30
|
createdAt: number;
|
|
31
|
+
/** Extended thinking / reasoning content */
|
|
32
|
+
thinking?: string;
|
|
33
|
+
/** Deep research progress metadata */
|
|
34
|
+
researchProgress?: ResearchProgress;
|
|
35
|
+
/** Plan preview data (pending approval) */
|
|
36
|
+
pendingPlan?: PendingPlan;
|
|
37
|
+
/** Message origin: text chat or voice */
|
|
38
|
+
source?: 'text' | 'voice';
|
|
39
|
+
/** Speaker identity in cohost voice mode */
|
|
40
|
+
speaker?: 'primary' | 'cohost';
|
|
41
|
+
/** Whether a voice transcript is still streaming */
|
|
42
|
+
isStreaming?: boolean;
|
|
43
|
+
/** Cached TTS audio URL for read-aloud */
|
|
44
|
+
audioUrl?: string;
|
|
7
45
|
}
|
|
8
46
|
|
|
9
47
|
export interface ToolInvocation {
|
|
10
48
|
toolName: string;
|
|
11
|
-
state: 'call' | 'result';
|
|
49
|
+
state: 'call' | 'partial-call' | 'result';
|
|
12
50
|
args?: Record<string, any>;
|
|
13
51
|
result?: any;
|
|
52
|
+
/** OpenAI-format tool call ID for matching calls to results */
|
|
53
|
+
toolCallId?: string;
|
|
14
54
|
}
|
|
15
55
|
|
|
16
56
|
export interface AliaChatSuggestion {
|
|
@@ -18,3 +58,25 @@ export interface AliaChatSuggestion {
|
|
|
18
58
|
icon?: string;
|
|
19
59
|
prompt: string;
|
|
20
60
|
}
|
|
61
|
+
|
|
62
|
+
// ── Voice Types ──
|
|
63
|
+
|
|
64
|
+
export type RoomState = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
65
|
+
export type AgentState = 'idle' | 'listening' | 'thinking' | 'speaking';
|
|
66
|
+
|
|
67
|
+
export interface VoiceToolInvocation {
|
|
68
|
+
toolCallId: string;
|
|
69
|
+
toolName: string;
|
|
70
|
+
state: 'call' | 'result';
|
|
71
|
+
args?: any;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface VoiceMessage {
|
|
75
|
+
id: string;
|
|
76
|
+
role: 'user' | 'assistant';
|
|
77
|
+
speaker?: 'primary' | 'cohost';
|
|
78
|
+
content: string;
|
|
79
|
+
timestamp: number;
|
|
80
|
+
isStreaming: boolean;
|
|
81
|
+
toolInvocations?: VoiceToolInvocation[];
|
|
82
|
+
}
|