refactor(server): move VoiceSession into session/voice/ to match CheckoutSession (#1645)

#1640 extracted the voice subsystem to server/voice/ (a peer of session.ts);
#1644 extracted the checkout read side to session/checkout/. The two carves
landed in inconsistent homes, so there was no single place to find "what has
session.ts been carved into."

Relocate server/voice/ -> server/session/voice/ so all session subsystems share
one home alongside session/checkout/. Pure relocation: git-tracked renames with
import-depth bumped one level (../ -> ../../); the only external touch point is
the import path in session.ts. Behavior preserved verbatim — the 17 voice unit
tests pass unchanged before and after.

Also record the actual shipped layout and the next carve (the checkout mutation
handlers still inline in session.ts -> session/checkout/checkout-session.ts) in
the decomposition plan, and fix its now-stale voice path.
This commit is contained in:
Mohamed Boudra
2026-06-21 20:45:26 +08:00
committed by GitHub
parent 18f880e561
commit 2b5cc727f0
6 changed files with 36 additions and 27 deletions
+1 -1
View File
@@ -167,7 +167,7 @@ import {
} from "./workspace-registry.js";
import { wrapSpokenInput } from "./voice-config.js";
import { isVoicePermissionAllowed } from "./voice-permission-policy.js";
import { VoiceSession } from "./voice/voice-session.js";
import { VoiceSession } from "./session/voice/voice-session.js";
import { CheckoutSession } from "./session/checkout/checkout-session.js";
import {
listDirectoryEntries,
@@ -3,18 +3,18 @@ import pino from "pino";
import { describe, expect, test, vi } from "vitest";
import { VoiceSession, type VoiceSessionHost } from "./voice-session.js";
import type { ManagedAgent } from "../agent/agent-manager.js";
import type { SessionOutboundMessage } from "../messages.js";
import type { ManagedAgent } from "../../agent/agent-manager.js";
import type { SessionOutboundMessage } from "../../messages.js";
import type {
SpeechToTextProvider,
StreamingTranscriptionCommittedEvent,
StreamingTranscriptionEvent,
StreamingTranscriptionSession,
} from "../speech/speech-provider.js";
} from "../../speech/speech-provider.js";
import type {
TurnDetectionProvider,
TurnDetectionSession,
} from "../speech/turn-detection-provider.js";
} from "../../speech/turn-detection-provider.js";
const VOICE_AGENT_ID = "11111111-1111-4111-8111-111111111111";
@@ -2,25 +2,25 @@ import { v4 as uuidv4 } from "uuid";
import { z } from "zod";
import type pino from "pino";
import { getErrorMessage } from "@getpaseo/protocol/error-utils";
import type { SessionInboundMessage, SessionOutboundMessage } from "../messages.js";
import { TTSManager } from "../agent/tts-manager.js";
import { STTManager } from "../agent/stt-manager.js";
import type { SpeechToTextProvider, TextToSpeechProvider } from "../speech/speech-provider.js";
import type { TurnDetectionProvider } from "../speech/turn-detection-provider.js";
import { maybePersistTtsDebugAudio } from "../agent/tts-debug.js";
import { isPaseoDictationDebugEnabled } from "../agent/recordings-debug.js";
import type { SessionInboundMessage, SessionOutboundMessage } from "../../messages.js";
import { TTSManager } from "../../agent/tts-manager.js";
import { STTManager } from "../../agent/stt-manager.js";
import type { SpeechToTextProvider, TextToSpeechProvider } from "../../speech/speech-provider.js";
import type { TurnDetectionProvider } from "../../speech/turn-detection-provider.js";
import { maybePersistTtsDebugAudio } from "../../agent/tts-debug.js";
import { isPaseoDictationDebugEnabled } from "../../agent/recordings-debug.js";
import {
DictationStreamManager,
type DictationStreamOutboundMessage,
} from "../dictation/dictation-stream-manager.js";
} from "../../dictation/dictation-stream-manager.js";
import { createVoiceTurnController, type VoiceTurnController } from "./voice-turn-controller.js";
import { buildVoiceModeSystemPrompt, stripVoiceModeSystemPrompt } from "../voice-config.js";
import type { VoiceCallerContext, VoiceSpeakHandler } from "../voice-types.js";
import type { ManagedAgent } from "../agent/agent-manager.js";
import type { AgentSessionConfig } from "../agent/agent-sdk-types.js";
import type { LocalSpeechModelId } from "../speech/providers/local/models.js";
import { toResolver, type Resolvable } from "../speech/provider-resolver.js";
import type { SpeechReadinessSnapshot, SpeechReadinessState } from "../speech/speech-runtime.js";
import { buildVoiceModeSystemPrompt, stripVoiceModeSystemPrompt } from "../../voice-config.js";
import type { VoiceCallerContext, VoiceSpeakHandler } from "../../voice-types.js";
import type { ManagedAgent } from "../../agent/agent-manager.js";
import type { AgentSessionConfig } from "../../agent/agent-sdk-types.js";
import type { LocalSpeechModelId } from "../../speech/providers/local/models.js";
import { toResolver, type Resolvable } from "../../speech/provider-resolver.js";
import type { SpeechReadinessSnapshot, SpeechReadinessState } from "../../speech/speech-runtime.js";
const PCM_SAMPLE_RATE = 16000;
const PCM_CHANNELS = 1;
@@ -7,11 +7,11 @@ import type {
StreamingTranscriptionCommittedEvent,
StreamingTranscriptionEvent,
StreamingTranscriptionSession,
} from "../speech/speech-provider.js";
} from "../../speech/speech-provider.js";
import type {
TurnDetectionProvider,
TurnDetectionSession,
} from "../speech/turn-detection-provider.js";
} from "../../speech/turn-detection-provider.js";
import { createVoiceTurnController } from "./voice-turn-controller.js";
class FakeTurnDetectionSession extends EventEmitter implements TurnDetectionSession {
@@ -2,14 +2,14 @@ import { Buffer } from "node:buffer";
import type { Logger } from "pino";
import { v4 as uuidv4 } from "uuid";
import { Pcm16MonoResampler } from "../agent/pcm16-resampler.js";
import { parsePcmRateFromFormat } from "../speech/audio.js";
import { Pcm16MonoResampler } from "../../agent/pcm16-resampler.js";
import { parsePcmRateFromFormat } from "../../speech/audio.js";
import type {
SpeechToTextProvider,
StreamingTranscriptionEvent,
StreamingTranscriptionSession,
} from "../speech/speech-provider.js";
import type { TurnDetectionProvider } from "../speech/turn-detection-provider.js";
} from "../../speech/speech-provider.js";
import type { TurnDetectionProvider } from "../../speech/turn-detection-provider.js";
const VOICE_FINAL_TRANSCRIPT_TIMEOUT_MS = 10_000;