@adhdev/daemon-core 0.9.82-rc.341 → 0.9.82-rc.343

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.js CHANGED
@@ -316,10 +316,10 @@ function readInjected(value) {
316
316
  }
317
317
  function getDaemonBuildInfo() {
318
318
  if (cached) return cached;
319
- const commit = readInjected(true ? "d2dce76eda1d1544a0c95c4de04b245102ee0c64" : void 0) ?? "unknown";
320
- const commitShort = readInjected(true ? "d2dce76e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
- const version = readInjected(true ? "0.9.82-rc.341" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
- const builtAt = readInjected(true ? "2026-06-21T03:40:02.339Z" : void 0);
319
+ const commit = readInjected(true ? "9a4c1af9349a342fc63d8d42746747a6feda8f08" : void 0) ?? "unknown";
320
+ const commitShort = readInjected(true ? "9a4c1af9" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
+ const version = readInjected(true ? "0.9.82-rc.343" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
+ const builtAt = readInjected(true ? "2026-06-21T11:25:17.034Z" : void 0);
323
323
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
324
324
  return cached;
325
325
  }
@@ -9793,7 +9793,16 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
9793
9793
  }).catch((e) => {
9794
9794
  LOG.error("MeshQueue", `Failed to dispatch task locally to node ${nodeId}: ${e?.message}`);
9795
9795
  updateSessionDeliveryStatus(delivery.id, "failed", { lastError: e?.message, incrementAttempt: true });
9796
- updateTaskStatus(meshId, task.id, "failed");
9796
+ updateTaskStatus(meshId, task.id, "pending");
9797
+ try {
9798
+ appendLedgerEntry(meshId, {
9799
+ kind: "dispatch_failed",
9800
+ nodeId,
9801
+ sessionId,
9802
+ payload: { taskId: task.id, deliveryId: delivery.id, error: e?.message, retryable: true }
9803
+ });
9804
+ } catch {
9805
+ }
9797
9806
  });
9798
9807
  return true;
9799
9808
  }
@@ -31983,6 +31992,8 @@ function countNewlines(s) {
31983
31992
  return n;
31984
31993
  }
31985
31994
  var SUBMIT_DELAY_FLOOR_MS = 200;
31995
+ var WIN32_SUBMIT_RESEND_GAP_MS = 350;
31996
+ var WIN32_SUBMIT_MAX_RESENDS = 14;
31986
31997
  function resolveSubmitDelayMs(specBeforeSubmit, text) {
31987
31998
  const lines = countNewlines(text);
31988
31999
  const linesBonus = Math.min(800, lines * 80);
@@ -32034,6 +32045,10 @@ var FsmDriver = class {
32034
32045
  * after a re-prime we don't re-inject until the screen changes (which
32035
32046
  * resets the stall reference) or another full stall window lapses. */
32036
32047
  lastRefocusAt = 0;
32048
+ /** Timer driving the win32 verification-based submit resend loop (see
32049
+ * WIN32_SUBMIT_* and scheduleWin32Submit). Re-arms itself until the FSM
32050
+ * leaves idle (submitted) or the resend budget is spent. */
32051
+ win32SubmitTimer = null;
32037
32052
  currentEval = null;
32038
32053
  stateHistory = [];
32039
32054
  prevStateAt = 0;
@@ -32150,6 +32165,10 @@ var FsmDriver = class {
32150
32165
  clearTimeout(this.stallTimer);
32151
32166
  this.stallTimer = null;
32152
32167
  }
32168
+ if (this.win32SubmitTimer) {
32169
+ clearTimeout(this.win32SubmitTimer);
32170
+ this.win32SubmitTimer = null;
32171
+ }
32153
32172
  this.specWatcher?.close();
32154
32173
  this.adapter.kill();
32155
32174
  }
@@ -32562,11 +32581,8 @@ var FsmDriver = class {
32562
32581
  const perChar = sm.delay_ms_per_char ?? 0;
32563
32582
  const beforeSubmit = resolveSubmitDelayMs(sm.delay_ms_before_submit, text);
32564
32583
  if (process.platform === "win32") {
32565
- if (beforeSubmit > 0) {
32566
- setTimeout(() => this.adapter.send_keys(text + sm.submit_key), beforeSubmit);
32567
- } else {
32568
- this.adapter.send_keys(text + sm.submit_key);
32569
- }
32584
+ this.adapter.send_keys(text);
32585
+ this.scheduleWin32Submit(sm.submit_key, beforeSubmit);
32570
32586
  return;
32571
32587
  }
32572
32588
  if (perChar === 0) {
@@ -32586,6 +32602,40 @@ var FsmDriver = class {
32586
32602
  i += 1;
32587
32603
  }, perChar);
32588
32604
  }
32605
+ /** The agent's current coarse status, derived from the FSM node we're in. */
32606
+ currentStatus() {
32607
+ const st = stateById(this.spec, this.currentStateId);
32608
+ return st ? statusForState(st) : "idle";
32609
+ }
32610
+ /**
32611
+ * win32 verification-based submit. Sends the submit key, waits a gap, and if
32612
+ * the FSM is still 'idle' (the prompt did not submit — the CR was absorbed as
32613
+ * a multiline-paste newline) resends, up to WIN32_SUBMIT_MAX_RESENDS. The
32614
+ * first CR always fires (so a stale/edge status never suppresses the submit);
32615
+ * subsequent resends are gated on still being idle, and stop the instant the
32616
+ * agent leaves idle (submitted → generating / approval). This converges the
32617
+ * nondeterministic multiline window without spamming Enter into the next turn.
32618
+ */
32619
+ scheduleWin32Submit(submitKey, initialDelayMs) {
32620
+ if (this.win32SubmitTimer) {
32621
+ clearTimeout(this.win32SubmitTimer);
32622
+ this.win32SubmitTimer = null;
32623
+ }
32624
+ const fire = (attempt) => {
32625
+ this.win32SubmitTimer = null;
32626
+ this.adapter.send_keys(submitKey);
32627
+ if (attempt + 1 >= WIN32_SUBMIT_MAX_RESENDS) return;
32628
+ this.win32SubmitTimer = setTimeout(() => {
32629
+ if (this.currentStatus() !== "idle") {
32630
+ this.win32SubmitTimer = null;
32631
+ return;
32632
+ }
32633
+ fire(attempt + 1);
32634
+ }, WIN32_SUBMIT_RESEND_GAP_MS);
32635
+ };
32636
+ if (initialDelayMs > 0) this.win32SubmitTimer = setTimeout(() => fire(0), initialDelayMs);
32637
+ else fire(0);
32638
+ }
32589
32639
  handleClickControl(controlId, payload) {
32590
32640
  const ctl = (this.spec.control_bar ?? []).find((c) => c.id === controlId);
32591
32641
  if (!ctl) return;