@mu-crew/mu 3.6.0 → 3.6.2

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.
@@ -769,7 +769,7 @@ function registerCloseNudge(pi, run = defaultRunner(), env = process.env) {
769
769
  }
770
770
 
771
771
  // extension/mu-pi.ts
772
- var EXT_VERSION = true ? "3.6.0" : void 0;
772
+ var EXT_VERSION = true ? "3.6.2" : void 0;
773
773
  var FRESH_COMMAND = "mu-fresh";
774
774
  var FRESH_TIMEOUT_MS = 3e4;
775
775
  function commandName(name) {
package/dist/index.d.ts CHANGED
@@ -17,6 +17,9 @@ interface StateReading {
17
17
  reason?: string;
18
18
  /** Set for agents that expect a control socket. */
19
19
  ctl?: Exclude<CtlLink, "n/a">;
20
+ /** ctl only: pi holds queued messages, so an idle reading is about to
21
+ * turn busy. */
22
+ pending?: boolean;
20
23
  }
21
24
  interface StateAgentRef {
22
25
  name: string;
@@ -3437,6 +3440,10 @@ interface TaskWaitOptions {
3437
3440
  * observation-only (wait keeps polling); `onStall: 'exit'` makes it
3438
3441
  * terminal. */
3439
3442
  stuckAfterMs?: number;
3443
+ /** `stuckAfterMs` for an owner whose reading came from a working
3444
+ * control socket (source ctl, ctl ok). Default
3445
+ * `DEFAULT_CTL_STUCK_AFTER_MS`. `stuckAfterMs: 0` disables both. */
3446
+ ctlStuckAfterMs?: number;
3440
3447
  /** What to do when the `--stuck-after` predicate fires on a watched
3441
3448
  * task. `'warn'` (default) = today's behaviour: yellow STUCK line
3442
3449
  * to stderr (deduped per task per wait call) + corroborating
package/dist/index.js CHANGED
@@ -5542,6 +5542,7 @@ async function claimSelf(db, localId, opts) {
5542
5542
  var currentWaitSleep = (ms) => new Promise((resolve7) => setTimeout(resolve7, ms));
5543
5543
  var pollCount = 0;
5544
5544
  var DEFAULT_STUCK_AFTER_MS = 12e4;
5545
+ var DEFAULT_CTL_STUCK_AFTER_MS = 5e3;
5545
5546
  var defaultStuckWarn = (msg) => {
5546
5547
  process.stderr.write(msg);
5547
5548
  };
@@ -5588,6 +5589,7 @@ async function waitForTasks(db, input, opts) {
5588
5589
  const timeoutMs = opts.timeoutMs ?? 6e5;
5589
5590
  const pollMs = opts.pollMs ?? 1e3;
5590
5591
  const stuckAfterMs = opts.stuckAfterMs ?? DEFAULT_STUCK_AFTER_MS;
5592
+ const ctlStuckAfterMs = opts.ctlStuckAfterMs ?? DEFAULT_CTL_STUCK_AFTER_MS;
5591
5593
  const onStall = opts.onStall ?? "warn";
5592
5594
  const deadline = timeoutMs > 0 ? Date.now() + timeoutMs : Number.POSITIVE_INFINITY;
5593
5595
  for (const ref of refs) {
@@ -5615,8 +5617,10 @@ async function waitForTasks(db, input, opts) {
5615
5617
  ctlBrokenSince.delete(ownerKey);
5616
5618
  stuckLabel.delete(ownerKey);
5617
5619
  if (reading?.state !== "needs_input" || reading.since === null) return null;
5620
+ const viaCtl = reading.source === "ctl" && reading.ctl === "ok";
5621
+ if (viaCtl && reading.pending === true) return null;
5618
5622
  const ageMs = Date.now() - reading.since;
5619
- return ageMs >= stuckAfterMs ? ageMs : null;
5623
+ return ageMs >= (viaCtl ? ctlStuckAfterMs : stuckAfterMs) ? ageMs : null;
5620
5624
  };
5621
5625
  const snapshot2 = async () => {
5622
5626
  const refStates = [];
@@ -7310,6 +7314,7 @@ function mapMurmurState(token, since) {
7310
7314
  break;
7311
7315
  case "idle":
7312
7316
  case "done":
7317
+ case "error":
7313
7318
  case "crashed":
7314
7319
  state = "needs_input";
7315
7320
  break;
@@ -7363,7 +7368,7 @@ function remoteReading(agent, panes) {
7363
7368
  (entry) => typeof entry === "object" && entry !== null && "kind" in entry && typeof entry.kind === "string" ? [entry.kind] : []
7364
7369
  )
7365
7370
  ) : /* @__PURE__ */ new Set();
7366
- const state = kinds.has("crashed") ? "needs_input" : kinds.has("blocked") ? "needs_permission" : kinds.has("done") ? "needs_input" : row.activity === "running" ? "busy" : "needs_input";
7371
+ const state = kinds.has("crashed") || kinds.has("error") ? "needs_input" : kinds.has("blocked") ? "needs_permission" : kinds.has("done") ? "needs_input" : row.activity === "running" ? "busy" : "needs_input";
7367
7372
  return {
7368
7373
  state,
7369
7374
  source: "murmur",
@@ -7421,7 +7426,8 @@ async function readAgentStates(agents, opts = {}) {
7421
7426
  source: "ctl",
7422
7427
  since: probe.status.since,
7423
7428
  alive: true,
7424
- ctl: "ok"
7429
+ ctl: "ok",
7430
+ pending: probe.status.pending
7425
7431
  });
7426
7432
  } else {
7427
7433
  failed.set(agentKey(agent), probe?.kind === "missing" ? "missing" : "refused");