@adhdev/daemon-standalone 1.0.28-rc.11 → 1.0.28-rc.13
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 +124 -77
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public/assets/{index-DJ5eteX0.js → index-Dse3MNe4.js} +45 -45
- package/public/index.html +1 -1
package/dist/index.js
CHANGED
|
@@ -33262,10 +33262,10 @@ var require_dist3 = __commonJS({
|
|
|
33262
33262
|
}
|
|
33263
33263
|
function getDaemonBuildInfo() {
|
|
33264
33264
|
if (cached2) return cached2;
|
|
33265
|
-
const commit = readInjected(true ? "
|
|
33266
|
-
const commitShort = readInjected(true ? "
|
|
33267
|
-
const version2 = readInjected(true ? "1.0.28-rc.
|
|
33268
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
33265
|
+
const commit = readInjected(true ? "200c050e12084938c52f329a7531fd59a7cf5064" : void 0) ?? "unknown";
|
|
33266
|
+
const commitShort = readInjected(true ? "200c050e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
33267
|
+
const version2 = readInjected(true ? "1.0.28-rc.13" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
33268
|
+
const builtAt = readInjected(true ? "2026-07-26T08:48:28.825Z" : void 0);
|
|
33269
33269
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
33270
33270
|
return cached2;
|
|
33271
33271
|
}
|
|
@@ -83336,18 +83336,20 @@ ${body}
|
|
|
83336
83336
|
// MESH_WORKER_STALL_REFIRE_COOLDOWN_MS between successive emissions across
|
|
83337
83337
|
// anchor re-arms (the per-anchor guard only covers a single continuous stall).
|
|
83338
83338
|
meshStallLastFiredAt = -1;
|
|
83339
|
-
// KIMI-MESH-COMPLETION-EMIT (axis 1)
|
|
83340
|
-
//
|
|
83341
|
-
//
|
|
83342
|
-
//
|
|
83343
|
-
//
|
|
83344
|
-
//
|
|
83345
|
-
//
|
|
83346
|
-
//
|
|
83347
|
-
//
|
|
83348
|
-
// handling can lead to the worker being stopped mid-work → completion
|
|
83349
|
-
// emitted).
|
|
83350
|
-
|
|
83339
|
+
// KIMI-MESH-COMPLETION-EMIT (axis 1) — TX-FSM Stage 1: whether the stall
|
|
83340
|
+
// watchdog has consumed a usable native-transcript SIGNAL SNAPSHOT for the
|
|
83341
|
+
// current stall episode. A pure-PTY native-source worker running a long,
|
|
83342
|
+
// screen-quiet tool (no viewport bytes for minutes) looks stalled by the
|
|
83343
|
+
// lastOutputAt clock even though its transcript file is still growing.
|
|
83344
|
+
// Before firing the stall, the watchdog consults the shared
|
|
83345
|
+
// TranscriptSignalSource's in_turn_progress signal; if the transcript is
|
|
83346
|
+
// advancing, the "stall" is a false positive of PTY-render stasis, so we
|
|
83347
|
+
// re-arm the anchor instead of paging the coordinator (whose no_progress
|
|
83348
|
+
// handling can lead to the worker being stopped mid-work → completion
|
|
83349
|
+
// never emitted). The FIRST usable sample of an episode still re-arms
|
|
83350
|
+
// unconditionally (no episode-scoped baseline exists yet to prove stasis
|
|
83351
|
+
// against) — the historical `!prev → advanced` semantics, preserved.
|
|
83352
|
+
meshStallTranscriptSignalSampled = false;
|
|
83351
83353
|
// FALSE-IDLE continuity epoch: monotonically bumped on EVERY entry into a busy
|
|
83352
83354
|
// phase (→generating or →waiting_approval). The completedDebouncePending snapshots
|
|
83353
83355
|
// this value at arm time (busyEpochAtArm); the flush guard requires it UNCHANGED
|
|
@@ -84145,10 +84147,17 @@ ${body}
|
|
|
84145
84147
|
completedDebounceTimer = null;
|
|
84146
84148
|
completedDebouncePending = null;
|
|
84147
84149
|
lastExternalCompletionProbe = null;
|
|
84148
|
-
/** TX-FSM
|
|
84149
|
-
*
|
|
84150
|
-
*
|
|
84150
|
+
/** TX-FSM: lazily-created transcript signal normalizer. Fed ONLY by
|
|
84151
|
+
* transcript reads this instance already performs — it adds zero I/O.
|
|
84152
|
+
* Stage 0: its output was a pure shadow observation for the FSM driver.
|
|
84153
|
+
* Stage 1: the instance's own stall/growth-hold judgments consume the
|
|
84154
|
+
* normalized snapshot too (single source of truth). */
|
|
84151
84155
|
transcriptSignalSource = null;
|
|
84156
|
+
/** TX-FSM Stage 1: the latest snapshot the source produced (set inside
|
|
84157
|
+
* publishTranscriptSignalObservation). Consumed the same tick by the
|
|
84158
|
+
* stall-path / growth-hold judgments via probeNativeTranscriptSignals —
|
|
84159
|
+
* never treated as fresh across ticks. */
|
|
84160
|
+
lastTranscriptSignalSnapshot = null;
|
|
84152
84161
|
/**
|
|
84153
84162
|
* The final assistant summary of the last completed turn, cached at
|
|
84154
84163
|
* completion-emit time. For a native-source provider (antigravity) whose
|
|
@@ -84326,19 +84335,21 @@ ${body}
|
|
|
84326
84335
|
return restoredHistory.messages;
|
|
84327
84336
|
}
|
|
84328
84337
|
/**
|
|
84329
|
-
* TX-FSM
|
|
84330
|
-
*
|
|
84331
|
-
*
|
|
84332
|
-
*
|
|
84333
|
-
*
|
|
84334
|
-
*
|
|
84335
|
-
*
|
|
84336
|
-
*
|
|
84337
|
-
*
|
|
84338
|
+
* TX-FSM: normalize the transcript read that JUST happened into a
|
|
84339
|
+
* SignalSnapshot. Stage 0 injected it into the FSM driver as a pure
|
|
84340
|
+
* shadow observation (daemon → SpecCliAdapter → FsmDriver); Stage 1
|
|
84341
|
+
* additionally caches it (lastTranscriptSignalSnapshot) so the instance's
|
|
84342
|
+
* OWN stall/growth-hold judgments consume the SAME normalized snapshot
|
|
84343
|
+
* instead of re-running private transcript scans. Fed ONLY by reads this
|
|
84344
|
+
* method's caller already performs — it adds zero I/O, so the getState()
|
|
84345
|
+
* zero-native-read invariant and the stall-path read cadence are
|
|
84346
|
+
* untouched. The source update runs regardless of the adapter hook so a
|
|
84347
|
+
* non-spec provider still produces the instance-side snapshot (the FSM
|
|
84348
|
+
* injection is simply skipped there). Fail-open end to end — an
|
|
84349
|
+
* unresolved transcript or any throw degrades to "no observation", never
|
|
84350
|
+
* to a wedge.
|
|
84338
84351
|
*/
|
|
84339
84352
|
publishTranscriptSignalObservation(messages, error48 = false) {
|
|
84340
|
-
const adapter = this.adapter;
|
|
84341
|
-
if (typeof adapter?.setSignalObservation !== "function") return;
|
|
84342
84353
|
try {
|
|
84343
84354
|
if (!this.transcriptSignalSource) {
|
|
84344
84355
|
this.transcriptSignalSource = new TranscriptSignalSource({
|
|
@@ -84348,7 +84359,8 @@ ${body}
|
|
|
84348
84359
|
profile: resolveTranscriptAuthorityProfile(this.provider),
|
|
84349
84360
|
turnStartedAt: () => {
|
|
84350
84361
|
const t = this.adapter?.currentTurnStartedAt;
|
|
84351
|
-
|
|
84362
|
+
if (typeof t === "number" && Number.isFinite(t)) return t;
|
|
84363
|
+
return this.meshTaskInjectedAt > 0 ? this.meshTaskInjectedAt : void 0;
|
|
84352
84364
|
},
|
|
84353
84365
|
// Reuse the exact completion machinery (I1) for the
|
|
84354
84366
|
// final_assistant_present signal rather than duplicating
|
|
@@ -84360,7 +84372,11 @@ ${body}
|
|
|
84360
84372
|
const snapshot = this.transcriptSignalSource.update(
|
|
84361
84373
|
{ messages, probe: this.lastExternalCompletionProbe, error: error48 }
|
|
84362
84374
|
);
|
|
84363
|
-
|
|
84375
|
+
this.lastTranscriptSignalSnapshot = snapshot;
|
|
84376
|
+
const adapter = this.adapter;
|
|
84377
|
+
if (typeof adapter?.setSignalObservation === "function") {
|
|
84378
|
+
adapter.setSignalObservation(snapshot);
|
|
84379
|
+
}
|
|
84364
84380
|
} catch {
|
|
84365
84381
|
}
|
|
84366
84382
|
}
|
|
@@ -84853,17 +84869,17 @@ ${body}
|
|
|
84853
84869
|
const threshold = turnActive ? _CliProviderInstance.MESH_WORKER_STALL_TURN_THRESHOLD_MS : _CliProviderInstance.MESH_WORKER_STALL_IDLE_THRESHOLD_MS;
|
|
84854
84870
|
const stalledMs = now - this.meshStallAnchorAt;
|
|
84855
84871
|
if (stalledMs < threshold) return;
|
|
84856
|
-
const
|
|
84857
|
-
if (
|
|
84858
|
-
const
|
|
84859
|
-
|
|
84860
|
-
|
|
84861
|
-
if (
|
|
84872
|
+
const transcriptSignals = this.probeNativeTranscriptSignals();
|
|
84873
|
+
if (transcriptSignals?.snapshot?.available === true) {
|
|
84874
|
+
const firstSampleThisEpisode = !this.meshStallTranscriptSignalSampled;
|
|
84875
|
+
this.meshStallTranscriptSignalSampled = true;
|
|
84876
|
+
const signalDetail = transcriptSignals.snapshot.detail;
|
|
84877
|
+
if (firstSampleThisEpisode || transcriptSignals.snapshot.signals.in_turn_progress === true) {
|
|
84862
84878
|
if (this.isMeshWorkerSession()) {
|
|
84863
84879
|
traceMeshEventDrop(
|
|
84864
84880
|
"mesh_worker_stall_transcript_advancing",
|
|
84865
84881
|
this.meshTraceCtx("monitor:no_progress"),
|
|
84866
|
-
`msgCount=${
|
|
84882
|
+
`msgCount=${signalDetail.msgCount} sourceMtime=${signalDetail.sourceMtimeMs} (PTY quiet ${Math.round(stalledMs / 1e3)}s but transcript advancing)`
|
|
84867
84883
|
);
|
|
84868
84884
|
}
|
|
84869
84885
|
this.meshStallAnchorAt = now;
|
|
@@ -84871,7 +84887,7 @@ ${body}
|
|
|
84871
84887
|
return;
|
|
84872
84888
|
}
|
|
84873
84889
|
}
|
|
84874
|
-
if (this.tryReconcileTranscriptCompletionForStall(observedStatus)) {
|
|
84890
|
+
if (this.tryReconcileTranscriptCompletionForStall(observedStatus, transcriptSignals)) {
|
|
84875
84891
|
this.meshStallEmittedForAnchor = true;
|
|
84876
84892
|
return;
|
|
84877
84893
|
}
|
|
@@ -84911,38 +84927,45 @@ ${body}
|
|
|
84911
84927
|
this.meshStallEmittedForAnchor = false;
|
|
84912
84928
|
this.meshStallTurnActiveLast = void 0;
|
|
84913
84929
|
this.meshStallLastFiredAt = -1;
|
|
84914
|
-
this.
|
|
84930
|
+
this.meshStallTranscriptSignalSampled = false;
|
|
84915
84931
|
}
|
|
84932
|
+
/** The result of one native-transcript signal probe: the normalized
|
|
84933
|
+
* snapshot the shared TranscriptSignalSource produced from the read, and
|
|
84934
|
+
* the very messages it was normalized from (so a judgment site can pull
|
|
84935
|
+
* a payload — e.g. the final summary — from the SAME read with zero
|
|
84936
|
+
* added I/O). */
|
|
84916
84937
|
/**
|
|
84917
|
-
*
|
|
84918
|
-
*
|
|
84919
|
-
*
|
|
84920
|
-
*
|
|
84921
|
-
*
|
|
84922
|
-
*
|
|
84923
|
-
*
|
|
84924
|
-
*
|
|
84925
|
-
*
|
|
84938
|
+
* TX-FSM Stage 1 — the single native-transcript signal probe (replaces
|
|
84939
|
+
* the Stage-0 sampleNativeTranscriptProgress fingerprint sampler). For a
|
|
84940
|
+
* native-source provider (its authoritative history is an on-disk
|
|
84941
|
+
* transcript file, e.g. kimi's wire.jsonl), perform the read this
|
|
84942
|
+
* judgment point already owns — SAME cadence as before, one
|
|
84943
|
+
* readExternalCompletionMessages() per call, never more — and return the
|
|
84944
|
+
* NORMALIZED SignalSnapshot the shared TranscriptSignalSource produced
|
|
84945
|
+
* from it (publishTranscriptSignalObservation runs inside the read), plus
|
|
84946
|
+
* the messages that read returned. Judgment sites (the stall watchdog's
|
|
84947
|
+
* transcript-advancing axis, the completion growth-hold, the stall-path
|
|
84948
|
+
* completion rescue) consume the snapshot's SIGNALS instead of running
|
|
84949
|
+
* their own fingerprint/freshness/final-assistant scans — one source of
|
|
84950
|
+
* truth for "what does the transcript say right now".
|
|
84926
84951
|
*
|
|
84927
|
-
*
|
|
84928
|
-
*
|
|
84929
|
-
*
|
|
84930
|
-
* (
|
|
84952
|
+
* Class gating goes through resolveTranscriptAuthorityProfile ONLY.
|
|
84953
|
+
* Returns null for a non-native-source class (nothing to signal from) and
|
|
84954
|
+
* a null snapshot when the read threw — callers keep their fail-open
|
|
84955
|
+
* fallbacks ("couldn't tell" never blocks an idle verdict and never
|
|
84956
|
+
* fabricates a completion). Cheap enough for the stall path: it runs
|
|
84957
|
+
* only at the stall threshold (≥180s of PTY stasis) or during an armed
|
|
84958
|
+
* completion-debounce retry, never on the routine 5s tick.
|
|
84931
84959
|
*/
|
|
84932
|
-
|
|
84933
|
-
if (
|
|
84960
|
+
probeNativeTranscriptSignals() {
|
|
84961
|
+
if (resolveTranscriptAuthorityProfile(this.provider).class !== "native-source") return null;
|
|
84934
84962
|
let messages = null;
|
|
84935
84963
|
try {
|
|
84936
84964
|
messages = this.readExternalCompletionMessages();
|
|
84937
84965
|
} catch {
|
|
84938
|
-
return null;
|
|
84966
|
+
return { snapshot: null, messages: null };
|
|
84939
84967
|
}
|
|
84940
|
-
|
|
84941
|
-
if (!probe) return null;
|
|
84942
|
-
return {
|
|
84943
|
-
msgCount: typeof probe.msgCount === "number" ? probe.msgCount : Array.isArray(messages) ? messages.length : 0,
|
|
84944
|
-
sourceMtimeMs: typeof probe.sourceMtimeMs === "number" ? probe.sourceMtimeMs : 0
|
|
84945
|
-
};
|
|
84968
|
+
return { snapshot: this.lastTranscriptSignalSnapshot, messages };
|
|
84946
84969
|
}
|
|
84947
84970
|
/**
|
|
84948
84971
|
* KIMI-MESH-COMPLETION-EMIT (axis 2). Last-chance completion emit for a mesh
|
|
@@ -85031,8 +85054,22 @@ ${body}
|
|
|
85031
85054
|
* false for a daemon-owned provider and for a genuinely mid-turn / wedged
|
|
85032
85055
|
* worker with no in-turn final assistant, so a real stall still fires
|
|
85033
85056
|
* unchanged. Evidence bar is identical to flushMeshCompletionBeforeCleanup.
|
|
85057
|
+
*
|
|
85058
|
+
* TX-FSM Stage 1 (FIX 3 probe delegation): for a native-source class the
|
|
85059
|
+
* completion VERDICT is the shared TranscriptSignalSource's
|
|
85060
|
+
* final_assistant_present signal, normalized from the ONE transcript read
|
|
85061
|
+
* the stall watchdog already performed this tick (passed in as
|
|
85062
|
+
* `transcriptSignals`) — not a second private read + scan. The emit
|
|
85063
|
+
* payload (finalSummary) is extracted from the SAME messages the signal
|
|
85064
|
+
* was normalized from, with the SAME turn boundary the legacy path used,
|
|
85065
|
+
* so the extraction re-proves the turn scope the signal checked. Fail-open
|
|
85066
|
+
* both ways: no usable snapshot (read failed / unresolved / a pure-PTY
|
|
85067
|
+
* class, which has no native signal by construction) → the legacy
|
|
85068
|
+
* class-appropriate evidence path (completionFinalSummary), unchanged; and
|
|
85069
|
+
* a present-but-unextractable signal yields false rather than a
|
|
85070
|
+
* payload-less emit.
|
|
85034
85071
|
*/
|
|
85035
|
-
tryReconcileTranscriptCompletionForStall(observedStatus) {
|
|
85072
|
+
tryReconcileTranscriptCompletionForStall(observedStatus, transcriptSignals) {
|
|
85036
85073
|
const profile = resolveTranscriptAuthorityProfile(this.provider);
|
|
85037
85074
|
if (profile.class === "daemon-owned") return false;
|
|
85038
85075
|
if (observedStatus !== "idle") return false;
|
|
@@ -85050,10 +85087,19 @@ ${body}
|
|
|
85050
85087
|
parsedMessages = void 0;
|
|
85051
85088
|
}
|
|
85052
85089
|
let finalSummary;
|
|
85053
|
-
|
|
85054
|
-
|
|
85055
|
-
|
|
85056
|
-
finalSummary =
|
|
85090
|
+
const signalSnapshot = transcriptSignals?.snapshot;
|
|
85091
|
+
if (profile.class === "native-source" && signalSnapshot?.available === true) {
|
|
85092
|
+
if (signalSnapshot.signals.final_assistant_present !== true) return false;
|
|
85093
|
+
finalSummary = extractFinalSummaryFromMessagesAfter(
|
|
85094
|
+
Array.isArray(transcriptSignals?.messages) ? transcriptSignals.messages : [],
|
|
85095
|
+
turnStartedAt
|
|
85096
|
+
) || void 0;
|
|
85097
|
+
} else {
|
|
85098
|
+
try {
|
|
85099
|
+
finalSummary = this.completionFinalSummary(parsedMessages, turnStartedAt);
|
|
85100
|
+
} catch {
|
|
85101
|
+
finalSummary = void 0;
|
|
85102
|
+
}
|
|
85057
85103
|
}
|
|
85058
85104
|
if (!finalSummary) return false;
|
|
85059
85105
|
const diagnosticSource = profile.class === "pure-pty" ? "stall_pure_pty_transcript_completion" : "stall_native_source_transcript_completion";
|
|
@@ -85320,24 +85366,25 @@ ${body}
|
|
|
85320
85366
|
const isTranscriptEvidenceGate = block2.allowTimeout === true;
|
|
85321
85367
|
LOG2.debug("CLI", `[${this.type}] finalization block: reason=${blockReason} terminal=${block2.terminal} allowTimeout=${isTranscriptEvidenceGate} waitedMs=${waitedMs} maxWait=${COMPLETED_FINALIZATION_MAX_WAIT_MS}`);
|
|
85322
85368
|
if (blockReason === "missing_final_assistant" && block2.noExternalTranscriptSource === true) {
|
|
85323
|
-
let
|
|
85369
|
+
let growthSnapshot = null;
|
|
85324
85370
|
try {
|
|
85325
|
-
|
|
85371
|
+
growthSnapshot = this.probeNativeTranscriptSignals()?.snapshot ?? null;
|
|
85326
85372
|
} catch {
|
|
85327
|
-
|
|
85373
|
+
growthSnapshot = null;
|
|
85328
85374
|
}
|
|
85329
|
-
|
|
85330
|
-
|
|
85375
|
+
if (growthSnapshot?.available === true && growthSnapshot.signals.transcript_growing === true) {
|
|
85376
|
+
const growthDetail = growthSnapshot.detail;
|
|
85377
|
+
const mtimeAgeMs = growthDetail.ageMs ?? 0;
|
|
85331
85378
|
if (pending.loggedBlockReason !== "native_transcript_advancing") {
|
|
85332
|
-
LOG2.info("CLI", `[${this.type}] holding pending completed (native_transcript_advancing: msgCount=${
|
|
85379
|
+
LOG2.info("CLI", `[${this.type}] holding pending completed (native_transcript_advancing: msgCount=${growthDetail.msgCount} mtimeAge=${mtimeAgeMs}ms < ${MISSING_ASSISTANT_TRANSCRIPT_GROWTH_QUIET_MS}ms) \u2014 transcript still growing, screen-idle verdict not trusted`);
|
|
85333
85380
|
if (this.isMeshWorkerSession()) {
|
|
85334
|
-
traceMeshEventDrop("completion_gate_hold", this.meshTraceCtx(), `native_transcript_advancing msgCount=${
|
|
85381
|
+
traceMeshEventDrop("completion_gate_hold", this.meshTraceCtx(), `native_transcript_advancing msgCount=${growthDetail.msgCount} mtimeAge=${mtimeAgeMs}ms`);
|
|
85335
85382
|
}
|
|
85336
85383
|
if (this.completionTraceOn()) this.recordCompletionGateTrace("hold", {
|
|
85337
85384
|
blockReason: "native_transcript_advancing",
|
|
85338
85385
|
latestVisibleStatus,
|
|
85339
|
-
msgCount:
|
|
85340
|
-
sourceMtimeAgeMs:
|
|
85386
|
+
msgCount: growthDetail.msgCount,
|
|
85387
|
+
sourceMtimeAgeMs: mtimeAgeMs,
|
|
85341
85388
|
growthQuietMs: MISSING_ASSISTANT_TRANSCRIPT_GROWTH_QUIET_MS,
|
|
85342
85389
|
waitedMs
|
|
85343
85390
|
});
|