@crvouga/mockingbird-service-slack 3.6.0 → 3.7.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,12 @@
1
1
  # Changelog — @crvouga/mockingbird-service-slack
2
2
 
3
- ## 3.6.0 (2026-10-17)
3
+ ## 3.7.0 (2026-10-19)
4
+
5
+ ### Features
6
+
7
+ - resolve the agent-reported issue queue in one batch ([25c52b6](https://github.com/crvouga/mockingbird/commit/25c52b668a53ddb80b968419601a20abf33f956b))
8
+
9
+ ## 3.6.0 (2026-10-16)
4
10
 
5
11
  ### Features
6
12
 
@@ -6,6 +6,7 @@ import {
6
6
  markSocketClosed,
7
7
  normalizeBootControls,
8
8
  normalizeControls,
9
+ normalizeIdBase,
9
10
  openSocketCount,
10
11
  ownedTransport,
11
12
  parseDuration,
@@ -13,12 +14,25 @@ import {
13
14
  resolveAdminPrefix,
14
15
  restoreClock,
15
16
  unbindSocketTransport
16
- } from "./chunk-4JPRLFNZ.js";
17
+ } from "./chunk-WBNF7Q2J.js";
17
18
 
18
19
  // ../../adapters/node/dist/cli.js
19
20
  import { readFile as readFile5 } from "node:fs/promises";
20
21
  import { parseArgs } from "node:util";
21
22
 
23
+ // ../../adapters/node/dist/boot-settings.js
24
+ var checkSettings = (target, settings, label) => {
25
+ if (!target.parseSettings)
26
+ throw new Error(`${label}: ${target.name} takes no boot settings`);
27
+ try {
28
+ return target.parseSettings(settings);
29
+ } catch (error) {
30
+ throw new Error(`${label}: ${error instanceof Error ? error.message : String(error)}`, {
31
+ cause: error
32
+ });
33
+ }
34
+ };
35
+
22
36
  // ../../adapters/node/dist/fleet.js
23
37
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
24
38
  import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
@@ -2668,6 +2682,9 @@ var fleet_config_schema_default = {
2668
2682
  adminControls: {
2669
2683
  $ref: "#/$defs/controls"
2670
2684
  },
2685
+ idBase: {
2686
+ $ref: "#/$defs/idBase"
2687
+ },
2671
2688
  namespace: {
2672
2689
  type: "string",
2673
2690
  pattern: "^[A-Za-z0-9_.-]{1,64}$"
@@ -2757,6 +2774,12 @@ var fleet_config_schema_default = {
2757
2774
  adminControls: {
2758
2775
  $ref: "#/$defs/controls"
2759
2776
  },
2777
+ idBase: {
2778
+ $ref: "#/$defs/idBase"
2779
+ },
2780
+ settings: {
2781
+ type: "object"
2782
+ },
2760
2783
  fixtures: {
2761
2784
  type: "object"
2762
2785
  },
@@ -2803,6 +2826,18 @@ var fleet_config_schema_default = {
2803
2826
  }
2804
2827
  }
2805
2828
  },
2829
+ idBase: {
2830
+ anyOf: [
2831
+ {
2832
+ type: "integer",
2833
+ minimum: 0
2834
+ },
2835
+ {
2836
+ type: "string",
2837
+ pattern: "^(boot|[0-9]+)$"
2838
+ }
2839
+ ]
2840
+ },
2806
2841
  controls: {
2807
2842
  type: "object",
2808
2843
  additionalProperties: false,
@@ -2952,6 +2987,8 @@ async function preflightFleet(config, options) {
2952
2987
  throw new Error("protected archive policy requires a protected repository; configure its protector before startup");
2953
2988
  resolveAdminPrefix(config.adminPrefix);
2954
2989
  normalizeBootControls(config.adminControls);
2990
+ if (config.idBase !== void 0)
2991
+ normalizeIdBase(config.idBase, "idBase");
2955
2992
  const targets = /* @__PURE__ */ new Map();
2956
2993
  const ports = /* @__PURE__ */ new Set();
2957
2994
  for (const [name, entry] of Object.entries(config.services)) {
@@ -2983,6 +3020,13 @@ async function preflightFleet(config, options) {
2983
3020
  throw new Error("invalid protocol namespace selector");
2984
3021
  }
2985
3022
  }
3023
+ if (entry.idBase !== void 0)
3024
+ normalizeIdBase(entry.idBase, "idBase");
3025
+ if (entry.settings !== void 0) {
3026
+ if (protocol !== "http" || !("create" in target))
3027
+ throw new Error("settings: only HTTP services take boot settings");
3028
+ checkSettings(target, entry.settings, "settings");
3029
+ }
2986
3030
  const port = entry.port ?? target.defaultPort;
2987
3031
  if (port !== 0) {
2988
3032
  const key = `${entry.host ?? "127.0.0.1"}:${port}`;
@@ -3018,7 +3062,7 @@ async function preflightFleet(config, options) {
3018
3062
  break;
3019
3063
  }
3020
3064
  }
3021
- targets.set(name, { ...target, packageVersion: packageVersion ?? "3.6.0" });
3065
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "3.7.0" });
3022
3066
  } catch (error) {
3023
3067
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3024
3068
  }
@@ -3338,6 +3382,7 @@ var httpChild = async (target, entry, options, admission, generation, privateAcc
3338
3382
  options.onLog?.(entry2);
3339
3383
  },
3340
3384
  ...entry.adminControls !== void 0 ? { adminControls: entry.adminControls } : {},
3385
+ ...entry.settings !== void 0 ? { settings: checkSettings(target, entry.settings, "settings") } : {},
3341
3386
  ...entry.fixtures !== void 0 ? { fixtures: entry.fixtures } : {},
3342
3387
  ...(advertisedHttpBase(entry) ?? entry.baseUrl) !== void 0 ? { baseUrl: advertisedHttpBase(entry) ?? entry.baseUrl } : {}
3343
3388
  });
@@ -3356,6 +3401,8 @@ var httpChild = async (target, entry, options, admission, generation, privateAcc
3356
3401
  ].some((method) => typeof created[method] !== "function"))
3357
3402
  throw new Error("HTTP target does not implement the fleet runtime protocol; build/install matching supported service versions");
3358
3403
  const runtime = created;
3404
+ if (entry.idBase !== void 0)
3405
+ runtime.setIdBase?.(entry.idBase);
3359
3406
  const unobserve = runtime.webhooks?.observeDeliveries(observer.delivery);
3360
3407
  if (options.outbound && runtime.webhooks)
3361
3408
  runtime.webhooks.setTransportPolicy(ownedTransport(options.outbound));
@@ -3954,6 +4001,7 @@ async function startFleet(config, options) {
3954
4001
  ...entry,
3955
4002
  adminPrefix: resolveAdminPrefix(entry.adminPrefix ?? adminPrefix),
3956
4003
  ...adminKey !== void 0 ? { adminKey } : {},
4004
+ ...(entry.idBase ?? config.idBase) !== void 0 ? { idBase: entry.idBase ?? config.idBase } : {},
3957
4005
  // Fleet-wide controls, with the service's own keys replacing them.
3958
4006
  ...config.adminControls !== void 0 || entry.adminControls !== void 0 ? { adminControls: { ...config.adminControls, ...entry.adminControls } } : {}
3959
4007
  }, options, (namespace, request) => management?.admit(namespace, request), (namespace) => management?.generation(namespace), (namespace, request) => management?.privateRequest(namespace, request) ?? false, {
@@ -4638,6 +4686,16 @@ var COMMON_SERVE_OPTIONS = {
4638
4686
  value: "<seed>",
4639
4687
  description: "Seed for every random choice (env MOCKINGBIRD_SEED)"
4640
4688
  },
4689
+ "id-base": {
4690
+ type: "string",
4691
+ value: "<n|boot>",
4692
+ description: "Start generated ids at this base so a restart does not reissue the last boot's ids; boot derives one from the clock (env MOCKINGBIRD_ID_BASE; default 0, the same ids every boot)"
4693
+ },
4694
+ settings: {
4695
+ type: "string",
4696
+ value: "<json|file>",
4697
+ description: "Service settings to boot with, as JSON or a JSON file; every namespace starts from them (env MOCKINGBIRD_SETTINGS; only for services that declare settings)"
4698
+ },
4641
4699
  "admin-controls": {
4642
4700
  type: "string",
4643
4701
  value: "<json|file>",
@@ -4732,19 +4790,40 @@ var readJsonFile = async (path, label) => {
4732
4790
  }
4733
4791
  };
4734
4792
  var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
4793
+ var readJsonOption = async (source, label) => {
4794
+ const trimmed = source.trim();
4795
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
4796
+ try {
4797
+ return JSON.parse(trimmed);
4798
+ } catch {
4799
+ throw new Error(`${label}: not valid JSON`);
4800
+ }
4801
+ }
4802
+ return readJsonFile(source, label);
4803
+ };
4804
+ var resolveServeIdBase = (values, env = process.env) => {
4805
+ const source = asString(values["id-base"]) ?? env.MOCKINGBIRD_ID_BASE;
4806
+ if (source === void 0 || source.trim() === "")
4807
+ return void 0;
4808
+ normalizeIdBase(source.trim(), "--id-base");
4809
+ return source.trim();
4810
+ };
4811
+ var resolveServeSettings = async (target, values, env = process.env) => {
4812
+ const flag = asString(values.settings);
4813
+ const source = flag ?? env.MOCKINGBIRD_SETTINGS;
4814
+ if (source === void 0 || source.trim() === "")
4815
+ return void 0;
4816
+ const label = flag !== void 0 ? "--settings" : "MOCKINGBIRD_SETTINGS";
4817
+ const parsed = await readJsonOption(source, label);
4818
+ if (!isObject2(parsed))
4819
+ throw new Error(`${label}: expected a JSON object`);
4820
+ return checkSettings(target, parsed, label);
4821
+ };
4735
4822
  var resolveServeControls = async (values, env = process.env, base) => {
4736
4823
  const source = asString(values["admin-controls"]) ?? env.MOCKINGBIRD_ADMIN_CONTROLS;
4737
4824
  let document = isObject2(base) ? { ...base } : {};
4738
4825
  if (source !== void 0 && source.trim() !== "") {
4739
- let parsed;
4740
- if (source.trim().startsWith("{")) {
4741
- try {
4742
- parsed = JSON.parse(source);
4743
- } catch {
4744
- throw new Error("--admin-controls: not valid JSON");
4745
- }
4746
- } else
4747
- parsed = await readJsonFile(source, "--admin-controls");
4826
+ const parsed = source.trim().startsWith("{") ? await readJsonOption(source, "--admin-controls") : await readJsonFile(source, "--admin-controls");
4748
4827
  if (!isObject2(parsed))
4749
4828
  throw new Error("--admin-controls: expected a JSON object");
4750
4829
  document = { ...document, ...parsed };
@@ -4794,8 +4873,11 @@ var start = async (target, values, config) => {
4794
4873
  adminKey: config.adminKey,
4795
4874
  seed: config.seed,
4796
4875
  onLog: formatLog(config.log),
4876
+ ...config.settings !== void 0 ? { settings: config.settings } : {},
4797
4877
  ...config.adminControls !== void 0 ? { adminControls: config.adminControls } : {}
4798
4878
  });
4879
+ if (config.idBase !== void 0)
4880
+ runtime.setIdBase?.(config.idBase);
4799
4881
  const listening = await listen(runtime, { port: config.port, host: config.host });
4800
4882
  target.listening?.(listening);
4801
4883
  console.log(`${target.name} emulator listening on ${listening.url}`);
@@ -4841,6 +4923,11 @@ var serveCommand = (target) => ({
4841
4923
  const adminControls = await resolveServeControls(values, process.env, config.adminControls);
4842
4924
  if (adminControls !== void 0)
4843
4925
  config.adminControls = adminControls;
4926
+ if (values.settings !== void 0)
4927
+ throw new Error("--settings serves a single service; give each service its own `settings` in the config");
4928
+ const idBase = config.idBase ?? resolveServeIdBase(values);
4929
+ if (idBase !== void 0)
4930
+ config.idBase = idBase;
4844
4931
  const fleet = await startFleet(config, {
4845
4932
  load: (name) => loadTarget(name, target),
4846
4933
  onLog: formatLog(config.log ?? log),
@@ -4870,8 +4957,12 @@ var serveCommand = (target) => ({
4870
4957
  let listening;
4871
4958
  try {
4872
4959
  const adminControls = await resolveServeControls(values);
4960
+ const idBase = resolveServeIdBase(values);
4961
+ const settings = await resolveServeSettings(target, values);
4873
4962
  listening = await start(target, values, {
4874
4963
  ...adminControls !== void 0 ? { adminControls } : {},
4964
+ ...idBase !== void 0 ? { idBase } : {},
4965
+ ...settings !== void 0 ? { settings } : {},
4875
4966
  adminPrefix: resolveAdminPrefix(asString(values["admin-prefix"]) ?? process.env.MOCKINGBIRD_ADMIN_PREFIX),
4876
4967
  port: port === void 0 ? target.defaultPort : Number.parseInt(port, 10),
4877
4968
  host: asString(values.host) ?? "127.0.0.1",
@@ -5283,4 +5374,4 @@ export {
5283
5374
  createServer2 as createServer,
5284
5375
  serveTarget
5285
5376
  };
5286
- //# sourceMappingURL=chunk-TMQCTVOT.js.map
5377
+ //# sourceMappingURL=chunk-OIN4LUJA.js.map