@crvouga/mockingbird-service-wholescripts 3.10.4 → 3.12.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,6 +1,18 @@
1
1
  # Changelog — @crvouga/mockingbird-service-wholescripts
2
2
 
3
- ## 3.10.4 (2026-11-03)
3
+ ## 3.12.0 (2026-11-12)
4
+
5
+ ### Features
6
+
7
+ - one dashboard for every admin UI and notification view ([d9fdf4d](https://github.com/crvouga/mockingbird/commit/d9fdf4dc1faeaa5c385f34bd5516323e49284b4d))
8
+
9
+ ## 3.11.0 (2026-11-10)
10
+
11
+ ### Features
12
+
13
+ - mockingbird.yaml as the one way to configure cloud and local fleets ([f7df8a1](https://github.com/crvouga/mockingbird/commit/f7df8a1bb6d17ca1c211832ff895d3014c015fab))
14
+
15
+ ## 3.10.4 (2026-11-02)
4
16
 
5
17
  ### Fixes and improvements
6
18
 
@@ -9,16 +21,13 @@
9
21
  - attach the snapshot download link and revoke its URL later ([a106903](https://github.com/crvouga/mockingbird/commit/a106903abe9d7d5def7f2857e2d7644c4ebcdae2))
10
22
  - stop the page-hide save inheriting the last write's result as `force` ([551c2dc](https://github.com/crvouga/mockingbird/commit/551c2dcd3615f82e70e0cd0b8a11c82a663d18b6))
11
23
  - keep the record id in the State table's id column ([2fc9bee](https://github.com/crvouga/mockingbird/commit/2fc9beeba6dd8bfe129993a4ff53fbd2925bf569))
24
+ - list migrations applied in the same second in run order ([f8c0591](https://github.com/crvouga/mockingbird/commit/f8c059146a65bfaf7fe99b4d3b6e812e82602bb9))
12
25
  - prune idempotency keys after 24 hours on the mock clock ([094c8b1](https://github.com/crvouga/mockingbird/commit/094c8b124211ae02901c26eb96cca410434b855a))
13
26
  - drop the previous emulator's manifest when switching emulators ([7ed4666](https://github.com/crvouga/mockingbird/commit/7ed46661288662a3789dbe013f1a195905b217e4))
14
27
  - reject a migration list that repeats an id, naming it ([47721d9](https://github.com/crvouga/mockingbird/commit/47721d96a29f4b5184322d19c1b10750086e8da4))
15
28
  - save and replay a 500 the endpoint produced under an Idempotency-Key ([789bbcc](https://github.com/crvouga/mockingbird/commit/789bbcccb792cddaf27f4f6db6d2fcf2da1d07fe))
16
29
  - reserve the manual admin view id ([3d4da92](https://github.com/crvouga/mockingbird/commit/3d4da926182ce609fba44e0fd58abcbb253eee2c))
17
30
 
18
- ### Dependencies
19
-
20
- - `@crvouga/mockingbird-service-sqlite`
21
-
22
31
  ## 3.10.3 (2026-11-02)
23
32
 
24
33
  ### Fixes and improvements
package/DISCOVERY.md CHANGED
@@ -4,6 +4,35 @@ This is the installed-package index for coding agents and tooling. All relative
4
4
  inside `node_modules/@crvouga/mockingbird-service-wholescripts/`; no repository checkout is needed to discover the emulator's
5
5
  supported surface or documented behavior.
6
6
 
7
+ ## Run it in a fleet
8
+
9
+ The recommended way to run this emulator is in a fleet, next to the other emulators the
10
+ application calls: one `mockingbird.json`, one process, each emulator on its own port.
11
+
12
+ ```sh
13
+ npm install -D @crvouga/mockingbird-fleet @crvouga/mockingbird-service-wholescripts
14
+ ```
15
+
16
+ `mockingbird.json` (add one entry per installed emulator; `"port": 0` picks a free port):
17
+
18
+ ```json
19
+ {
20
+ "services": {
21
+ "wholescripts": { "port": 0 }
22
+ }
23
+ }
24
+ ```
25
+
26
+ ```sh
27
+ npx mockingbird-fleet serve --config mockingbird.json --dashboard --ready-file ready.json
28
+ ```
29
+
30
+ Read this emulator's URL from `services.<name>.url` in `ready.json` and point the client at it.
31
+ `adminBase` in the same file is the fleet controller, which resets, snapshots and restores every
32
+ emulator in one call, and `dashboard` is one page with every HTTP emulator's admin UI and the
33
+ notifications the application sent. The guide: <https://mockingbird.chrisvouga.dev/docs/fleets>. The README covers running this
34
+ emulator alone or in-process.
35
+
7
36
  ## Capability and behavior sources
8
37
 
9
38
  | Question | Authoritative file | What it contains |
@@ -12,7 +12,7 @@ import {
12
12
  parseFaultHeader,
13
13
  resolveAdminPrefix,
14
14
  restoreClock
15
- } from "./chunk-IESBLTW6.js";
15
+ } from "./chunk-LSHJ52FN.js";
16
16
 
17
17
  // src/server.ts
18
18
  import { readFileSync } from "node:fs";
@@ -1668,9 +1668,7 @@ data: ${JSON.stringify(data)}
1668
1668
  async handle(request, path, namespace, body, admin) {
1669
1669
  const route = path.slice("/fleet".length), method = request.method;
1670
1670
  if (path === "/ui")
1671
- return new Response(fleetConsole(this.ctx.config.adminPrefix ?? "/__admin"), {
1672
- headers: { "content-type": "text/html; charset=utf-8" }
1673
- });
1671
+ return new Response(fleetConsole(this.ctx.config.adminPrefix ?? "/__admin", this.ctx.dashboard?.()), { headers: { "content-type": "text/html; charset=utf-8" } });
1674
1672
  if (route === "" && method === "GET")
1675
1673
  return Response.json({
1676
1674
  ...this.capability(),
@@ -2640,7 +2638,8 @@ data: ${JSON.stringify(data)}
2640
2638
  clearInterval(this.expiryTimer);
2641
2639
  }
2642
2640
  };
2643
- var fleetConsole = (prefix) => `<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Mockingbird Fleet</title><style>body{font:16px system-ui;max-width:1000px;margin:3rem auto;padding:1rem;background:#10151b;color:#e0e9f2}input,select,button{padding:.7rem;margin:.3rem;background:#233142;color:inherit;border:1px solid #60768b;border-radius:5px}pre{white-space:pre-wrap;overflow-wrap:anywhere}a{color:#9fdbff}</style><h1>Mockingbird Fleet</h1><label>Admin key <input id="key" type="password" autocomplete="off"></label><label>Namespace <input id="ns" value="default"></label><button id="refresh">Refresh</button><section id="children"></section><label>Action <select id="action"><option value="snapshots">Capture checkpoint</option><option value="reset">Reset namespace</option></select></label><button id="run">Run</button><h2>Lifecycle and operations</h2><pre id="result"></pre><script type="module">const base=${JSON.stringify(`${prefix}/fleet`)};const key=document.querySelector('#key'),ns=document.querySelector('#ns'),result=document.querySelector('#result');async function api(path,method='GET',body){const r=await fetch(base+path,{method,headers:{'content-type':'application/json','x-mockingbird-admin-key':key.value},...(body?{body:JSON.stringify(body)}:{})});const data=await r.json();result.textContent=JSON.stringify(data,null,2);return data}document.querySelector('#refresh').onclick=async()=>{const data=await api('');const host=document.querySelector('#children');host.replaceChildren();for(const [name,child]of Object.entries(data.manifest?.services??{})){const link=document.createElement('a');link.href=child.adminUrl;link.textContent=name+' ('+child.protocol+') ';host.append(link)}await api('/operations?namespace='+encodeURIComponent(ns.value))};document.querySelector('#run').onclick=()=>api('/namespaces/'+encodeURIComponent(ns.value)+'/'+document.querySelector('#action').value,'POST',{});</script></html>`;
2641
+ var escapeAttribute = (value) => value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
2642
+ var fleetConsole = (prefix, dashboard) => `<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Mockingbird Fleet</title><style>body{font:16px system-ui;max-width:1000px;margin:3rem auto;padding:1rem;background:#10151b;color:#e0e9f2}input,select,button{padding:.7rem;margin:.3rem;background:#233142;color:inherit;border:1px solid #60768b;border-radius:5px}pre{white-space:pre-wrap;overflow-wrap:anywhere}a{color:#9fdbff}</style><h1>Mockingbird Fleet</h1>${dashboard ? `<p id="dashboard">Every emulator's admin UI and the notifications UI are on the <a href="${escapeAttribute(dashboard)}">dashboard</a>.</p>` : ""}<label>Admin key <input id="key" type="password" autocomplete="off"></label><label>Namespace <input id="ns" value="default"></label><button id="refresh">Refresh</button><section id="children"></section><label>Action <select id="action"><option value="snapshots">Capture checkpoint</option><option value="reset">Reset namespace</option></select></label><button id="run">Run</button><h2>Lifecycle and operations</h2><pre id="result"></pre><script type="module">const base=${JSON.stringify(`${prefix}/fleet`)};const key=document.querySelector('#key'),ns=document.querySelector('#ns'),result=document.querySelector('#result');async function api(path,method='GET',body){const r=await fetch(base+path,{method,headers:{'content-type':'application/json','x-mockingbird-admin-key':key.value},...(body?{body:JSON.stringify(body)}:{})});const data=await r.json();result.textContent=JSON.stringify(data,null,2);return data}document.querySelector('#refresh').onclick=async()=>{const data=await api('');const host=document.querySelector('#children');host.replaceChildren();for(const [name,child]of Object.entries(data.manifest?.services??{})){const link=document.createElement('a');link.href=child.adminUrl;link.textContent=name+' ('+child.protocol+') ';host.append(link)}await api('/operations?namespace='+encodeURIComponent(ns.value))};document.querySelector('#run').onclick=()=>api('/namespaces/'+encodeURIComponent(ns.value)+'/'+document.querySelector('#action').value,'POST',{});</script></html>`;
2644
2643
 
2645
2644
  // ../../adapters/node/dist/fleet-preflight.js
2646
2645
  import { readFile, realpath } from "node:fs/promises";
@@ -2704,6 +2703,28 @@ var fleet_config_schema_default = {
2704
2703
  }
2705
2704
  }
2706
2705
  },
2706
+ dashboard: {
2707
+ description: "Serve the dashboard (every emulator's admin UI and the notifications UI) next to the fleet. Honored by mockingbird-fleet serve.",
2708
+ anyOf: [
2709
+ {
2710
+ type: "boolean"
2711
+ },
2712
+ {
2713
+ type: "object",
2714
+ additionalProperties: false,
2715
+ properties: {
2716
+ port: {
2717
+ type: "integer",
2718
+ minimum: 0,
2719
+ maximum: 65535
2720
+ },
2721
+ host: {
2722
+ type: "string"
2723
+ }
2724
+ }
2725
+ }
2726
+ ]
2727
+ },
2707
2728
  cors: {
2708
2729
  type: "object",
2709
2730
  required: ["origins"],
@@ -2988,6 +3009,7 @@ async function preflightFleet(config, options) {
2988
3009
  throw new Error("protected archive policy requires a protected repository; configure its protector before startup");
2989
3010
  resolveAdminPrefix(config.adminPrefix);
2990
3011
  normalizeBootControls(config.adminControls);
3012
+ validateDashboard(config.dashboard);
2991
3013
  if (config.idBase !== void 0)
2992
3014
  normalizeIdBase(config.idBase, "idBase");
2993
3015
  const targets = /* @__PURE__ */ new Map();
@@ -3063,7 +3085,7 @@ async function preflightFleet(config, options) {
3063
3085
  break;
3064
3086
  }
3065
3087
  }
3066
- targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.4" });
3088
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "3.12.0" });
3067
3089
  } catch (error) {
3068
3090
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3069
3091
  }
@@ -3148,6 +3170,22 @@ function validateFleetPolicies(options) {
3148
3170
  if (duration !== void 0 && (!Number.isSafeInteger(duration) || duration < 1))
3149
3171
  throw new Error("hook deadlines must be positive integer milliseconds");
3150
3172
  }
3173
+ function validateDashboard(value) {
3174
+ if (value === void 0 || typeof value === "boolean")
3175
+ return;
3176
+ if (!value || typeof value !== "object" || Array.isArray(value))
3177
+ throw new Error("dashboard: expected true, false or { port, host }");
3178
+ for (const [key, entry] of Object.entries(value)) {
3179
+ if (key === "port") {
3180
+ if (!Number.isInteger(entry) || entry < 0 || entry > 65535)
3181
+ throw new Error("dashboard.port: expected an integer from 0 to 65535");
3182
+ } else if (key === "host") {
3183
+ if (typeof entry !== "string" || !entry)
3184
+ throw new Error("dashboard.host: expected a host");
3185
+ } else
3186
+ throw new Error(`dashboard.${key}: unknown key; expected port or host`);
3187
+ }
3188
+ }
3151
3189
 
3152
3190
  // ../../adapters/node/dist/serve.js
3153
3191
  import { createServer } from "node:http";
@@ -3603,6 +3641,7 @@ async function startFleet(config, options) {
3603
3641
  const checkpoints = /* @__PURE__ */ new Map();
3604
3642
  let supervisor;
3605
3643
  let management;
3644
+ let dashboard;
3606
3645
  let manifest;
3607
3646
  const privateConnections = () => Object.fromEntries([...children].map(([name, child]) => [
3608
3647
  name,
@@ -3670,6 +3709,7 @@ async function startFleet(config, options) {
3670
3709
  }
3671
3710
  }
3672
3711
  const cleanup = await Promise.allSettled([
3712
+ dashboard?.close(),
3673
3713
  supervisor?.close(),
3674
3714
  removeOwned(options.readyFile, id),
3675
3715
  removeOwned(options.connectionsFile, id)
@@ -4036,6 +4076,7 @@ async function startFleet(config, options) {
4036
4076
  clock,
4037
4077
  transaction,
4038
4078
  manifest: () => manifest,
4079
+ dashboard: () => dashboard?.url,
4039
4080
  publish,
4040
4081
  recovery,
4041
4082
  controlling
@@ -4099,6 +4140,10 @@ async function startFleet(config, options) {
4099
4140
  }
4100
4141
  }
4101
4142
  await management.startPolicies();
4143
+ if (options.dashboard) {
4144
+ dashboard = await options.dashboard({ manifest, config });
4145
+ manifest.dashboard = dashboard.url;
4146
+ }
4102
4147
  await publish();
4103
4148
  if (manifest.state === "ready")
4104
4149
  options.onReady?.(manifest);
@@ -4930,6 +4975,8 @@ var serveCommand = (target) => ({
4930
4975
  const adminKey2 = config.adminKey ?? asString(values["admin-key"]) ?? process.env.MOCKINGBIRD_ADMIN_KEY;
4931
4976
  if (adminKey2 !== void 0)
4932
4977
  config.adminKey = adminKey2;
4978
+ if (config.dashboard)
4979
+ console.error(`${configPath}: "dashboard" is served by mockingbird-fleet (npx @crvouga/mockingbird-fleet serve --config ${configPath}); a service's own serve command starts the fleet without it`);
4933
4980
  const adminControls = await resolveServeControls(values, process.env, config.adminControls);
4934
4981
  if (adminControls !== void 0)
4935
4982
  config.adminControls = adminControls;
@@ -5096,4 +5143,4 @@ export {
5096
5143
  loadCatalogFile,
5097
5144
  serveTarget
5098
5145
  };
5099
- //# sourceMappingURL=chunk-L5NEDSSU.js.map
5146
+ //# sourceMappingURL=chunk-A3XR5VOC.js.map