@adhdev/daemon-core 0.9.82-rc.402 → 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 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -4
- package/dist/index.mjs.map +1 -1
- package/dist/providers/cli-provider-instance.d.ts +29 -0
- package/package.json +2 -2
- package/src/providers/cli-provider-instance.ts +154 -0
package/dist/index.js
CHANGED
|
@@ -399,10 +399,10 @@ function readInjected(value) {
|
|
|
399
399
|
}
|
|
400
400
|
function getDaemonBuildInfo() {
|
|
401
401
|
if (cached) return cached;
|
|
402
|
-
const commit = readInjected(true ? "
|
|
403
|
-
const commitShort = readInjected(true ? "
|
|
404
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
405
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
402
|
+
const commit = readInjected(true ? "056bddcd4112e4c90d82fdaab60557ccc7acf2a3" : void 0) ?? "unknown";
|
|
403
|
+
const commitShort = readInjected(true ? "056bddcd" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
404
|
+
const version = readInjected(true ? "0.9.82-rc.404" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
405
|
+
const builtAt = readInjected(true ? "2026-06-27T19:00:01.532Z" : void 0);
|
|
406
406
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
407
407
|
return cached;
|
|
408
408
|
}
|
|
@@ -39691,6 +39691,7 @@ var COMPLETED_FINALIZATION_RETRY_MS = 1e3;
|
|
|
39691
39691
|
var COMPLETED_FINALIZATION_MAX_WAIT_MS = 3e4;
|
|
39692
39692
|
var NATIVE_HISTORY_MESH_IDLE_SETTLE_MS = 4e3;
|
|
39693
39693
|
var USER_INPUT_ACK_DEDUP_WINDOW_MS = 6e4;
|
|
39694
|
+
var STARTUP_GRACE_IDLE_COLLAPSE_WINDOW_MS = 12e3;
|
|
39694
39695
|
var TERMINAL_MESH_EVENTS = /* @__PURE__ */ new Set([
|
|
39695
39696
|
"agent:generating_completed",
|
|
39696
39697
|
"agent:stopped",
|
|
@@ -39956,6 +39957,13 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
39956
39957
|
// first sets it; the other becomes a no-op.
|
|
39957
39958
|
agentReadyEmitted = false;
|
|
39958
39959
|
generatingStartedAt = 0;
|
|
39960
|
+
// GENERATING-BOUNDARY (R4b): the per-turn taskId for which a startup-grace
|
|
39961
|
+
// started+completed pair was already synthesized. Both fast-collapse callers
|
|
39962
|
+
// (starting→idle transition AND the idle-stayed no-status-change poll) route
|
|
39963
|
+
// through maybeSynthesizeStartupGraceCollapse; the idle-stayed caller re-polls
|
|
39964
|
+
// steadily while the session sits idle, so this guard makes the synthesis fire
|
|
39965
|
+
// AT MOST ONCE per collapsed turn.
|
|
39966
|
+
fastCollapseSynthesizedTaskId = null;
|
|
39959
39967
|
settings = {};
|
|
39960
39968
|
monitor;
|
|
39961
39969
|
generatingDebounceTimer = null;
|
|
@@ -41082,6 +41090,73 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41082
41090
|
this.agentReadyEmitted = true;
|
|
41083
41091
|
this.pushEvent({ event: "agent:ready", chatTitle, timestamp: now });
|
|
41084
41092
|
}
|
|
41093
|
+
/**
|
|
41094
|
+
* GENERATING-BOUNDARY synthetic emit for a first turn that started AND finished
|
|
41095
|
+
* inside the startup-grace window without the FSM ever observing a 'generating'
|
|
41096
|
+
* frame (an unobservably-fast turn). Synthesizes the agent:generating_started +
|
|
41097
|
+
* agent:generating_completed pair so the mesh coordinator learns the worker went
|
|
41098
|
+
* idle. Returns true iff it synthesized.
|
|
41099
|
+
*
|
|
41100
|
+
* Two callers share this defense line:
|
|
41101
|
+
* - 'startup_grace_fast_collapse' — the starting→idle transition (the FSM whose
|
|
41102
|
+
* spec lacks/hadn't-synced the starting→busy edge collapses starting→idle
|
|
41103
|
+
* directly, with no intervening 'generating' frame).
|
|
41104
|
+
* - 'startup_grace_idle_turn_collapse' — the idle→idle no-status-change poll
|
|
41105
|
+
* (the launch settle already drained starting→idle BEFORE the first turn, so
|
|
41106
|
+
* the turn runs+completes while status stays 'idle' the whole time and
|
|
41107
|
+
* detectStatusTransition never re-enters its change block — the live rc.403
|
|
41108
|
+
* Probe1 miss).
|
|
41109
|
+
*
|
|
41110
|
+
* False-positive safety (must NOT fire on a benign boot): currentTurnTaskId is
|
|
41111
|
+
* set ONLY by onTurnStarted (a real turn STARTED this boot) and persists past
|
|
41112
|
+
* completion, so it excludes a true idle boot (null) and a queued-pending first
|
|
41113
|
+
* turn that only runs after grace (onTurnStarted not yet called → null).
|
|
41114
|
+
* !hasAdapterPendingResponse() excludes a turn still mid-flight. generating
|
|
41115
|
+
* never armed (generatingStartedAt===0 && !generatingDebouncePending) means the
|
|
41116
|
+
* whole idle→busy→idle never happened for this turn. The once-per-turn guard
|
|
41117
|
+
* (fastCollapseSynthesizedTaskId) keeps the re-polled idle-stayed caller from
|
|
41118
|
+
* re-emitting every poll.
|
|
41119
|
+
*/
|
|
41120
|
+
maybeSynthesizeStartupGraceCollapse(chatTitle, now, reason) {
|
|
41121
|
+
const startedTurnTaskId = typeof this.adapter?.currentTurnTaskId === "string" && this.adapter.currentTurnTaskId.trim() ? this.adapter.currentTurnTaskId : void 0;
|
|
41122
|
+
const fastCollapsed = !!startedTurnTaskId && !this.hasAdapterPendingResponse() && !this.generatingStartedAt && !this.generatingDebouncePending;
|
|
41123
|
+
if (!fastCollapsed) return false;
|
|
41124
|
+
if (this.fastCollapseSynthesizedTaskId === startedTurnTaskId) return false;
|
|
41125
|
+
let fcFinalSummary;
|
|
41126
|
+
let fcEvidenceSource = "unavailable";
|
|
41127
|
+
try {
|
|
41128
|
+
const parsedMessages = this.adapter?.getScriptParsedStatus()?.messages;
|
|
41129
|
+
const evidence = this.completionFinalAssistantEvidence(parsedMessages);
|
|
41130
|
+
fcEvidenceSource = evidence.source;
|
|
41131
|
+
fcFinalSummary = extractFinalSummaryFromMessages(evidence.messages);
|
|
41132
|
+
} catch {
|
|
41133
|
+
}
|
|
41134
|
+
const missingEvidence = (this.provider.requiresFinalAssistantBeforeIdle === true || fcEvidenceSource === "external-native") && !fcFinalSummary;
|
|
41135
|
+
const hasMeshContext = !!(this.settings.meshNodeFor || this.settings.meshActiveTaskId || this.settings.launchedByCoordinator);
|
|
41136
|
+
if (missingEvidence && !hasMeshContext) {
|
|
41137
|
+
LOG.info("CLI", `[${this.type}] ${reason} suppressed: missing final assistant evidence, no mesh context (source=${fcEvidenceSource})`);
|
|
41138
|
+
return false;
|
|
41139
|
+
}
|
|
41140
|
+
this.fastCollapseSynthesizedTaskId = startedTurnTaskId;
|
|
41141
|
+
LOG.info("CLI", `[${this.type}] ${reason}: synthesizing started+completed (taskId=${startedTurnTaskId} source=${fcEvidenceSource} hadFinalSummary=${!!fcFinalSummary})`);
|
|
41142
|
+
this.pushEvent({ event: "agent:generating_started", chatTitle, timestamp: now });
|
|
41143
|
+
if (this.isMeshWorkerSession()) {
|
|
41144
|
+
traceMeshEventStage("fired", this.meshTraceCtx(), `${reason} (source=${fcEvidenceSource})`);
|
|
41145
|
+
}
|
|
41146
|
+
this.pushEvent({
|
|
41147
|
+
event: "agent:generating_completed",
|
|
41148
|
+
chatTitle,
|
|
41149
|
+
duration: 0,
|
|
41150
|
+
timestamp: now,
|
|
41151
|
+
finalSummary: fcFinalSummary,
|
|
41152
|
+
completionDiagnostic: {
|
|
41153
|
+
reason,
|
|
41154
|
+
finalAssistantEvidenceSource: fcEvidenceSource,
|
|
41155
|
+
...missingEvidence ? { blockReason: "missing_final_assistant" } : {}
|
|
41156
|
+
}
|
|
41157
|
+
});
|
|
41158
|
+
return true;
|
|
41159
|
+
}
|
|
41085
41160
|
detectStatusTransition() {
|
|
41086
41161
|
const now = Date.now();
|
|
41087
41162
|
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
@@ -41240,6 +41315,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41240
41315
|
}
|
|
41241
41316
|
} else if (newStatus === "idle" && this.lastStatus === "starting") {
|
|
41242
41317
|
this.emitAgentReadyOnce(chatTitle, now);
|
|
41318
|
+
this.maybeSynthesizeStartupGraceCollapse(chatTitle, now, "startup_grace_fast_collapse");
|
|
41243
41319
|
} else if (newStatus === "error") {
|
|
41244
41320
|
if (this.generatingDebounceTimer) {
|
|
41245
41321
|
clearTimeout(this.generatingDebounceTimer);
|
|
@@ -41278,6 +41354,9 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41278
41354
|
}
|
|
41279
41355
|
this.lastStatus = newStatus;
|
|
41280
41356
|
}
|
|
41357
|
+
if (newStatus === "idle" && previousStatus === "idle" && now - this.startedAt < STARTUP_GRACE_IDLE_COLLAPSE_WINDOW_MS) {
|
|
41358
|
+
this.maybeSynthesizeStartupGraceCollapse(chatTitle, now, "startup_grace_idle_turn_collapse");
|
|
41359
|
+
}
|
|
41281
41360
|
if (newStatus === "idle" && adapterStatus.fsmReadySeen === true && !this.agentReadyEmitted) {
|
|
41282
41361
|
this.emitAgentReadyOnce(chatTitle, now);
|
|
41283
41362
|
}
|