@adhdev/daemon-standalone 0.9.82-rc.378 → 0.9.82-rc.379
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 +90 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30036,10 +30036,10 @@ var require_dist3 = __commonJS({
|
|
|
30036
30036
|
}
|
|
30037
30037
|
function getDaemonBuildInfo() {
|
|
30038
30038
|
if (cached2) return cached2;
|
|
30039
|
-
const commit = readInjected(true ? "
|
|
30040
|
-
const commitShort = readInjected(true ? "
|
|
30041
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30042
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30039
|
+
const commit = readInjected(true ? "7b74c2c74e315b3fa6eb9f18d694b79eeb561184" : void 0) ?? "unknown";
|
|
30040
|
+
const commitShort = readInjected(true ? "7b74c2c7" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30041
|
+
const version2 = readInjected(true ? "0.9.82-rc.379" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30042
|
+
const builtAt = readInjected(true ? "2026-06-25T09:34:11.123Z" : void 0);
|
|
30043
30043
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30044
30044
|
return cached2;
|
|
30045
30045
|
}
|
|
@@ -40155,6 +40155,16 @@ Next step: ${nextStep}`;
|
|
|
40155
40155
|
dispatchWarmupGetterMissingWarned.add(daemonId);
|
|
40156
40156
|
LOG2.warn("MeshQueue", `Mesh peer connection getter unavailable for ${String(daemonId).slice(0, 12)}; remote task-dispatch warmup deadline degraded to the combined connect+response window. Avoids a cold-open false-timeout but loses warm/cold precision \u2014 wire getMeshPeerConnectionStatus on this daemon.`);
|
|
40157
40157
|
}
|
|
40158
|
+
async function waitForLocalSessionReady(components, sessionId) {
|
|
40159
|
+
const adapter = components.cliManager?.adapters?.get(sessionId);
|
|
40160
|
+
if (!adapter || typeof adapter.isReady !== "function") return;
|
|
40161
|
+
const deadline = Date.now() + LOCAL_LAUNCH_READY_TIMEOUT_MS;
|
|
40162
|
+
while (Date.now() < deadline) {
|
|
40163
|
+
if (adapter.isReady() || adapter.currentStatus === "idle") return;
|
|
40164
|
+
await new Promise((resolve24) => setTimeout(resolve24, LOCAL_LAUNCH_READY_POLL_MS));
|
|
40165
|
+
}
|
|
40166
|
+
LOG2.warn("MeshQueue", `Auto-launched session ${sessionId} not interactive after ${LOCAL_LAUNCH_READY_TIMEOUT_MS}ms; dispatching anyway (adapter queue-until-ready will buffer)`);
|
|
40167
|
+
}
|
|
40158
40168
|
function deliverTaskToSession(dispatchThunk, ctx, warmup) {
|
|
40159
40169
|
const delivery = createSessionDelivery({
|
|
40160
40170
|
meshId: ctx.meshId,
|
|
@@ -40751,6 +40761,7 @@ Next step: ${nextStep}`;
|
|
|
40751
40761
|
return false;
|
|
40752
40762
|
}
|
|
40753
40763
|
markAutoLaunch(meshId, task.id, { status: "completed", nodeId, providerType: resolved.providerType, sessionId });
|
|
40764
|
+
await waitForLocalSessionReady(components, sessionId);
|
|
40754
40765
|
tryAssignQueueTask(components, meshId, nodeId, sessionId, resolved.providerType);
|
|
40755
40766
|
return true;
|
|
40756
40767
|
} catch (e) {
|
|
@@ -40978,6 +40989,8 @@ Next step: ${nextStep}`;
|
|
|
40978
40989
|
var DISPATCH_CONFIRM_TIMEOUT_MS;
|
|
40979
40990
|
var DISPATCH_CONNECT_TIMEOUT_MS;
|
|
40980
40991
|
var dispatchWarmupGetterMissingWarned;
|
|
40992
|
+
var LOCAL_LAUNCH_READY_TIMEOUT_MS;
|
|
40993
|
+
var LOCAL_LAUNCH_READY_POLL_MS;
|
|
40981
40994
|
var autoLaunchInProgress;
|
|
40982
40995
|
var autoLaunchCooldownUntil;
|
|
40983
40996
|
var AUTO_LAUNCH_COOLDOWN_MS;
|
|
@@ -41009,6 +41022,8 @@ Next step: ${nextStep}`;
|
|
|
41009
41022
|
DISPATCH_CONFIRM_TIMEOUT_MS = 12e4;
|
|
41010
41023
|
DISPATCH_CONNECT_TIMEOUT_MS = MESH_CONNECT_TIMEOUT_MS2;
|
|
41011
41024
|
dispatchWarmupGetterMissingWarned = /* @__PURE__ */ new Set();
|
|
41025
|
+
LOCAL_LAUNCH_READY_TIMEOUT_MS = 15e3;
|
|
41026
|
+
LOCAL_LAUNCH_READY_POLL_MS = 100;
|
|
41012
41027
|
autoLaunchInProgress = /* @__PURE__ */ new Set();
|
|
41013
41028
|
autoLaunchCooldownUntil = /* @__PURE__ */ new Map();
|
|
41014
41029
|
AUTO_LAUNCH_COOLDOWN_MS = 5e3;
|
|
@@ -46797,6 +46812,33 @@ ${cleanBody}`;
|
|
|
46797
46812
|
};
|
|
46798
46813
|
}
|
|
46799
46814
|
});
|
|
46815
|
+
function chunkPreservingSurrogates(text, size) {
|
|
46816
|
+
const chunks = [];
|
|
46817
|
+
let offset = 0;
|
|
46818
|
+
while (offset < text.length) {
|
|
46819
|
+
let end = Math.min(text.length, offset + size);
|
|
46820
|
+
if (end < text.length) {
|
|
46821
|
+
const code = text.charCodeAt(end - 1);
|
|
46822
|
+
if (code >= 55296 && code <= 56319) end -= 1;
|
|
46823
|
+
}
|
|
46824
|
+
if (end <= offset) end = Math.min(text.length, offset + size);
|
|
46825
|
+
chunks.push(text.slice(offset, end));
|
|
46826
|
+
offset = end;
|
|
46827
|
+
}
|
|
46828
|
+
return chunks;
|
|
46829
|
+
}
|
|
46830
|
+
function shouldChunkWin32Write(length) {
|
|
46831
|
+
return length > WIN32_PTY_WRITE_CHUNK_CHARS;
|
|
46832
|
+
}
|
|
46833
|
+
var WIN32_PTY_WRITE_CHUNK_CHARS;
|
|
46834
|
+
var WIN32_PTY_WRITE_CHUNK_GAP_MS;
|
|
46835
|
+
var init_pty_write_chunking = __esm2({
|
|
46836
|
+
"src/cli-adapters/pty-write-chunking.ts"() {
|
|
46837
|
+
"use strict";
|
|
46838
|
+
WIN32_PTY_WRITE_CHUNK_CHARS = 1024;
|
|
46839
|
+
WIN32_PTY_WRITE_CHUNK_GAP_MS = 8;
|
|
46840
|
+
}
|
|
46841
|
+
});
|
|
46800
46842
|
function compile(re, flags) {
|
|
46801
46843
|
try {
|
|
46802
46844
|
return new RegExp(re, flags ?? "");
|
|
@@ -48745,6 +48787,7 @@ ${cont}` : cont;
|
|
|
48745
48787
|
init_terminal_screen();
|
|
48746
48788
|
import_session_host_core5 = require_dist();
|
|
48747
48789
|
init_pty_transport();
|
|
48790
|
+
init_pty_write_chunking();
|
|
48748
48791
|
init_provider_cli_shared();
|
|
48749
48792
|
init_cli_script_runner();
|
|
48750
48793
|
init_cli_state_engine();
|
|
@@ -49223,6 +49266,7 @@ ${lastSnapshot}`;
|
|
|
49223
49266
|
`[${this.cliType}] Startup settled (${trigger}, stableMs=${stableMs}, modal=${!!startupModal}) providerDir=${this.providerResolutionMeta.providerDir || "-"} scriptDir=${this.providerResolutionMeta.scriptDir || "-"} scriptsPath=${this.providerResolutionMeta.scriptsPath || "-"}`
|
|
49224
49267
|
);
|
|
49225
49268
|
this.onStatusChange?.();
|
|
49269
|
+
if (!startupModal) this.schedulePendingOutboundFlush();
|
|
49226
49270
|
}
|
|
49227
49271
|
scheduleStartupSettleCheck() {
|
|
49228
49272
|
if (!this.startupParseGate) return;
|
|
@@ -49543,8 +49587,26 @@ ${lastSnapshot}`;
|
|
|
49543
49587
|
}
|
|
49544
49588
|
async writeToPty(data) {
|
|
49545
49589
|
if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
|
|
49590
|
+
if (process.platform === "win32" && shouldChunkWin32Write(data.length)) {
|
|
49591
|
+
await this.writeWin32Chunked(data);
|
|
49592
|
+
return;
|
|
49593
|
+
}
|
|
49546
49594
|
await this.ptyProcess.write(data);
|
|
49547
49595
|
}
|
|
49596
|
+
/** Write `data` to the PTY in bounded, surrogate-safe chunks with a short
|
|
49597
|
+
* inter-chunk gap (win32 paced write). Awaits each chunk's write and the gap
|
|
49598
|
+
* so the returned promise resolves only after the FINAL chunk (carrying any
|
|
49599
|
+
* trailing submit key) has been written. */
|
|
49600
|
+
async writeWin32Chunked(data) {
|
|
49601
|
+
const chunks = chunkPreservingSurrogates(data, WIN32_PTY_WRITE_CHUNK_CHARS);
|
|
49602
|
+
for (let i = 0; i < chunks.length; i += 1) {
|
|
49603
|
+
if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
|
|
49604
|
+
await this.ptyProcess.write(chunks[i]);
|
|
49605
|
+
if (i + 1 < chunks.length) {
|
|
49606
|
+
await new Promise((resolve24) => setTimeout(resolve24, WIN32_PTY_WRITE_CHUNK_GAP_MS));
|
|
49607
|
+
}
|
|
49608
|
+
}
|
|
49609
|
+
}
|
|
49548
49610
|
resetPendingSendState(reason) {
|
|
49549
49611
|
this.responseBuffer = "";
|
|
49550
49612
|
if (this.responseTimeout) {
|
|
@@ -49792,7 +49854,13 @@ ${lastSnapshot}`;
|
|
|
49792
49854
|
LOG2.info("CLI", `[${this.cliType}] sendMessage recovered idle prompt readiness`);
|
|
49793
49855
|
}
|
|
49794
49856
|
}
|
|
49795
|
-
if (!this.ready)
|
|
49857
|
+
if (!this.ready) {
|
|
49858
|
+
if (allowQueue) {
|
|
49859
|
+
this.enqueuePendingOutboundMessage(text, "not_ready_pending_prompt");
|
|
49860
|
+
return;
|
|
49861
|
+
}
|
|
49862
|
+
throw new Error(`${this.cliName} not ready (status: ${this.engine.currentStatus})`);
|
|
49863
|
+
}
|
|
49796
49864
|
const parsedSessionStatus = typeof parsedStatusBeforeSend?.status === "string" ? String(parsedStatusBeforeSend.status) : "";
|
|
49797
49865
|
if (!allowInputDuringGeneration && (parsedSessionStatus === "generating" || parsedSessionStatus === "no_progress" || parsedSessionStatus === "long_generating")) {
|
|
49798
49866
|
const parsedModal = parsedStatusBeforeSend?.activeModal ?? parsedStatusBeforeSend?.modal ?? null;
|
|
@@ -65236,6 +65304,7 @@ ${body}
|
|
|
65236
65304
|
}
|
|
65237
65305
|
}
|
|
65238
65306
|
init_logger();
|
|
65307
|
+
init_pty_write_chunking();
|
|
65239
65308
|
function countNewlines(s2) {
|
|
65240
65309
|
let n = 0;
|
|
65241
65310
|
for (let i = 0; i < s2.length; i += 1) if (s2.charCodeAt(i) === 10) n += 1;
|
|
@@ -65246,8 +65315,6 @@ ${body}
|
|
|
65246
65315
|
var WIN32_SUBMIT_MAX_RESENDS = 14;
|
|
65247
65316
|
var WIN32_SUBMIT_SETTLE_MS = 500;
|
|
65248
65317
|
var WIN32_SUBMIT_SETTLE_POLL_MS = 120;
|
|
65249
|
-
var WIN32_PTY_WRITE_CHUNK_CHARS = 1024;
|
|
65250
|
-
var WIN32_PTY_WRITE_CHUNK_GAP_MS = 8;
|
|
65251
65318
|
var WIN32_ECHO_PROBE_CHARS = 16;
|
|
65252
65319
|
var WIN32_ECHO_MAX_WAIT_MS = 2e4;
|
|
65253
65320
|
function normalizeForEcho(s2) {
|
|
@@ -65259,21 +65326,7 @@ ${body}
|
|
|
65259
65326
|
const spec = typeof specBeforeSubmit === "number" && specBeforeSubmit > 0 ? specBeforeSubmit : 0;
|
|
65260
65327
|
return Math.max(spec, SUBMIT_DELAY_FLOOR_MS + linesBonus);
|
|
65261
65328
|
}
|
|
65262
|
-
|
|
65263
|
-
const chunks = [];
|
|
65264
|
-
let offset = 0;
|
|
65265
|
-
while (offset < text.length) {
|
|
65266
|
-
let end = Math.min(text.length, offset + size);
|
|
65267
|
-
if (end < text.length) {
|
|
65268
|
-
const code = text.charCodeAt(end - 1);
|
|
65269
|
-
if (code >= 55296 && code <= 56319) end -= 1;
|
|
65270
|
-
}
|
|
65271
|
-
if (end <= offset) end = Math.min(text.length, offset + size);
|
|
65272
|
-
chunks.push(text.slice(offset, end));
|
|
65273
|
-
offset = end;
|
|
65274
|
-
}
|
|
65275
|
-
return chunks;
|
|
65276
|
-
}
|
|
65329
|
+
var chunkPreservingSurrogates2 = chunkPreservingSurrogates;
|
|
65277
65330
|
function guessExt(mime) {
|
|
65278
65331
|
if (/png/i.test(mime)) return ".png";
|
|
65279
65332
|
if (/jpe?g/i.test(mime)) return ".jpg";
|
|
@@ -65944,7 +65997,7 @@ ${body}
|
|
|
65944
65997
|
this.adapter.send_keys(text);
|
|
65945
65998
|
return;
|
|
65946
65999
|
}
|
|
65947
|
-
const chunks =
|
|
66000
|
+
const chunks = chunkPreservingSurrogates2(text, WIN32_PTY_WRITE_CHUNK_CHARS);
|
|
65948
66001
|
let idx = 0;
|
|
65949
66002
|
const writeNext = () => {
|
|
65950
66003
|
this.win32WriteTimer = null;
|
|
@@ -76716,8 +76769,9 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
76716
76769
|
};
|
|
76717
76770
|
}
|
|
76718
76771
|
}
|
|
76772
|
+
const explicitCleanupMode = args?.sessionCleanupMode ?? args?.session_cleanup_mode;
|
|
76719
76773
|
const sessionCleanupMode = ctx.normalizeMeshSessionCleanupMode(
|
|
76720
|
-
|
|
76774
|
+
explicitCleanupMode ?? (node?.isLocalWorktree === true ? "stop_and_delete" : void 0) ?? mesh?.policy?.sessionCleanupOnNodeRemove
|
|
76721
76775
|
);
|
|
76722
76776
|
const explicitSessionIds = Array.isArray(args?.sessionIds) ? args.sessionIds.filter((v) => typeof v === "string" && v.trim().length > 0).map((v) => v.trim()) : void 0;
|
|
76723
76777
|
let sessionCleanup;
|
|
@@ -76789,12 +76843,16 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
76789
76843
|
}
|
|
76790
76844
|
}
|
|
76791
76845
|
const residueWarning = worktreeCleanup?.residue === true && typeof worktreeCleanup?.residueWarning === "string" ? worktreeCleanup.residueWarning : void 0;
|
|
76846
|
+
const skippedLiveSessionIds = Array.isArray(sessionCleanup?.skippedLiveSessionIds) ? sessionCleanup.skippedLiveSessionIds.filter((v) => typeof v === "string") : [];
|
|
76847
|
+
const orphanedSessionsRemaining = skippedLiveSessionIds.length > 0;
|
|
76848
|
+
const orphanNextAction = orphanedSessionsRemaining ? `Live session(s) [${skippedLiveSessionIds.join(", ")}] were skipped and still survive this node removal. Run mesh_cleanup_sessions with mode:'stop_and_delete' and sessionIds:[${skippedLiveSessionIds.map((id) => `'${id}'`).join(", ")}] to release them.` : void 0;
|
|
76792
76849
|
return {
|
|
76793
76850
|
success: true,
|
|
76794
76851
|
removed,
|
|
76795
76852
|
...residueWarning ? { residueWarning } : {},
|
|
76796
76853
|
...sessionCleanup ? { sessionCleanup } : {},
|
|
76797
|
-
...worktreeCleanup ? { worktreeCleanup } : {}
|
|
76854
|
+
...worktreeCleanup ? { worktreeCleanup } : {},
|
|
76855
|
+
...orphanedSessionsRemaining ? { orphanedSessionsRemaining: true, nextAction: orphanNextAction } : {}
|
|
76798
76856
|
};
|
|
76799
76857
|
} catch (e) {
|
|
76800
76858
|
return { success: false, error: e.message };
|
|
@@ -82214,14 +82272,19 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
82214
82272
|
skippedCoordinatorSessionIds.push(sessionId);
|
|
82215
82273
|
continue;
|
|
82216
82274
|
}
|
|
82217
|
-
|
|
82275
|
+
const matchedByWorkspaceOnly = !recordNodeId;
|
|
82276
|
+
const isWorktreeNodeRemoval = cleanupSource === "mesh_remove_node" && args.node?.isLocalWorktree === true;
|
|
82277
|
+
const cleanWorkspaceOnlyForWorktree = isWorktreeNodeRemoval && matchedByWorkspaceOnly;
|
|
82278
|
+
if (!hasExplicitSessionIds && liveRuntime && !delegateBoundToThisNode && !cleanWorkspaceOnlyForWorktree) {
|
|
82218
82279
|
skippedSessionIds.push(sessionId);
|
|
82219
82280
|
skippedLiveSessionIds.push(sessionId);
|
|
82220
|
-
const matchedByWorkspaceOnly = !recordNodeId;
|
|
82221
82281
|
const reason = recordNodeId && recordNodeId !== args.nodeId ? `live_delegate_bound_to_other_node:${recordNodeId}` : matchedByWorkspaceOnly ? "live_session_matched_by_workspace_only_no_node_binding" : "live_session_not_bound_to_this_node";
|
|
82222
82282
|
skippedLiveSessionReasons.push({ sessionId, reason });
|
|
82223
82283
|
continue;
|
|
82224
82284
|
}
|
|
82285
|
+
if (cleanWorkspaceOnlyForWorktree && !delegateBoundToThisNode) {
|
|
82286
|
+
actedLiveDelegateSessionIds.push(sessionId);
|
|
82287
|
+
}
|
|
82225
82288
|
if (!hasExplicitSessionIds && liveRuntime && delegateBoundToThisNode && args.mode === "delete_stopped") {
|
|
82226
82289
|
skippedSessionIds.push(sessionId);
|
|
82227
82290
|
skippedLiveSessionIds.push(sessionId);
|