@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 +59 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -12
- package/dist/index.mjs.map +1 -1
- package/dist/providers/spec/fsm-driver.d.ts +16 -0
- package/package.json +2 -2
- package/src/mesh/mesh-events-coordinator.ts +15 -1
- package/src/providers/spec/fsm-driver.ts +64 -24
package/dist/index.mjs
CHANGED
|
@@ -311,10 +311,10 @@ function readInjected(value) {
|
|
|
311
311
|
}
|
|
312
312
|
function getDaemonBuildInfo() {
|
|
313
313
|
if (cached) return cached;
|
|
314
|
-
const commit = readInjected(true ? "
|
|
315
|
-
const commitShort = readInjected(true ? "
|
|
316
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
317
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
314
|
+
const commit = readInjected(true ? "9a4c1af9349a342fc63d8d42746747a6feda8f08" : void 0) ?? "unknown";
|
|
315
|
+
const commitShort = readInjected(true ? "9a4c1af9" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
316
|
+
const version = readInjected(true ? "0.9.82-rc.343" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
317
|
+
const builtAt = readInjected(true ? "2026-06-21T11:25:17.034Z" : void 0);
|
|
318
318
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
319
319
|
return cached;
|
|
320
320
|
}
|
|
@@ -9790,7 +9790,16 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
|
|
|
9790
9790
|
}).catch((e) => {
|
|
9791
9791
|
LOG.error("MeshQueue", `Failed to dispatch task locally to node ${nodeId}: ${e?.message}`);
|
|
9792
9792
|
updateSessionDeliveryStatus(delivery.id, "failed", { lastError: e?.message, incrementAttempt: true });
|
|
9793
|
-
updateTaskStatus(meshId, task.id, "
|
|
9793
|
+
updateTaskStatus(meshId, task.id, "pending");
|
|
9794
|
+
try {
|
|
9795
|
+
appendLedgerEntry(meshId, {
|
|
9796
|
+
kind: "dispatch_failed",
|
|
9797
|
+
nodeId,
|
|
9798
|
+
sessionId,
|
|
9799
|
+
payload: { taskId: task.id, deliveryId: delivery.id, error: e?.message, retryable: true }
|
|
9800
|
+
});
|
|
9801
|
+
} catch {
|
|
9802
|
+
}
|
|
9794
9803
|
});
|
|
9795
9804
|
return true;
|
|
9796
9805
|
}
|
|
@@ -31622,7 +31631,8 @@ function countNewlines(s) {
|
|
|
31622
31631
|
return n;
|
|
31623
31632
|
}
|
|
31624
31633
|
var SUBMIT_DELAY_FLOOR_MS = 200;
|
|
31625
|
-
var
|
|
31634
|
+
var WIN32_SUBMIT_RESEND_GAP_MS = 350;
|
|
31635
|
+
var WIN32_SUBMIT_MAX_RESENDS = 14;
|
|
31626
31636
|
function resolveSubmitDelayMs(specBeforeSubmit, text) {
|
|
31627
31637
|
const lines = countNewlines(text);
|
|
31628
31638
|
const linesBonus = Math.min(800, lines * 80);
|
|
@@ -31674,6 +31684,10 @@ var FsmDriver = class {
|
|
|
31674
31684
|
* after a re-prime we don't re-inject until the screen changes (which
|
|
31675
31685
|
* resets the stall reference) or another full stall window lapses. */
|
|
31676
31686
|
lastRefocusAt = 0;
|
|
31687
|
+
/** Timer driving the win32 verification-based submit resend loop (see
|
|
31688
|
+
* WIN32_SUBMIT_* and scheduleWin32Submit). Re-arms itself until the FSM
|
|
31689
|
+
* leaves idle (submitted) or the resend budget is spent. */
|
|
31690
|
+
win32SubmitTimer = null;
|
|
31677
31691
|
currentEval = null;
|
|
31678
31692
|
stateHistory = [];
|
|
31679
31693
|
prevStateAt = 0;
|
|
@@ -31790,6 +31804,10 @@ var FsmDriver = class {
|
|
|
31790
31804
|
clearTimeout(this.stallTimer);
|
|
31791
31805
|
this.stallTimer = null;
|
|
31792
31806
|
}
|
|
31807
|
+
if (this.win32SubmitTimer) {
|
|
31808
|
+
clearTimeout(this.win32SubmitTimer);
|
|
31809
|
+
this.win32SubmitTimer = null;
|
|
31810
|
+
}
|
|
31793
31811
|
this.specWatcher?.close();
|
|
31794
31812
|
this.adapter.kill();
|
|
31795
31813
|
}
|
|
@@ -32202,13 +32220,8 @@ var FsmDriver = class {
|
|
|
32202
32220
|
const perChar = sm.delay_ms_per_char ?? 0;
|
|
32203
32221
|
const beforeSubmit = resolveSubmitDelayMs(sm.delay_ms_before_submit, text);
|
|
32204
32222
|
if (process.platform === "win32") {
|
|
32205
|
-
const submitTwice = () => {
|
|
32206
|
-
this.adapter.send_keys(sm.submit_key);
|
|
32207
|
-
setTimeout(() => this.adapter.send_keys(sm.submit_key), WIN32_SUBMIT_REPEAT_GAP_MS);
|
|
32208
|
-
};
|
|
32209
32223
|
this.adapter.send_keys(text);
|
|
32210
|
-
|
|
32211
|
-
else submitTwice();
|
|
32224
|
+
this.scheduleWin32Submit(sm.submit_key, beforeSubmit);
|
|
32212
32225
|
return;
|
|
32213
32226
|
}
|
|
32214
32227
|
if (perChar === 0) {
|
|
@@ -32228,6 +32241,40 @@ var FsmDriver = class {
|
|
|
32228
32241
|
i += 1;
|
|
32229
32242
|
}, perChar);
|
|
32230
32243
|
}
|
|
32244
|
+
/** The agent's current coarse status, derived from the FSM node we're in. */
|
|
32245
|
+
currentStatus() {
|
|
32246
|
+
const st = stateById(this.spec, this.currentStateId);
|
|
32247
|
+
return st ? statusForState(st) : "idle";
|
|
32248
|
+
}
|
|
32249
|
+
/**
|
|
32250
|
+
* win32 verification-based submit. Sends the submit key, waits a gap, and if
|
|
32251
|
+
* the FSM is still 'idle' (the prompt did not submit — the CR was absorbed as
|
|
32252
|
+
* a multiline-paste newline) resends, up to WIN32_SUBMIT_MAX_RESENDS. The
|
|
32253
|
+
* first CR always fires (so a stale/edge status never suppresses the submit);
|
|
32254
|
+
* subsequent resends are gated on still being idle, and stop the instant the
|
|
32255
|
+
* agent leaves idle (submitted → generating / approval). This converges the
|
|
32256
|
+
* nondeterministic multiline window without spamming Enter into the next turn.
|
|
32257
|
+
*/
|
|
32258
|
+
scheduleWin32Submit(submitKey, initialDelayMs) {
|
|
32259
|
+
if (this.win32SubmitTimer) {
|
|
32260
|
+
clearTimeout(this.win32SubmitTimer);
|
|
32261
|
+
this.win32SubmitTimer = null;
|
|
32262
|
+
}
|
|
32263
|
+
const fire = (attempt) => {
|
|
32264
|
+
this.win32SubmitTimer = null;
|
|
32265
|
+
this.adapter.send_keys(submitKey);
|
|
32266
|
+
if (attempt + 1 >= WIN32_SUBMIT_MAX_RESENDS) return;
|
|
32267
|
+
this.win32SubmitTimer = setTimeout(() => {
|
|
32268
|
+
if (this.currentStatus() !== "idle") {
|
|
32269
|
+
this.win32SubmitTimer = null;
|
|
32270
|
+
return;
|
|
32271
|
+
}
|
|
32272
|
+
fire(attempt + 1);
|
|
32273
|
+
}, WIN32_SUBMIT_RESEND_GAP_MS);
|
|
32274
|
+
};
|
|
32275
|
+
if (initialDelayMs > 0) this.win32SubmitTimer = setTimeout(() => fire(0), initialDelayMs);
|
|
32276
|
+
else fire(0);
|
|
32277
|
+
}
|
|
32231
32278
|
handleClickControl(controlId, payload) {
|
|
32232
32279
|
const ctl = (this.spec.control_bar ?? []).find((c) => c.id === controlId);
|
|
32233
32280
|
if (!ctl) return;
|