@w0nna_dev/lina-widget 1.1.2 → 1.2.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/dist/lina-widget.es.js +88 -50
- package/dist/lina-widget.umd.js +9 -9
- package/dist/sounds/pop-connect.mp3 +0 -0
- package/dist/sounds/pop-disconnect.mp3 +0 -0
- package/dist/src/components/orb-widget.d.ts +14 -1
- package/dist/src/core/orb/SoundManager.d.ts +25 -7
- package/dist/src/orb/core/LiveKitManager.d.ts +9 -0
- package/package.json +5 -5
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import { HancAiWidgetConfig, WidgetMode } from '../orb/components';
|
|
3
|
-
type ColorPreset = 'indigo' | 'cyan' | 'emerald' | 'rose' | 'amber';
|
|
3
|
+
type ColorPreset = 'indigo' | 'cyan' | 'emerald' | 'rose' | 'amber' | 'purple' | 'blue' | 'pink' | 'orange' | 'teal' | 'violet' | 'red' | 'gold' | 'lime' | 'sky';
|
|
4
4
|
type ThemeMode = 'auto' | 'dark' | 'light';
|
|
5
5
|
export declare class HancAiOrbElement extends LitElement {
|
|
6
6
|
static styles: import('lit').CSSResult[];
|
|
@@ -23,10 +23,23 @@ export declare class HancAiOrbElement extends LitElement {
|
|
|
23
23
|
colorPreset: ColorPreset;
|
|
24
24
|
private orbContainer?;
|
|
25
25
|
private currentState;
|
|
26
|
+
private customColor;
|
|
26
27
|
private widget;
|
|
27
28
|
private themeQuery;
|
|
28
29
|
connectedCallback(): void;
|
|
29
30
|
disconnectedCallback(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Handle agent commands received via data channel
|
|
33
|
+
*/
|
|
34
|
+
private handleAgentCommand;
|
|
35
|
+
/**
|
|
36
|
+
* Set a custom color for the orb (persists to localStorage)
|
|
37
|
+
*/
|
|
38
|
+
setCustomColor(color: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Reset to default color preset (clears custom color)
|
|
41
|
+
*/
|
|
42
|
+
resetColor(): void;
|
|
30
43
|
firstUpdated(): void;
|
|
31
44
|
protected updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
32
45
|
render(): import('lit-html').TemplateResult<1>;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SoundManager -
|
|
3
|
-
* Uses Web Audio API
|
|
2
|
+
* SoundManager - Sound effects for call events
|
|
3
|
+
* Uses MP3 files for connect/disconnect sounds with Web Audio API fallback
|
|
4
4
|
*/
|
|
5
5
|
export interface SoundConfig {
|
|
6
6
|
enabled: boolean;
|
|
7
7
|
volume: number;
|
|
8
|
+
connectSoundUrl?: string;
|
|
9
|
+
disconnectSoundUrl?: string;
|
|
8
10
|
}
|
|
9
11
|
export declare class SoundManager {
|
|
10
12
|
private audioContext;
|
|
11
13
|
private config;
|
|
14
|
+
private connectAudio;
|
|
15
|
+
private disconnectAudio;
|
|
12
16
|
constructor(config?: Partial<SoundConfig>);
|
|
17
|
+
/**
|
|
18
|
+
* Preload audio files for instant playback
|
|
19
|
+
*/
|
|
20
|
+
private preloadAudio;
|
|
13
21
|
/**
|
|
14
22
|
* Initialize audio context (must be called from user interaction)
|
|
15
23
|
*/
|
|
@@ -20,17 +28,27 @@ export declare class SoundManager {
|
|
|
20
28
|
*/
|
|
21
29
|
prewarm(): Promise<void>;
|
|
22
30
|
/**
|
|
23
|
-
*
|
|
31
|
+
* Play MP3 audio element
|
|
32
|
+
*/
|
|
33
|
+
private playAudioElement;
|
|
34
|
+
/**
|
|
35
|
+
* Create a synthesized tone (fallback)
|
|
24
36
|
*/
|
|
25
37
|
private createTone;
|
|
26
38
|
/**
|
|
27
|
-
*
|
|
28
|
-
|
|
39
|
+
* Synthesized fallback for call start sound
|
|
40
|
+
*/
|
|
41
|
+
private playSynthesizedStartSound;
|
|
42
|
+
/**
|
|
43
|
+
* Synthesized fallback for call end sound
|
|
44
|
+
*/
|
|
45
|
+
private playSynthesizedEndSound;
|
|
46
|
+
/**
|
|
47
|
+
* Play call start sound (MP3 with synthesized fallback)
|
|
29
48
|
*/
|
|
30
49
|
playCallStartSound(): Promise<void>;
|
|
31
50
|
/**
|
|
32
|
-
* Play
|
|
33
|
-
* Single soft tone
|
|
51
|
+
* Play call end sound (MP3 with synthesized fallback)
|
|
34
52
|
*/
|
|
35
53
|
playCallEndSound(): Promise<void>;
|
|
36
54
|
/**
|
|
@@ -13,11 +13,20 @@ export interface LiveKitConfig {
|
|
|
13
13
|
agentId: string;
|
|
14
14
|
voiceServiceUrl: string;
|
|
15
15
|
}
|
|
16
|
+
export interface AgentCommand {
|
|
17
|
+
type: 'change_color' | 'set_emotion' | 'agent_state';
|
|
18
|
+
payload?: {
|
|
19
|
+
color?: string;
|
|
20
|
+
emotion?: 'neutral' | 'joy' | 'thinking' | 'interrupted';
|
|
21
|
+
state?: 'idle' | 'listening' | 'thinking' | 'speaking';
|
|
22
|
+
};
|
|
23
|
+
}
|
|
16
24
|
export interface LiveKitManagerCallbacks {
|
|
17
25
|
onStateChange?: (state: CallState, previousState: CallState) => void;
|
|
18
26
|
onCallStart?: (event: CallStartEvent) => void;
|
|
19
27
|
onCallEnd?: (event: CallEndEvent) => void;
|
|
20
28
|
onAudioTrack?: (stream: MediaStream) => void;
|
|
29
|
+
onAgentCommand?: (command: AgentCommand) => void;
|
|
21
30
|
onError?: (error: Error) => void;
|
|
22
31
|
}
|
|
23
32
|
export declare class LiveKitManager {
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w0nna_dev/lina-widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"private": false,
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "restricted"
|
|
7
|
+
},
|
|
5
8
|
"type": "module",
|
|
6
9
|
"main": "dist/lina-widget.umd.js",
|
|
7
10
|
"module": "dist/lina-widget.es.js",
|
|
@@ -10,14 +13,11 @@
|
|
|
10
13
|
"dist",
|
|
11
14
|
"README.md"
|
|
12
15
|
],
|
|
13
|
-
"publishConfig": {
|
|
14
|
-
"access": "restricted"
|
|
15
|
-
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"dev": "vite",
|
|
18
18
|
"build": "tsc && vite build",
|
|
19
19
|
"preview": "vite preview",
|
|
20
|
-
"release": "pnpm build && changeset publish --access
|
|
20
|
+
"release": "pnpm build && changeset publish --access restricted"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lit": "^3.2.1",
|