@nsshunt/stsrunnerframework 2.0.11 → 2.0.13

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/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import isNode from "detect-node";
2
- import { ModelDelimeter, Sleep, defaultLogger } from "@nsshunt/stsutils";
1
+ import { ModelDelimeter, Sleep, defaultLogger, isNode } from "@nsshunt/stsutils";
3
2
  import { Gauge } from "@nsshunt/stsobservability";
4
3
  //#region \0rolldown/runtime.js
5
4
  var __create = Object.create;
@@ -1482,6 +1481,32 @@ var AbstractRunnerExecutionWorker = class {
1482
1481
  };
1483
1482
  //#endregion
1484
1483
  //#region src/messageBroker.ts
1484
+ /**
1485
+ * STSMessageBroker
1486
+ * ----------------
1487
+ * Central message broker for worker <-> manager communications.
1488
+ *
1489
+ * Responsibilities:
1490
+ * - Create and manage callback-correlated request/response message flows
1491
+ * - Route inbound port messages as either:
1492
+ * - solicited responses (request/response messages with `messageId`)
1493
+ * - unsolicited push/event messages (telemetry, state changes, etc.)
1494
+ * - Initialise message ports between the manager and the worker
1495
+ * - Provide helper methods for sending worker-level and runner-level commands
1496
+ * - Manage response timeouts for outstanding requests
1497
+ *
1498
+ * High-level design:
1499
+ * - Every solicited request gets a generated `messageId`
1500
+ * - The broker stores a pending promise resolver keyed by `messageId`
1501
+ * - When a matching inbound response arrives, the broker resolves that promise
1502
+ * - If no response arrives before the configured timeout, the request is rejected
1503
+ *
1504
+ * Notes:
1505
+ * - This broker supports both Node and browser worker environments
1506
+ * - Environment-specific message port listener wiring is handled internally
1507
+ * - The broker itself does not interpret business meaning of unsolicited messages;
1508
+ * those are delegated to a caller-supplied callback
1509
+ */
1485
1510
  var import_lodash_merge = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
1486
1511
  /**
1487
1512
  * Lodash (Custom Build) <https://lodash.com/>