@crvouga/mockingbird-service-elevenlabs 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog — @crvouga/mockingbird-service-elevenlabs
2
2
 
3
- ## 0.1.0 (2026-10-11)
3
+ ## 0.3.0 (2026-10-15)
4
+
5
+ ### Features
6
+
7
+ - finish durable run lifecycle ([725ea1a](https://github.com/crvouga/mockingbird/commit/725ea1a966dac65434e98f06a9c33aca0d6f32d7))
8
+ - add management and portable archives ([0d2a6dd](https://github.com/crvouga/mockingbird/commit/0d2a6dd0f9fecb3a1ea7c1638f6639787395c2f4))
9
+
10
+ ### Fixes and improvements
11
+
12
+ - correlate cross-namespace operations ([3457a4b](https://github.com/crvouga/mockingbird/commit/3457a4b7dbfd9ad9c8a10671a5744b7c8425d000))
13
+ - harden HTTP stream handling ([674307a](https://github.com/crvouga/mockingbird/commit/674307a869f57907567d462c4f506c3b0a237e13))
14
+
15
+ ## 0.2.0 (2026-10-12)
16
+
17
+ ### Features
18
+
19
+ - unify the emulator control plane ([2068547](https://github.com/crvouga/mockingbird/commit/2068547bedde4e2e2331c1657c1a78120e84428b))
20
+
21
+ ## 0.1.0 (2026-10-10)
4
22
 
5
23
  Initial release.
package/DISCOVERY.md CHANGED
@@ -35,6 +35,7 @@ repository; live parity is an additional oracle check, not a substitute for the
35
35
 
36
36
  - `GET /__admin/health`
37
37
  - `GET /__admin`
38
+ - `GET /__admin/controls`
38
39
  - `GET /__admin/state`
39
40
  - `GET /__admin/requests`
40
41
  - `GET /__admin/metrics`
@@ -45,6 +46,28 @@ For HTTP services, use `x-mockingbird-namespace` (or the documented credential/p
45
46
  parallel tests do not share state. Admin state, journal, metrics and fault-preset endpoints are
46
47
  designed for assertions and diagnosis by consuming test suites.
47
48
 
49
+ ## Admin controls
50
+
51
+ Every HTTP emulator takes the same controls, and each means the same thing at boot
52
+ (`createRuntime({ adminControls })`, `serve --admin-controls`), over `/__admin`, and in a request header:
53
+
54
+ | Control | Admin API | Request header | Interface |
55
+ | --- | --- | --- | --- |
56
+ | Isolate state by key | `GET /__admin/namespaces` | `x-mockingbird-namespace: <key>` | [Namespaces](https://mockingbird.chrisvouga.dev/docs/admin-controls/namespaces) |
57
+ | Reset to boot | `POST /__admin/reset` | `x-mockingbird-reset: true` | [Reset](https://mockingbird.chrisvouga.dev/docs/admin-controls/reset) |
58
+ | Snapshot and restore | `POST /__admin/snapshots`, `POST /__admin/snapshots/<id>/restore` | `x-mockingbird-snapshot: <name>`, `x-mockingbird-restore: <name>` | [Snapshot and restore](https://mockingbird.chrisvouga.dev/docs/admin-controls/snapshot-and-restore) |
59
+ | Move the clock | `POST /__admin/clock` | `x-mockingbird-time: <instant>`, `x-mockingbird-advance: <duration>` | [Clock](https://mockingbird.chrisvouga.dev/docs/admin-controls/clock) |
60
+ | Read or branch from old state | `GET /__admin/timeline` | `x-mockingbird-at: <checkpoint>`, `x-mockingbird-branch: <name>` | [Checkpoints and branches](https://mockingbird.chrisvouga.dev/docs/admin-controls/checkpoints-and-branches) |
61
+ | Inject a fault | `POST /__admin/faults` | `x-mockingbird-fault: <fault>` | [Faults](https://mockingbird.chrisvouga.dev/docs/admin-controls/faults) |
62
+ | Latency and timeouts | `PUT /__admin/latency` | `x-mockingbird-delay: <duration>`, `x-mockingbird-timeout: <duration>` | [Latency and timeouts](https://mockingbird.chrisvouga.dev/docs/admin-controls/latency-and-timeouts) |
63
+ | Replay from a seed | `PUT /__admin/controls` | `x-mockingbird-seed: <seed>` | [Seed and determinism](https://mockingbird.chrisvouga.dev/docs/admin-controls/seed-and-determinism) |
64
+ | See what happened | `GET /__admin/requests`, `GET /__admin/state` | | [Journal, metrics and state](https://mockingbird.chrisvouga.dev/docs/admin-controls/journal-and-state) |
65
+
66
+ `GET /__admin` lists every route and header with a one-line summary, and `GET /__admin/controls`
67
+ is the namespace's current control document. The same seed and the same requests give the same
68
+ bytes. Setting controls as an emulator starts is [Boot](https://mockingbird.chrisvouga.dev/docs/admin-controls/boot); every route and header is in
69
+ the [Reference](https://mockingbird.chrisvouga.dev/docs/admin-controls/reference). The full guide: <https://mockingbird.chrisvouga.dev/docs/admin-controls>.
70
+
48
71
  ## Report a mismatch or missing capability
49
72
 
50
73
  Follow the [agent reporting contract](https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md). Include package version,
package/README.md CHANGED
@@ -35,9 +35,10 @@ npx mockingbird-elevenlabs serve --port 8841 \
35
35
  --models eleven_multilingual_v2,eleven_flash_v2_5
36
36
  ```
37
37
 
38
- In-process, pass `runtime.fetch` as the adapter's `fetch`:
38
+ In-process, pass the emulator as the `fetch` of the official SDK (`@elevenlabs/elevenlabs-js`):
39
39
 
40
40
  ```ts
41
+ import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"
41
42
  import {
42
43
  createRuntime,
43
44
  DEFAULT_API_KEY,
@@ -45,32 +46,31 @@ import {
45
46
  mp3Audio,
46
47
  } from "@crvouga/mockingbird-service-elevenlabs"
47
48
 
48
- // A reply the test controls: exact bytes for one text. Here they are a valid MP3, but any
49
- // bytes are returned as given.
49
+ // Test setup. A reply the test controls: exact bytes for one text. Here they are a valid MP3,
50
+ // but any bytes are returned as given.
50
51
  const scripted = mp3Audio(44_100, 128, 500, 9)
51
- const elevenlabs = createRuntime({
52
+ const emulator = createRuntime({
52
53
  scripts: [{ match: { text: "Welcome back." }, audio: scripted }],
53
54
  })
54
55
 
55
- const speak = (text: string, outputFormat: string) =>
56
- elevenlabs.fetch(
57
- new Request(
58
- `http://elevenlabs.test/v1/text-to-speech/${DEFAULT_VOICES[0]?.voice_id}?output_format=${outputFormat}`,
59
- {
60
- method: "POST",
61
- headers: { "content-type": "application/json", "xi-api-key": DEFAULT_API_KEY },
62
- body: JSON.stringify({ text, model_id: "eleven_multilingual_v2" }),
63
- },
64
- ),
65
- )
66
-
67
- const welcome = await speak("Welcome back.", "mp3_44100_128")
68
- console.log(welcome.status, welcome.headers.get("content-type")) // 200 audio/mpeg
69
- console.log(new Uint8Array(await welcome.arrayBuffer()).length === scripted.length) // true
56
+ // The ElevenLabs SDK your application already uses. Only its fetch changes: requests reach
57
+ // the emulator in this process instead of api.elevenlabs.io.
58
+ const elevenlabs = new ElevenLabsClient({
59
+ apiKey: DEFAULT_API_KEY,
60
+ fetch: ((url: RequestInfo | URL, init?: RequestInit) =>
61
+ emulator.fetch(new Request(url, init))) as typeof fetch,
62
+ })
63
+ const voiceId = DEFAULT_VOICES[0]?.voice_id ?? ""
64
+
65
+ const welcome = await elevenlabs.textToSpeech
66
+ .convert(voiceId, { text: "Welcome back.", modelId: "eleven_multilingual_v2", outputFormat: "mp3_44100_128" })
67
+ .withRawResponse()
68
+ console.log(welcome.rawResponse.status, welcome.rawResponse.headers.get("content-type")) // 200 audio/mpeg
69
+ console.log((await new Response(welcome.data).arrayBuffer()).byteLength === scripted.length) // true
70
70
 
71
71
  // Unscripted requests get generated audio: raw 16-bit mono samples for pcm_44100.
72
- const pcm = await speak("Anything else.", "pcm_44100")
73
- console.log(pcm.headers.get("content-type"), (await pcm.arrayBuffer()).byteLength) // audio/pcm 61740
72
+ const pcm = await elevenlabs.textToSpeech.convert(voiceId, { text: "Anything else.", outputFormat: "pcm_44100" })
73
+ console.log((await new Response(pcm).arrayBuffer()).byteLength) // 61740
74
74
  ```
75
75
 
76
76
  ### Routes