@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.js
CHANGED
|
@@ -389,10 +389,10 @@ function readInjected(value) {
|
|
|
389
389
|
}
|
|
390
390
|
function getDaemonBuildInfo() {
|
|
391
391
|
if (cached) return cached;
|
|
392
|
-
const commit = readInjected(true ? "
|
|
393
|
-
const commitShort = readInjected(true ? "
|
|
394
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
395
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
392
|
+
const commit = readInjected(true ? "dfcf9ed9e1e897f0290bac0f1a6aad3ffaf3b41f" : void 0) ?? "unknown";
|
|
393
|
+
const commitShort = readInjected(true ? "dfcf9ed9" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
394
|
+
const version = readInjected(true ? "0.9.82-rc.425" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
395
|
+
const builtAt = readInjected(true ? "2026-06-29T12:47:28.457Z" : void 0);
|
|
396
396
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
397
397
|
return cached;
|
|
398
398
|
}
|
|
@@ -4166,6 +4166,24 @@ function normalizeMeshWorkerResult(input, source = "explicit_metadata") {
|
|
|
4166
4166
|
source
|
|
4167
4167
|
};
|
|
4168
4168
|
}
|
|
4169
|
+
function summaryHasParseableJsonAnswer(summary) {
|
|
4170
|
+
const text = readNonEmptyString(summary);
|
|
4171
|
+
if (!text) return false;
|
|
4172
|
+
const fenced = text.match(/```(?:json)?\s*([\s\S]*?)```/i);
|
|
4173
|
+
const candidates = [fenced?.[1], text].filter(Boolean);
|
|
4174
|
+
for (const candidate of candidates) {
|
|
4175
|
+
const trimmed = candidate.trim();
|
|
4176
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) continue;
|
|
4177
|
+
try {
|
|
4178
|
+
const parsed = JSON.parse(trimmed);
|
|
4179
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed) && Object.keys(parsed).length > 0) {
|
|
4180
|
+
return true;
|
|
4181
|
+
}
|
|
4182
|
+
} catch {
|
|
4183
|
+
}
|
|
4184
|
+
}
|
|
4185
|
+
return false;
|
|
4186
|
+
}
|
|
4169
4187
|
function resolveWorkerResult(opts) {
|
|
4170
4188
|
if (opts.workerResult && typeof opts.workerResult === "object") {
|
|
4171
4189
|
return normalizeMeshWorkerResult(opts.workerResult, "explicit_metadata");
|
|
@@ -4174,6 +4192,9 @@ function resolveWorkerResult(opts) {
|
|
|
4174
4192
|
if (parsed) {
|
|
4175
4193
|
return normalizeMeshWorkerResult(parsed, "final_summary_json");
|
|
4176
4194
|
}
|
|
4195
|
+
if (summaryHasParseableJsonAnswer(opts.finalSummary)) {
|
|
4196
|
+
return normalizeMeshWorkerResult(void 0, "parseable_answer");
|
|
4197
|
+
}
|
|
4177
4198
|
return normalizeMeshWorkerResult(void 0, "default");
|
|
4178
4199
|
}
|
|
4179
4200
|
function buildTaskCompletionEvidence(opts) {
|
|
@@ -16261,6 +16282,11 @@ function injectMeshSystemMessage(components, args) {
|
|
|
16261
16282
|
completionDiagnostic: args.metadataEvent.completionDiagnostic && typeof args.metadataEvent.completionDiagnostic === "object" ? args.metadataEvent.completionDiagnostic : void 0,
|
|
16262
16283
|
evidence: completionEvidence,
|
|
16263
16284
|
// B2: evidenceLevel lets coordinator know when completion evidence is insufficient.
|
|
16285
|
+
// NOTIF Defect-2b: ONLY source==='default' (no parseable answer at all) is
|
|
16286
|
+
// 'insufficient'. 'parseable_answer' (a real JSON answer that just isn't
|
|
16287
|
+
// worker-result-shaped, e.g. a MAGI envelope) is concrete evidence and must
|
|
16288
|
+
// resolve to 'sufficient' — resolveWorkerResult now upgrades that case so a
|
|
16289
|
+
// complete, valid answer is no longer mislabelled insufficient/reviewRecommended.
|
|
16264
16290
|
...completionEvidence ? completionEvidence.workerResult.source === "default" ? { evidenceLevel: "insufficient", reviewRecommended: true } : { evidenceLevel: "sufficient" } : {}
|
|
16265
16291
|
}
|
|
16266
16292
|
});
|
|
@@ -16807,6 +16833,21 @@ function findLiveCoordinators(components) {
|
|
|
16807
16833
|
const status = readNonEmptyString2(state.status).toLowerCase();
|
|
16808
16834
|
const modalParked = typeof inst.isModalParked === "function" ? inst.isModalParked() === true : status === "waiting_choice" || status === "waiting_approval";
|
|
16809
16835
|
const sessionId = readNonEmptyString2(state.instanceId);
|
|
16836
|
+
if (getLogLevel() === "debug") {
|
|
16837
|
+
let adapterRaw = "?";
|
|
16838
|
+
try {
|
|
16839
|
+
const a = inst.adapter;
|
|
16840
|
+
if (a && typeof a.getStatus === "function") {
|
|
16841
|
+
adapterRaw = readNonEmptyString2(a.getStatus({ allowParse: false })?.status) || "?";
|
|
16842
|
+
}
|
|
16843
|
+
} catch (e) {
|
|
16844
|
+
adapterRaw = `err:${e?.message || e}`;
|
|
16845
|
+
}
|
|
16846
|
+
const lastStatus = readNonEmptyString2(inst.lastStatus) || "?";
|
|
16847
|
+
const autoApproveBusy = inst.autoApproveBusy;
|
|
16848
|
+
const maskSince = inst.autoApproveMaskSince;
|
|
16849
|
+
LOG.debug("MeshReconcile", `coordDiag sess=${sessionId || "?"} mesh=${meshId} getState=${status || "?"} lastStatus=${lastStatus} adapterRaw=${adapterRaw} autoApproveBusy=${autoApproveBusy === true} maskSince=${maskSince || 0}`);
|
|
16850
|
+
}
|
|
16810
16851
|
const stateKey = `${meshId}::${sessionId || "?"}`;
|
|
16811
16852
|
const prevParked = coordinatorModalParkState.get(stateKey);
|
|
16812
16853
|
if (prevParked !== modalParked) {
|
|
@@ -17096,6 +17137,9 @@ async function runMeshReconcileTick(components) {
|
|
|
17096
17137
|
}
|
|
17097
17138
|
}
|
|
17098
17139
|
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` : ""})`);
|
|
17140
|
+
if (getLogLevel() === "debug") {
|
|
17141
|
+
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)`);
|
|
17142
|
+
}
|
|
17099
17143
|
let hasPending = true;
|
|
17100
17144
|
if (store) {
|
|
17101
17145
|
try {
|
|
@@ -17121,6 +17165,9 @@ async function runMeshReconcileTick(components) {
|
|
|
17121
17165
|
}
|
|
17122
17166
|
if (hasPending) {
|
|
17123
17167
|
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)`);
|
|
17168
|
+
if (getLogLevel() === "debug") {
|
|
17169
|
+
LOG.debug("MeshReconcile", `coordHoldGenerating mesh=${meshId} heldFor=[${generatingCoordinators.map((c) => c.sessionId || "?").join(",")}] (these were classified busy; cross-ref same-tick coordDiag by sessionId)`);
|
|
17170
|
+
}
|
|
17124
17171
|
recordHeldTerminalEventsToLedger(
|
|
17125
17172
|
meshId,
|
|
17126
17173
|
drainDaemonIds.length > 0 ? drainDaemonIds : localDaemonId ? [localDaemonId] : [],
|
|
@@ -40434,6 +40481,12 @@ function hasNonEmptyCliModalButtons(activeModal) {
|
|
|
40434
40481
|
function isCliGeneratingLikeStatus(status) {
|
|
40435
40482
|
return status === "generating" || status === "streaming" || status === "no_progress" || status === "long_generating" || status === "starting";
|
|
40436
40483
|
}
|
|
40484
|
+
function computeTurnAnchoredDurationMs(engineTurnStartedAt, generatingStartedAt, now) {
|
|
40485
|
+
const engineStart = typeof engineTurnStartedAt === "number" && Number.isFinite(engineTurnStartedAt) ? engineTurnStartedAt : 0;
|
|
40486
|
+
if (engineStart > 0) return { durationMs: now - engineStart, anchor: "turn-start" };
|
|
40487
|
+
if (generatingStartedAt > 0) return { durationMs: now - generatingStartedAt, anchor: "generatingStartedAt" };
|
|
40488
|
+
return { durationMs: 0, anchor: "none" };
|
|
40489
|
+
}
|
|
40437
40490
|
function buildCliStructuredInputPrompt(input, options = {}) {
|
|
40438
40491
|
const promptParts = [];
|
|
40439
40492
|
const imageRefs = [];
|
|
@@ -41944,8 +41997,12 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41944
41997
|
if (!this.generatingStartedAt && !this.generatingDebouncePending) {
|
|
41945
41998
|
LOG.debug("CLI", `[${this.type}] suppressed startup-phase generating\u2192idle blip (generatingStartedAt=0, no debounce pending)`);
|
|
41946
41999
|
} else if (this.generatingDebouncePending) {
|
|
41947
|
-
const
|
|
41948
|
-
|
|
42000
|
+
const { durationMs: shortDurationMs, anchor: durationAnchor } = computeTurnAnchoredDurationMs(
|
|
42001
|
+
this.adapter?.currentTurnStartedAt,
|
|
42002
|
+
this.generatingStartedAt,
|
|
42003
|
+
now
|
|
42004
|
+
);
|
|
42005
|
+
LOG.info("CLI", `[${this.type}] suppressed short generating (${shortDurationMs}ms, anchor=${durationAnchor})`);
|
|
41949
42006
|
if (this.generatingDebounceTimer) {
|
|
41950
42007
|
clearTimeout(this.generatingDebounceTimer);
|
|
41951
42008
|
this.generatingDebounceTimer = null;
|