fix: resolve type errors and test failures from branch integration

- Align portless code with storage branch's numeric workspace IDs and new field names
- Update workspace kind comparisons (local_checkout → checkout/worktree)
- Add missing services, supportsTerminalMode, terminal fields to test fixtures
- Fix archive timestamp assertions to match dynamic archiveSnapshot flow
- Fix dictation, voice runtime, and service health monitor test timing
- Add xterm-addon-ligatures type declaration for terminal emulator
This commit is contained in:
Mohamed Boudra
2026-04-01 22:58:59 +07:00
parent d75dd33773
commit 59cb4d7499
29 changed files with 405 additions and 235 deletions
@@ -153,6 +153,7 @@ describe("voice runtime", () => {
await runtime.startVoice("server-1", "agent-1");
runtime.onTurnEvent("server-1", "agent-1", "turn_started");
vi.mocked(engine.play).mockClear();
runtime.handleAudioOutput(
"server-1",
@@ -204,6 +205,8 @@ describe("voice runtime", () => {
await runtime.startVoice("server-1", "agent-1");
runtime.onTurnEvent("server-1", "agent-1", "turn_started");
vi.mocked(engine.play).mockClear();
playResolvers.length = 0;
runtime.handleAudioOutput(
"server-1",
@@ -286,6 +289,8 @@ describe("voice runtime", () => {
expect(runtime.getSnapshot().phase).toBe("waiting");
expect(engine.play).toHaveBeenCalledTimes(1);
vi.mocked(engine.stop).mockClear();
vi.mocked(engine.clearQueue).mockClear();
runtime.handleCaptureVolume(REALTIME_VOICE_VAD_CONFIG.volumeThreshold + 0.05);
runtime.handleCaptureVolume(0);
@@ -325,6 +330,8 @@ describe("voice runtime", () => {
await runtime.startVoice("server-1", "agent-1");
runtime.onTurnEvent("server-1", "agent-1", "turn_started");
runtime.onAssistantAudioStarted("server-1");
vi.mocked(engine.stop).mockClear();
vi.mocked(engine.clearQueue).mockClear();
runtime.handleCaptureVolume(0.5);
expect(runtime.getTelemetrySnapshot().isSpeaking).toBe(false);
+11 -2
View File
@@ -540,6 +540,7 @@ export function createVoiceRuntime(deps: VoiceRuntimeDeps): VoiceRuntime {
clearTimeout(cue.timeout);
cue.timeout = null;
}
cue.playing = false;
if (hadActive) {
deps.engine.stop();
deps.engine.clearQueue();
@@ -1025,6 +1026,8 @@ export function createVoiceRuntime(deps: VoiceRuntimeDeps): VoiceRuntime {
}
if (state.turnInProgress) {
patchSnapshot((prev) => ({ ...prev, phase: "waiting" }));
reconcileCue();
return;
}
@@ -1060,9 +1063,15 @@ export function createVoiceRuntime(deps: VoiceRuntimeDeps): VoiceRuntime {
state.serverSpeechDetected = isSpeaking;
state.serverSpeechStartedAt = isSpeaking ? (state.serverSpeechStartedAt ?? Date.now()) : null;
if (isSpeaking) {
const shouldInterruptPlayback =
state.snapshot.phase === "playing" || playback.groups.size > 0;
const hadCue = cue.active || cue.timeout !== null || cue.playing;
resetPlaybackState();
deps.engine.stop();
deps.engine.clearQueue();
stopCue();
if (shouldInterruptPlayback && !hadCue) {
deps.engine.stop();
deps.engine.clearQueue();
}
getActiveSession()?.adapter.setAssistantAudioPlaying(false);
}
patchTelemetry((prev) => ({