@adhdev/daemon-standalone 0.9.82-rc.396 → 0.9.82-rc.397
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 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30108,10 +30108,10 @@ var require_dist3 = __commonJS({
|
|
|
30108
30108
|
}
|
|
30109
30109
|
function getDaemonBuildInfo() {
|
|
30110
30110
|
if (cached2) return cached2;
|
|
30111
|
-
const commit = readInjected(true ? "
|
|
30112
|
-
const commitShort = readInjected(true ? "
|
|
30113
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30114
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30111
|
+
const commit = readInjected(true ? "5e6a6bcc5ba51a08f3941445f431cb0411217547" : void 0) ?? "unknown";
|
|
30112
|
+
const commitShort = readInjected(true ? "5e6a6bcc" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30113
|
+
const version2 = readInjected(true ? "0.9.82-rc.397" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30114
|
+
const builtAt = readInjected(true ? "2026-06-27T08:34:04.661Z" : void 0);
|
|
30115
30115
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30116
30116
|
return cached2;
|
|
30117
30117
|
}
|
|
@@ -34977,6 +34977,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
34977
34977
|
init_load_better_sqlite3();
|
|
34978
34978
|
init_mesh_ledger();
|
|
34979
34979
|
init_mesh_work_queue();
|
|
34980
|
+
init_dist();
|
|
34980
34981
|
loggedMigrationFailure = false;
|
|
34981
34982
|
MeshRuntimeStore = class _MeshRuntimeStore {
|
|
34982
34983
|
static instance;
|
|
@@ -35509,6 +35510,8 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35509
35510
|
if (providerType && typeof providerMaxParallel === "number" && Number.isFinite(providerMaxParallel) && providerMaxParallel >= 0 && this.activeProviderAssignmentCount(meshId, nodeId, providerType) >= providerMaxParallel) {
|
|
35510
35511
|
return null;
|
|
35511
35512
|
}
|
|
35513
|
+
const nodeIdForms = expandDaemonIdForms(nodeId);
|
|
35514
|
+
const nodePinnedPlaceholders = nodeIdForms.map(() => "?").join(", ");
|
|
35512
35515
|
const rows = [
|
|
35513
35516
|
...this.db.prepare(`
|
|
35514
35517
|
SELECT payload FROM mesh_queue
|
|
@@ -35517,9 +35520,9 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35517
35520
|
`).all(meshId, sessionId),
|
|
35518
35521
|
...this.db.prepare(`
|
|
35519
35522
|
SELECT payload FROM mesh_queue
|
|
35520
|
-
WHERE mesh_id = ? AND status = 'pending' AND target_node_id
|
|
35523
|
+
WHERE mesh_id = ? AND status = 'pending' AND target_node_id IN (${nodePinnedPlaceholders}) AND target_session_id IS NULL
|
|
35521
35524
|
ORDER BY created_at ASC
|
|
35522
|
-
`).all(meshId,
|
|
35525
|
+
`).all(meshId, ...nodeIdForms),
|
|
35523
35526
|
...this.db.prepare(`
|
|
35524
35527
|
SELECT payload FROM mesh_queue
|
|
35525
35528
|
WHERE mesh_id = ? AND status = 'pending' AND target_node_id IS NULL AND target_session_id IS NULL
|
|
@@ -35549,7 +35552,9 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35549
35552
|
const convergenceAllows = (candidate) => candidate.taskMode !== "convergence" || !nodeIsWorktree;
|
|
35550
35553
|
const targetMatches = (candidate) => {
|
|
35551
35554
|
if (candidate.targetSessionId && candidate.targetSessionId !== sessionId) return false;
|
|
35552
|
-
if (candidate.targetNodeId && candidate.targetNodeId
|
|
35555
|
+
if (candidate.targetNodeId && !daemonIdsEquivalent(candidate.targetNodeId, nodeId) && !meshNodeIdMatches({ id: candidate.targetNodeId }, nodeId)) {
|
|
35556
|
+
return false;
|
|
35557
|
+
}
|
|
35553
35558
|
return true;
|
|
35554
35559
|
};
|
|
35555
35560
|
const entry = candidates.find((candidate) => nodeSatisfiesRequiredTags(candidate.requiredTags, capabilityTags) && dependenciesSatisfied(candidate) && convergenceAllows(candidate) && targetMatches(candidate) && nodeConflictAllows(candidate));
|
|
@@ -40570,7 +40575,7 @@ Next step: ${nextStep}`;
|
|
|
40570
40575
|
}
|
|
40571
40576
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
40572
40577
|
const mesh = getMeshWithCache(components, meshId);
|
|
40573
|
-
const node = mesh?.nodes.find((n) =>
|
|
40578
|
+
const node = mesh?.nodes.find((n) => meshNodeIdMatches(n, nodeId));
|
|
40574
40579
|
const gateNode = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
40575
40580
|
if (gateNode?.worktreeBootstrap?.status === "running") {
|
|
40576
40581
|
LOG2.info("MeshQueue", `Gating queue claim for worktree node ${nodeId} (${sessionId}): worktree bootstrap still running \u2014 task left pending; claim re-fires once bootstrap reaches a terminal state (guards against dispatching into a half-built worktree \u2192 empty session)`);
|
|
@@ -41179,7 +41184,7 @@ Next step: ${nextStep}`;
|
|
|
41179
41184
|
const providerType = state.type || readNonEmptyString2(settings.providerType);
|
|
41180
41185
|
if (providerType) {
|
|
41181
41186
|
localIdleSessionsChecked += 1;
|
|
41182
|
-
localCandidates.push({ nodeId, sessionId, providerType, origin: "local", node: mesh.nodes.find((n) =>
|
|
41187
|
+
localCandidates.push({ nodeId, sessionId, providerType, origin: "local", node: mesh.nodes.find((n) => meshNodeIdMatches(n, nodeId)) });
|
|
41183
41188
|
} else {
|
|
41184
41189
|
skippedSessions.push({
|
|
41185
41190
|
nodeId,
|
|
@@ -49400,6 +49405,16 @@ ${cont}` : cont;
|
|
|
49400
49405
|
providerSessionId = null;
|
|
49401
49406
|
responseTimeout = null;
|
|
49402
49407
|
ready = false;
|
|
49408
|
+
// WIN32-READY-HOLD: the ready barrier can release on screen/spec-FSM grace
|
|
49409
|
+
// before win32 ConPTY's input layer is live. The first split write (text, then a
|
|
49410
|
+
// separate trailing CR via waitForEchoAndSubmit) then has its submit CR swallowed,
|
|
49411
|
+
// and every CR-only retry re-sends a bare CR the input layer keeps dropping — the
|
|
49412
|
+
// first message is typed-but-never-submitted and lost. Routing only the FIRST turn
|
|
49413
|
+
// through the atomic content+sendKey single write (submitImmediatePrompt) keeps the
|
|
49414
|
+
// Enter in the same PTY write unit as the text, the invariant win32 ConPTY needs to
|
|
49415
|
+
// recognize a submit, so the swallow is bypassed. Subsequent turns (input layer now
|
|
49416
|
+
// proven live) keep the normal echo-gated path. Flips true on first committed turn.
|
|
49417
|
+
firstTurnSent = false;
|
|
49403
49418
|
startupBuffer = "";
|
|
49404
49419
|
startupParseGate = false;
|
|
49405
49420
|
startupSettleTimer = null;
|
|
@@ -49686,6 +49701,7 @@ ${lastSnapshot}`;
|
|
|
49686
49701
|
this.resetTerminalScreen(import_session_host_core5.DEFAULT_SESSION_HOST_ROWS, import_session_host_core5.DEFAULT_SESSION_HOST_COLS);
|
|
49687
49702
|
this.pendingTerminalQueryTail = "";
|
|
49688
49703
|
this.ready = false;
|
|
49704
|
+
this.firstTurnSent = false;
|
|
49689
49705
|
await this.ptyProcess.ready;
|
|
49690
49706
|
this.engine.onSpawnReady();
|
|
49691
49707
|
this.scheduleStartupSettleCheck();
|
|
@@ -50150,6 +50166,7 @@ ${lastSnapshot}`;
|
|
|
50150
50166
|
commitSendUserTurn(state) {
|
|
50151
50167
|
if (state.didCommitUserTurn) return;
|
|
50152
50168
|
state.didCommitUserTurn = true;
|
|
50169
|
+
this.firstTurnSent = true;
|
|
50153
50170
|
}
|
|
50154
50171
|
armResponseTimeout() {
|
|
50155
50172
|
if (this.responseTimeout) clearTimeout(this.responseTimeout);
|
|
@@ -50172,12 +50189,30 @@ ${lastSnapshot}`;
|
|
|
50172
50189
|
LOG2.warn("CLI", `[${this.cliType}] ${mode} write failed: ${error48?.message || error48}`);
|
|
50173
50190
|
});
|
|
50174
50191
|
}
|
|
50192
|
+
// WIN32-READY-HOLD: choose the retry write for a stuck prompt. When the FIRST turn
|
|
50193
|
+
// is stuck on win32 — the premature-ready swallow window — the prompt text itself
|
|
50194
|
+
// may have been partially eaten by a not-yet-live ConPTY input layer, so re-sending
|
|
50195
|
+
// a bare CR keeps hitting nothing. Re-type the whole `text + sendKey` atomically
|
|
50196
|
+
// once so the input layer (now live) receives a self-contained, submit-coupled
|
|
50197
|
+
// write. All other cases keep the cheap bare-CR retry (the prompt is fully echoed
|
|
50198
|
+
// and only the Enter is missing).
|
|
50199
|
+
writeStuckRetry(state, mode) {
|
|
50200
|
+
const retypeFirstTurn = process.platform === "win32" && state.isFirstTurn;
|
|
50201
|
+
if (retypeFirstTurn) {
|
|
50202
|
+
LOG2.info("CLI", `[${this.cliType}] ${mode}: re-typing full prompt atomically (win32 first-turn swallow recovery)`);
|
|
50203
|
+
void this.writeToPty(state.text + this.sendKey).catch((error48) => {
|
|
50204
|
+
LOG2.warn("CLI", `[${this.cliType}] ${mode} re-type write failed: ${error48?.message || error48}`);
|
|
50205
|
+
});
|
|
50206
|
+
return;
|
|
50207
|
+
}
|
|
50208
|
+
this.writeSubmitKeyForRetry(mode);
|
|
50209
|
+
}
|
|
50175
50210
|
retrySubmitIfStuck(state, attempt) {
|
|
50176
50211
|
this.submitRetryTimer = null;
|
|
50177
50212
|
if (!this.isSubmitStuck(state.normalizedPromptSnippet)) return;
|
|
50178
50213
|
this.engine.responseSettleIgnoreUntil = Date.now() + this.timeouts.outputSettle + 400;
|
|
50179
50214
|
LOG2.info("CLI", `[${this.cliType}] Retrying submit key for stuck prompt (attempt ${attempt})`);
|
|
50180
|
-
this.
|
|
50215
|
+
this.writeStuckRetry(state, "submit_retry");
|
|
50181
50216
|
if (attempt >= 3) {
|
|
50182
50217
|
this.engine.submitRetryUsed = true;
|
|
50183
50218
|
return;
|
|
@@ -50189,7 +50224,7 @@ ${lastSnapshot}`;
|
|
|
50189
50224
|
if (!this.isSubmitStuck(state.normalizedPromptSnippet)) return;
|
|
50190
50225
|
this.engine.responseSettleIgnoreUntil = Date.now() + this.timeouts.outputSettle + 400;
|
|
50191
50226
|
LOG2.info("CLI", `[${this.cliType}] Retrying submit key for stuck prompt (attempt 1)`);
|
|
50192
|
-
this.
|
|
50227
|
+
this.writeStuckRetry(state, "immediate_retry");
|
|
50193
50228
|
this.engine.submitRetryUsed = true;
|
|
50194
50229
|
}
|
|
50195
50230
|
submitSendKey(state, completion) {
|
|
@@ -50442,7 +50477,9 @@ ${lastSnapshot}`;
|
|
|
50442
50477
|
submitDelayMs,
|
|
50443
50478
|
maxEchoWaitMs,
|
|
50444
50479
|
retryDelayMs,
|
|
50445
|
-
didCommitUserTurn: false
|
|
50480
|
+
didCommitUserTurn: false,
|
|
50481
|
+
// Capture BEFORE the send commits — commitSendUserTurn flips firstTurnSent.
|
|
50482
|
+
isFirstTurn: !this.firstTurnSent
|
|
50446
50483
|
};
|
|
50447
50484
|
this.engine.responseSettleIgnoreUntil = Date.now() + submitDelayMs + this.timeouts.outputSettle + 250;
|
|
50448
50485
|
await new Promise((resolve24, reject) => {
|
|
@@ -50460,7 +50497,8 @@ ${lastSnapshot}`;
|
|
|
50460
50497
|
reject(error48);
|
|
50461
50498
|
}
|
|
50462
50499
|
};
|
|
50463
|
-
|
|
50500
|
+
const useAtomicFirstTurn = this.submitStrategy === "immediate" || process.platform === "win32" && sendState.isFirstTurn;
|
|
50501
|
+
if (useAtomicFirstTurn) {
|
|
50464
50502
|
this.submitImmediatePrompt(sendState, completion);
|
|
50465
50503
|
return;
|
|
50466
50504
|
}
|
|
@@ -83937,7 +83975,14 @@ ${hintLines.join("\n")}` : "",
|
|
|
83937
83975
|
nodeId,
|
|
83938
83976
|
sessionCleanupMode: refineSessionCleanupMode,
|
|
83939
83977
|
...refineSessionIds && refineSessionIds.length > 0 ? { sessionIds: refineSessionIds } : {},
|
|
83940
|
-
inlineMesh: args?.inlineMesh
|
|
83978
|
+
inlineMesh: args?.inlineMesh,
|
|
83979
|
+
// REFINE-CLEANUP: refine reaches cleanup only AFTER a verified merge
|
|
83980
|
+
// convergence, so any residual worktree dirtiness here is incidental
|
|
83981
|
+
// (e.g. a bootstrap lockfile rewrite) — never unmerged work. `force`
|
|
83982
|
+
// sets requireClean=false so a plain-dirty worktree no longer aborts
|
|
83983
|
+
// removal with merged_cleanup_failed. Branch-ref deletion still keys off
|
|
83984
|
+
// mergeConvergence (NOT the force flag), so no merged work can be lost.
|
|
83985
|
+
force: true
|
|
83941
83986
|
});
|
|
83942
83987
|
recordMeshRefineStage(refineStages, "cleanup", removeResult?.success === false ? "failed" : "passed", cleanupStarted, {
|
|
83943
83988
|
removed: removeResult?.removed,
|