camstack 1.2.162 → 1.2.163

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/dist/cli.js CHANGED
@@ -38,7 +38,7 @@ async function runServe(args) {
38
38
  ...typeof values.data === "string" ? { data: values.data } : {}
39
39
  };
40
40
  Object.assign(process.env, buildServeEnv(opts));
41
- await import("./launcher-3GIYBFMQ.js");
41
+ await import("./launcher-JVXE2AOJ.js");
42
42
  }
43
43
 
44
44
  // src/commands/agent.ts
@@ -83,7 +83,7 @@ async function runAgent(args) {
83
83
  ...typeof values.port === "string" ? { port: values.port } : {}
84
84
  };
85
85
  Object.assign(process.env, buildAgentEnv(opts));
86
- await import("./launcher-3GIYBFMQ.js");
86
+ await import("./launcher-JVXE2AOJ.js");
87
87
  }
88
88
 
89
89
  // src/commands/setup.ts
@@ -431585,6 +431585,24 @@ var require_runner_convergence = __commonJS({
431585
431585
  }
431586
431586
  });
431587
431587
 
431588
+ // ../../server/backend/dist/core/addon/runner-serialization.js
431589
+ var require_runner_serialization = __commonJS({
431590
+ "../../server/backend/dist/core/addon/runner-serialization.js"(exports) {
431591
+ "use strict";
431592
+ Object.defineProperty(exports, "__esModule", { value: true });
431593
+ exports.createRunnerSerializer = createRunnerSerializer;
431594
+ function createRunnerSerializer() {
431595
+ const tails = /* @__PURE__ */ new Map();
431596
+ return (runnerId, converge) => {
431597
+ const previous = tails.get(runnerId) ?? Promise.resolve();
431598
+ const result = previous.then(converge, converge);
431599
+ tails.set(runnerId, result.then(() => void 0, () => void 0));
431600
+ return result;
431601
+ };
431602
+ }
431603
+ }
431604
+ });
431605
+
431588
431606
  // ../../server/backend/dist/core/addon/runner-spawn-fanout.js
431589
431607
  var require_runner_spawn_fanout = __commonJS({
431590
431608
  "../../server/backend/dist/core/addon/runner-spawn-fanout.js"(exports) {
@@ -431692,6 +431710,7 @@ var require_addon_registry_service = __commonJS({
431692
431710
  var forked_custom_actions_js_1 = require_forked_custom_actions();
431693
431711
  var prune_misplaced_addons_js_1 = require_prune_misplaced_addons();
431694
431712
  var runner_convergence_1 = require_runner_convergence();
431713
+ var runner_serialization_1 = require_runner_serialization();
431695
431714
  var runner_spawn_fanout_js_1 = require_runner_spawn_fanout();
431696
431715
  function shouldEvictMissingOnDisk(entry, id, onDiskIds) {
431697
431716
  return entry.source === "installed" && entry.packageName !== "@camstack/system" && !onDiskIds.has(id);
@@ -434058,6 +434077,12 @@ var require_addon_registry_service = __commonJS({
434058
434077
  * a group respawns the ENTIRE group (they share a process): the operator's
434059
434078
  * "update one → respawn the whole group" invariant.
434060
434079
  */
434080
+ /**
434081
+ * One converge at a time per runner. See `runner-serialization.ts` for the
434082
+ * two live episodes this closes and why the lock inside `process-service`
434083
+ * could not.
434084
+ */
434085
+ serializeRunner = (0, runner_serialization_1.createRunnerSerializer)();
434061
434086
  async ensureForkedRunner(addonId, opts) {
434062
434087
  const entry = this.addonEntries.get(addonId);
434063
434088
  if (!entry?.declaration || !entry.addonDir) {
@@ -434068,33 +434093,35 @@ var require_addon_registry_service = __commonJS({
434068
434093
  { addonId, addonDir: entry.addonDir }
434069
434094
  ];
434070
434095
  const effectiveRestart = opts.restart && roster.length > 1 && Date.now() - (this.recentGroupRespawns.get(runnerId) ?? 0) < GROUP_RESPAWN_COALESCE_MS ? false : opts.restart;
434071
- const running = await this.listRunnerProcesses();
434072
- const plan = (0, runner_convergence_1.planRunnerConvergence)(runnerId, roster.map((r) => r.addonId), running, { restart: effectiveRestart });
434073
- for (const name of plan.stop) {
434074
- await this.broker.call("$process.stop", { name }).catch((err) => {
434075
- this.logger.warn("ensureForkedRunner: failed to stop stale runner (continuing)", {
434076
- meta: { runnerId, stale: name, error: (0, types_1.errMsg)(err) }
434096
+ return this.serializeRunner(runnerId, async () => {
434097
+ const running = await this.listRunnerProcesses();
434098
+ const plan = (0, runner_convergence_1.planRunnerConvergence)(runnerId, roster.map((r) => r.addonId), running, { restart: effectiveRestart });
434099
+ for (const name of plan.stop) {
434100
+ await this.broker.call("$process.stop", { name }).catch((err) => {
434101
+ this.logger.warn("ensureForkedRunner: failed to stop stale runner (continuing)", {
434102
+ meta: { runnerId, stale: name, error: (0, types_1.errMsg)(err) }
434103
+ });
434077
434104
  });
434078
- });
434079
- }
434080
- if (plan.action === "spawn") {
434081
- await this.broker.call("$process.spawnRunner", { runnerId, addons: roster }).catch((err) => {
434082
- if (!/already running/i.test((0, types_1.errMsg)(err)))
434083
- throw err;
434084
- });
434085
- this.recentGroupRespawns.set(runnerId, Date.now());
434086
- } else if (plan.action === "restart") {
434087
- const res = await this.broker.call("$process.restart", { name: runnerId });
434088
- if (!res.success) {
434089
- throw new Error(`Process restart failed: ${res.reason ?? "unknown"}`);
434090
434105
  }
434091
- this.recentGroupRespawns.set(runnerId, Date.now());
434092
- }
434093
- for (const { addonId: memberId } of roster) {
434094
- const memberEntry = this.addonEntries.get(memberId);
434095
- if (memberEntry)
434096
- memberEntry.initialized = true;
434097
- }
434106
+ if (plan.action === "spawn") {
434107
+ await this.broker.call("$process.spawnRunner", { runnerId, addons: roster }).catch((err) => {
434108
+ if (!/already running/i.test((0, types_1.errMsg)(err)))
434109
+ throw err;
434110
+ });
434111
+ this.recentGroupRespawns.set(runnerId, Date.now());
434112
+ } else if (plan.action === "restart") {
434113
+ const res = await this.broker.call("$process.restart", { name: runnerId });
434114
+ if (!res.success) {
434115
+ throw new Error(`Process restart failed: ${res.reason ?? "unknown"}`);
434116
+ }
434117
+ this.recentGroupRespawns.set(runnerId, Date.now());
434118
+ }
434119
+ for (const { addonId: memberId } of roster) {
434120
+ const memberEntry = this.addonEntries.get(memberId);
434121
+ if (memberEntry)
434122
+ memberEntry.initialized = true;
434123
+ }
434124
+ });
434098
434125
  }
434099
434126
  /**
434100
434127
  * Apply the custom-action catalogs a UDS child DESCRIBED in its register
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstack",
3
- "version": "1.2.162",
3
+ "version": "1.2.163",
4
4
  "description": "CLI tool for managing and running CamStack server",
5
5
  "keywords": [
6
6
  "camstack",