@crvouga/mockingbird-service-rxvortex 3.11.0 → 3.12.1

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,19 @@
1
1
  # Changelog — @crvouga/mockingbird-service-rxvortex
2
2
 
3
- ## 3.11.0 (2026-11-11)
3
+ ## 3.12.1 (2026-11-12)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - serve vendor brand data from each emulator instead of the docs site ([0c72a69](https://github.com/crvouga/mockingbird/commit/0c72a693fc76e612936150598faef9787ad1c824))
8
+ - take SIGINT/SIGTERM before readiness is published ([d5a98a0](https://github.com/crvouga/mockingbird/commit/d5a98a09a344e12818c5c94cbea03621b528f841))
9
+
10
+ ## 3.12.0 (2026-11-11)
11
+
12
+ ### Features
13
+
14
+ - one dashboard for every admin UI and notification view ([d9fdf4d](https://github.com/crvouga/mockingbird/commit/d9fdf4dc1faeaa5c385f34bd5516323e49284b4d))
15
+
16
+ ## 3.11.0 (2026-11-10)
4
17
 
5
18
  ### Features
6
19
 
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-rxvortex/`; 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-rxvortex
14
+ ```
15
+
16
+ `mockingbird.json` (add one entry per installed emulator; `"port": 0` picks a free port):
17
+
18
+ ```json
19
+ {
20
+ "services": {
21
+ "rxvortex": { "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 |
@@ -10,7 +10,7 @@ import {
10
10
  parseFaultHeader,
11
11
  resolveAdminPrefix,
12
12
  restoreClock
13
- } from "./chunk-KYF6NH62.js";
13
+ } from "./chunk-KVEXOK7V.js";
14
14
 
15
15
  // src/server.ts
16
16
  import { readFileSync } from "node:fs";
@@ -1666,9 +1666,7 @@ data: ${JSON.stringify(data)}
1666
1666
  async handle(request, path, namespace, body, admin) {
1667
1667
  const route = path.slice("/fleet".length), method = request.method;
1668
1668
  if (path === "/ui")
1669
- return new Response(fleetConsole(this.ctx.config.adminPrefix ?? "/__admin"), {
1670
- headers: { "content-type": "text/html; charset=utf-8" }
1671
- });
1669
+ return new Response(fleetConsole(this.ctx.config.adminPrefix ?? "/__admin", this.ctx.dashboard?.()), { headers: { "content-type": "text/html; charset=utf-8" } });
1672
1670
  if (route === "" && method === "GET")
1673
1671
  return Response.json({
1674
1672
  ...this.capability(),
@@ -2638,7 +2636,8 @@ data: ${JSON.stringify(data)}
2638
2636
  clearInterval(this.expiryTimer);
2639
2637
  }
2640
2638
  };
2641
- 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>`;
2639
+ var escapeAttribute = (value) => value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
2640
+ 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>`;
2642
2641
 
2643
2642
  // ../../adapters/node/dist/fleet-preflight.js
2644
2643
  import { readFile, realpath } from "node:fs/promises";
@@ -2702,6 +2701,28 @@ var fleet_config_schema_default = {
2702
2701
  }
2703
2702
  }
2704
2703
  },
2704
+ dashboard: {
2705
+ description: "Serve the dashboard (every emulator's admin UI and the notifications UI) next to the fleet. Honored by mockingbird-fleet serve.",
2706
+ anyOf: [
2707
+ {
2708
+ type: "boolean"
2709
+ },
2710
+ {
2711
+ type: "object",
2712
+ additionalProperties: false,
2713
+ properties: {
2714
+ port: {
2715
+ type: "integer",
2716
+ minimum: 0,
2717
+ maximum: 65535
2718
+ },
2719
+ host: {
2720
+ type: "string"
2721
+ }
2722
+ }
2723
+ }
2724
+ ]
2725
+ },
2705
2726
  cors: {
2706
2727
  type: "object",
2707
2728
  required: ["origins"],
@@ -2986,6 +3007,7 @@ async function preflightFleet(config, options) {
2986
3007
  throw new Error("protected archive policy requires a protected repository; configure its protector before startup");
2987
3008
  resolveAdminPrefix(config.adminPrefix);
2988
3009
  normalizeBootControls(config.adminControls);
3010
+ validateDashboard(config.dashboard);
2989
3011
  if (config.idBase !== void 0)
2990
3012
  normalizeIdBase(config.idBase, "idBase");
2991
3013
  const targets = /* @__PURE__ */ new Map();
@@ -3061,7 +3083,7 @@ async function preflightFleet(config, options) {
3061
3083
  break;
3062
3084
  }
3063
3085
  }
3064
- targets.set(name, { ...target, packageVersion: packageVersion ?? "3.11.0" });
3086
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "3.12.1" });
3065
3087
  } catch (error) {
3066
3088
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3067
3089
  }
@@ -3146,6 +3168,22 @@ function validateFleetPolicies(options) {
3146
3168
  if (duration !== void 0 && (!Number.isSafeInteger(duration) || duration < 1))
3147
3169
  throw new Error("hook deadlines must be positive integer milliseconds");
3148
3170
  }
3171
+ function validateDashboard(value) {
3172
+ if (value === void 0 || typeof value === "boolean")
3173
+ return;
3174
+ if (!value || typeof value !== "object" || Array.isArray(value))
3175
+ throw new Error("dashboard: expected true, false or { port, host }");
3176
+ for (const [key, entry] of Object.entries(value)) {
3177
+ if (key === "port") {
3178
+ if (!Number.isInteger(entry) || entry < 0 || entry > 65535)
3179
+ throw new Error("dashboard.port: expected an integer from 0 to 65535");
3180
+ } else if (key === "host") {
3181
+ if (typeof entry !== "string" || !entry)
3182
+ throw new Error("dashboard.host: expected a host");
3183
+ } else
3184
+ throw new Error(`dashboard.${key}: unknown key; expected port or host`);
3185
+ }
3186
+ }
3149
3187
 
3150
3188
  // ../../adapters/node/dist/serve.js
3151
3189
  import { createServer } from "node:http";
@@ -3601,6 +3639,7 @@ async function startFleet(config, options) {
3601
3639
  const checkpoints = /* @__PURE__ */ new Map();
3602
3640
  let supervisor;
3603
3641
  let management;
3642
+ let dashboard;
3604
3643
  let manifest;
3605
3644
  const privateConnections = () => Object.fromEntries([...children].map(([name, child]) => [
3606
3645
  name,
@@ -3668,6 +3707,7 @@ async function startFleet(config, options) {
3668
3707
  }
3669
3708
  }
3670
3709
  const cleanup = await Promise.allSettled([
3710
+ dashboard?.close(),
3671
3711
  supervisor?.close(),
3672
3712
  removeOwned(options.readyFile, id),
3673
3713
  removeOwned(options.connectionsFile, id)
@@ -4034,6 +4074,7 @@ async function startFleet(config, options) {
4034
4074
  clock,
4035
4075
  transaction,
4036
4076
  manifest: () => manifest,
4077
+ dashboard: () => dashboard?.url,
4037
4078
  publish,
4038
4079
  recovery,
4039
4080
  controlling
@@ -4097,6 +4138,10 @@ async function startFleet(config, options) {
4097
4138
  }
4098
4139
  }
4099
4140
  await management.startPolicies();
4141
+ if (options.dashboard) {
4142
+ dashboard = await options.dashboard({ manifest, config });
4143
+ manifest.dashboard = dashboard.url;
4144
+ }
4100
4145
  await publish();
4101
4146
  if (manifest.state === "ready")
4102
4147
  options.onReady?.(manifest);
@@ -4896,20 +4941,35 @@ var start = async (target, values, config) => {
4896
4941
  console.log(`${target.name} ${line.replaceAll("/__admin", adminPrefix)}`);
4897
4942
  return listening;
4898
4943
  };
4899
- var untilSignal = async (servers) => new Promise((resolve4) => {
4900
- const stop = async () => {
4944
+ var watchSignals = () => {
4945
+ let received = false;
4946
+ let wake = () => {
4947
+ };
4948
+ const on = () => {
4949
+ received = true;
4950
+ wake();
4951
+ };
4952
+ const dispose = () => {
4901
4953
  ;
4902
- process.removeListener("SIGINT", stop);
4903
- process.removeListener("SIGTERM", stop);
4904
- const results = await Promise.allSettled(servers.map((s) => s.close()));
4905
- for (const result of results)
4906
- if (result.status === "rejected")
4907
- console.error(result.reason instanceof Error ? result.reason.message : String(result.reason));
4908
- resolve4(results.some((r) => r.status === "rejected") ? 1 : 0);
4954
+ process.removeListener("SIGINT", on);
4955
+ process.removeListener("SIGTERM", on);
4909
4956
  };
4910
- process.once("SIGINT", stop);
4911
- process.once("SIGTERM", stop);
4912
- });
4957
+ process.once("SIGINT", on);
4958
+ process.once("SIGTERM", on);
4959
+ return {
4960
+ dispose,
4961
+ async untilSignal(servers) {
4962
+ if (!received)
4963
+ await new Promise((resolve4) => wake = resolve4);
4964
+ dispose();
4965
+ const results = await Promise.allSettled(servers.map((s) => s.close()));
4966
+ for (const result of results)
4967
+ if (result.status === "rejected")
4968
+ console.error(result.reason instanceof Error ? result.reason.message : String(result.reason));
4969
+ return results.some((r) => r.status === "rejected") ? 1 : 0;
4970
+ }
4971
+ };
4972
+ };
4913
4973
  var serveCommand = (target) => ({
4914
4974
  fleetTarget: target,
4915
4975
  summary: `Serve the ${target.name} emulator or a configured fleet`,
@@ -4922,12 +4982,15 @@ var serveCommand = (target) => ({
4922
4982
  }
4923
4983
  const configPath = asString(values.config);
4924
4984
  if (configPath !== void 0) {
4985
+ const signals2 = watchSignals();
4925
4986
  try {
4926
4987
  const config = JSON.parse(await readFile5(configPath, "utf8"));
4927
4988
  config.adminPrefix = resolveAdminPrefix(config.adminPrefix ?? asString(values["admin-prefix"]) ?? process.env.MOCKINGBIRD_ADMIN_PREFIX);
4928
4989
  const adminKey2 = config.adminKey ?? asString(values["admin-key"]) ?? process.env.MOCKINGBIRD_ADMIN_KEY;
4929
4990
  if (adminKey2 !== void 0)
4930
4991
  config.adminKey = adminKey2;
4992
+ if (config.dashboard)
4993
+ 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`);
4931
4994
  const adminControls = await resolveServeControls(values, process.env, config.adminControls);
4932
4995
  if (adminControls !== void 0)
4933
4996
  config.adminControls = adminControls;
@@ -4949,8 +5012,9 @@ var serveCommand = (target) => ({
4949
5012
  console.log(`${name} emulator listening on ${endpoint.url}`);
4950
5013
  }
4951
5014
  });
4952
- return untilSignal([fleet]);
5015
+ return signals2.untilSignal([fleet]);
4953
5016
  } catch (error) {
5017
+ signals2.dispose();
4954
5018
  console.error(error instanceof Error ? error.message : String(error));
4955
5019
  return 1;
4956
5020
  }
@@ -4963,6 +5027,7 @@ var serveCommand = (target) => ({
4963
5027
  const adminKey = asString(values["admin-key"]) ?? process.env.MOCKINGBIRD_ADMIN_KEY;
4964
5028
  const seed = asString(values.seed) ?? process.env.MOCKINGBIRD_SEED;
4965
5029
  let listening;
5030
+ const signals = watchSignals();
4966
5031
  try {
4967
5032
  const adminControls = await resolveServeControls(values);
4968
5033
  const idBase = resolveServeIdBase(values);
@@ -4979,10 +5044,11 @@ var serveCommand = (target) => ({
4979
5044
  log
4980
5045
  });
4981
5046
  } catch (error) {
5047
+ signals.dispose();
4982
5048
  console.error(error instanceof Error ? error.message : String(error));
4983
5049
  return 1;
4984
5050
  }
4985
- return untilSignal([listening]);
5051
+ return signals.untilSignal([listening]);
4986
5052
  }
4987
5053
  });
4988
5054
 
@@ -5100,4 +5166,4 @@ export {
5100
5166
  loadCatalogFile,
5101
5167
  serveTarget
5102
5168
  };
5103
- //# sourceMappingURL=chunk-GJEFDIPI.js.map
5169
+ //# sourceMappingURL=chunk-BCKBQQOM.js.map