@moxxy/plugin-voice-admin 0.28.0 → 0.29.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 +3 -3
- package/src/discovery.test.ts +12 -3
- package/src/index.test.ts +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moxxy/plugin-voice-admin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Voice/TTS control for moxxy. set_voice / list_voices let the agent switch which text-to-speech backend read-aloud surfaces use (a registered synthesizer, or 'system' for the OS voice) without a settings UI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"moxxy",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"zod": "^3.24.0",
|
|
47
|
-
"@moxxy/sdk": "0.
|
|
47
|
+
"@moxxy/sdk": "0.29.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/node": "^22.10.0",
|
|
51
51
|
"typescript": "^5.7.3",
|
|
52
52
|
"vitest": "^2.1.8",
|
|
53
|
-
"@moxxy/core": "0.
|
|
53
|
+
"@moxxy/core": "0.29.0",
|
|
54
54
|
"@moxxy/tsconfig": "0.0.0",
|
|
55
55
|
"@moxxy/vitest-preset": "0.0.0"
|
|
56
56
|
},
|
package/src/discovery.test.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import type { ServiceRegistry } from '@moxxy/sdk';
|
|
3
|
+
import { assertDefined } from '@moxxy/sdk';
|
|
3
4
|
import { voiceAdminPlugin } from './index.js';
|
|
4
5
|
|
|
5
6
|
function fakeSynths(active: string | null, names: string[]) {
|
|
@@ -36,13 +37,21 @@ describe('voiceAdminPlugin (discovery-loadable)', () => {
|
|
|
36
37
|
has: () => true,
|
|
37
38
|
register: () => {},
|
|
38
39
|
} as unknown as ServiceRegistry;
|
|
39
|
-
voiceAdminPlugin.hooks
|
|
40
|
+
const hooks = voiceAdminPlugin.hooks;
|
|
41
|
+
assertDefined(hooks, 'plugin declares hooks');
|
|
42
|
+
const onInit = hooks.onInit;
|
|
43
|
+
assertDefined(onInit, 'plugin declares onInit');
|
|
44
|
+
onInit({ services } as never);
|
|
40
45
|
|
|
41
|
-
const
|
|
46
|
+
const tools = voiceAdminPlugin.tools;
|
|
47
|
+
assertDefined(tools, 'plugin declares tools');
|
|
48
|
+
const listVoices = tools.find((t) => t.name === 'list_voices');
|
|
49
|
+
assertDefined(listVoices, 'plugin registers list_voices');
|
|
42
50
|
const listed = await listVoices.handler({} as never, {} as never);
|
|
43
51
|
expect(listed).toEqual({ active: 'eleven', available: ['system', 'eleven', 'openai'] });
|
|
44
52
|
|
|
45
|
-
const setVoice =
|
|
53
|
+
const setVoice = tools.find((t) => t.name === 'set_voice');
|
|
54
|
+
assertDefined(setVoice, 'plugin registers set_voice');
|
|
46
55
|
const set = await setVoice.handler({ synthesizer: 'openai' } as never, {} as never);
|
|
47
56
|
expect(set).toEqual({ active: 'openai' });
|
|
48
57
|
expect(synths.getActiveName()).toBe('openai');
|
package/src/index.test.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import { Session, silentLogger } from '@moxxy/core';
|
|
3
|
+
import { assertDefined } from '@moxxy/sdk';
|
|
3
4
|
import { buildVoiceAdminPlugin } from './index.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -9,10 +10,11 @@ import { buildVoiceAdminPlugin } from './index.js';
|
|
|
9
10
|
function tools(session: Session) {
|
|
10
11
|
const plugin = buildVoiceAdminPlugin(session);
|
|
11
12
|
const byName = new Map((plugin.tools ?? []).map((t) => [t.name, t]));
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const listVoices = byName.get('list_voices');
|
|
14
|
+
assertDefined(listVoices, 'plugin registers list_voices');
|
|
15
|
+
const setVoice = byName.get('set_voice');
|
|
16
|
+
assertDefined(setVoice, 'plugin registers set_voice');
|
|
17
|
+
return { listVoices, setVoice };
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
const ctx = { sessionId: 's', turnId: 't' } as never;
|