@adhdev/daemon-core 0.9.82-rc.342 → 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 ? "ff8ffda8c3d1a14f846ad4d785e4cab4d111a36b" : void 0) ?? "unknown";
320
- const commitShort = readInjected(true ? "ff8ffda8" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
- const version = readInjected(true ? "0.9.82-rc.342" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
- const builtAt = readInjected(true ? "2026-06-21T05:12:18.017Z" : 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,7 +31992,8 @@ function countNewlines(s) {
31983
31992
  return n;
31984
31993
  }
31985
31994
  var SUBMIT_DELAY_FLOOR_MS = 200;
31986
- var WIN32_SUBMIT_REPEAT_GAP_MS = 300;
31995
+ var WIN32_SUBMIT_RESEND_GAP_MS = 350;
31996
+ var WIN32_SUBMIT_MAX_RESENDS = 14;
31987
31997
  function resolveSubmitDelayMs(specBeforeSubmit, text) {
31988
31998
  const lines = countNewlines(text);
31989
31999
  const linesBonus = Math.min(800, lines * 80);
@@ -32035,6 +32045,10 @@ var FsmDriver = class {
32035
32045
  * after a re-prime we don't re-inject until the screen changes (which
32036
32046
  * resets the stall reference) or another full stall window lapses. */
32037
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;
32038
32052
  currentEval = null;
32039
32053
  stateHistory = [];
32040
32054
  prevStateAt = 0;
@@ -32151,6 +32165,10 @@ var FsmDriver = class {
32151
32165
  clearTimeout(this.stallTimer);
32152
32166
  this.stallTimer = null;
32153
32167
  }
32168
+ if (this.win32SubmitTimer) {
32169
+ clearTimeout(this.win32SubmitTimer);
32170
+ this.win32SubmitTimer = null;
32171
+ }
32154
32172
  this.specWatcher?.close();
32155
32173
  this.adapter.kill();
32156
32174
  }
@@ -32563,13 +32581,8 @@ var FsmDriver = class {
32563
32581
  const perChar = sm.delay_ms_per_char ?? 0;
32564
32582
  const beforeSubmit = resolveSubmitDelayMs(sm.delay_ms_before_submit, text);
32565
32583
  if (process.platform === "win32") {
32566
- const submitTwice = () => {
32567
- this.adapter.send_keys(sm.submit_key);
32568
- setTimeout(() => this.adapter.send_keys(sm.submit_key), WIN32_SUBMIT_REPEAT_GAP_MS);
32569
- };
32570
32584
  this.adapter.send_keys(text);
32571
- if (beforeSubmit > 0) setTimeout(submitTwice, beforeSubmit);
32572
- else submitTwice();
32585
+ this.scheduleWin32Submit(sm.submit_key, beforeSubmit);
32573
32586
  return;
32574
32587
  }
32575
32588
  if (perChar === 0) {
@@ -32589,6 +32602,40 @@ var FsmDriver = class {
32589
32602
  i += 1;
32590
32603
  }, perChar);
32591
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
+ }
32592
32639
  handleClickControl(controlId, payload) {
32593
32640
  const ctl = (this.spec.control_bar ?? []).find((c) => c.id === controlId);
32594
32641
  if (!ctl) return;