voice-page-agent 2.7.6 → 2.7.7

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,119 @@
1
+ type VoiceStateStatus = "idle" | "waking" | "listening_command" | "processing" | "error" | "unsupported" | "off";
2
+ type VoicePageAgentState = {
3
+ status: VoiceStateStatus;
4
+ message: string;
5
+ supported: boolean;
6
+ enabled: boolean;
7
+ micPermissionGranted: boolean;
8
+ };
9
+ type RuntimePageAgent = {
10
+ panel?: {
11
+ show: () => void;
12
+ expand: () => void;
13
+ hide?: () => void;
14
+ collapse?: () => void;
15
+ };
16
+ execute: (task: string) => Promise<unknown>;
17
+ dispose?: (...args: unknown[]) => void;
18
+ disposed?: boolean;
19
+ status?: "idle" | "running" | "completed" | "error" | string;
20
+ };
21
+ type RuntimePageAgentCtor = new (config: Record<string, unknown>) => RuntimePageAgent;
22
+ type VoicePageAgentButtonTextOptions = {
23
+ startText?: string;
24
+ wakeOnText?: string;
25
+ openText?: string;
26
+ };
27
+ type VoicePageAgentButtonStyleOptions = {
28
+ wakeButtonBackground?: string;
29
+ wakeButtonTextColor?: string;
30
+ openButtonBackground?: string;
31
+ openButtonTextColor?: string;
32
+ };
33
+ type VoicePageAgentOptions = {
34
+ pageAgent: Record<string, unknown>;
35
+ pageAgentCtor?: RuntimePageAgentCtor;
36
+ wakeWord?: string | string[];
37
+ enableHomophoneMatch?: boolean;
38
+ wakeCooldownMs?: number;
39
+ commandInitialTimeoutMs?: number;
40
+ commandSilenceTimeoutMs?: number;
41
+ commandMaxWindowMs?: number;
42
+ recognitionLang?: string;
43
+ showAgentWhenWake?: boolean;
44
+ autoStart?: boolean;
45
+ buttonText?: VoicePageAgentButtonTextOptions;
46
+ buttonStyle?: VoicePageAgentButtonStyleOptions;
47
+ };
48
+ type ResolvedVoicePageAgentOptions = {
49
+ pageAgent: Record<string, unknown>;
50
+ pageAgentCtor?: RuntimePageAgentCtor;
51
+ wakeWord: string[];
52
+ enableHomophoneMatch: boolean;
53
+ wakeCooldownMs: number;
54
+ commandInitialTimeoutMs: number;
55
+ commandSilenceTimeoutMs: number;
56
+ commandMaxWindowMs: number;
57
+ recognitionLang: string;
58
+ showAgentWhenWake: boolean;
59
+ autoStart: boolean;
60
+ buttonText?: VoicePageAgentButtonTextOptions;
61
+ buttonStyle?: VoicePageAgentButtonStyleOptions;
62
+ };
63
+ type VoiceStateListener = (state: VoicePageAgentState) => void;
64
+
65
+ declare class VoicePageAgentController {
66
+ private options;
67
+ private listeners;
68
+ private state;
69
+ private recognition;
70
+ private initAgentPromise;
71
+ private voiceEnabled;
72
+ private disposed;
73
+ private awaitingCommand;
74
+ private commandFinalText;
75
+ private commandInterimText;
76
+ private commandTimer;
77
+ private commandDeadlineTimer;
78
+ private restartBusy;
79
+ private lastWakeAt;
80
+ private wakeRegex;
81
+ private wakeHomophoneRegex;
82
+ constructor(options: VoicePageAgentOptions);
83
+ get snapshot(): {
84
+ status: VoiceStateStatus;
85
+ message: string;
86
+ supported: boolean;
87
+ enabled: boolean;
88
+ micPermissionGranted: boolean;
89
+ };
90
+ onStateChange(listener: VoiceStateListener): () => void;
91
+ openAgent(): Promise<RuntimePageAgent | null>;
92
+ toggleAgentPanel(): Promise<void>;
93
+ startWake(): Promise<void>;
94
+ stopWake(): void;
95
+ runCommand(commandText: string): Promise<void>;
96
+ dispose(): void;
97
+ private hasSpeechSupport;
98
+ private patchState;
99
+ private clearCommandTimer;
100
+ private clearCommandDeadlineTimer;
101
+ private composeCommandText;
102
+ private scheduleFlushCommand;
103
+ private scheduleCommandDeadline;
104
+ private flushVoiceCommand;
105
+ private isWakePhraseHit;
106
+ private extractCommandAfterWake;
107
+ private sanitizeVoiceCommand;
108
+ private requestMicrophonePermission;
109
+ private syncPermissionState;
110
+ private ensureAgent;
111
+ private isAgentPanelVisible;
112
+ private hideAgentPanel;
113
+ private resolveAgentInitErrorMessage;
114
+ private executeVoiceCommand;
115
+ private buildRecognition;
116
+ }
117
+ declare function createVoicePageAgent(options: VoicePageAgentOptions): VoicePageAgentController;
118
+
119
+ export { type ResolvedVoicePageAgentOptions as R, VoicePageAgentController as V, type VoicePageAgentOptions as a, type RuntimePageAgent as b, type VoicePageAgentButtonStyleOptions as c, type VoicePageAgentButtonTextOptions as d, type VoicePageAgentState as e, type VoiceStateListener as f, type VoiceStateStatus as g, createVoicePageAgent as h };
@@ -0,0 +1,119 @@
1
+ type VoiceStateStatus = "idle" | "waking" | "listening_command" | "processing" | "error" | "unsupported" | "off";
2
+ type VoicePageAgentState = {
3
+ status: VoiceStateStatus;
4
+ message: string;
5
+ supported: boolean;
6
+ enabled: boolean;
7
+ micPermissionGranted: boolean;
8
+ };
9
+ type RuntimePageAgent = {
10
+ panel?: {
11
+ show: () => void;
12
+ expand: () => void;
13
+ hide?: () => void;
14
+ collapse?: () => void;
15
+ };
16
+ execute: (task: string) => Promise<unknown>;
17
+ dispose?: (...args: unknown[]) => void;
18
+ disposed?: boolean;
19
+ status?: "idle" | "running" | "completed" | "error" | string;
20
+ };
21
+ type RuntimePageAgentCtor = new (config: Record<string, unknown>) => RuntimePageAgent;
22
+ type VoicePageAgentButtonTextOptions = {
23
+ startText?: string;
24
+ wakeOnText?: string;
25
+ openText?: string;
26
+ };
27
+ type VoicePageAgentButtonStyleOptions = {
28
+ wakeButtonBackground?: string;
29
+ wakeButtonTextColor?: string;
30
+ openButtonBackground?: string;
31
+ openButtonTextColor?: string;
32
+ };
33
+ type VoicePageAgentOptions = {
34
+ pageAgent: Record<string, unknown>;
35
+ pageAgentCtor?: RuntimePageAgentCtor;
36
+ wakeWord?: string | string[];
37
+ enableHomophoneMatch?: boolean;
38
+ wakeCooldownMs?: number;
39
+ commandInitialTimeoutMs?: number;
40
+ commandSilenceTimeoutMs?: number;
41
+ commandMaxWindowMs?: number;
42
+ recognitionLang?: string;
43
+ showAgentWhenWake?: boolean;
44
+ autoStart?: boolean;
45
+ buttonText?: VoicePageAgentButtonTextOptions;
46
+ buttonStyle?: VoicePageAgentButtonStyleOptions;
47
+ };
48
+ type ResolvedVoicePageAgentOptions = {
49
+ pageAgent: Record<string, unknown>;
50
+ pageAgentCtor?: RuntimePageAgentCtor;
51
+ wakeWord: string[];
52
+ enableHomophoneMatch: boolean;
53
+ wakeCooldownMs: number;
54
+ commandInitialTimeoutMs: number;
55
+ commandSilenceTimeoutMs: number;
56
+ commandMaxWindowMs: number;
57
+ recognitionLang: string;
58
+ showAgentWhenWake: boolean;
59
+ autoStart: boolean;
60
+ buttonText?: VoicePageAgentButtonTextOptions;
61
+ buttonStyle?: VoicePageAgentButtonStyleOptions;
62
+ };
63
+ type VoiceStateListener = (state: VoicePageAgentState) => void;
64
+
65
+ declare class VoicePageAgentController {
66
+ private options;
67
+ private listeners;
68
+ private state;
69
+ private recognition;
70
+ private initAgentPromise;
71
+ private voiceEnabled;
72
+ private disposed;
73
+ private awaitingCommand;
74
+ private commandFinalText;
75
+ private commandInterimText;
76
+ private commandTimer;
77
+ private commandDeadlineTimer;
78
+ private restartBusy;
79
+ private lastWakeAt;
80
+ private wakeRegex;
81
+ private wakeHomophoneRegex;
82
+ constructor(options: VoicePageAgentOptions);
83
+ get snapshot(): {
84
+ status: VoiceStateStatus;
85
+ message: string;
86
+ supported: boolean;
87
+ enabled: boolean;
88
+ micPermissionGranted: boolean;
89
+ };
90
+ onStateChange(listener: VoiceStateListener): () => void;
91
+ openAgent(): Promise<RuntimePageAgent | null>;
92
+ toggleAgentPanel(): Promise<void>;
93
+ startWake(): Promise<void>;
94
+ stopWake(): void;
95
+ runCommand(commandText: string): Promise<void>;
96
+ dispose(): void;
97
+ private hasSpeechSupport;
98
+ private patchState;
99
+ private clearCommandTimer;
100
+ private clearCommandDeadlineTimer;
101
+ private composeCommandText;
102
+ private scheduleFlushCommand;
103
+ private scheduleCommandDeadline;
104
+ private flushVoiceCommand;
105
+ private isWakePhraseHit;
106
+ private extractCommandAfterWake;
107
+ private sanitizeVoiceCommand;
108
+ private requestMicrophonePermission;
109
+ private syncPermissionState;
110
+ private ensureAgent;
111
+ private isAgentPanelVisible;
112
+ private hideAgentPanel;
113
+ private resolveAgentInitErrorMessage;
114
+ private executeVoiceCommand;
115
+ private buildRecognition;
116
+ }
117
+ declare function createVoicePageAgent(options: VoicePageAgentOptions): VoicePageAgentController;
118
+
119
+ export { type ResolvedVoicePageAgentOptions as R, VoicePageAgentController as V, type VoicePageAgentOptions as a, type RuntimePageAgent as b, type VoicePageAgentButtonStyleOptions as c, type VoicePageAgentButtonTextOptions as d, type VoicePageAgentState as e, type VoiceStateListener as f, type VoiceStateStatus as g, createVoicePageAgent as h };
package/dist/index.cjs CHANGED
@@ -19346,6 +19346,7 @@ function resolveOptions(options) {
19346
19346
  ...DEFAULT_OPTIONS,
19347
19347
  ...options,
19348
19348
  pageAgent: options.pageAgent,
19349
+ pageAgentCtor: options.pageAgentCtor,
19349
19350
  wakeWord
19350
19351
  };
19351
19352
  }
@@ -19609,8 +19610,7 @@ var VoicePageAgentController = class {
19609
19610
  }
19610
19611
  if (this.initAgentPromise) return this.initAgentPromise;
19611
19612
  this.initAgentPromise = (async () => {
19612
- const mod = await Promise.resolve().then(() => (init_page_agent(), page_agent_exports));
19613
- const Agent = mod.PageAgent;
19613
+ const Agent = this.options.pageAgentCtor || (await Promise.resolve().then(() => (init_page_agent(), page_agent_exports))).PageAgent;
19614
19614
  let agent;
19615
19615
  try {
19616
19616
  agent = new Agent(this.options.pageAgent);
package/dist/index.d.cts CHANGED
@@ -1,120 +1,7 @@
1
+ import { V as VoicePageAgentController, a as VoicePageAgentOptions } from './controller-CUOCIsnS.cjs';
2
+ export { R as ResolvedVoicePageAgentOptions, b as RuntimePageAgent, c as VoicePageAgentButtonStyleOptions, d as VoicePageAgentButtonTextOptions, e as VoicePageAgentState, f as VoiceStateListener, g as VoiceStateStatus, h as createVoicePageAgent } from './controller-CUOCIsnS.cjs';
1
3
  import * as vue from 'vue';
2
4
 
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
- hide?: () => void;
16
- collapse?: () => void;
17
- };
18
- execute: (task: string) => Promise<unknown>;
19
- dispose?: (...args: unknown[]) => void;
20
- disposed?: boolean;
21
- status?: "idle" | "running" | "completed" | "error" | string;
22
- };
23
- type VoicePageAgentButtonTextOptions = {
24
- startText?: string;
25
- wakeOnText?: string;
26
- openText?: string;
27
- };
28
- type VoicePageAgentButtonStyleOptions = {
29
- wakeButtonBackground?: string;
30
- wakeButtonTextColor?: string;
31
- openButtonBackground?: string;
32
- openButtonTextColor?: string;
33
- };
34
- type VoicePageAgentOptions = {
35
- pageAgent: Record<string, unknown>;
36
- wakeWord?: string | string[];
37
- enableHomophoneMatch?: boolean;
38
- wakeCooldownMs?: number;
39
- commandInitialTimeoutMs?: number;
40
- commandSilenceTimeoutMs?: number;
41
- commandMaxWindowMs?: number;
42
- recognitionLang?: string;
43
- showAgentWhenWake?: boolean;
44
- autoStart?: boolean;
45
- buttonText?: VoicePageAgentButtonTextOptions;
46
- buttonStyle?: VoicePageAgentButtonStyleOptions;
47
- };
48
- type ResolvedVoicePageAgentOptions = {
49
- pageAgent: Record<string, unknown>;
50
- wakeWord: string[];
51
- enableHomophoneMatch: boolean;
52
- wakeCooldownMs: number;
53
- commandInitialTimeoutMs: number;
54
- commandSilenceTimeoutMs: number;
55
- commandMaxWindowMs: number;
56
- recognitionLang: string;
57
- showAgentWhenWake: boolean;
58
- autoStart: boolean;
59
- buttonText?: VoicePageAgentButtonTextOptions;
60
- buttonStyle?: VoicePageAgentButtonStyleOptions;
61
- };
62
- type VoiceStateListener = (state: VoicePageAgentState) => void;
63
-
64
- declare class VoicePageAgentController {
65
- private options;
66
- private listeners;
67
- private state;
68
- private recognition;
69
- private initAgentPromise;
70
- private voiceEnabled;
71
- private disposed;
72
- private awaitingCommand;
73
- private commandFinalText;
74
- private commandInterimText;
75
- private commandTimer;
76
- private commandDeadlineTimer;
77
- private restartBusy;
78
- private lastWakeAt;
79
- private wakeRegex;
80
- private wakeHomophoneRegex;
81
- constructor(options: VoicePageAgentOptions);
82
- get snapshot(): {
83
- status: VoiceStateStatus;
84
- message: string;
85
- supported: boolean;
86
- enabled: boolean;
87
- micPermissionGranted: boolean;
88
- };
89
- onStateChange(listener: VoiceStateListener): () => void;
90
- openAgent(): Promise<RuntimePageAgent | null>;
91
- toggleAgentPanel(): Promise<void>;
92
- startWake(): Promise<void>;
93
- stopWake(): void;
94
- runCommand(commandText: string): Promise<void>;
95
- dispose(): void;
96
- private hasSpeechSupport;
97
- private patchState;
98
- private clearCommandTimer;
99
- private clearCommandDeadlineTimer;
100
- private composeCommandText;
101
- private scheduleFlushCommand;
102
- private scheduleCommandDeadline;
103
- private flushVoiceCommand;
104
- private isWakePhraseHit;
105
- private extractCommandAfterWake;
106
- private sanitizeVoiceCommand;
107
- private requestMicrophonePermission;
108
- private syncPermissionState;
109
- private ensureAgent;
110
- private isAgentPanelVisible;
111
- private hideAgentPanel;
112
- private resolveAgentInitErrorMessage;
113
- private executeVoiceCommand;
114
- private buildRecognition;
115
- }
116
- declare function createVoicePageAgent(options: VoicePageAgentOptions): VoicePageAgentController;
117
-
118
5
  declare module "@vue/runtime-core" {
119
6
  interface ComponentCustomProperties {
120
7
  $voicePageAgent: VoicePageAgentController;
@@ -207,4 +94,4 @@ type VoicePageAgentPlugin = {
207
94
  declare function createVoicePageAgentPlugin(options: VoicePageAgentOptions): VoicePageAgentPlugin;
208
95
  declare const VoicePageAgentVuePlugin: VoicePageAgentPlugin;
209
96
 
210
- export { type ResolvedVoicePageAgentOptions, type RuntimePageAgent, VoicePageAgentButton, type VoicePageAgentButtonStyleOptions, type VoicePageAgentButtonTextOptions, VoicePageAgentController, type VoicePageAgentOptions, VoicePageAgentVuePlugin as VoicePageAgentPlugin, type VoicePageAgentState, type VoiceStateListener, type VoiceStateStatus, createVoicePageAgent, createVoicePageAgentPlugin, VoicePageAgentVuePlugin as default, useVoicePageAgent };
97
+ export { VoicePageAgentButton, VoicePageAgentController, VoicePageAgentOptions, VoicePageAgentVuePlugin as VoicePageAgentPlugin, createVoicePageAgentPlugin, VoicePageAgentVuePlugin as default, useVoicePageAgent };
package/dist/index.d.ts CHANGED
@@ -1,120 +1,7 @@
1
+ import { V as VoicePageAgentController, a as VoicePageAgentOptions } from './controller-CUOCIsnS.js';
2
+ export { R as ResolvedVoicePageAgentOptions, b as RuntimePageAgent, c as VoicePageAgentButtonStyleOptions, d as VoicePageAgentButtonTextOptions, e as VoicePageAgentState, f as VoiceStateListener, g as VoiceStateStatus, h as createVoicePageAgent } from './controller-CUOCIsnS.js';
1
3
  import * as vue from 'vue';
2
4
 
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
- hide?: () => void;
16
- collapse?: () => void;
17
- };
18
- execute: (task: string) => Promise<unknown>;
19
- dispose?: (...args: unknown[]) => void;
20
- disposed?: boolean;
21
- status?: "idle" | "running" | "completed" | "error" | string;
22
- };
23
- type VoicePageAgentButtonTextOptions = {
24
- startText?: string;
25
- wakeOnText?: string;
26
- openText?: string;
27
- };
28
- type VoicePageAgentButtonStyleOptions = {
29
- wakeButtonBackground?: string;
30
- wakeButtonTextColor?: string;
31
- openButtonBackground?: string;
32
- openButtonTextColor?: string;
33
- };
34
- type VoicePageAgentOptions = {
35
- pageAgent: Record<string, unknown>;
36
- wakeWord?: string | string[];
37
- enableHomophoneMatch?: boolean;
38
- wakeCooldownMs?: number;
39
- commandInitialTimeoutMs?: number;
40
- commandSilenceTimeoutMs?: number;
41
- commandMaxWindowMs?: number;
42
- recognitionLang?: string;
43
- showAgentWhenWake?: boolean;
44
- autoStart?: boolean;
45
- buttonText?: VoicePageAgentButtonTextOptions;
46
- buttonStyle?: VoicePageAgentButtonStyleOptions;
47
- };
48
- type ResolvedVoicePageAgentOptions = {
49
- pageAgent: Record<string, unknown>;
50
- wakeWord: string[];
51
- enableHomophoneMatch: boolean;
52
- wakeCooldownMs: number;
53
- commandInitialTimeoutMs: number;
54
- commandSilenceTimeoutMs: number;
55
- commandMaxWindowMs: number;
56
- recognitionLang: string;
57
- showAgentWhenWake: boolean;
58
- autoStart: boolean;
59
- buttonText?: VoicePageAgentButtonTextOptions;
60
- buttonStyle?: VoicePageAgentButtonStyleOptions;
61
- };
62
- type VoiceStateListener = (state: VoicePageAgentState) => void;
63
-
64
- declare class VoicePageAgentController {
65
- private options;
66
- private listeners;
67
- private state;
68
- private recognition;
69
- private initAgentPromise;
70
- private voiceEnabled;
71
- private disposed;
72
- private awaitingCommand;
73
- private commandFinalText;
74
- private commandInterimText;
75
- private commandTimer;
76
- private commandDeadlineTimer;
77
- private restartBusy;
78
- private lastWakeAt;
79
- private wakeRegex;
80
- private wakeHomophoneRegex;
81
- constructor(options: VoicePageAgentOptions);
82
- get snapshot(): {
83
- status: VoiceStateStatus;
84
- message: string;
85
- supported: boolean;
86
- enabled: boolean;
87
- micPermissionGranted: boolean;
88
- };
89
- onStateChange(listener: VoiceStateListener): () => void;
90
- openAgent(): Promise<RuntimePageAgent | null>;
91
- toggleAgentPanel(): Promise<void>;
92
- startWake(): Promise<void>;
93
- stopWake(): void;
94
- runCommand(commandText: string): Promise<void>;
95
- dispose(): void;
96
- private hasSpeechSupport;
97
- private patchState;
98
- private clearCommandTimer;
99
- private clearCommandDeadlineTimer;
100
- private composeCommandText;
101
- private scheduleFlushCommand;
102
- private scheduleCommandDeadline;
103
- private flushVoiceCommand;
104
- private isWakePhraseHit;
105
- private extractCommandAfterWake;
106
- private sanitizeVoiceCommand;
107
- private requestMicrophonePermission;
108
- private syncPermissionState;
109
- private ensureAgent;
110
- private isAgentPanelVisible;
111
- private hideAgentPanel;
112
- private resolveAgentInitErrorMessage;
113
- private executeVoiceCommand;
114
- private buildRecognition;
115
- }
116
- declare function createVoicePageAgent(options: VoicePageAgentOptions): VoicePageAgentController;
117
-
118
5
  declare module "@vue/runtime-core" {
119
6
  interface ComponentCustomProperties {
120
7
  $voicePageAgent: VoicePageAgentController;
@@ -207,4 +94,4 @@ type VoicePageAgentPlugin = {
207
94
  declare function createVoicePageAgentPlugin(options: VoicePageAgentOptions): VoicePageAgentPlugin;
208
95
  declare const VoicePageAgentVuePlugin: VoicePageAgentPlugin;
209
96
 
210
- export { type ResolvedVoicePageAgentOptions, type RuntimePageAgent, VoicePageAgentButton, type VoicePageAgentButtonStyleOptions, type VoicePageAgentButtonTextOptions, VoicePageAgentController, type VoicePageAgentOptions, VoicePageAgentVuePlugin as VoicePageAgentPlugin, type VoicePageAgentState, type VoiceStateListener, type VoiceStateStatus, createVoicePageAgent, createVoicePageAgentPlugin, VoicePageAgentVuePlugin as default, useVoicePageAgent };
97
+ export { VoicePageAgentButton, VoicePageAgentController, VoicePageAgentOptions, VoicePageAgentVuePlugin as VoicePageAgentPlugin, createVoicePageAgentPlugin, VoicePageAgentVuePlugin as default, useVoicePageAgent };