@adhdev/daemon-core 0.9.82-rc.359 → 0.9.82-rc.360
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 +36 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -20
- package/dist/index.mjs.map +1 -1
- package/dist/providers/spec/fsm-driver.d.ts +10 -7
- package/package.json +2 -2
- package/src/providers/spec/fsm-driver.ts +64 -27
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 ? "ea4a65e3d2be71c4aba09dbb000df08d2111759e" : void 0) ?? "unknown";
|
|
315
|
+
const commitShort = readInjected(true ? "ea4a65e3" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
316
|
+
const version = readInjected(true ? "0.9.82-rc.360" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
317
|
+
const builtAt = readInjected(true ? "2026-06-23T08:23:05.522Z" : void 0);
|
|
318
318
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
319
319
|
return cached;
|
|
320
320
|
}
|
|
@@ -32946,10 +32946,14 @@ var SUBMIT_DELAY_FLOOR_MS = 200;
|
|
|
32946
32946
|
var WIN32_SUBMIT_RESEND_GAP_MS = 350;
|
|
32947
32947
|
var WIN32_SUBMIT_MAX_RESENDS = 14;
|
|
32948
32948
|
var WIN32_SUBMIT_SETTLE_MS = 500;
|
|
32949
|
-
var WIN32_SUBMIT_MAX_SETTLE_WAIT_MS = 1e4;
|
|
32950
32949
|
var WIN32_SUBMIT_SETTLE_POLL_MS = 120;
|
|
32951
32950
|
var WIN32_PTY_WRITE_CHUNK_CHARS = 1024;
|
|
32952
32951
|
var WIN32_PTY_WRITE_CHUNK_GAP_MS = 8;
|
|
32952
|
+
var WIN32_ECHO_PROBE_CHARS = 16;
|
|
32953
|
+
var WIN32_ECHO_MAX_WAIT_MS = 2e4;
|
|
32954
|
+
function normalizeForEcho(s2) {
|
|
32955
|
+
return s2.replace(/\s+/g, "");
|
|
32956
|
+
}
|
|
32953
32957
|
function resolveSubmitDelayMs(specBeforeSubmit, text) {
|
|
32954
32958
|
const lines = countNewlines(text);
|
|
32955
32959
|
const linesBonus = Math.min(800, lines * 80);
|
|
@@ -33579,7 +33583,7 @@ var FsmDriver = class {
|
|
|
33579
33583
|
const beforeSubmit = resolveSubmitDelayMs(sm.delay_ms_before_submit, text);
|
|
33580
33584
|
if (process.platform === "win32") {
|
|
33581
33585
|
this.writeWin32Body(text);
|
|
33582
|
-
this.scheduleWin32Submit(sm.submit_key, beforeSubmit);
|
|
33586
|
+
this.scheduleWin32Submit(sm.submit_key, beforeSubmit, text);
|
|
33583
33587
|
return;
|
|
33584
33588
|
}
|
|
33585
33589
|
if (perChar === 0) {
|
|
@@ -33649,13 +33653,16 @@ var FsmDriver = class {
|
|
|
33649
33653
|
/**
|
|
33650
33654
|
* win32 submit. Two phases:
|
|
33651
33655
|
*
|
|
33652
|
-
* Phase 1 (
|
|
33653
|
-
*
|
|
33654
|
-
*
|
|
33655
|
-
*
|
|
33656
|
-
*
|
|
33657
|
-
*
|
|
33658
|
-
*
|
|
33656
|
+
* Phase 1 (echo-gate): hold the first CR until the body text is CONFIRMED in the
|
|
33657
|
+
* composer (its whitespace-collapsed tail appears in the rendered screen) AND the
|
|
33658
|
+
* PTY output is then quiet for WIN32_SUBMIT_SETTLE_MS (the full, possibly multi-KB
|
|
33659
|
+
* / multiline body has finished arriving). This replaces a bare output-quiet
|
|
33660
|
+
* settle: an early write that races claude's boot is buffered, not dropped, so the
|
|
33661
|
+
* screen can go quiet with the body NOT YET in the composer — a quiet-only gate
|
|
33662
|
+
* would then fire a CR into an empty composer (no submit). Waiting on the echo
|
|
33663
|
+
* closes that. Honors an initial minimum delay and a generous WIN32_ECHO_MAX_WAIT_MS
|
|
33664
|
+
* last-resort blind fire so a body that truly never confirms still submits (carried
|
|
33665
|
+
* by phase 2) rather than hanging. A settled session echoes immediately → no delay.
|
|
33659
33666
|
*
|
|
33660
33667
|
* Phase 2 (verified resend — unchanged): send the submit key, wait a gap, and
|
|
33661
33668
|
* if the FSM is still 'idle' (the CR was absorbed as a multiline-paste
|
|
@@ -33664,12 +33671,17 @@ var FsmDriver = class {
|
|
|
33664
33671
|
* idle and stop the instant the agent leaves idle (submitted → generating /
|
|
33665
33672
|
* approval). This preserves the win32 lone-CR-swallow handling.
|
|
33666
33673
|
*/
|
|
33667
|
-
scheduleWin32Submit(submitKey, initialDelayMs) {
|
|
33674
|
+
scheduleWin32Submit(submitKey, initialDelayMs, body) {
|
|
33668
33675
|
if (this.win32SubmitTimer) {
|
|
33669
33676
|
clearTimeout(this.win32SubmitTimer);
|
|
33670
33677
|
this.win32SubmitTimer = null;
|
|
33671
33678
|
}
|
|
33672
33679
|
const startedAt = Date.now();
|
|
33680
|
+
const probe = normalizeForEcho(body).slice(-WIN32_ECHO_PROBE_CHARS);
|
|
33681
|
+
const bodyEchoed = () => {
|
|
33682
|
+
if (!probe) return true;
|
|
33683
|
+
return normalizeForEcho(this.adapter.snapshot()).includes(probe);
|
|
33684
|
+
};
|
|
33673
33685
|
const fire = (attempt) => {
|
|
33674
33686
|
this.win32SubmitTimer = null;
|
|
33675
33687
|
this.adapter.send_keys(submitKey);
|
|
@@ -33682,20 +33694,24 @@ var FsmDriver = class {
|
|
|
33682
33694
|
fire(attempt + 1);
|
|
33683
33695
|
}, WIN32_SUBMIT_RESEND_GAP_MS);
|
|
33684
33696
|
};
|
|
33685
|
-
const
|
|
33697
|
+
const waitForEcho = () => {
|
|
33686
33698
|
this.win32SubmitTimer = null;
|
|
33687
33699
|
const now = Date.now();
|
|
33688
33700
|
const quietFor = now - this.lastWin32InputActivityAt();
|
|
33689
33701
|
const waited = now - startedAt;
|
|
33690
|
-
|
|
33702
|
+
const settled = quietFor >= WIN32_SUBMIT_SETTLE_MS;
|
|
33703
|
+
if (bodyEchoed() && settled) {
|
|
33704
|
+
fire(0);
|
|
33705
|
+
return;
|
|
33706
|
+
}
|
|
33707
|
+
if (waited >= WIN32_ECHO_MAX_WAIT_MS) {
|
|
33691
33708
|
fire(0);
|
|
33692
33709
|
return;
|
|
33693
33710
|
}
|
|
33694
|
-
|
|
33695
|
-
this.win32SubmitTimer = setTimeout(waitForSettle, Math.max(recheckIn, 30));
|
|
33711
|
+
this.win32SubmitTimer = setTimeout(waitForEcho, WIN32_SUBMIT_SETTLE_POLL_MS);
|
|
33696
33712
|
};
|
|
33697
|
-
if (initialDelayMs > 0) this.win32SubmitTimer = setTimeout(
|
|
33698
|
-
else
|
|
33713
|
+
if (initialDelayMs > 0) this.win32SubmitTimer = setTimeout(waitForEcho, initialDelayMs);
|
|
33714
|
+
else waitForEcho();
|
|
33699
33715
|
}
|
|
33700
33716
|
handleClickControl(controlId, payload) {
|
|
33701
33717
|
const ctl = (this.spec.control_bar ?? []).find((c) => c.id === controlId);
|