@crvouga/mockingbird-service-docker 1.1.0 → 1.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,21 @@
1
1
  # Changelog — @crvouga/mockingbird-service-docker
2
2
 
3
+ ## 1.3.0 (2026-10-12)
4
+
5
+ ### Features
6
+
7
+ - unify the emulator control plane ([2068547](https://github.com/crvouga/mockingbird/commit/2068547bedde4e2e2331c1657c1a78120e84428b))
8
+
9
+ ### Dependencies
10
+
11
+ - `@crvouga/mockingbird-service-sqlite`
12
+
13
+ ## 1.2.0 (2026-10-08)
14
+
15
+ ### Features
16
+
17
+ - match Emulate provider coverage ([16b65ce](https://github.com/crvouga/mockingbird/commit/16b65ce791fa216f28ec1521df636f57771d9c5e))
18
+
3
19
  ## 1.1.0 (2026-10-08)
4
20
 
5
21
  ### Features
package/DISCOVERY.md CHANGED
@@ -34,6 +34,7 @@ repository; live parity is an additional oracle check, not a substitute for the
34
34
 
35
35
  - `GET /__admin/health`
36
36
  - `GET /__admin`
37
+ - `GET /__admin/controls`
37
38
  - `GET /__admin/state`
38
39
  - `GET /__admin/requests`
39
40
  - `GET /__admin/metrics`
@@ -44,6 +45,28 @@ For HTTP services, use `x-mockingbird-namespace` (or the documented credential/p
44
45
  parallel tests do not share state. Admin state, journal, metrics and fault-preset endpoints are
45
46
  designed for assertions and diagnosis by consuming test suites.
46
47
 
48
+ ## Admin controls
49
+
50
+ Every HTTP emulator takes the same controls, and each means the same thing at boot
51
+ (`createRuntime({ adminControls })`, `serve --admin-controls`), over `/__admin`, and in a request header:
52
+
53
+ | Control | Admin API | Request header | Interface |
54
+ | --- | --- | --- | --- |
55
+ | Isolate state by key | `GET /__admin/namespaces` | `x-mockingbird-namespace: <key>` | [Namespaces](https://mockingbird.chrisvouga.dev/docs/admin-controls/namespaces) |
56
+ | Reset to boot | `POST /__admin/reset` | `x-mockingbird-reset: true` | [Reset](https://mockingbird.chrisvouga.dev/docs/admin-controls/reset) |
57
+ | 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) |
58
+ | Move the clock | `POST /__admin/clock` | `x-mockingbird-time: <instant>`, `x-mockingbird-advance: <duration>` | [Clock](https://mockingbird.chrisvouga.dev/docs/admin-controls/clock) |
59
+ | 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) |
60
+ | Inject a fault | `POST /__admin/faults` | `x-mockingbird-fault: <fault>` | [Faults](https://mockingbird.chrisvouga.dev/docs/admin-controls/faults) |
61
+ | 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) |
62
+ | Replay from a seed | `PUT /__admin/controls` | `x-mockingbird-seed: <seed>` | [Seed and determinism](https://mockingbird.chrisvouga.dev/docs/admin-controls/seed-and-determinism) |
63
+ | See what happened | `GET /__admin/requests`, `GET /__admin/state` | | [Journal, metrics and state](https://mockingbird.chrisvouga.dev/docs/admin-controls/journal-and-state) |
64
+
65
+ `GET /__admin` lists every route and header with a one-line summary, and `GET /__admin/controls`
66
+ is the namespace's current control document. The same seed and the same requests give the same
67
+ bytes. Setting controls as an emulator starts is [Boot](https://mockingbird.chrisvouga.dev/docs/admin-controls/boot); every route and header is in
68
+ the [Reference](https://mockingbird.chrisvouga.dev/docs/admin-controls/reference). The full guide: <https://mockingbird.chrisvouga.dev/docs/admin-controls>.
69
+
47
70
  ## Report a mismatch or missing capability
48
71
 
49
72
  Follow the [agent reporting contract](https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md). Include package version,
package/README.md CHANGED
@@ -18,11 +18,17 @@ bun add @crvouga/mockingbird-service-docker
18
18
  ## Usage
19
19
 
20
20
  ```ts
21
- import { createRuntime } from "@crvouga/mockingbird-service-docker"
21
+ import { DockerClient } from "@docker/node-sdk"
22
+ import { createServer } from "@crvouga/mockingbird-service-docker/server"
23
+
24
+ // Docker's Node SDK, as your application uses it (run with Node; its transport does not
25
+ // work under Bun). Only the Docker host changes.
26
+ const server = await createServer({ seed: 42 })
27
+ const docker = await DockerClient.fromDockerHost(`tcp://${server.host}:${server.port}`)
28
+ console.log(await docker.systemPing()) // 1.52
22
29
 
23
- const docker = createRuntime({ seed: 42 })
24
- const response = await docker.fetch(new Request("http://docker.mock/_ping"))
25
- console.log(await response.text()) // OK
30
+ await docker.close()
31
+ await server.close()
26
32
  ```
27
33
 
28
34
  Use `DockerAPI` for the provider-only Fetch surface, or `createRuntime` for health,
@@ -49,14 +55,15 @@ Run this with Node against the built package. The server uses an ephemeral
49
55
  loopback port and synthetic state; no Docker installation is needed.
50
56
 
51
57
  ```ts
58
+ import { DockerClient } from "@docker/node-sdk"
52
59
  import { createServer } from "@crvouga/mockingbird-service-docker/server"
53
60
 
54
61
  const server = await createServer({ seed: 42 })
62
+ const docker = await DockerClient.fromDockerHost(`tcp://${server.host}:${server.port}`)
55
63
  try {
56
- const response = await fetch(`${server.url}/v1.52/version`)
57
- if (!response.ok) throw new Error(`Docker mock returned ${response.status}`)
58
- console.log(await response.json())
64
+ console.log(await docker.systemVersion())
59
65
  } finally {
66
+ await docker.close()
60
67
  await server.close()
61
68
  }
62
69
  ```
@@ -71,10 +78,13 @@ adapter; use `createServer` for Docker's attach and Unix-socket transport.
71
78
  namespace. It never downloads an image or starts a process. For example:
72
79
 
73
80
  ```ts
74
- import { createRuntime } from "@crvouga/mockingbird-service-docker"
81
+ import { DockerClient } from "@docker/node-sdk"
82
+ import { createServer } from "@crvouga/mockingbird-service-docker/server"
75
83
 
76
- const docker = createRuntime({ seed: 42 })
77
- await docker.fetch(new Request("http://docker.mock/__admin/docker/seed", {
84
+ const server = await createServer({ seed: 42 })
85
+
86
+ // Test setup: seed synthetic observations.
87
+ await fetch(`${server.url}/__admin/docker/seed`, {
78
88
  method: "POST",
79
89
  headers: { "content-type": "application/json" },
80
90
  body: JSON.stringify({
@@ -85,7 +95,15 @@ await docker.fetch(new Request("http://docker.mock/__admin/docker/seed", {
85
95
  }],
86
96
  daemon: { rootless: true },
87
97
  }),
88
- }))
98
+ })
99
+
100
+ // The application sees them through Docker's SDK.
101
+ const docker = await DockerClient.fromDockerHost(`tcp://${server.host}:${server.port}`)
102
+ const [worker] = await docker.containerList({ all: true })
103
+ console.log(worker?.Names, worker?.State) // [ '/worker' ] running
104
+
105
+ await docker.close()
106
+ await server.close()
89
107
  ```
90
108
 
91
109
  Image IDs are immutable SHA-256 strings; container IDs are separate 64-character