{"version":3,"file":"OpenAITranscriber.test.mjs","names":["OpenAITranscriber.layer","Transcriber"],"sources":["../../../../node_modules/.pnpm/vitest@5.0.3_@types+node@26.2.0_vite@7.3.2_@types+node@26.2.0_jiti@2.6.1_lightningcss@1.32.0_tsx@4.23.12_yaml@2.9.0_/node_modules/vitest/dist/index.js","../src/OpenAITranscriber.test.ts"],"sourcesContent":["export { S as Snapshots, T as TestRunner, a as assert, b as assertType, c as createExpect, g as expect, d as inject, s as should, v as vi, e as vitest } from './chunks/index.C4tKZ0yW.js';\nexport { V as EvaluatedModules } from './chunks/rpc.BTmCtPly.js';\nexport { j as afterAll, k as afterEach, l as aroundAll, n as aroundEach, o as beforeAll, q as beforeEach, r as describe, t as it, u as onTestFailed, v as onTestFinished, w as recordArtifact, x as suite, y as test } from './chunks/run.BTlFXlnv.js';\nexport { expectTypeOf } from 'expect-type';\nimport * as chai from 'chai';\nexport { chai };\nimport './chunks/utils.DYj33du9.js';\nimport './chunks/source-map.DUxvo12T.js';\nimport './chunks/index.cx-_w29y.js';\nimport './chunks/tinyrainbow.Ht9iggcq.js';\nimport './chunks/pathe.M-eThtNZ.CknpM8Or.js';\nimport './chunks/spy.DgMTfhrK.js';\nimport './chunks/display.CXBnkt9a.js';\nimport './task-utils.js';\nimport './chunks/plugins.D2ut1V9b.js';\nimport './chunks/offset.Dy-5Fdfn.js';\nimport 'tinybench';\nimport 'vite/module-runner';\nimport './chunks/index.DmDMHCg8.js';\n","import { Effect, Layer, Redacted, Stream } from \"effect\"\nimport { FetchHttpClient } from \"effect/http\"\nimport { describe, expect, expectTypeOf, it } from \"vitest\"\nimport type * as AiError from \"@effect-uai/core/AiError\"\nimport * as Transcriber from \"@effect-uai/core/Transcriber\"\nimport * as OpenAITranscriber from \"./OpenAITranscriber.js\"\n\nconst cfg: OpenAITranscriber.Config = { apiKey: Redacted.make(\"test-key\") }\n\n// FetchHttpClient is required for `make`, but these tests only exercise the\n// request-validation path that fails *before* the HTTP call goes out.\nconst live = Layer.provide(OpenAITranscriber.layer(cfg), FetchHttpClient.layer)\n\ndescribe(\"OpenAITranscriber capability guards (runtime)\", () => {\n  it(\"streamTranscriptionFrom returns an Unsupported stream\", async () => {\n    const program = OpenAITranscriber.OpenAITranscriber.use((t) =>\n      Stream.runDrain(\n        t.streamTranscriptionFrom(Stream.fromIterable<Uint8Array>([new Uint8Array([0])]), {\n          model: \"gpt-live-transcribe\",\n          inputFormat: { container: \"raw\", encoding: \"pcm_s16le\", sampleRate: 16000 },\n        }),\n      ),\n    )\n    const exit = await Effect.runPromiseExit(program.pipe(Effect.provide(live)))\n    expect(exit._tag).toBe(\"Failure\")\n    if (exit._tag === \"Failure\") {\n      expect(JSON.stringify(exit.cause)).toContain(\"Unsupported\")\n      expect(JSON.stringify(exit.cause)).toContain(\"streamTranscriptionFrom\")\n    }\n  })\n})\n\ndescribe(\"OpenAITranscriber Layer (compile-time)\", () => {\n  it(\"leaves `SttStreaming` unsatisfied when using `streamTranscriptionFrom` against this Layer\", () => {\n    const audio: Stream.Stream<Uint8Array> = Stream.fromIterable([new Uint8Array([0])])\n    const events = audio.pipe(\n      Transcriber.streamTranscriptionFrom({\n        model: \"gpt-live-transcribe\",\n        inputFormat: { container: \"raw\", encoding: \"pcm_s16le\", sampleRate: 16000 },\n      }),\n    )\n    const provided = Stream.runDrain(events).pipe(Effect.provide(live))\n    // `Transcriber` is provided; `SttStreaming` is NOT — calling\n    // `Effect.runPromise(provided)` would be a type error because R is\n    // non-`never`.\n    expectTypeOf(provided).toEqualTypeOf<\n      Effect.Effect<void, AiError.AiError, Transcriber.SttStreaming>\n    >()\n  })\n\n  it(\"sync `transcribe` requires no marker and clears R to never\", () => {\n    const eff = Transcriber.transcribe({\n      audio: { _tag: \"bytes\", bytes: new Uint8Array([0]), mimeType: \"audio/wav\" },\n      model: \"whisper-1\",\n    }).pipe(Effect.provide(live))\n    expectTypeOf(eff).toEqualTypeOf<\n      Effect.Effect<import(\"@effect-uai/core/Transcript\").TranscriptResult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