@adhdev/daemon-standalone 0.9.82-rc.395 → 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 +95 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +6 -3
- package/vendor/mcp-server/index.js.map +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));
|
|
@@ -39649,27 +39654,32 @@ Next step: ${nextStep}`;
|
|
|
39649
39654
|
updateDirectDispatchStatus(args.meshId, args.sessionId, kind === "task_completed" ? "completed" : "failed", args.taskId);
|
|
39650
39655
|
markSessionDeliveriesTerminal(args.meshId, args.sessionId, kind === "task_completed" ? "completed" : "failed");
|
|
39651
39656
|
setImmediate(() => cleanupTerminalDirectDispatches());
|
|
39657
|
+
const eventName = kind === "task_completed" ? "agent:generating_completed" : "agent:stopped";
|
|
39658
|
+
const nodeLabel = nodeId ? `Node '${nodeId}'` : "Remote agent";
|
|
39659
|
+
const metadataEvent = {
|
|
39660
|
+
targetSessionId: args.sessionId,
|
|
39661
|
+
providerType: providerType || void 0,
|
|
39662
|
+
providerSessionId: readNonEmptyString2(args.providerSessionId),
|
|
39663
|
+
finalSummary,
|
|
39664
|
+
taskId: args.taskId,
|
|
39665
|
+
workerResult,
|
|
39666
|
+
completionDiagnostic: {
|
|
39667
|
+
reason: "direct_task_transcript_reconciliation",
|
|
39668
|
+
terminalLedgerKind: kind,
|
|
39669
|
+
terminalLedgerId: entry.id
|
|
39670
|
+
}
|
|
39671
|
+
};
|
|
39672
|
+
const targetCoordinatorSessionId = readNonEmptyString2(args.targetCoordinatorSessionId) || readNonEmptyString2(dispatch?.payload?.coordinatorSessionId);
|
|
39652
39673
|
queuePendingMeshCoordinatorEvent({
|
|
39653
|
-
event:
|
|
39674
|
+
event: eventName,
|
|
39654
39675
|
meshId: args.meshId,
|
|
39655
|
-
nodeLabel
|
|
39676
|
+
nodeLabel,
|
|
39656
39677
|
nodeId: nodeId || void 0,
|
|
39657
|
-
metadataEvent
|
|
39658
|
-
|
|
39659
|
-
providerType: providerType || void 0,
|
|
39660
|
-
providerSessionId: readNonEmptyString2(args.providerSessionId),
|
|
39661
|
-
finalSummary,
|
|
39662
|
-
taskId: args.taskId,
|
|
39663
|
-
workerResult,
|
|
39664
|
-
completionDiagnostic: {
|
|
39665
|
-
reason: "direct_task_transcript_reconciliation",
|
|
39666
|
-
terminalLedgerKind: kind,
|
|
39667
|
-
terminalLedgerId: entry.id
|
|
39668
|
-
}
|
|
39669
|
-
},
|
|
39670
|
-
coordinatorMessage: void 0,
|
|
39678
|
+
metadataEvent,
|
|
39679
|
+
coordinatorMessage: buildMeshSystemMessage({ event: eventName, nodeLabel, metadataEvent }),
|
|
39671
39680
|
queuedAt: Date.now(),
|
|
39672
|
-
...readNonEmptyString2(args.targetCoordinatorDaemonId) ? { targetCoordinatorDaemonId: readNonEmptyString2(args.targetCoordinatorDaemonId) } : {}
|
|
39681
|
+
...readNonEmptyString2(args.targetCoordinatorDaemonId) ? { targetCoordinatorDaemonId: readNonEmptyString2(args.targetCoordinatorDaemonId) } : {},
|
|
39682
|
+
...targetCoordinatorSessionId ? { targetCoordinatorSessionId } : {}
|
|
39673
39683
|
});
|
|
39674
39684
|
return { reconciled: true, kind, workerResult, ledgerEntryId: entry.id };
|
|
39675
39685
|
}
|
|
@@ -40565,7 +40575,7 @@ Next step: ${nextStep}`;
|
|
|
40565
40575
|
}
|
|
40566
40576
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
40567
40577
|
const mesh = getMeshWithCache(components, meshId);
|
|
40568
|
-
const node = mesh?.nodes.find((n) =>
|
|
40578
|
+
const node = mesh?.nodes.find((n) => meshNodeIdMatches(n, nodeId));
|
|
40569
40579
|
const gateNode = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
40570
40580
|
if (gateNode?.worktreeBootstrap?.status === "running") {
|
|
40571
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)`);
|
|
@@ -41174,7 +41184,7 @@ Next step: ${nextStep}`;
|
|
|
41174
41184
|
const providerType = state.type || readNonEmptyString2(settings.providerType);
|
|
41175
41185
|
if (providerType) {
|
|
41176
41186
|
localIdleSessionsChecked += 1;
|
|
41177
|
-
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)) });
|
|
41178
41188
|
} else {
|
|
41179
41189
|
skippedSessions.push({
|
|
41180
41190
|
nodeId,
|
|
@@ -45031,7 +45041,19 @@ ${cleanBody}`;
|
|
|
45031
45041
|
return localIds.some((id) => daemonIdsEquivalent(id, requested));
|
|
45032
45042
|
}
|
|
45033
45043
|
function injectPendingIntoCoordinator(coordinator, pending) {
|
|
45034
|
-
if (!coordinator
|
|
45044
|
+
if (!coordinator) return;
|
|
45045
|
+
let coordinatorMessage = pending.coordinatorMessage;
|
|
45046
|
+
if (!coordinatorMessage) {
|
|
45047
|
+
if (!shouldForceInjectMeshEvent(pending.event)) return;
|
|
45048
|
+
const metadataEvent = pending.metadataEvent && typeof pending.metadataEvent === "object" ? pending.metadataEvent : {};
|
|
45049
|
+
coordinatorMessage = buildMeshSystemMessage({
|
|
45050
|
+
event: pending.event,
|
|
45051
|
+
nodeLabel: pending.nodeLabel,
|
|
45052
|
+
metadataEvent
|
|
45053
|
+
});
|
|
45054
|
+
if (!coordinatorMessage) return;
|
|
45055
|
+
LOG2.warn("MeshReconcile", `Lazily synthesized missing coordinatorMessage for ${pending.event} (mesh ${pending.meshId}) at inject time \u2014 a queued terminal event arrived message-less`);
|
|
45056
|
+
}
|
|
45035
45057
|
const force = shouldForceInjectMeshEvent(pending.event);
|
|
45036
45058
|
traceMeshEventStage("surfaced", {
|
|
45037
45059
|
taskId: pending.metadataEvent?.taskId,
|
|
@@ -45041,7 +45063,7 @@ ${cleanBody}`;
|
|
|
45041
45063
|
event: pending.event
|
|
45042
45064
|
}, force ? "force-inject" : "inject");
|
|
45043
45065
|
coordinator.onEvent("send_message", {
|
|
45044
|
-
input: { text:
|
|
45066
|
+
input: { text: coordinatorMessage, textFallback: coordinatorMessage },
|
|
45045
45067
|
...force ? { force: true } : {}
|
|
45046
45068
|
});
|
|
45047
45069
|
}
|
|
@@ -49383,6 +49405,16 @@ ${cont}` : cont;
|
|
|
49383
49405
|
providerSessionId = null;
|
|
49384
49406
|
responseTimeout = null;
|
|
49385
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;
|
|
49386
49418
|
startupBuffer = "";
|
|
49387
49419
|
startupParseGate = false;
|
|
49388
49420
|
startupSettleTimer = null;
|
|
@@ -49669,6 +49701,7 @@ ${lastSnapshot}`;
|
|
|
49669
49701
|
this.resetTerminalScreen(import_session_host_core5.DEFAULT_SESSION_HOST_ROWS, import_session_host_core5.DEFAULT_SESSION_HOST_COLS);
|
|
49670
49702
|
this.pendingTerminalQueryTail = "";
|
|
49671
49703
|
this.ready = false;
|
|
49704
|
+
this.firstTurnSent = false;
|
|
49672
49705
|
await this.ptyProcess.ready;
|
|
49673
49706
|
this.engine.onSpawnReady();
|
|
49674
49707
|
this.scheduleStartupSettleCheck();
|
|
@@ -50133,6 +50166,7 @@ ${lastSnapshot}`;
|
|
|
50133
50166
|
commitSendUserTurn(state) {
|
|
50134
50167
|
if (state.didCommitUserTurn) return;
|
|
50135
50168
|
state.didCommitUserTurn = true;
|
|
50169
|
+
this.firstTurnSent = true;
|
|
50136
50170
|
}
|
|
50137
50171
|
armResponseTimeout() {
|
|
50138
50172
|
if (this.responseTimeout) clearTimeout(this.responseTimeout);
|
|
@@ -50155,12 +50189,30 @@ ${lastSnapshot}`;
|
|
|
50155
50189
|
LOG2.warn("CLI", `[${this.cliType}] ${mode} write failed: ${error48?.message || error48}`);
|
|
50156
50190
|
});
|
|
50157
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
|
+
}
|
|
50158
50210
|
retrySubmitIfStuck(state, attempt) {
|
|
50159
50211
|
this.submitRetryTimer = null;
|
|
50160
50212
|
if (!this.isSubmitStuck(state.normalizedPromptSnippet)) return;
|
|
50161
50213
|
this.engine.responseSettleIgnoreUntil = Date.now() + this.timeouts.outputSettle + 400;
|
|
50162
50214
|
LOG2.info("CLI", `[${this.cliType}] Retrying submit key for stuck prompt (attempt ${attempt})`);
|
|
50163
|
-
this.
|
|
50215
|
+
this.writeStuckRetry(state, "submit_retry");
|
|
50164
50216
|
if (attempt >= 3) {
|
|
50165
50217
|
this.engine.submitRetryUsed = true;
|
|
50166
50218
|
return;
|
|
@@ -50172,7 +50224,7 @@ ${lastSnapshot}`;
|
|
|
50172
50224
|
if (!this.isSubmitStuck(state.normalizedPromptSnippet)) return;
|
|
50173
50225
|
this.engine.responseSettleIgnoreUntil = Date.now() + this.timeouts.outputSettle + 400;
|
|
50174
50226
|
LOG2.info("CLI", `[${this.cliType}] Retrying submit key for stuck prompt (attempt 1)`);
|
|
50175
|
-
this.
|
|
50227
|
+
this.writeStuckRetry(state, "immediate_retry");
|
|
50176
50228
|
this.engine.submitRetryUsed = true;
|
|
50177
50229
|
}
|
|
50178
50230
|
submitSendKey(state, completion) {
|
|
@@ -50425,7 +50477,9 @@ ${lastSnapshot}`;
|
|
|
50425
50477
|
submitDelayMs,
|
|
50426
50478
|
maxEchoWaitMs,
|
|
50427
50479
|
retryDelayMs,
|
|
50428
|
-
didCommitUserTurn: false
|
|
50480
|
+
didCommitUserTurn: false,
|
|
50481
|
+
// Capture BEFORE the send commits — commitSendUserTurn flips firstTurnSent.
|
|
50482
|
+
isFirstTurn: !this.firstTurnSent
|
|
50429
50483
|
};
|
|
50430
50484
|
this.engine.responseSettleIgnoreUntil = Date.now() + submitDelayMs + this.timeouts.outputSettle + 250;
|
|
50431
50485
|
await new Promise((resolve24, reject) => {
|
|
@@ -50443,7 +50497,8 @@ ${lastSnapshot}`;
|
|
|
50443
50497
|
reject(error48);
|
|
50444
50498
|
}
|
|
50445
50499
|
};
|
|
50446
|
-
|
|
50500
|
+
const useAtomicFirstTurn = this.submitStrategy === "immediate" || process.platform === "win32" && sendState.isFirstTurn;
|
|
50501
|
+
if (useAtomicFirstTurn) {
|
|
50447
50502
|
this.submitImmediatePrompt(sendState, completion);
|
|
50448
50503
|
return;
|
|
50449
50504
|
}
|
|
@@ -83920,7 +83975,14 @@ ${hintLines.join("\n")}` : "",
|
|
|
83920
83975
|
nodeId,
|
|
83921
83976
|
sessionCleanupMode: refineSessionCleanupMode,
|
|
83922
83977
|
...refineSessionIds && refineSessionIds.length > 0 ? { sessionIds: refineSessionIds } : {},
|
|
83923
|
-
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
|
|
83924
83986
|
});
|
|
83925
83987
|
recordMeshRefineStage(refineStages, "cleanup", removeResult?.success === false ? "failed" : "passed", cleanupStarted, {
|
|
83926
83988
|
removed: removeResult?.removed,
|