@alia.onl/sdk 1.0.0 → 2.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.
@@ -0,0 +1,69 @@
1
+ // Type declarations for optional peer dependencies.
2
+ // These prevent TypeScript errors when the deps aren't installed.
3
+ // At runtime, the host app provides the actual packages.
4
+
5
+ declare module 'livekit-client' {
6
+ export class Room {
7
+ on(event: any, listener: (...args: any[]) => void): this;
8
+ off(event: any, listener: (...args: any[]) => void): this;
9
+ localParticipant: LocalParticipant;
10
+ remoteParticipants: Map<string, RemoteParticipant>;
11
+ connect(url: string, token: string, options?: any): Promise<void>;
12
+ disconnect(): Promise<void>;
13
+ state: string;
14
+ }
15
+ export class LocalParticipant {
16
+ publishData(data: Uint8Array, options?: DataPublishOptions): Promise<void>;
17
+ getTrackPublications(): Map<string, any>;
18
+ getTrackPublication(source: string): any;
19
+ setMicrophoneEnabled(enabled: boolean): Promise<void>;
20
+ audioTrackPublications: Map<string, any>;
21
+ trackPublications: Map<string, any>;
22
+ }
23
+ export class RemoteParticipant {
24
+ getTrackPublications(): Map<string, RemoteTrackPublication>;
25
+ audioTrackPublications: Map<string, RemoteTrackPublication>;
26
+ trackPublications: Map<string, RemoteTrackPublication>;
27
+ identity: string;
28
+ }
29
+ export class RemoteTrackPublication {
30
+ track: any;
31
+ source: string;
32
+ kind: string;
33
+ isSubscribed: boolean;
34
+ trackSid: string;
35
+ }
36
+ export interface DataPublishOptions {
37
+ reliable?: boolean;
38
+ topic?: string;
39
+ }
40
+ export const RoomEvent: Record<string, string>;
41
+ export const Track: { Source: Record<string, string>; Kind: Record<string, string> };
42
+ export const DataPacket_Kind: Record<string, number>;
43
+ export enum DisconnectReason {
44
+ UNKNOWN_REASON = 0,
45
+ CLIENT_INITIATED = 1,
46
+ DUPLICATE_IDENTITY = 2,
47
+ SERVER_SHUTDOWN = 3,
48
+ PARTICIPANT_REMOVED = 4,
49
+ ROOM_DELETED = 5,
50
+ STATE_MISMATCH = 6,
51
+ JOIN_FAILURE = 7,
52
+ }
53
+ }
54
+
55
+ declare module 'expo-audio' {
56
+ export function createAudioPlayer(source: any): any;
57
+ export function useAudioRecorder(preset: any): any;
58
+ export function useAudioRecorderState(recorder: any, interval: number): any;
59
+ export function requestRecordingPermissionsAsync(): Promise<{ granted: boolean }>;
60
+ export function setAudioModeAsync(mode: any): Promise<void>;
61
+ export const RecordingPresets: { HIGH_QUALITY: any };
62
+ export class AudioRecorder {
63
+ constructor(preset: any);
64
+ prepareToRecordAsync(): Promise<void>;
65
+ record(): void;
66
+ stop(): Promise<void>;
67
+ uri: string | null;
68
+ }
69
+ }
package/src/theme.ts CHANGED
@@ -11,6 +11,9 @@ const COLORS = {
11
11
  secondaryText: '#8E8E93',
12
12
  icon: '#687076',
13
13
  tint: '#0a7ea4',
14
+ muted: '#F4F4F5',
15
+ mutedForeground: '#71717A',
16
+ primary: '#0a7ea4',
14
17
  },
15
18
  dark: {
16
19
  text: '#ECEDEE',
@@ -21,12 +24,32 @@ const COLORS = {
21
24
  secondaryText: '#8E8E93',
22
25
  icon: '#9BA1A6',
23
26
  tint: '#fff',
27
+ muted: '#27272A',
28
+ mutedForeground: '#A1A1AA',
29
+ primary: '#38BDF8',
24
30
  },
25
31
  } as const;
26
32
 
27
- export type AliaColors = (typeof COLORS)['light'];
33
+ export interface AliaColors {
34
+ text: string;
35
+ background: string;
36
+ card: string;
37
+ inputBackground: string;
38
+ border: string;
39
+ secondaryText: string;
40
+ icon: string;
41
+ tint: string;
42
+ muted: string;
43
+ mutedForeground: string;
44
+ primary: string;
45
+ isDark: boolean;
46
+ }
28
47
 
29
48
  export function useAliaColors(): AliaColors {
30
49
  const scheme = useColorScheme();
31
- return useMemo(() => COLORS[scheme ?? 'light'], [scheme]);
50
+ const key = scheme === 'dark' ? 'dark' : 'light';
51
+ return useMemo(() => ({
52
+ ...COLORS[key],
53
+ isDark: key === 'dark',
54
+ }), [key]);
32
55
  }
package/src/types.ts CHANGED
@@ -1,16 +1,52 @@
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 PendingPlan {
13
+ planId: string;
14
+ intent: string;
15
+ confidence?: number;
16
+ steps: string[];
17
+ approved: boolean;
18
+ rejected: boolean;
19
+ }
20
+
1
21
  export interface ChatMessage {
2
22
  id: string;
3
23
  role: 'user' | 'assistant' | 'system';
4
24
  content: string;
5
25
  toolInvocations?: ToolInvocation[];
6
26
  createdAt: number;
27
+ /** Extended thinking / reasoning content */
28
+ thinking?: string;
29
+ /** Deep research progress metadata */
30
+ researchProgress?: ResearchProgress;
31
+ /** Plan preview data (pending approval) */
32
+ pendingPlan?: PendingPlan;
33
+ /** Message origin: text chat or voice */
34
+ source?: 'text' | 'voice';
35
+ /** Speaker identity in cohost voice mode */
36
+ speaker?: 'primary' | 'cohost';
37
+ /** Whether a voice transcript is still streaming */
38
+ isStreaming?: boolean;
39
+ /** Cached TTS audio URL for read-aloud */
40
+ audioUrl?: string;
7
41
  }
8
42
 
9
43
  export interface ToolInvocation {
10
44
  toolName: string;
11
- state: 'call' | 'result';
45
+ state: 'call' | 'partial-call' | 'result';
12
46
  args?: Record<string, any>;
13
47
  result?: any;
48
+ /** OpenAI-format tool call ID for matching calls to results */
49
+ toolCallId?: string;
14
50
  }
15
51
 
16
52
  export interface AliaChatSuggestion {
@@ -18,3 +54,25 @@ export interface AliaChatSuggestion {
18
54
  icon?: string;
19
55
  prompt: string;
20
56
  }
57
+
58
+ // ── Voice Types ──
59
+
60
+ export type RoomState = 'disconnected' | 'connecting' | 'connected' | 'error';
61
+ export type AgentState = 'idle' | 'listening' | 'thinking' | 'speaking';
62
+
63
+ export interface VoiceToolInvocation {
64
+ toolCallId: string;
65
+ toolName: string;
66
+ state: 'call' | 'result';
67
+ args?: any;
68
+ }
69
+
70
+ export interface VoiceMessage {
71
+ id: string;
72
+ role: 'user' | 'assistant';
73
+ speaker?: 'primary' | 'cohost';
74
+ content: string;
75
+ timestamp: number;
76
+ isStreaming: boolean;
77
+ toolInvocations?: VoiceToolInvocation[];
78
+ }