Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ Format based on [Keep a Changelog](https://keepachangelog.com/). Versioning foll

## [Unreleased]

## [0.24.0] - 2026-11-09

### Added

- `voicethere projects voice-advanced` lists and sets the speaker gate tuning keys `speakerGate.splitOnSpeakerChange`, `speakerGate.recheckOnOther`, `speakerGate.recheckMaxWindows`, `speakerGate.threshold`, `speakerGate.enrollSpeechMs`, `speakerGate.checkSpeechMs` and `speakerGate.minCheckSpeechMs`. They show up once the platform returns them; against a platform that does not, `set` types them from the voice engine catalog.
- `set` checks the voice engine's cross-field rules locally, in every `speakerGate.mode`: `speakerGate.recheckMaxWindows` 1 is rejected while `speakerGate.recheckOnOther` or `speakerGate.splitOnSpeakerChange` is on, and `speakerGate.checkSpeechMs` must be at least `speakerGate.minCheckSpeechMs`. The error carries the engine's message. The server stays the final check.

### Changed

- `speakerGate.threshold` must be above 0 and below 1; 0 and 1 are rejected as outside the engine range. `list` shows such a range in parentheses.
- `@node-webrtc-rust/voice-catalog` is now 0.18.2.

## [0.23.0] - 2026-11-08

### Changed
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,25 @@ voicethere projects voice-advanced set vad.adaptive.noiseMarginDb 9
| `speakerGate.mode` | `disabled`, `auto`, `manual` | `disabled` |
| `speakerGate.bargeIn` | `caller_only`, `anyone` | `caller_only` |
| `speakerGate.suppressShortBargeIn` | bool | `false` |
| `speakerGate.splitOnSpeakerChange` | bool | `false` |
| `speakerGate.recheckOnOther` | bool | `true` |
| `speakerGate.recheckMaxWindows` | whole number (platform: 1–24) | `12` |
| `speakerGate.threshold` | above 0 and below 1 | `0.459` |
| `speakerGate.enrollSpeechMs` | whole number (ms) | `3000` |
| `speakerGate.checkSpeechMs` | whole number (ms) | `1500` |
| `speakerGate.minCheckSpeechMs` | whole number (ms) | `1500` |
| `vad.provider` | `energy`, `adaptive` | `energy` |
| `vad.adaptive.noiseMarginDb` | 0–30 (dB above the noise floor) | `6` |
| `vad.adaptive.useSpeechLevel` | bool | `true` |
| `vad.adaptive.stuckActiveMs` | 1000–60000 | `8000` |

The platform may cap the speaker gate numbers below the engine range; `list` shows the range that applies. Two rules hold in every `speakerGate.mode`, and `set` checks them before it sends anything (the server still has the final say):

- `speakerGate.recheckMaxWindows` must not be `1` while `speakerGate.recheckOnOther` or `speakerGate.splitOnSpeakerChange` is `true`. Use `2` or more, or turn both off first.
- `speakerGate.checkSpeechMs` must be at least `speakerGate.minCheckSpeechMs`.

`speakerGate.splitOnSpeakerChange` ends an utterance when the caller's speech runs straight into another voice, so the caller's text does not carry the other person's words.

## Language switch settings

Spoken-language auto-switch and its wait behavior are advanced voice settings. They apply on the next **`voicethere deploy --wait`**. When the caller switches to a language whose models are not running yet, the runner starts them on demand and can play a short wait message in the language being left.
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@voicethere/cli",
"version": "0.23.0",
"version": "0.24.0",
"description": "VoiceThere cloud CLI — login, projects, and agent bundle upload",
"type": "module",
"bin": {
Expand Down Expand Up @@ -38,7 +38,7 @@
},
"license": "MIT",
"dependencies": {
"@node-webrtc-rust/voice-catalog": "0.18.0",
"@node-webrtc-rust/voice-catalog": "0.18.2",
"@voicethere/agent": "0.29.1",
"commander": "13.1.0",
"diff": "5.2.0",
Expand Down
283 changes: 283 additions & 0 deletions src/commands/projects/voice-advanced/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,59 @@ const DEFINITIONS: VoiceAdvancedDefinition[] = [
max: 2,
}),
def({ key: "tts.phraseCache", type: "boolean", default: true }),
def({
key: "speakerGate.splitOnSpeakerChange",
type: "boolean",
default: false,
engineKey: "speakerGate.splitOnSpeakerChange",
}),
def({
key: "speakerGate.recheckOnOther",
type: "boolean",
default: true,
engineKey: "speakerGate.recheckOnOther",
}),
def({
key: "speakerGate.recheckMaxWindows",
type: "number",
default: 12,
min: 1,
max: 24,
engineKey: "speakerGate.recheckMaxWindows",
}),
def({
key: "speakerGate.threshold",
type: "number",
default: 0.459,
integer: false,
min: 0.2,
max: 0.8,
engineKey: "speakerGate.threshold",
}),
def({
key: "speakerGate.enrollSpeechMs",
type: "number",
default: 3000,
min: 1500,
max: 10000,
engineKey: "speakerGate.enrollSpeechMs",
}),
def({
key: "speakerGate.checkSpeechMs",
type: "number",
default: 1500,
min: 1000,
max: 5000,
engineKey: "speakerGate.checkSpeechMs",
}),
def({
key: "speakerGate.minCheckSpeechMs",
type: "number",
default: 1500,
min: 1000,
max: 5000,
engineKey: "speakerGate.minCheckSpeechMs",
}),
def({ key: "voice.profilesByLanguage", type: "string", default: "{}" }),
];

Expand Down Expand Up @@ -254,6 +307,236 @@ describe("projects voice-advanced", () => {
});
});

describe("speakerGate keys", () => {
const gateSettings = (over: Record<string, unknown> = {}) => ({
speakerGate: {
mode: "disabled",
splitOnSpeakerChange: false,
recheckOnOther: true,
recheckMaxWindows: 12,
threshold: 0.459,
enrollSpeechMs: 3000,
checkSpeechMs: 1500,
minCheckSpeechMs: 1500,
...over,
},
});

it("list prints all 7 speakerGate keys with defaults, threshold range open-ended", async () => {
listProjectVoiceAdvancedSettings.mockResolvedValue({
settings: gateSettings(),
definitions: DEFINITIONS,
});
await runProjectsVoiceAdvancedList();
const lines = vi.mocked(console.log).mock.calls.map((c) => String(c[0]));
for (const k of [
"splitOnSpeakerChange",
"recheckMaxWindows",
"recheckOnOther",
"threshold",
"enrollSpeechMs",
"checkSpeechMs",
"minCheckSpeechMs",
]) {
expect(lines.some((l) => l.startsWith(`speakerGate.${k}=`))).toBe(true);
}
expect(lines).toContain(
"speakerGate.threshold=0.459 (default 0.459 [0.2–0.8])",
);
});

it("threshold 1 fails the engine range (exclusive), 0 too, 0.85 fails the API cap", async () => {
listProjectVoiceAdvancedSettings.mockResolvedValue({
settings: gateSettings(),
definitions: DEFINITIONS,
});
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.threshold",
value: "1",
}),
).rejects.toThrow(/engine range/);
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.threshold",
value: "0",
}),
).rejects.toThrow(/engine range/);
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.threshold",
value: "0.85",
}),
).rejects.toThrow(/between 0\.2 and 0\.8$/);
expect(setProjectVoiceAdvancedSetting).not.toHaveBeenCalled();
await runProjectsVoiceAdvancedSet({
name: "speakerGate.threshold",
value: "0.5",
});
expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledWith(
"proj-1",
"speakerGate.threshold",
0.5,
);
});

it("R1: splitOnSpeakerChange true with recheckMaxWindows 1 is rejected locally with the engine message", async () => {
listProjectVoiceAdvancedSettings.mockResolvedValue({
settings: gateSettings({ recheckMaxWindows: 1, recheckOnOther: false }),
definitions: DEFINITIONS,
});
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.splitOnSpeakerChange",
value: "true",
}),
).rejects.toThrow(/recheckMaxWindows must be 0 \(no cap\) or at least 2/);
expect(setProjectVoiceAdvancedSetting).not.toHaveBeenCalled();
});

it("R1 applies in mode disabled, and from the recheckMaxWindows side", async () => {
listProjectVoiceAdvancedSettings.mockResolvedValue({
settings: gateSettings({ mode: "disabled" }),
definitions: DEFINITIONS,
});
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.recheckMaxWindows",
value: "1",
}),
).rejects.toThrow(/at least 2/);
expect(setProjectVoiceAdvancedSetting).not.toHaveBeenCalled();
});

it("R1 allows 1 window once both rechecks are off, and 2 with the split on", async () => {
listProjectVoiceAdvancedSettings.mockResolvedValue({
settings: gateSettings({
recheckOnOther: false,
splitOnSpeakerChange: false,
}),
definitions: DEFINITIONS,
});
await runProjectsVoiceAdvancedSet({
name: "speakerGate.recheckMaxWindows",
value: "1",
});
expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledTimes(1);
listProjectVoiceAdvancedSettings.mockResolvedValue({
settings: gateSettings({ splitOnSpeakerChange: true }),
definitions: DEFINITIONS,
});
await runProjectsVoiceAdvancedSet({
name: "speakerGate.recheckMaxWindows",
value: "2",
});
expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledTimes(2);
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.recheckMaxWindows",
value: "0",
}),
).rejects.toThrow(/between 1 and 24/);
expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledTimes(2);
});

it("R2: checkSpeechMs below minCheckSpeechMs is rejected, equal passes", async () => {
listProjectVoiceAdvancedSettings.mockResolvedValue({
settings: gateSettings(),
definitions: DEFINITIONS,
});
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.checkSpeechMs",
value: "1000",
}),
).rejects.toThrow(/checkSpeechMs must be at least .*minCheckSpeechMs/);
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.minCheckSpeechMs",
value: "2000",
}),
).rejects.toThrow(/checkSpeechMs must be at least/);
expect(setProjectVoiceAdvancedSetting).not.toHaveBeenCalled();
await runProjectsVoiceAdvancedSet({
name: "speakerGate.checkSpeechMs",
value: "1500",
});
expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledTimes(1);
});

it("an unrelated key is not blocked by an older broken combination", async () => {
listProjectVoiceAdvancedSettings.mockResolvedValue({
settings: gateSettings({ recheckMaxWindows: 1 }),
definitions: DEFINITIONS,
});
await runProjectsVoiceAdvancedSet({
name: "speakerGate.enrollSpeechMs",
value: "4000",
});
expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledWith(
"proj-1",
"speakerGate.enrollSpeechMs",
4000,
);
});

it("a server 400 is shown as is", async () => {
listProjectVoiceAdvancedSettings.mockResolvedValue({
settings: gateSettings(),
definitions: DEFINITIONS,
});
setProjectVoiceAdvancedSetting.mockRejectedValue(
new Error("HTTP 400: speakerGate.threshold is not allowed on this plan"),
);
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.threshold",
value: "0.5",
}),
).rejects.toThrow(
/HTTP 400: speakerGate\.threshold is not allowed on this plan/,
);
});

it("fallback path (no definitions) sends booleans and numbers, keeps the exclusive range and R1", async () => {
const response = {
settings: gateSettings({ recheckMaxWindows: 1, recheckOnOther: false }),
defaults: gateSettings(),
};
listProjectVoiceAdvancedSettings.mockResolvedValue(response);
await runProjectsVoiceAdvancedSet({
name: "speakerGate.recheckOnOther",
value: "false",
});
expect(setProjectVoiceAdvancedSetting).toHaveBeenLastCalledWith(
"proj-1",
"speakerGate.recheckOnOther",
false,
);
await runProjectsVoiceAdvancedSet({
name: "speakerGate.threshold",
value: "0.6",
});
expect(setProjectVoiceAdvancedSetting).toHaveBeenLastCalledWith(
"proj-1",
"speakerGate.threshold",
0.6,
);
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.threshold",
value: "1",
}),
).rejects.toThrow(/engine range/);
await expect(
runProjectsVoiceAdvancedSet({
name: "speakerGate.splitOnSpeakerChange",
value: "true",
}),
).rejects.toThrow(/at least 2/);
});
});

describe("set against a platform without definitions", () => {
const response = {
settings: {
Expand Down
Loading
Loading