@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.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 ? "
|
|
320
|
-
const commitShort = readInjected(true ? "
|
|
321
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
322
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
319
|
+
const commit = readInjected(true ? "ea4a65e3d2be71c4aba09dbb000df08d2111759e" : void 0) ?? "unknown";
|
|
320
|
+
const commitShort = readInjected(true ? "ea4a65e3" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
321
|
+
const version = readInjected(true ? "0.9.82-rc.360" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
322
|
+
const builtAt = readInjected(true ? "2026-06-23T08:23:05.522Z" : void 0);
|
|
323
323
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
324
324
|
return cached;
|
|
325
325
|
}
|
|
@@ -33314,10 +33314,14 @@ var SUBMIT_DELAY_FLOOR_MS = 200;
|
|
|
33314
33314
|
var WIN32_SUBMIT_RESEND_GAP_MS = 350;
|
|
33315
33315
|
var WIN32_SUBMIT_MAX_RESENDS = 14;
|
|
33316
33316
|
var WIN32_SUBMIT_SETTLE_MS = 500;
|
|
33317
|
-
var WIN32_SUBMIT_MAX_SETTLE_WAIT_MS = 1e4;
|
|
33318
33317
|
var WIN32_SUBMIT_SETTLE_POLL_MS = 120;
|
|
33319
33318
|
var WIN32_PTY_WRITE_CHUNK_CHARS = 1024;
|
|
33320
33319
|
var WIN32_PTY_WRITE_CHUNK_GAP_MS = 8;
|
|
33320
|
+
var WIN32_ECHO_PROBE_CHARS = 16;
|
|
33321
|
+
var WIN32_ECHO_MAX_WAIT_MS = 2e4;
|
|
33322
|
+
function normalizeForEcho(s2) {
|
|
33323
|
+
return s2.replace(/\s+/g, "");
|
|
33324
|
+
}
|
|
33321
33325
|
function resolveSubmitDelayMs(specBeforeSubmit, text) {
|
|
33322
33326
|
const lines = countNewlines(text);
|
|
33323
33327
|
const linesBonus = Math.min(800, lines * 80);
|
|
@@ -33947,7 +33951,7 @@ var FsmDriver = class {
|
|
|
33947
33951
|
const beforeSubmit = resolveSubmitDelayMs(sm.delay_ms_before_submit, text);
|
|
33948
33952
|
if (process.platform === "win32") {
|
|
33949
33953
|
this.writeWin32Body(text);
|
|
33950
|
-
this.scheduleWin32Submit(sm.submit_key, beforeSubmit);
|
|
33954
|
+
this.scheduleWin32Submit(sm.submit_key, beforeSubmit, text);
|
|
33951
33955
|
return;
|
|
33952
33956
|
}
|
|
33953
33957
|
if (perChar === 0) {
|
|
@@ -34017,13 +34021,16 @@ var FsmDriver = class {
|
|
|
34017
34021
|
/**
|
|
34018
34022
|
* win32 submit. Two phases:
|
|
34019
34023
|
*
|
|
34020
|
-
* Phase 1 (
|
|
34021
|
-
*
|
|
34022
|
-
*
|
|
34023
|
-
*
|
|
34024
|
-
*
|
|
34025
|
-
*
|
|
34026
|
-
*
|
|
34024
|
+
* Phase 1 (echo-gate): hold the first CR until the body text is CONFIRMED in the
|
|
34025
|
+
* composer (its whitespace-collapsed tail appears in the rendered screen) AND the
|
|
34026
|
+
* PTY output is then quiet for WIN32_SUBMIT_SETTLE_MS (the full, possibly multi-KB
|
|
34027
|
+
* / multiline body has finished arriving). This replaces a bare output-quiet
|
|
34028
|
+
* settle: an early write that races claude's boot is buffered, not dropped, so the
|
|
34029
|
+
* screen can go quiet with the body NOT YET in the composer — a quiet-only gate
|
|
34030
|
+
* would then fire a CR into an empty composer (no submit). Waiting on the echo
|
|
34031
|
+
* closes that. Honors an initial minimum delay and a generous WIN32_ECHO_MAX_WAIT_MS
|
|
34032
|
+
* last-resort blind fire so a body that truly never confirms still submits (carried
|
|
34033
|
+
* by phase 2) rather than hanging. A settled session echoes immediately → no delay.
|
|
34027
34034
|
*
|
|
34028
34035
|
* Phase 2 (verified resend — unchanged): send the submit key, wait a gap, and
|
|
34029
34036
|
* if the FSM is still 'idle' (the CR was absorbed as a multiline-paste
|
|
@@ -34032,12 +34039,17 @@ var FsmDriver = class {
|
|
|
34032
34039
|
* idle and stop the instant the agent leaves idle (submitted → generating /
|
|
34033
34040
|
* approval). This preserves the win32 lone-CR-swallow handling.
|
|
34034
34041
|
*/
|
|
34035
|
-
scheduleWin32Submit(submitKey, initialDelayMs) {
|
|
34042
|
+
scheduleWin32Submit(submitKey, initialDelayMs, body) {
|
|
34036
34043
|
if (this.win32SubmitTimer) {
|
|
34037
34044
|
clearTimeout(this.win32SubmitTimer);
|
|
34038
34045
|
this.win32SubmitTimer = null;
|
|
34039
34046
|
}
|
|
34040
34047
|
const startedAt = Date.now();
|
|
34048
|
+
const probe = normalizeForEcho(body).slice(-WIN32_ECHO_PROBE_CHARS);
|
|
34049
|
+
const bodyEchoed = () => {
|
|
34050
|
+
if (!probe) return true;
|
|
34051
|
+
return normalizeForEcho(this.adapter.snapshot()).includes(probe);
|
|
34052
|
+
};
|
|
34041
34053
|
const fire = (attempt) => {
|
|
34042
34054
|
this.win32SubmitTimer = null;
|
|
34043
34055
|
this.adapter.send_keys(submitKey);
|
|
@@ -34050,20 +34062,24 @@ var FsmDriver = class {
|
|
|
34050
34062
|
fire(attempt + 1);
|
|
34051
34063
|
}, WIN32_SUBMIT_RESEND_GAP_MS);
|
|
34052
34064
|
};
|
|
34053
|
-
const
|
|
34065
|
+
const waitForEcho = () => {
|
|
34054
34066
|
this.win32SubmitTimer = null;
|
|
34055
34067
|
const now = Date.now();
|
|
34056
34068
|
const quietFor = now - this.lastWin32InputActivityAt();
|
|
34057
34069
|
const waited = now - startedAt;
|
|
34058
|
-
|
|
34070
|
+
const settled = quietFor >= WIN32_SUBMIT_SETTLE_MS;
|
|
34071
|
+
if (bodyEchoed() && settled) {
|
|
34072
|
+
fire(0);
|
|
34073
|
+
return;
|
|
34074
|
+
}
|
|
34075
|
+
if (waited >= WIN32_ECHO_MAX_WAIT_MS) {
|
|
34059
34076
|
fire(0);
|
|
34060
34077
|
return;
|
|
34061
34078
|
}
|
|
34062
|
-
|
|
34063
|
-
this.win32SubmitTimer = setTimeout(waitForSettle, Math.max(recheckIn, 30));
|
|
34079
|
+
this.win32SubmitTimer = setTimeout(waitForEcho, WIN32_SUBMIT_SETTLE_POLL_MS);
|
|
34064
34080
|
};
|
|
34065
|
-
if (initialDelayMs > 0) this.win32SubmitTimer = setTimeout(
|
|
34066
|
-
else
|
|
34081
|
+
if (initialDelayMs > 0) this.win32SubmitTimer = setTimeout(waitForEcho, initialDelayMs);
|
|
34082
|
+
else waitForEcho();
|
|
34067
34083
|
}
|
|
34068
34084
|
handleClickControl(controlId, payload) {
|
|
34069
34085
|
const ctl = (this.spec.control_bar ?? []).find((c) => c.id === controlId);
|