@adhdev/daemon-core 0.9.82-rc.423 → 0.9.82-rc.425
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 +63 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -6
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-ledger.d.ts +1 -1
- package/dist/providers/cli-provider-instance.d.ts +13 -0
- package/package.json +2 -2
- package/src/mesh/mesh-event-forwarding.ts +5 -0
- package/src/mesh/mesh-ledger.ts +44 -1
- package/src/mesh/mesh-reconcile-loop.ts +47 -1
- package/src/providers/cli-provider-instance.ts +37 -2
package/dist/index.mjs
CHANGED
|
@@ -384,10 +384,10 @@ function readInjected(value) {
|
|
|
384
384
|
}
|
|
385
385
|
function getDaemonBuildInfo() {
|
|
386
386
|
if (cached) return cached;
|
|
387
|
-
const commit = readInjected(true ? "
|
|
388
|
-
const commitShort = readInjected(true ? "
|
|
389
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
390
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
387
|
+
const commit = readInjected(true ? "dfcf9ed9e1e897f0290bac0f1a6aad3ffaf3b41f" : void 0) ?? "unknown";
|
|
388
|
+
const commitShort = readInjected(true ? "dfcf9ed9" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
389
|
+
const version = readInjected(true ? "0.9.82-rc.425" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
390
|
+
const builtAt = readInjected(true ? "2026-06-29T12:47:28.457Z" : void 0);
|
|
391
391
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
392
392
|
return cached;
|
|
393
393
|
}
|
|
@@ -4163,6 +4163,24 @@ function normalizeMeshWorkerResult(input, source = "explicit_metadata") {
|
|
|
4163
4163
|
source
|
|
4164
4164
|
};
|
|
4165
4165
|
}
|
|
4166
|
+
function summaryHasParseableJsonAnswer(summary) {
|
|
4167
|
+
const text = readNonEmptyString(summary);
|
|
4168
|
+
if (!text) return false;
|
|
4169
|
+
const fenced = text.match(/```(?:json)?\s*([\s\S]*?)```/i);
|
|
4170
|
+
const candidates = [fenced?.[1], text].filter(Boolean);
|
|
4171
|
+
for (const candidate of candidates) {
|
|
4172
|
+
const trimmed = candidate.trim();
|
|
4173
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) continue;
|
|
4174
|
+
try {
|
|
4175
|
+
const parsed = JSON.parse(trimmed);
|
|
4176
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed) && Object.keys(parsed).length > 0) {
|
|
4177
|
+
return true;
|
|
4178
|
+
}
|
|
4179
|
+
} catch {
|
|
4180
|
+
}
|
|
4181
|
+
}
|
|
4182
|
+
return false;
|
|
4183
|
+
}
|
|
4166
4184
|
function resolveWorkerResult(opts) {
|
|
4167
4185
|
if (opts.workerResult && typeof opts.workerResult === "object") {
|
|
4168
4186
|
return normalizeMeshWorkerResult(opts.workerResult, "explicit_metadata");
|
|
@@ -4171,6 +4189,9 @@ function resolveWorkerResult(opts) {
|
|
|
4171
4189
|
if (parsed) {
|
|
4172
4190
|
return normalizeMeshWorkerResult(parsed, "final_summary_json");
|
|
4173
4191
|
}
|
|
4192
|
+
if (summaryHasParseableJsonAnswer(opts.finalSummary)) {
|
|
4193
|
+
return normalizeMeshWorkerResult(void 0, "parseable_answer");
|
|
4194
|
+
}
|
|
4174
4195
|
return normalizeMeshWorkerResult(void 0, "default");
|
|
4175
4196
|
}
|
|
4176
4197
|
function buildTaskCompletionEvidence(opts) {
|
|
@@ -16256,6 +16277,11 @@ function injectMeshSystemMessage(components, args) {
|
|
|
16256
16277
|
completionDiagnostic: args.metadataEvent.completionDiagnostic && typeof args.metadataEvent.completionDiagnostic === "object" ? args.metadataEvent.completionDiagnostic : void 0,
|
|
16257
16278
|
evidence: completionEvidence,
|
|
16258
16279
|
// B2: evidenceLevel lets coordinator know when completion evidence is insufficient.
|
|
16280
|
+
// NOTIF Defect-2b: ONLY source==='default' (no parseable answer at all) is
|
|
16281
|
+
// 'insufficient'. 'parseable_answer' (a real JSON answer that just isn't
|
|
16282
|
+
// worker-result-shaped, e.g. a MAGI envelope) is concrete evidence and must
|
|
16283
|
+
// resolve to 'sufficient' — resolveWorkerResult now upgrades that case so a
|
|
16284
|
+
// complete, valid answer is no longer mislabelled insufficient/reviewRecommended.
|
|
16259
16285
|
...completionEvidence ? completionEvidence.workerResult.source === "default" ? { evidenceLevel: "insufficient", reviewRecommended: true } : { evidenceLevel: "sufficient" } : {}
|
|
16260
16286
|
}
|
|
16261
16287
|
});
|
|
@@ -16802,6 +16828,21 @@ function findLiveCoordinators(components) {
|
|
|
16802
16828
|
const status = readNonEmptyString2(state.status).toLowerCase();
|
|
16803
16829
|
const modalParked = typeof inst.isModalParked === "function" ? inst.isModalParked() === true : status === "waiting_choice" || status === "waiting_approval";
|
|
16804
16830
|
const sessionId = readNonEmptyString2(state.instanceId);
|
|
16831
|
+
if (getLogLevel() === "debug") {
|
|
16832
|
+
let adapterRaw = "?";
|
|
16833
|
+
try {
|
|
16834
|
+
const a = inst.adapter;
|
|
16835
|
+
if (a && typeof a.getStatus === "function") {
|
|
16836
|
+
adapterRaw = readNonEmptyString2(a.getStatus({ allowParse: false })?.status) || "?";
|
|
16837
|
+
}
|
|
16838
|
+
} catch (e) {
|
|
16839
|
+
adapterRaw = `err:${e?.message || e}`;
|
|
16840
|
+
}
|
|
16841
|
+
const lastStatus = readNonEmptyString2(inst.lastStatus) || "?";
|
|
16842
|
+
const autoApproveBusy = inst.autoApproveBusy;
|
|
16843
|
+
const maskSince = inst.autoApproveMaskSince;
|
|
16844
|
+
LOG.debug("MeshReconcile", `coordDiag sess=${sessionId || "?"} mesh=${meshId} getState=${status || "?"} lastStatus=${lastStatus} adapterRaw=${adapterRaw} autoApproveBusy=${autoApproveBusy === true} maskSince=${maskSince || 0}`);
|
|
16845
|
+
}
|
|
16805
16846
|
const stateKey = `${meshId}::${sessionId || "?"}`;
|
|
16806
16847
|
const prevParked = coordinatorModalParkState.get(stateKey);
|
|
16807
16848
|
if (prevParked !== modalParked) {
|
|
@@ -17091,6 +17132,9 @@ async function runMeshReconcileTick(components) {
|
|
|
17091
17132
|
}
|
|
17092
17133
|
}
|
|
17093
17134
|
LOG.info("MeshReconcile", `Reconcile skip \u2192 modal-parked: holding pending event(s) for mesh ${meshId} (${modalParkedCoordinators.length} coordinator(s) awaiting a modal answer; events left queued${orphanEscaped > 0 ? `; ${orphanEscaped} orphan-targeted event(s) routed to strict-route TTL` : ""})`);
|
|
17135
|
+
if (getLogLevel() === "debug") {
|
|
17136
|
+
LOG.debug("MeshReconcile", `coordHoldModalParked mesh=${meshId} heldFor=[${modalParkedCoordinators.map((c) => c.sessionId || "?").join(",")}] (these were classified modal-parked; cross-ref same-tick coordDiag by sessionId)`);
|
|
17137
|
+
}
|
|
17094
17138
|
let hasPending = true;
|
|
17095
17139
|
if (store) {
|
|
17096
17140
|
try {
|
|
@@ -17116,6 +17160,9 @@ async function runMeshReconcileTick(components) {
|
|
|
17116
17160
|
}
|
|
17117
17161
|
if (hasPending) {
|
|
17118
17162
|
LOG.info("MeshReconcile", `Reconcile skip \u2192 generating: holding pending event(s) for mesh ${meshId} (${generatingCoordinators.length} coordinator(s) busy; events left queued for the next idle tick)`);
|
|
17163
|
+
if (getLogLevel() === "debug") {
|
|
17164
|
+
LOG.debug("MeshReconcile", `coordHoldGenerating mesh=${meshId} heldFor=[${generatingCoordinators.map((c) => c.sessionId || "?").join(",")}] (these were classified busy; cross-ref same-tick coordDiag by sessionId)`);
|
|
17165
|
+
}
|
|
17119
17166
|
recordHeldTerminalEventsToLedger(
|
|
17120
17167
|
meshId,
|
|
17121
17168
|
drainDaemonIds.length > 0 ? drainDaemonIds : localDaemonId ? [localDaemonId] : [],
|
|
@@ -40038,6 +40085,12 @@ function hasNonEmptyCliModalButtons(activeModal) {
|
|
|
40038
40085
|
function isCliGeneratingLikeStatus(status) {
|
|
40039
40086
|
return status === "generating" || status === "streaming" || status === "no_progress" || status === "long_generating" || status === "starting";
|
|
40040
40087
|
}
|
|
40088
|
+
function computeTurnAnchoredDurationMs(engineTurnStartedAt, generatingStartedAt, now) {
|
|
40089
|
+
const engineStart = typeof engineTurnStartedAt === "number" && Number.isFinite(engineTurnStartedAt) ? engineTurnStartedAt : 0;
|
|
40090
|
+
if (engineStart > 0) return { durationMs: now - engineStart, anchor: "turn-start" };
|
|
40091
|
+
if (generatingStartedAt > 0) return { durationMs: now - generatingStartedAt, anchor: "generatingStartedAt" };
|
|
40092
|
+
return { durationMs: 0, anchor: "none" };
|
|
40093
|
+
}
|
|
40041
40094
|
function buildCliStructuredInputPrompt(input, options = {}) {
|
|
40042
40095
|
const promptParts = [];
|
|
40043
40096
|
const imageRefs = [];
|
|
@@ -41548,8 +41601,12 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41548
41601
|
if (!this.generatingStartedAt && !this.generatingDebouncePending) {
|
|
41549
41602
|
LOG.debug("CLI", `[${this.type}] suppressed startup-phase generating\u2192idle blip (generatingStartedAt=0, no debounce pending)`);
|
|
41550
41603
|
} else if (this.generatingDebouncePending) {
|
|
41551
|
-
const
|
|
41552
|
-
|
|
41604
|
+
const { durationMs: shortDurationMs, anchor: durationAnchor } = computeTurnAnchoredDurationMs(
|
|
41605
|
+
this.adapter?.currentTurnStartedAt,
|
|
41606
|
+
this.generatingStartedAt,
|
|
41607
|
+
now
|
|
41608
|
+
);
|
|
41609
|
+
LOG.info("CLI", `[${this.type}] suppressed short generating (${shortDurationMs}ms, anchor=${durationAnchor})`);
|
|
41553
41610
|
if (this.generatingDebounceTimer) {
|
|
41554
41611
|
clearTimeout(this.generatingDebounceTimer);
|
|
41555
41612
|
this.generatingDebounceTimer = null;
|