@adhdev/daemon-standalone 1.0.58-rc.25 → 1.0.58-rc.26
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 +91 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/vendor/mcp-server/index.js +21 -15
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -36885,10 +36885,10 @@ var require_dist3 = __commonJS({
|
|
|
36885
36885
|
}
|
|
36886
36886
|
function getDaemonBuildInfo() {
|
|
36887
36887
|
if (cached2) return cached2;
|
|
36888
|
-
const commit = readInjected(true ? "
|
|
36889
|
-
const commitShort = readInjected(true ? "
|
|
36890
|
-
const version2 = readInjected(true ? "1.0.58-rc.
|
|
36891
|
-
const builtAt = readInjected(true ? "2026-08-
|
|
36888
|
+
const commit = readInjected(true ? "9d74c9f0f92fde5a57a60e0068576d1868701f35" : void 0) ?? "unknown";
|
|
36889
|
+
const commitShort = readInjected(true ? "9d74c9f0" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
36890
|
+
const version2 = readInjected(true ? "1.0.58-rc.26" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
36891
|
+
const builtAt = readInjected(true ? "2026-08-27T06:32:25.171Z" : void 0);
|
|
36892
36892
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
36893
36893
|
return cached2;
|
|
36894
36894
|
}
|
|
@@ -57870,17 +57870,23 @@ CREATE TABLE IF NOT EXISTS sq_archive (
|
|
|
57870
57870
|
}
|
|
57871
57871
|
}
|
|
57872
57872
|
function recordMeshEventShadow(meshId, entry) {
|
|
57873
|
+
recordMeshEvent(meshId, entry, "inline");
|
|
57874
|
+
}
|
|
57875
|
+
function backfillMeshEventShadow(meshId, entry) {
|
|
57876
|
+
return recordMeshEvent(meshId, entry, "backfill");
|
|
57877
|
+
}
|
|
57878
|
+
function recordMeshEvent(meshId, entry, origin) {
|
|
57873
57879
|
try {
|
|
57874
57880
|
const node = activeNode2;
|
|
57875
|
-
if (!node || activeMode === "off") return;
|
|
57881
|
+
if (!node || activeMode === "off") return false;
|
|
57876
57882
|
const topic = ensureTopic(node, meshId);
|
|
57877
|
-
if (!topic) return;
|
|
57883
|
+
if (!topic) return false;
|
|
57878
57884
|
if (inflight >= MAX_INFLIGHT) {
|
|
57879
57885
|
counters.dropped++;
|
|
57880
57886
|
warnOnce2(
|
|
57881
57887
|
`mesh dual-write shedding load \u2014 ${MAX_INFLIGHT} appends in flight; records are being dropped from the SHADOW leg only (the ledger is unaffected)`
|
|
57882
57888
|
);
|
|
57883
|
-
return;
|
|
57889
|
+
return false;
|
|
57884
57890
|
}
|
|
57885
57891
|
const projected = projectMeshLedgerEntry(entry);
|
|
57886
57892
|
const estimated = estimateProjectedEntryBytes(topic, projected);
|
|
@@ -57890,27 +57896,32 @@ CREATE TABLE IF NOT EXISTS sq_archive (
|
|
|
57890
57896
|
warnOnce2(
|
|
57891
57897
|
`mesh dual-write skipped an oversized record (further occurrences logged once): estimated=${estimated}B ceiling=${ceiling}B ledgerKind=${projected.ledgerKind}. The projection is supposed to bound every field \u2014 this is a projection bug, not a transport one.`
|
|
57892
57898
|
);
|
|
57893
|
-
return;
|
|
57899
|
+
return false;
|
|
57894
57900
|
}
|
|
57895
57901
|
inflight++;
|
|
57896
57902
|
void node.node.log(topic).append(MESH_EVENT_ENTRY_KIND, toJsonValue(projected)).then(
|
|
57897
57903
|
() => {
|
|
57898
57904
|
inflight--;
|
|
57899
|
-
counters.
|
|
57905
|
+
if (origin === "backfill") counters.backfilled++;
|
|
57906
|
+
else counters.written++;
|
|
57900
57907
|
},
|
|
57901
57908
|
(error48) => {
|
|
57902
57909
|
inflight--;
|
|
57903
|
-
counters.
|
|
57910
|
+
if (origin === "backfill") counters.backfillFailed++;
|
|
57911
|
+
else counters.failed++;
|
|
57904
57912
|
warnOnce2(
|
|
57905
57913
|
`mesh dual-write append failed (further failures logged once): ${error48 instanceof Error ? error48.message : String(error48)}`
|
|
57906
57914
|
);
|
|
57907
57915
|
}
|
|
57908
57916
|
);
|
|
57917
|
+
return true;
|
|
57909
57918
|
} catch (error48) {
|
|
57910
|
-
counters.
|
|
57919
|
+
if (origin === "backfill") counters.backfillFailed++;
|
|
57920
|
+
else counters.failed++;
|
|
57911
57921
|
warnOnce2(
|
|
57912
57922
|
`mesh dual-write threw synchronously (further throws logged once): ${error48 instanceof Error ? error48.message : String(error48)}`
|
|
57913
57923
|
);
|
|
57924
|
+
return false;
|
|
57914
57925
|
}
|
|
57915
57926
|
}
|
|
57916
57927
|
function meshDualWriteCounters() {
|
|
@@ -57938,6 +57949,8 @@ CREATE TABLE IF NOT EXISTS sq_archive (
|
|
|
57938
57949
|
counters.failed = 0;
|
|
57939
57950
|
counters.dropped = 0;
|
|
57940
57951
|
counters.topicErrors = 0;
|
|
57952
|
+
counters.backfilled = 0;
|
|
57953
|
+
counters.backfillFailed = 0;
|
|
57941
57954
|
counters.oversized = 0;
|
|
57942
57955
|
}
|
|
57943
57956
|
var MESH_DUAL_WRITE_ENV;
|
|
@@ -57962,6 +57975,8 @@ CREATE TABLE IF NOT EXISTS sq_archive (
|
|
|
57962
57975
|
failed: 0,
|
|
57963
57976
|
dropped: 0,
|
|
57964
57977
|
topicErrors: 0,
|
|
57978
|
+
backfilled: 0,
|
|
57979
|
+
backfillFailed: 0,
|
|
57965
57980
|
oversized: 0
|
|
57966
57981
|
};
|
|
57967
57982
|
definedTopics = /* @__PURE__ */ new Map();
|
|
@@ -96437,6 +96452,8 @@ ${e?.stderr || ""}`;
|
|
|
96437
96452
|
OPERATING_NOTE_KIND: () => OPERATING_NOTE_KIND,
|
|
96438
96453
|
OPERATING_NOTE_TOMBSTONE_KIND: () => OPERATING_NOTE_TOMBSTONE_KIND,
|
|
96439
96454
|
P2pRelayFailureError: () => P2pRelayFailureError,
|
|
96455
|
+
PARITY_BACKFILL_CAP: () => PARITY_BACKFILL_CAP,
|
|
96456
|
+
PARITY_BACKFILL_FAILURE_LIMIT: () => PARITY_BACKFILL_FAILURE_LIMIT,
|
|
96440
96457
|
PARITY_CONSUMER: () => PARITY_CONSUMER,
|
|
96441
96458
|
PARITY_INTERVAL_MS: () => PARITY_INTERVAL_MS,
|
|
96442
96459
|
PARITY_TAIL: () => PARITY_TAIL,
|
|
@@ -96497,6 +96514,7 @@ ${e?.stderr || ""}`;
|
|
|
96497
96514
|
appendRemoteLedgerEntries: () => appendRemoteLedgerEntries,
|
|
96498
96515
|
assertNoDependencyCycle: () => assertNoDependencyCycle,
|
|
96499
96516
|
assistantJournalPolicy: () => assistantJournalPolicy,
|
|
96517
|
+
backfillMeshEventShadow: () => backfillMeshEventShadow,
|
|
96500
96518
|
baseTopicDefinitions: () => baseTopicDefinitions,
|
|
96501
96519
|
buildAssistantChatMessage: () => buildAssistantChatMessage,
|
|
96502
96520
|
buildAvailableProviders: () => buildAvailableProviders2,
|
|
@@ -97143,18 +97161,21 @@ ${e?.stderr || ""}`;
|
|
|
97143
97161
|
const answers = {};
|
|
97144
97162
|
const entries = record2.answers;
|
|
97145
97163
|
entries.forEach((entryRaw, index) => {
|
|
97146
|
-
|
|
97147
|
-
const entry = entryRaw;
|
|
97164
|
+
const entry = entryRaw && typeof entryRaw === "object" && !Array.isArray(entryRaw) ? entryRaw : { select: entryRaw };
|
|
97148
97165
|
const questionId = readString(entry.questionId);
|
|
97149
97166
|
const question = (questionId ? prompt.questions.find((q) => q.questionId === questionId) : void 0) ?? prompt.questions[index];
|
|
97150
97167
|
if (!question) throw new Error(`No matching question for answer entry ${index}`);
|
|
97151
97168
|
const freeformText = readString(entry.freeform) ?? readString(entry.freeformText);
|
|
97169
|
+
const select = entry.select ?? entry.answer ?? entry.selected;
|
|
97152
97170
|
const selectedLabels = [];
|
|
97153
|
-
const select = entry.select;
|
|
97154
97171
|
if (Array.isArray(select)) {
|
|
97155
97172
|
for (const sel of select) selectedLabels.push(resolveOneLabel(question, sel));
|
|
97156
97173
|
} else if (select !== void 0 && select !== null) {
|
|
97157
97174
|
selectedLabels.push(resolveOneLabel(question, select));
|
|
97175
|
+
} else if (!freeformText) {
|
|
97176
|
+
throw new Error(
|
|
97177
|
+
`Answer entry ${index} for ${question.questionId} has no recognized selection: expected "select" (option label, 1-based index, or array of either) or "freeform" (text).`
|
|
97178
|
+
);
|
|
97158
97179
|
}
|
|
97159
97180
|
answers[question.questionId] = {
|
|
97160
97181
|
selectedLabels,
|
|
@@ -147123,6 +147144,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
147123
147144
|
dualWrite: opts.dualWrite?.active ?? false,
|
|
147124
147145
|
dualWriteFailedBucket: bucket(opts.dualWrite?.failed ?? 0, BACKLOG_BUCKETS),
|
|
147125
147146
|
dualWriteDroppedBucket: bucket(opts.dualWrite?.dropped ?? 0, BACKLOG_BUCKETS),
|
|
147147
|
+
dualWriteBackfilledBucket: bucket(opts.dualWrite?.backfilled ?? 0, BACKLOG_BUCKETS),
|
|
147126
147148
|
parityMismatchBucket: bucket(opts.parity?.mismatches ?? 0, BACKLOG_BUCKETS),
|
|
147127
147149
|
parityRan: (opts.parity?.runs ?? 0) > 0
|
|
147128
147150
|
};
|
|
@@ -147136,13 +147158,57 @@ data: ${JSON.stringify(msg.data)}
|
|
|
147136
147158
|
init_mesh_ledger();
|
|
147137
147159
|
var PARITY_INTERVAL_MS = 15 * 60 * 1e3;
|
|
147138
147160
|
var PARITY_TAIL = 500;
|
|
147161
|
+
var PARITY_BACKFILL_CAP = 100;
|
|
147162
|
+
var PARITY_BACKFILL_FAILURE_LIMIT = 2;
|
|
147139
147163
|
function startMeshParityLoop(handle, opts = {}) {
|
|
147140
147164
|
if (!isMeshDualWriteActive()) {
|
|
147141
147165
|
LOG2.info("Seqscribe", "parity loop idle \u2014 mesh dual-write shadow is not active");
|
|
147142
147166
|
return null;
|
|
147143
147167
|
}
|
|
147144
147168
|
const armedAt = opts.armedAt ?? Date.now();
|
|
147169
|
+
const backfillEnabled = opts.backfill !== false;
|
|
147170
|
+
const backfillCap = opts.backfillCap ?? PARITY_BACKFILL_CAP;
|
|
147145
147171
|
let stopped = false;
|
|
147172
|
+
const backfillFailures = /* @__PURE__ */ new Map();
|
|
147173
|
+
const backfillMissing = (meshId, entries, result) => {
|
|
147174
|
+
if (!backfillEnabled) return;
|
|
147175
|
+
const missing = result.mismatches.filter((m) => m.kind === "missing_in_shadow");
|
|
147176
|
+
if (missing.length === 0) {
|
|
147177
|
+
backfillFailures.delete(meshId);
|
|
147178
|
+
return;
|
|
147179
|
+
}
|
|
147180
|
+
if ((backfillFailures.get(meshId) ?? 0) >= PARITY_BACKFILL_FAILURE_LIMIT) {
|
|
147181
|
+
LOG2.warn(
|
|
147182
|
+
"Seqscribe",
|
|
147183
|
+
`parity backfill paused mesh=${meshId} \u2014 ${PARITY_BACKFILL_FAILURE_LIMIT} consecutive failed sweeps; ${missing.length} entries remain unmirrored and parity keeps reporting them`
|
|
147184
|
+
);
|
|
147185
|
+
return;
|
|
147186
|
+
}
|
|
147187
|
+
const byId = new Map(entries.map((e) => [e.id, e]));
|
|
147188
|
+
let mirrored = 0;
|
|
147189
|
+
let failed = 0;
|
|
147190
|
+
let skipped = 0;
|
|
147191
|
+
for (const mismatch of missing) {
|
|
147192
|
+
if (stopped) break;
|
|
147193
|
+
if (mirrored + failed >= backfillCap) {
|
|
147194
|
+
skipped = missing.length - (mirrored + failed);
|
|
147195
|
+
break;
|
|
147196
|
+
}
|
|
147197
|
+
const entry = byId.get(mismatch.id);
|
|
147198
|
+
if (!entry) {
|
|
147199
|
+
skipped++;
|
|
147200
|
+
continue;
|
|
147201
|
+
}
|
|
147202
|
+
if (backfillMeshEventShadow(meshId, entry)) mirrored++;
|
|
147203
|
+
else failed++;
|
|
147204
|
+
}
|
|
147205
|
+
if (mirrored > 0) backfillFailures.delete(meshId);
|
|
147206
|
+
else if (failed > 0) backfillFailures.set(meshId, (backfillFailures.get(meshId) ?? 0) + 1);
|
|
147207
|
+
LOG2.info(
|
|
147208
|
+
"Seqscribe",
|
|
147209
|
+
`parity backfill mesh=${meshId} mirrored=${mirrored} failed=${failed}` + (skipped > 0 ? ` deferred=${skipped} (cap=${backfillCap}, next sweep)` : "") + " \u2014 these entries were appended by a process with no armed shadow leg (see mesh-dual-write.ts process-boundary note)"
|
|
147210
|
+
);
|
|
147211
|
+
};
|
|
147146
147212
|
const runOnce = async () => {
|
|
147147
147213
|
if (stopped) return;
|
|
147148
147214
|
let meshIds;
|
|
@@ -147165,7 +147231,15 @@ data: ${JSON.stringify(msg.data)}
|
|
|
147165
147231
|
return Number.isFinite(at) && at >= armedAt;
|
|
147166
147232
|
});
|
|
147167
147233
|
if (entries.length === 0) continue;
|
|
147168
|
-
await runMeshParityCheck(handle, meshId, entries);
|
|
147234
|
+
const result = await runMeshParityCheck(handle, meshId, entries);
|
|
147235
|
+
try {
|
|
147236
|
+
backfillMissing(meshId, entries, result);
|
|
147237
|
+
} catch (error48) {
|
|
147238
|
+
LOG2.warn(
|
|
147239
|
+
"Seqscribe",
|
|
147240
|
+
`parity backfill failed mesh=${meshId}: ${error48 instanceof Error ? error48.message : String(error48)}`
|
|
147241
|
+
);
|
|
147242
|
+
}
|
|
147169
147243
|
} catch (error48) {
|
|
147170
147244
|
LOG2.warn(
|
|
147171
147245
|
"Seqscribe",
|
|
@@ -147482,7 +147556,8 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
|
|
|
147482
147556
|
dualWrite: {
|
|
147483
147557
|
active: isMeshDualWriteActive(),
|
|
147484
147558
|
failed: dual.failed,
|
|
147485
|
-
dropped: dual.dropped
|
|
147559
|
+
dropped: dual.dropped,
|
|
147560
|
+
backfilled: dual.backfilled
|
|
147486
147561
|
},
|
|
147487
147562
|
parity: { runs: parity.runs, mismatches: parity.mismatches }
|
|
147488
147563
|
});
|