chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts.

This commit is contained in:
cpojer
2026-02-01 10:03:47 +09:00
parent ad943bd8cf
commit f06dd8df06
1778 changed files with 2949 additions and 4242 deletions
+1 -3
View File
@@ -1,9 +1,7 @@
import type { Command } from "commander";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import type { Command } from "commander";
import type { VoiceCallConfig } from "./config.js";
import type { VoiceCallRuntime } from "./runtime.js";
import { resolveUserPath } from "./utils.js";
-1
View File
@@ -1,5 +1,4 @@
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { validateProviderConfig, resolveVoiceCallConfig, type VoiceCallConfig } from "./config.js";
function createBaseConfig(provider: "telnyx" | "twilio" | "plivo" | "mock"): VoiceCallConfig {
-1
View File
@@ -1,7 +1,6 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import type { VoiceCallTtsConfig } from "./config.js";
export type CoreConfig = {
+3 -5
View File
@@ -1,10 +1,7 @@
import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { VoiceCallConfigSchema } from "./config.js";
import { CallManager } from "./manager.js";
import type { VoiceCallProvider } from "./providers/base.js";
import type {
HangupCallInput,
InitiateCallInput,
@@ -16,7 +13,8 @@ import type {
WebhookContext,
WebhookVerificationResult,
} from "./types.js";
import type { VoiceCallProvider } from "./providers/base.js";
import { VoiceCallConfigSchema } from "./config.js";
import { CallManager } from "./manager.js";
class FakeProvider implements VoiceCallProvider {
readonly name = "plivo" as const;
+1 -2
View File
@@ -3,8 +3,6 @@ import fs from "node:fs";
import fsp from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { resolveUserPath } from "./utils.js";
import type { CallMode, VoiceCallConfig } from "./config.js";
import type { VoiceCallProvider } from "./providers/base.js";
import {
@@ -17,6 +15,7 @@ import {
TerminalStates,
type TranscriptEntry,
} from "./types.js";
import { resolveUserPath } from "./utils.js";
import { escapeXml, mapVoiceToPolly } from "./voice-mapping.js";
function resolveDefaultStoreBase(config: VoiceCallConfig, storePath?: string): string {
+1 -1
View File
@@ -1,6 +1,6 @@
import type { CallId, CallRecord } from "../types.js";
import type { VoiceCallConfig } from "../config.js";
import type { VoiceCallProvider } from "../providers/base.js";
import type { CallId, CallRecord } from "../types.js";
export type TranscriptWaiter = {
resolve: (text: string) => void;
+1 -2
View File
@@ -1,8 +1,8 @@
import crypto from "node:crypto";
import type { CallRecord, CallState, NormalizedEvent } from "../types.js";
import type { CallManagerContext } from "./context.js";
import { findCall } from "./lookup.js";
import { endCall } from "./outbound.js";
import { addTranscriptEntry, transitionState } from "./state.js";
import { persistCallRecord } from "./store.js";
import {
@@ -11,7 +11,6 @@ import {
resolveTranscriptWaiter,
startMaxDurationTimer,
} from "./timers.js";
import { endCall } from "./outbound.js";
function shouldAcceptInbound(
config: CallManagerContext["config"],
@@ -1,16 +1,14 @@
import crypto from "node:crypto";
import type { CallMode } from "../config.js";
import type { CallManagerContext } from "./context.js";
import {
TerminalStates,
type CallId,
type CallRecord,
type OutboundCallOptions,
} from "../types.js";
import type { CallMode } from "../config.js";
import { mapVoiceToPolly } from "../voice-mapping.js";
import type { CallManagerContext } from "./context.js";
import { getCallByProviderCallId } from "./lookup.js";
import { generateNotifyTwiml } from "./twiml.js";
import { addTranscriptEntry, transitionState } from "./state.js";
import { persistCallRecord } from "./store.js";
import {
@@ -19,6 +17,7 @@ import {
rejectTranscriptWaiter,
waitForFinalTranscript,
} from "./timers.js";
import { generateNotifyTwiml } from "./twiml.js";
export async function initiateCall(
ctx: CallManagerContext,
@@ -1,7 +1,6 @@
import fs from "node:fs";
import fsp from "node:fs/promises";
import path from "node:path";
import { CallRecordSchema, TerminalStates, type CallId, type CallRecord } from "../types.js";
export function persistCallRecord(storePath: string, call: CallRecord): void {
+1 -1
View File
@@ -1,5 +1,5 @@
import { TerminalStates, type CallId } from "../types.js";
import type { CallManagerContext } from "./context.js";
import { TerminalStates, type CallId } from "../types.js";
import { persistCallRecord } from "./store.js";
export function clearMaxDurationTimer(ctx: CallManagerContext, callId: CallId): void {
@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest";
import type {
OpenAIRealtimeSTTProvider,
RealtimeSTTSession,
@@ -9,9 +9,7 @@
import type { IncomingMessage } from "node:http";
import type { Duplex } from "node:stream";
import { WebSocket, WebSocketServer } from "ws";
import type {
OpenAIRealtimeSTTProvider,
RealtimeSTTSession,
@@ -1,5 +1,4 @@
import crypto from "node:crypto";
import type {
EndReason,
HangupCallInput,
@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest";
import { PlivoProvider } from "./plivo.js";
describe("PlivoProvider", () => {
+1 -2
View File
@@ -1,5 +1,4 @@
import crypto from "node:crypto";
import type { PlivoConfig } from "../config.js";
import type {
HangupCallInput,
@@ -13,9 +12,9 @@ import type {
WebhookContext,
WebhookVerificationResult,
} from "../types.js";
import type { VoiceCallProvider } from "./base.js";
import { escapeXml } from "../voice-mapping.js";
import { reconstructWebhookUrl, verifyPlivoWebhook } from "../webhook-security.js";
import type { VoiceCallProvider } from "./base.js";
export interface PlivoProviderOptions {
/** Override public URL origin for signature verification */
@@ -1,5 +1,4 @@
import crypto from "node:crypto";
import type { TelnyxConfig } from "../config.js";
import type {
EndReason,
@@ -1,5 +1,4 @@
import { describe, expect, it } from "vitest";
import type { WebhookContext } from "../types.js";
import { TwilioProvider } from "./twilio.js";
@@ -1,7 +1,7 @@
import crypto from "node:crypto";
import type { TwilioConfig } from "../config.js";
import type { MediaStreamHandler } from "../media-stream.js";
import type { TelephonyTtsProvider } from "../telephony-tts.js";
import type {
HangupCallInput,
InitiateCallInput,
@@ -14,10 +14,9 @@ import type {
WebhookContext,
WebhookVerificationResult,
} from "../types.js";
import { escapeXml, mapVoiceToPolly } from "../voice-mapping.js";
import { chunkAudio } from "../telephony-audio.js";
import type { TelephonyTtsProvider } from "../telephony-tts.js";
import type { VoiceCallProvider } from "./base.js";
import { chunkAudio } from "../telephony-audio.js";
import { escapeXml, mapVoiceToPolly } from "../voice-mapping.js";
import { twilioApiRequest } from "./twilio/api.js";
import { verifyTwilioProviderWebhook } from "./twilio/webhook.js";
@@ -1,7 +1,6 @@
import type { WebhookContext, WebhookVerificationResult } from "../../types.js";
import { verifyTwilioWebhook } from "../../webhook-security.js";
import type { TwilioProviderOptions } from "../twilio.js";
import { verifyTwilioWebhook } from "../../webhook-security.js";
export function verifyTwilioProviderWebhook(params: {
ctx: WebhookContext;
@@ -4,10 +4,8 @@
*/
import crypto from "node:crypto";
import { loadCoreAgentDeps, type CoreConfig } from "./core-bridge.js";
import type { VoiceCallConfig } from "./config.js";
import { loadCoreAgentDeps, type CoreConfig } from "./core-bridge.js";
export type VoiceResponseParams = {
/** Voice call config */
+3 -3
View File
@@ -1,13 +1,13 @@
import type { CoreConfig } from "./core-bridge.js";
import type { VoiceCallConfig } from "./config.js";
import type { CoreConfig } from "./core-bridge.js";
import type { VoiceCallProvider } from "./providers/base.js";
import type { TelephonyTtsRuntime } from "./telephony-tts.js";
import { resolveVoiceCallConfig, validateProviderConfig } from "./config.js";
import { CallManager } from "./manager.js";
import type { VoiceCallProvider } from "./providers/base.js";
import { MockProvider } from "./providers/mock.js";
import { PlivoProvider } from "./providers/plivo.js";
import { TelnyxProvider } from "./providers/telnyx.js";
import { TwilioProvider } from "./providers/twilio.js";
import type { TelephonyTtsRuntime } from "./telephony-tts.js";
import { createTelephonyTtsProvider } from "./telephony-tts.js";
import { startTunnel, type TunnelResult } from "./tunnel.js";
import {
+1 -1
View File
@@ -1,5 +1,5 @@
import type { CoreConfig } from "./core-bridge.js";
import type { VoiceCallTtsConfig } from "./config.js";
import type { CoreConfig } from "./core-bridge.js";
import { convertPcmToMulaw8k } from "./telephony-audio.js";
export type TelephonyTtsRuntime = {
-1
View File
@@ -1,5 +1,4 @@
import { spawn } from "node:child_process";
import { getTailscaleDnsName } from "./webhook.js";
/**
-1
View File
@@ -1,5 +1,4 @@
import { z } from "zod";
import type { CallMode } from "./config.js";
// -----------------------------------------------------------------------------
@@ -1,7 +1,5 @@
import crypto from "node:crypto";
import { describe, expect, it } from "vitest";
import { verifyPlivoWebhook, verifyTwilioWebhook } from "./webhook-security.js";
function canonicalizeBase64(input: string): string {
@@ -1,5 +1,4 @@
import crypto from "node:crypto";
import type { WebhookContext } from "./types.js";
/**
+2 -3
View File
@@ -1,16 +1,15 @@
import { spawn } from "node:child_process";
import http from "node:http";
import { URL } from "node:url";
import type { VoiceCallConfig } from "./config.js";
import type { CoreConfig } from "./core-bridge.js";
import type { CallManager } from "./manager.js";
import type { MediaStreamConfig } from "./media-stream.js";
import { MediaStreamHandler } from "./media-stream.js";
import type { VoiceCallProvider } from "./providers/base.js";
import { OpenAIRealtimeSTTProvider } from "./providers/stt-openai-realtime.js";
import type { TwilioProvider } from "./providers/twilio.js";
import type { NormalizedEvent, WebhookContext } from "./types.js";
import { MediaStreamHandler } from "./media-stream.js";
import { OpenAIRealtimeSTTProvider } from "./providers/stt-openai-realtime.js";
/**
* HTTP server for receiving voice call webhooks from providers.