@adhdev/daemon-standalone 0.9.82-rc.403 → 0.9.82-rc.404
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 +83 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30127,10 +30127,10 @@ var require_dist3 = __commonJS({
|
|
|
30127
30127
|
}
|
|
30128
30128
|
function getDaemonBuildInfo() {
|
|
30129
30129
|
if (cached2) return cached2;
|
|
30130
|
-
const commit = readInjected(true ? "
|
|
30131
|
-
const commitShort = readInjected(true ? "
|
|
30132
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30133
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30130
|
+
const commit = readInjected(true ? "056bddcd4112e4c90d82fdaab60557ccc7acf2a3" : void 0) ?? "unknown";
|
|
30131
|
+
const commitShort = readInjected(true ? "056bddcd" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30132
|
+
const version2 = readInjected(true ? "0.9.82-rc.404" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30133
|
+
const builtAt = readInjected(true ? "2026-06-27T19:00:32.749Z" : void 0);
|
|
30134
30134
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30135
30135
|
return cached2;
|
|
30136
30136
|
}
|
|
@@ -69336,6 +69336,7 @@ ${body}
|
|
|
69336
69336
|
var COMPLETED_FINALIZATION_MAX_WAIT_MS = 3e4;
|
|
69337
69337
|
var NATIVE_HISTORY_MESH_IDLE_SETTLE_MS = 4e3;
|
|
69338
69338
|
var USER_INPUT_ACK_DEDUP_WINDOW_MS = 6e4;
|
|
69339
|
+
var STARTUP_GRACE_IDLE_COLLAPSE_WINDOW_MS = 12e3;
|
|
69339
69340
|
var TERMINAL_MESH_EVENTS = /* @__PURE__ */ new Set([
|
|
69340
69341
|
"agent:generating_completed",
|
|
69341
69342
|
"agent:stopped",
|
|
@@ -69601,6 +69602,13 @@ ${body}
|
|
|
69601
69602
|
// first sets it; the other becomes a no-op.
|
|
69602
69603
|
agentReadyEmitted = false;
|
|
69603
69604
|
generatingStartedAt = 0;
|
|
69605
|
+
// GENERATING-BOUNDARY (R4b): the per-turn taskId for which a startup-grace
|
|
69606
|
+
// started+completed pair was already synthesized. Both fast-collapse callers
|
|
69607
|
+
// (starting→idle transition AND the idle-stayed no-status-change poll) route
|
|
69608
|
+
// through maybeSynthesizeStartupGraceCollapse; the idle-stayed caller re-polls
|
|
69609
|
+
// steadily while the session sits idle, so this guard makes the synthesis fire
|
|
69610
|
+
// AT MOST ONCE per collapsed turn.
|
|
69611
|
+
fastCollapseSynthesizedTaskId = null;
|
|
69604
69612
|
settings = {};
|
|
69605
69613
|
monitor;
|
|
69606
69614
|
generatingDebounceTimer = null;
|
|
@@ -70727,6 +70735,73 @@ ${body}
|
|
|
70727
70735
|
this.agentReadyEmitted = true;
|
|
70728
70736
|
this.pushEvent({ event: "agent:ready", chatTitle, timestamp: now });
|
|
70729
70737
|
}
|
|
70738
|
+
/**
|
|
70739
|
+
* GENERATING-BOUNDARY synthetic emit for a first turn that started AND finished
|
|
70740
|
+
* inside the startup-grace window without the FSM ever observing a 'generating'
|
|
70741
|
+
* frame (an unobservably-fast turn). Synthesizes the agent:generating_started +
|
|
70742
|
+
* agent:generating_completed pair so the mesh coordinator learns the worker went
|
|
70743
|
+
* idle. Returns true iff it synthesized.
|
|
70744
|
+
*
|
|
70745
|
+
* Two callers share this defense line:
|
|
70746
|
+
* - 'startup_grace_fast_collapse' — the starting→idle transition (the FSM whose
|
|
70747
|
+
* spec lacks/hadn't-synced the starting→busy edge collapses starting→idle
|
|
70748
|
+
* directly, with no intervening 'generating' frame).
|
|
70749
|
+
* - 'startup_grace_idle_turn_collapse' — the idle→idle no-status-change poll
|
|
70750
|
+
* (the launch settle already drained starting→idle BEFORE the first turn, so
|
|
70751
|
+
* the turn runs+completes while status stays 'idle' the whole time and
|
|
70752
|
+
* detectStatusTransition never re-enters its change block — the live rc.403
|
|
70753
|
+
* Probe1 miss).
|
|
70754
|
+
*
|
|
70755
|
+
* False-positive safety (must NOT fire on a benign boot): currentTurnTaskId is
|
|
70756
|
+
* set ONLY by onTurnStarted (a real turn STARTED this boot) and persists past
|
|
70757
|
+
* completion, so it excludes a true idle boot (null) and a queued-pending first
|
|
70758
|
+
* turn that only runs after grace (onTurnStarted not yet called → null).
|
|
70759
|
+
* !hasAdapterPendingResponse() excludes a turn still mid-flight. generating
|
|
70760
|
+
* never armed (generatingStartedAt===0 && !generatingDebouncePending) means the
|
|
70761
|
+
* whole idle→busy→idle never happened for this turn. The once-per-turn guard
|
|
70762
|
+
* (fastCollapseSynthesizedTaskId) keeps the re-polled idle-stayed caller from
|
|
70763
|
+
* re-emitting every poll.
|
|
70764
|
+
*/
|
|
70765
|
+
maybeSynthesizeStartupGraceCollapse(chatTitle, now, reason) {
|
|
70766
|
+
const startedTurnTaskId = typeof this.adapter?.currentTurnTaskId === "string" && this.adapter.currentTurnTaskId.trim() ? this.adapter.currentTurnTaskId : void 0;
|
|
70767
|
+
const fastCollapsed = !!startedTurnTaskId && !this.hasAdapterPendingResponse() && !this.generatingStartedAt && !this.generatingDebouncePending;
|
|
70768
|
+
if (!fastCollapsed) return false;
|
|
70769
|
+
if (this.fastCollapseSynthesizedTaskId === startedTurnTaskId) return false;
|
|
70770
|
+
let fcFinalSummary;
|
|
70771
|
+
let fcEvidenceSource = "unavailable";
|
|
70772
|
+
try {
|
|
70773
|
+
const parsedMessages = this.adapter?.getScriptParsedStatus()?.messages;
|
|
70774
|
+
const evidence = this.completionFinalAssistantEvidence(parsedMessages);
|
|
70775
|
+
fcEvidenceSource = evidence.source;
|
|
70776
|
+
fcFinalSummary = extractFinalSummaryFromMessages(evidence.messages);
|
|
70777
|
+
} catch {
|
|
70778
|
+
}
|
|
70779
|
+
const missingEvidence = (this.provider.requiresFinalAssistantBeforeIdle === true || fcEvidenceSource === "external-native") && !fcFinalSummary;
|
|
70780
|
+
const hasMeshContext = !!(this.settings.meshNodeFor || this.settings.meshActiveTaskId || this.settings.launchedByCoordinator);
|
|
70781
|
+
if (missingEvidence && !hasMeshContext) {
|
|
70782
|
+
LOG2.info("CLI", `[${this.type}] ${reason} suppressed: missing final assistant evidence, no mesh context (source=${fcEvidenceSource})`);
|
|
70783
|
+
return false;
|
|
70784
|
+
}
|
|
70785
|
+
this.fastCollapseSynthesizedTaskId = startedTurnTaskId;
|
|
70786
|
+
LOG2.info("CLI", `[${this.type}] ${reason}: synthesizing started+completed (taskId=${startedTurnTaskId} source=${fcEvidenceSource} hadFinalSummary=${!!fcFinalSummary})`);
|
|
70787
|
+
this.pushEvent({ event: "agent:generating_started", chatTitle, timestamp: now });
|
|
70788
|
+
if (this.isMeshWorkerSession()) {
|
|
70789
|
+
traceMeshEventStage("fired", this.meshTraceCtx(), `${reason} (source=${fcEvidenceSource})`);
|
|
70790
|
+
}
|
|
70791
|
+
this.pushEvent({
|
|
70792
|
+
event: "agent:generating_completed",
|
|
70793
|
+
chatTitle,
|
|
70794
|
+
duration: 0,
|
|
70795
|
+
timestamp: now,
|
|
70796
|
+
finalSummary: fcFinalSummary,
|
|
70797
|
+
completionDiagnostic: {
|
|
70798
|
+
reason,
|
|
70799
|
+
finalAssistantEvidenceSource: fcEvidenceSource,
|
|
70800
|
+
...missingEvidence ? { blockReason: "missing_final_assistant" } : {}
|
|
70801
|
+
}
|
|
70802
|
+
});
|
|
70803
|
+
return true;
|
|
70804
|
+
}
|
|
70730
70805
|
detectStatusTransition() {
|
|
70731
70806
|
const now = Date.now();
|
|
70732
70807
|
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
@@ -70885,42 +70960,7 @@ ${body}
|
|
|
70885
70960
|
}
|
|
70886
70961
|
} else if (newStatus === "idle" && this.lastStatus === "starting") {
|
|
70887
70962
|
this.emitAgentReadyOnce(chatTitle, now);
|
|
70888
|
-
|
|
70889
|
-
const fastCollapsed = !!startedTurnTaskId && !this.hasAdapterPendingResponse() && !this.generatingStartedAt && !this.generatingDebouncePending;
|
|
70890
|
-
if (fastCollapsed) {
|
|
70891
|
-
let fcFinalSummary;
|
|
70892
|
-
let fcEvidenceSource = "unavailable";
|
|
70893
|
-
try {
|
|
70894
|
-
const parsedMessages = this.adapter?.getScriptParsedStatus()?.messages;
|
|
70895
|
-
const evidence = this.completionFinalAssistantEvidence(parsedMessages);
|
|
70896
|
-
fcEvidenceSource = evidence.source;
|
|
70897
|
-
fcFinalSummary = extractFinalSummaryFromMessages(evidence.messages);
|
|
70898
|
-
} catch {
|
|
70899
|
-
}
|
|
70900
|
-
const missingEvidence = (this.provider.requiresFinalAssistantBeforeIdle === true || fcEvidenceSource === "external-native") && !fcFinalSummary;
|
|
70901
|
-
const hasMeshContext = !!(this.settings.meshNodeFor || this.settings.meshActiveTaskId || this.settings.launchedByCoordinator);
|
|
70902
|
-
if (missingEvidence && !hasMeshContext) {
|
|
70903
|
-
LOG2.info("CLI", `[${this.type}] startup-grace fast-collapse suppressed: missing final assistant evidence, no mesh context (source=${fcEvidenceSource})`);
|
|
70904
|
-
} else {
|
|
70905
|
-
LOG2.info("CLI", `[${this.type}] startup-grace fast-collapse: synthesizing started+completed (taskId=${startedTurnTaskId} source=${fcEvidenceSource} hadFinalSummary=${!!fcFinalSummary})`);
|
|
70906
|
-
this.pushEvent({ event: "agent:generating_started", chatTitle, timestamp: now });
|
|
70907
|
-
if (this.isMeshWorkerSession()) {
|
|
70908
|
-
traceMeshEventStage("fired", this.meshTraceCtx(), `startup-grace fast-collapse (source=${fcEvidenceSource})`);
|
|
70909
|
-
}
|
|
70910
|
-
this.pushEvent({
|
|
70911
|
-
event: "agent:generating_completed",
|
|
70912
|
-
chatTitle,
|
|
70913
|
-
duration: 0,
|
|
70914
|
-
timestamp: now,
|
|
70915
|
-
finalSummary: fcFinalSummary,
|
|
70916
|
-
completionDiagnostic: {
|
|
70917
|
-
reason: "startup_grace_fast_collapse",
|
|
70918
|
-
finalAssistantEvidenceSource: fcEvidenceSource,
|
|
70919
|
-
...missingEvidence ? { blockReason: "missing_final_assistant" } : {}
|
|
70920
|
-
}
|
|
70921
|
-
});
|
|
70922
|
-
}
|
|
70923
|
-
}
|
|
70963
|
+
this.maybeSynthesizeStartupGraceCollapse(chatTitle, now, "startup_grace_fast_collapse");
|
|
70924
70964
|
} else if (newStatus === "error") {
|
|
70925
70965
|
if (this.generatingDebounceTimer) {
|
|
70926
70966
|
clearTimeout(this.generatingDebounceTimer);
|
|
@@ -70959,6 +70999,9 @@ ${body}
|
|
|
70959
70999
|
}
|
|
70960
71000
|
this.lastStatus = newStatus;
|
|
70961
71001
|
}
|
|
71002
|
+
if (newStatus === "idle" && previousStatus === "idle" && now - this.startedAt < STARTUP_GRACE_IDLE_COLLAPSE_WINDOW_MS) {
|
|
71003
|
+
this.maybeSynthesizeStartupGraceCollapse(chatTitle, now, "startup_grace_idle_turn_collapse");
|
|
71004
|
+
}
|
|
70962
71005
|
if (newStatus === "idle" && adapterStatus.fsmReadySeen === true && !this.agentReadyEmitted) {
|
|
70963
71006
|
this.emitAgentReadyOnce(chatTitle, now);
|
|
70964
71007
|
}
|