@adhdev/daemon-standalone 1.0.18-rc.14 → 1.0.18-rc.15
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 +130 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -30265,10 +30265,10 @@ var require_dist3 = __commonJS({
|
|
|
30265
30265
|
}
|
|
30266
30266
|
function getDaemonBuildInfo() {
|
|
30267
30267
|
if (cached2) return cached2;
|
|
30268
|
-
const commit = readInjected(true ? "
|
|
30269
|
-
const commitShort = readInjected(true ? "
|
|
30270
|
-
const version2 = readInjected(true ? "1.0.18-rc.
|
|
30271
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
30268
|
+
const commit = readInjected(true ? "64f056340da99d3b28464efcf5c05fe643e5db63" : void 0) ?? "unknown";
|
|
30269
|
+
const commitShort = readInjected(true ? "64f05634" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30270
|
+
const version2 = readInjected(true ? "1.0.18-rc.15" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30271
|
+
const builtAt = readInjected(true ? "2026-07-23T00:53:09.129Z" : void 0);
|
|
30272
30272
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30273
30273
|
return cached2;
|
|
30274
30274
|
}
|
|
@@ -42873,6 +42873,12 @@ ${rendered}`, "utf-8");
|
|
|
42873
42873
|
import_session_host_core22 = require_dist();
|
|
42874
42874
|
}
|
|
42875
42875
|
});
|
|
42876
|
+
function isPurePtyTranscriptProvider(provider) {
|
|
42877
|
+
if (provider.transcriptAuthority === "provider") return false;
|
|
42878
|
+
if (provider.nativeHistory) return false;
|
|
42879
|
+
const transcriptPty = provider.tui?.transcriptPty;
|
|
42880
|
+
return transcriptPty?.scope === "buffer";
|
|
42881
|
+
}
|
|
42876
42882
|
function stripAnsi(str) {
|
|
42877
42883
|
return str.replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, "").replace(/\x1B[P^_X][\s\S]*?(?:\x07|\x1B\\)/g, "").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
|
|
42878
42884
|
}
|
|
@@ -53161,10 +53167,54 @@ ${cleanBody}`;
|
|
|
53161
53167
|
for (const key2 of [...deliveredUnconsumedUnknownStreak.keys()]) {
|
|
53162
53168
|
if (key2.startsWith(meshKeyPrefix) && !assignedKeys.has(key2)) deliveredUnconsumedUnknownStreak.delete(key2);
|
|
53163
53169
|
}
|
|
53170
|
+
for (const key2 of [...assignedIdleFinalAssistantSince.keys()]) {
|
|
53171
|
+
if (key2.startsWith(meshKeyPrefix) && !assignedKeys.has(key2)) assignedIdleFinalAssistantSince.delete(key2);
|
|
53172
|
+
}
|
|
53164
53173
|
for (const row of assigned) {
|
|
53165
53174
|
const dispatchedAtMs = Date.parse(row.dispatchTimestamp ?? "");
|
|
53166
53175
|
if (!Number.isFinite(dispatchedAtMs)) continue;
|
|
53167
53176
|
const ageMs = nowMs - dispatchedAtMs;
|
|
53177
|
+
const idleTranscriptStreakKey = `${meshId}::${row.id}`;
|
|
53178
|
+
if (store.taskHasConfirmedDelivery(meshId, row.id) && !findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id }) && readNonEmptyString(row.assignedSessionId) && resolveSessionBusyVerdict(components, row.assignedSessionId) !== "GENERATING") {
|
|
53179
|
+
const since = assignedIdleFinalAssistantSince.get(idleTranscriptStreakKey);
|
|
53180
|
+
if (since === void 0) {
|
|
53181
|
+
assignedIdleFinalAssistantSince.set(idleTranscriptStreakKey, nowMs);
|
|
53182
|
+
} else if (nowMs - since >= ASSIGNED_IDLE_TRANSCRIPT_COMPLETE_MS) {
|
|
53183
|
+
const terminalEvidence = await pollAssignedTaskTerminalEvidence(components, mesh, row);
|
|
53184
|
+
if (terminalEvidence) {
|
|
53185
|
+
assignedIdleFinalAssistantSince.delete(idleTranscriptStreakKey);
|
|
53186
|
+
updateTaskStatus(meshId, row.id, terminalEvidence);
|
|
53187
|
+
if (!findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id })) {
|
|
53188
|
+
try {
|
|
53189
|
+
appendLedgerEntry(meshId, {
|
|
53190
|
+
kind: terminalEvidence === "completed" ? "task_completed" : "task_failed",
|
|
53191
|
+
nodeId: row.assignedNodeId,
|
|
53192
|
+
sessionId: row.assignedSessionId,
|
|
53193
|
+
providerType: row.assignedProviderType,
|
|
53194
|
+
payload: {
|
|
53195
|
+
taskId: row.id,
|
|
53196
|
+
event: "agent:generating_completed",
|
|
53197
|
+
source: "early_idle_transcript_evidence"
|
|
53198
|
+
}
|
|
53199
|
+
});
|
|
53200
|
+
} catch {
|
|
53201
|
+
}
|
|
53202
|
+
}
|
|
53203
|
+
LOG2.warn("MeshReconcile", `Early-completed assigned task ${row.id} on mesh ${meshId} (node=${row.assignedNodeId ?? "?"} session=${row.assignedSessionId ?? "?"}): worker idle with a final assistant message after dispatch for \u2265${Math.round(ASSIGNED_IDLE_TRANSCRIPT_COMPLETE_MS / 1e3)}s \u2014 the completion event was lost/late (pure-PTY provider), task is ${terminalEvidence} without waiting the 15-min deadline`);
|
|
53204
|
+
traceMeshEventDrop("assigned_early_transcript_completed", {
|
|
53205
|
+
taskId: row.id,
|
|
53206
|
+
sessionId: row.assignedSessionId,
|
|
53207
|
+
nodeId: row.assignedNodeId,
|
|
53208
|
+
meshId,
|
|
53209
|
+
event: "agent:generating_completed"
|
|
53210
|
+
}, terminalEvidence);
|
|
53211
|
+
continue;
|
|
53212
|
+
}
|
|
53213
|
+
assignedIdleFinalAssistantSince.delete(idleTranscriptStreakKey);
|
|
53214
|
+
}
|
|
53215
|
+
} else {
|
|
53216
|
+
assignedIdleFinalAssistantSince.delete(idleTranscriptStreakKey);
|
|
53217
|
+
}
|
|
53168
53218
|
if (ageMs >= ASSIGNED_DELIVERED_UNCONSUMED_REDRIVE_MS && ageMs < ASSIGNED_STRANDED_DEADLINE_MS && store.taskHasConfirmedDelivery(meshId, row.id) && !store.taskDeliveryConsumed(meshId, row.id)) {
|
|
53169
53219
|
const terminal2 = findTerminalLedgerEvidenceForTask({ meshId, taskId: row.id });
|
|
53170
53220
|
if (terminal2) {
|
|
@@ -53850,6 +53900,8 @@ ${cleanBody}`;
|
|
|
53850
53900
|
var RECLAIM_UNKNOWN_GRACE_TICKS;
|
|
53851
53901
|
var deliveredNoTurnUnknownStreak;
|
|
53852
53902
|
var deliveredUnconsumedUnknownStreak;
|
|
53903
|
+
var ASSIGNED_IDLE_TRANSCRIPT_COMPLETE_MS;
|
|
53904
|
+
var assignedIdleFinalAssistantSince;
|
|
53853
53905
|
var ZOMBIE_ASSIGNED_MIN_AGE_MS;
|
|
53854
53906
|
var STRICT_SESSION_MATCH_TTL_MS;
|
|
53855
53907
|
var unresolvedForwardRejectionCounts;
|
|
@@ -53894,6 +53946,8 @@ ${cleanBody}`;
|
|
|
53894
53946
|
RECLAIM_UNKNOWN_GRACE_TICKS = 3;
|
|
53895
53947
|
deliveredNoTurnUnknownStreak = /* @__PURE__ */ new Map();
|
|
53896
53948
|
deliveredUnconsumedUnknownStreak = /* @__PURE__ */ new Map();
|
|
53949
|
+
ASSIGNED_IDLE_TRANSCRIPT_COMPLETE_MS = 8e3;
|
|
53950
|
+
assignedIdleFinalAssistantSince = /* @__PURE__ */ new Map();
|
|
53897
53951
|
ZOMBIE_ASSIGNED_MIN_AGE_MS = 30 * 60 * 1e3;
|
|
53898
53952
|
STRICT_SESSION_MATCH_TTL_MS = 6e4;
|
|
53899
53953
|
unresolvedForwardRejectionCounts = /* @__PURE__ */ new Map();
|
|
@@ -56651,7 +56705,8 @@ ${cont}` : cont;
|
|
|
56651
56705
|
this.currentTurnStartedAt = Date.now();
|
|
56652
56706
|
this.responseEpoch += 1;
|
|
56653
56707
|
this.clearApprovalResolutionMemory();
|
|
56654
|
-
|
|
56708
|
+
const promoteOnTurnStart = this.provider.transcriptAuthority === "provider" || isPurePtyTranscriptProvider(this.provider);
|
|
56709
|
+
if (promoteOnTurnStart && this.currentStatus !== "waiting_approval") {
|
|
56655
56710
|
this.setStatus("generating", "turn_started");
|
|
56656
56711
|
this.callbacks.onStatusChange();
|
|
56657
56712
|
}
|
|
@@ -58182,10 +58237,7 @@ ${lastSnapshot}`;
|
|
|
58182
58237
|
* provider-owned) so no other provider's turn-scoped parse changes.
|
|
58183
58238
|
*/
|
|
58184
58239
|
parsesFullPtyTranscriptFromBuffer() {
|
|
58185
|
-
|
|
58186
|
-
if (this.provider.nativeHistory) return false;
|
|
58187
|
-
const transcriptPty = this.provider.tui?.transcriptPty;
|
|
58188
|
-
return transcriptPty?.scope === "buffer";
|
|
58240
|
+
return isPurePtyTranscriptProvider(this.provider);
|
|
58189
58241
|
}
|
|
58190
58242
|
/**
|
|
58191
58243
|
* The turn scope to feed the transcript parser. Normally the live turn scope
|
|
@@ -75191,6 +75243,7 @@ ${body}
|
|
|
75191
75243
|
init_contracts2();
|
|
75192
75244
|
init_provider_input_support();
|
|
75193
75245
|
init_hash();
|
|
75246
|
+
init_provider_cli_shared();
|
|
75194
75247
|
var fs222 = __toESM2(require("fs"));
|
|
75195
75248
|
var path26 = __toESM2(require("path"));
|
|
75196
75249
|
init_provider_cli_adapter();
|
|
@@ -80819,6 +80872,10 @@ ${body}
|
|
|
80819
80872
|
return;
|
|
80820
80873
|
}
|
|
80821
80874
|
}
|
|
80875
|
+
if (this.tryReconcilePurePtyCompletionForStall(observedStatus)) {
|
|
80876
|
+
this.meshStallEmittedForAnchor = true;
|
|
80877
|
+
return;
|
|
80878
|
+
}
|
|
80822
80879
|
this.meshStallEmittedForAnchor = true;
|
|
80823
80880
|
if (this.meshStallLastFiredAt >= 0 && now - this.meshStallLastFiredAt < _CliProviderInstance.MESH_WORKER_STALL_REFIRE_COOLDOWN_MS) {
|
|
80824
80881
|
return;
|
|
@@ -80949,6 +81006,70 @@ ${body}
|
|
|
80949
81006
|
});
|
|
80950
81007
|
return true;
|
|
80951
81008
|
}
|
|
81009
|
+
/**
|
|
81010
|
+
* KIMI-PURE-PTY-COMPLETION-EMIT (Fix 3): stall-path completion reconcile for the
|
|
81011
|
+
* PURE-PTY transcript class (kimi and kin — no native transcript, no provider
|
|
81012
|
+
* authority; see isPurePtyTranscriptProvider). Such a worker whose
|
|
81013
|
+
* generating_completed never emitted (the onTurnStarted idle→idle collapse Fix 1
|
|
81014
|
+
* fixes at the source) sits at a STATIC idle prompt: its PTY output stops the
|
|
81015
|
+
* instant the answer is rendered, so the status-agnostic no-progress watchdog
|
|
81016
|
+
* (checkMeshWorkerStall) reads the finished-but-quiet session as a stall and would
|
|
81017
|
+
* false-fire monitor:no_progress. The native-transcript reconcile
|
|
81018
|
+
* (sampleNativeTranscriptProgress) does NOT cover this class (no native source →
|
|
81019
|
+
* null sample), so the stall path needs its own guard.
|
|
81020
|
+
*
|
|
81021
|
+
* Called from checkMeshWorkerStall just before the fire. Returns true when the
|
|
81022
|
+
* session is a finished pure-PTY turn — idle, no pending response, and a PTY-parsed
|
|
81023
|
+
* in-turn final assistant summary — in which case it emits the missing
|
|
81024
|
+
* generating_completed (idempotent: a real/late emit writes the terminal ledger and
|
|
81025
|
+
* the coordinator's reconcile makes any duplicate a no-op) and the caller SUPPRESSES
|
|
81026
|
+
* the stall. Returns false for every other class/state (native-source provider, a
|
|
81027
|
+
* genuinely mid-turn or wedged worker with no final assistant), so a real stall still
|
|
81028
|
+
* fires unchanged.
|
|
81029
|
+
*
|
|
81030
|
+
* Evidence bar is identical to flushMeshCompletionBeforeCleanup: injected task's turn
|
|
81031
|
+
* genuinely started + an in-turn final assistant summary. Conservative by
|
|
81032
|
+
* construction — no summary ⇒ no proof of completion ⇒ return false and let the real
|
|
81033
|
+
* stall fire.
|
|
81034
|
+
*/
|
|
81035
|
+
tryReconcilePurePtyCompletionForStall(observedStatus) {
|
|
81036
|
+
if (!isPurePtyTranscriptProvider(this.provider)) return false;
|
|
81037
|
+
if (observedStatus !== "idle") return false;
|
|
81038
|
+
if (this.hasAdapterPendingResponse()) return false;
|
|
81039
|
+
const taskId = this.completingTurnTaskId();
|
|
81040
|
+
if (this.lastEmittedCompletion && this.lastEmittedCompletion.taskId === (taskId ?? "")) {
|
|
81041
|
+
return false;
|
|
81042
|
+
}
|
|
81043
|
+
if (!this.injectedTaskHasStartedGenerating()) return false;
|
|
81044
|
+
const turnStartedAt = typeof this.adapter?.currentTurnStartedAt === "number" ? this.adapter.currentTurnStartedAt : this.meshTaskInjectedAt || void 0;
|
|
81045
|
+
let parsedMessages;
|
|
81046
|
+
try {
|
|
81047
|
+
parsedMessages = this.adapter?.getScriptParsedStatus?.()?.messages;
|
|
81048
|
+
} catch {
|
|
81049
|
+
parsedMessages = void 0;
|
|
81050
|
+
}
|
|
81051
|
+
let finalSummary;
|
|
81052
|
+
try {
|
|
81053
|
+
finalSummary = this.completionFinalSummary(parsedMessages, turnStartedAt);
|
|
81054
|
+
} catch {
|
|
81055
|
+
finalSummary = void 0;
|
|
81056
|
+
}
|
|
81057
|
+
if (!finalSummary) return false;
|
|
81058
|
+
LOG2.warn("CLI", `[${this.type}] reconciling pure-PTY mesh completion from the stall path for session ${this.instanceId} task=${taskId ?? "(none)"} \u2014 PTY is idle-quiet with an in-turn final assistant message but the completion event never fired (pure-PTY provider); emitting it instead of a false monitor:no_progress.`);
|
|
81059
|
+
if (this.isMeshWorkerSession()) {
|
|
81060
|
+
traceMeshEventStage("fired", this.meshTraceCtx(), "stall_pure_pty_transcript_completion");
|
|
81061
|
+
}
|
|
81062
|
+
this.emitGeneratingCompleted({
|
|
81063
|
+
chatTitle: "",
|
|
81064
|
+
duration: void 0,
|
|
81065
|
+
timestamp: Date.now(),
|
|
81066
|
+
taskId,
|
|
81067
|
+
finalSummary,
|
|
81068
|
+
evidenceLevel: "transcript",
|
|
81069
|
+
completionDiagnostic: { source: "stall_pure_pty_transcript_completion" }
|
|
81070
|
+
});
|
|
81071
|
+
return true;
|
|
81072
|
+
}
|
|
80952
81073
|
/**
|
|
80953
81074
|
* AUTOAPPROVE-FLAP-RECUR (Fix A+B): how long a busy blip / modal scroll-out may
|
|
80954
81075
|
* persist before the in-progress settle gate is torn down. For a delegated
|