voice-page-agent 0.1.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,151 @@
1
+ import * as vue from 'vue';
2
+
3
+ type VoiceStateStatus = "idle" | "waking" | "listening_command" | "processing" | "error" | "unsupported" | "off";
4
+ type VoicePageAgentState = {
5
+ status: VoiceStateStatus;
6
+ message: string;
7
+ supported: boolean;
8
+ enabled: boolean;
9
+ micPermissionGranted: boolean;
10
+ };
11
+ type RuntimePageAgent = {
12
+ panel: {
13
+ show: () => void;
14
+ expand: () => void;
15
+ };
16
+ execute: (task: string) => Promise<unknown>;
17
+ status?: "idle" | "running" | "completed" | "error" | string;
18
+ };
19
+ type VoicePageAgentOptions = {
20
+ pageAgent: Record<string, unknown>;
21
+ wakeWord?: string | string[];
22
+ enableHomophoneMatch?: boolean;
23
+ wakeCooldownMs?: number;
24
+ commandInitialTimeoutMs?: number;
25
+ commandSilenceTimeoutMs?: number;
26
+ commandMaxWindowMs?: number;
27
+ recognitionLang?: string;
28
+ showAgentWhenWake?: boolean;
29
+ autoStart?: boolean;
30
+ };
31
+ type ResolvedVoicePageAgentOptions = {
32
+ pageAgent: Record<string, unknown>;
33
+ wakeWord: string[];
34
+ enableHomophoneMatch: boolean;
35
+ wakeCooldownMs: number;
36
+ commandInitialTimeoutMs: number;
37
+ commandSilenceTimeoutMs: number;
38
+ commandMaxWindowMs: number;
39
+ recognitionLang: string;
40
+ showAgentWhenWake: boolean;
41
+ autoStart: boolean;
42
+ };
43
+ type VoiceStateListener = (state: VoicePageAgentState) => void;
44
+
45
+ declare class VoicePageAgentController {
46
+ private options;
47
+ private listeners;
48
+ private state;
49
+ private recognition;
50
+ private initAgentPromise;
51
+ private voiceEnabled;
52
+ private disposed;
53
+ private awaitingCommand;
54
+ private commandFinalText;
55
+ private commandInterimText;
56
+ private commandTimer;
57
+ private commandDeadlineTimer;
58
+ private restartBusy;
59
+ private lastWakeAt;
60
+ private wakeRegex;
61
+ private wakeHomophoneRegex;
62
+ constructor(options: VoicePageAgentOptions);
63
+ get snapshot(): {
64
+ status: VoiceStateStatus;
65
+ message: string;
66
+ supported: boolean;
67
+ enabled: boolean;
68
+ micPermissionGranted: boolean;
69
+ };
70
+ onStateChange(listener: VoiceStateListener): () => void;
71
+ openAgent(): Promise<RuntimePageAgent | null>;
72
+ startWake(): Promise<void>;
73
+ stopWake(): void;
74
+ runCommand(commandText: string): Promise<void>;
75
+ dispose(): void;
76
+ private hasSpeechSupport;
77
+ private patchState;
78
+ private clearCommandTimer;
79
+ private clearCommandDeadlineTimer;
80
+ private composeCommandText;
81
+ private scheduleFlushCommand;
82
+ private scheduleCommandDeadline;
83
+ private flushVoiceCommand;
84
+ private isWakePhraseHit;
85
+ private extractCommandAfterWake;
86
+ private sanitizeVoiceCommand;
87
+ private requestMicrophonePermission;
88
+ private syncPermissionState;
89
+ private ensureAgent;
90
+ private executeVoiceCommand;
91
+ private buildRecognition;
92
+ }
93
+ declare function createVoicePageAgent(options: VoicePageAgentOptions): VoicePageAgentController;
94
+
95
+ declare module "@vue/runtime-core" {
96
+ interface ComponentCustomProperties {
97
+ $voicePageAgent: VoicePageAgentController;
98
+ }
99
+ }
100
+
101
+ declare function useVoicePageAgent(): VoicePageAgentController;
102
+ declare const VoicePageAgentButton: vue.DefineComponent<vue.ExtractPropTypes<{
103
+ showStatus: {
104
+ type: BooleanConstructor;
105
+ default: boolean;
106
+ };
107
+ startText: {
108
+ type: StringConstructor;
109
+ default: string;
110
+ };
111
+ wakeOnText: {
112
+ type: StringConstructor;
113
+ default: string;
114
+ };
115
+ openText: {
116
+ type: StringConstructor;
117
+ default: string;
118
+ };
119
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
120
+ [key: string]: any;
121
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
122
+ showStatus: {
123
+ type: BooleanConstructor;
124
+ default: boolean;
125
+ };
126
+ startText: {
127
+ type: StringConstructor;
128
+ default: string;
129
+ };
130
+ wakeOnText: {
131
+ type: StringConstructor;
132
+ default: string;
133
+ };
134
+ openText: {
135
+ type: StringConstructor;
136
+ default: string;
137
+ };
138
+ }>> & Readonly<{}>, {
139
+ showStatus: boolean;
140
+ startText: string;
141
+ wakeOnText: string;
142
+ openText: string;
143
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
144
+ type VoicePageAgentPlugin = {
145
+ install: (app: unknown, options?: VoicePageAgentOptions) => void;
146
+ controller?: VoicePageAgentController;
147
+ };
148
+ declare function createVoicePageAgentPlugin(options: VoicePageAgentOptions): VoicePageAgentPlugin;
149
+ declare const VoicePageAgentVuePlugin: VoicePageAgentPlugin;
150
+
151
+ export { type ResolvedVoicePageAgentOptions, type RuntimePageAgent, VoicePageAgentButton, VoicePageAgentController, type VoicePageAgentOptions, VoicePageAgentVuePlugin as VoicePageAgentPlugin, type VoicePageAgentState, type VoiceStateListener, type VoiceStateStatus, createVoicePageAgent, createVoicePageAgentPlugin, useVoicePageAgent };
@@ -0,0 +1,151 @@
1
+ import * as vue from 'vue';
2
+
3
+ type VoiceStateStatus = "idle" | "waking" | "listening_command" | "processing" | "error" | "unsupported" | "off";
4
+ type VoicePageAgentState = {
5
+ status: VoiceStateStatus;
6
+ message: string;
7
+ supported: boolean;
8
+ enabled: boolean;
9
+ micPermissionGranted: boolean;
10
+ };
11
+ type RuntimePageAgent = {
12
+ panel: {
13
+ show: () => void;
14
+ expand: () => void;
15
+ };
16
+ execute: (task: string) => Promise<unknown>;
17
+ status?: "idle" | "running" | "completed" | "error" | string;
18
+ };
19
+ type VoicePageAgentOptions = {
20
+ pageAgent: Record<string, unknown>;
21
+ wakeWord?: string | string[];
22
+ enableHomophoneMatch?: boolean;
23
+ wakeCooldownMs?: number;
24
+ commandInitialTimeoutMs?: number;
25
+ commandSilenceTimeoutMs?: number;
26
+ commandMaxWindowMs?: number;
27
+ recognitionLang?: string;
28
+ showAgentWhenWake?: boolean;
29
+ autoStart?: boolean;
30
+ };
31
+ type ResolvedVoicePageAgentOptions = {
32
+ pageAgent: Record<string, unknown>;
33
+ wakeWord: string[];
34
+ enableHomophoneMatch: boolean;
35
+ wakeCooldownMs: number;
36
+ commandInitialTimeoutMs: number;
37
+ commandSilenceTimeoutMs: number;
38
+ commandMaxWindowMs: number;
39
+ recognitionLang: string;
40
+ showAgentWhenWake: boolean;
41
+ autoStart: boolean;
42
+ };
43
+ type VoiceStateListener = (state: VoicePageAgentState) => void;
44
+
45
+ declare class VoicePageAgentController {
46
+ private options;
47
+ private listeners;
48
+ private state;
49
+ private recognition;
50
+ private initAgentPromise;
51
+ private voiceEnabled;
52
+ private disposed;
53
+ private awaitingCommand;
54
+ private commandFinalText;
55
+ private commandInterimText;
56
+ private commandTimer;
57
+ private commandDeadlineTimer;
58
+ private restartBusy;
59
+ private lastWakeAt;
60
+ private wakeRegex;
61
+ private wakeHomophoneRegex;
62
+ constructor(options: VoicePageAgentOptions);
63
+ get snapshot(): {
64
+ status: VoiceStateStatus;
65
+ message: string;
66
+ supported: boolean;
67
+ enabled: boolean;
68
+ micPermissionGranted: boolean;
69
+ };
70
+ onStateChange(listener: VoiceStateListener): () => void;
71
+ openAgent(): Promise<RuntimePageAgent | null>;
72
+ startWake(): Promise<void>;
73
+ stopWake(): void;
74
+ runCommand(commandText: string): Promise<void>;
75
+ dispose(): void;
76
+ private hasSpeechSupport;
77
+ private patchState;
78
+ private clearCommandTimer;
79
+ private clearCommandDeadlineTimer;
80
+ private composeCommandText;
81
+ private scheduleFlushCommand;
82
+ private scheduleCommandDeadline;
83
+ private flushVoiceCommand;
84
+ private isWakePhraseHit;
85
+ private extractCommandAfterWake;
86
+ private sanitizeVoiceCommand;
87
+ private requestMicrophonePermission;
88
+ private syncPermissionState;
89
+ private ensureAgent;
90
+ private executeVoiceCommand;
91
+ private buildRecognition;
92
+ }
93
+ declare function createVoicePageAgent(options: VoicePageAgentOptions): VoicePageAgentController;
94
+
95
+ declare module "@vue/runtime-core" {
96
+ interface ComponentCustomProperties {
97
+ $voicePageAgent: VoicePageAgentController;
98
+ }
99
+ }
100
+
101
+ declare function useVoicePageAgent(): VoicePageAgentController;
102
+ declare const VoicePageAgentButton: vue.DefineComponent<vue.ExtractPropTypes<{
103
+ showStatus: {
104
+ type: BooleanConstructor;
105
+ default: boolean;
106
+ };
107
+ startText: {
108
+ type: StringConstructor;
109
+ default: string;
110
+ };
111
+ wakeOnText: {
112
+ type: StringConstructor;
113
+ default: string;
114
+ };
115
+ openText: {
116
+ type: StringConstructor;
117
+ default: string;
118
+ };
119
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
120
+ [key: string]: any;
121
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
122
+ showStatus: {
123
+ type: BooleanConstructor;
124
+ default: boolean;
125
+ };
126
+ startText: {
127
+ type: StringConstructor;
128
+ default: string;
129
+ };
130
+ wakeOnText: {
131
+ type: StringConstructor;
132
+ default: string;
133
+ };
134
+ openText: {
135
+ type: StringConstructor;
136
+ default: string;
137
+ };
138
+ }>> & Readonly<{}>, {
139
+ showStatus: boolean;
140
+ startText: string;
141
+ wakeOnText: string;
142
+ openText: string;
143
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
144
+ type VoicePageAgentPlugin = {
145
+ install: (app: unknown, options?: VoicePageAgentOptions) => void;
146
+ controller?: VoicePageAgentController;
147
+ };
148
+ declare function createVoicePageAgentPlugin(options: VoicePageAgentOptions): VoicePageAgentPlugin;
149
+ declare const VoicePageAgentVuePlugin: VoicePageAgentPlugin;
150
+
151
+ export { type ResolvedVoicePageAgentOptions, type RuntimePageAgent, VoicePageAgentButton, VoicePageAgentController, type VoicePageAgentOptions, VoicePageAgentVuePlugin as VoicePageAgentPlugin, type VoicePageAgentState, type VoiceStateListener, type VoiceStateStatus, createVoicePageAgent, createVoicePageAgentPlugin, useVoicePageAgent };