@inerrata-corporation/errata 2.0.2-dev.297 → 2.0.2-dev.302
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/errata.mjs +26 -5
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -52635,6 +52635,14 @@ function enqueueWitnesses(queue, fresh, now) {
|
|
|
52635
52635
|
function pendingFor(queue, channel) {
|
|
52636
52636
|
return queue.filter((w) => w.channel === channel);
|
|
52637
52637
|
}
|
|
52638
|
+
function partitionReplayable(queue, channel, isShipped) {
|
|
52639
|
+
const replay2 = [];
|
|
52640
|
+
const waiting = [];
|
|
52641
|
+
for (const w of pendingFor(queue, channel)) {
|
|
52642
|
+
(isShipped(w.nodeId) ? replay2 : waiting).push(w);
|
|
52643
|
+
}
|
|
52644
|
+
return { replay: replay2, waiting };
|
|
52645
|
+
}
|
|
52638
52646
|
function retireWitnesses(queue, channel, settledKeys) {
|
|
52639
52647
|
return queue.filter((w) => !(w.channel === channel && settledKeys.has(w.witnessKey)));
|
|
52640
52648
|
}
|
|
@@ -52894,7 +52902,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
52894
52902
|
}
|
|
52895
52903
|
|
|
52896
52904
|
// src/engine.ts
|
|
52897
|
-
var DAEMON_VERSION = true ? "2.0.2-dev.
|
|
52905
|
+
var DAEMON_VERSION = true ? "2.0.2-dev.302" : "2.0.0-alpha.0";
|
|
52898
52906
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
52899
52907
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
52900
52908
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -53837,8 +53845,20 @@ function createWorkspaceEngine(opts) {
|
|
|
53837
53845
|
const citingSession = sessionOriginKey(sessionId);
|
|
53838
53846
|
const mintedHere = (nodeId) => store.getNode(nodeId)?.attrs["sources"]?.[0] === sessionId;
|
|
53839
53847
|
const sendWitnesses = async (channel, fresh, send) => {
|
|
53840
|
-
const queued =
|
|
53841
|
-
|
|
53848
|
+
const { replay: queued, waiting } = partitionReplayable(
|
|
53849
|
+
witnessQueue,
|
|
53850
|
+
channel,
|
|
53851
|
+
(nodeId) => {
|
|
53852
|
+
const n = store.getNode(nodeId);
|
|
53853
|
+
return !n || n.attrs["contributedAtSeq"] != null;
|
|
53854
|
+
}
|
|
53855
|
+
);
|
|
53856
|
+
if (fresh.length === 0 && queued.length === 0) {
|
|
53857
|
+
if (waiting.length > 0) {
|
|
53858
|
+
console.log(`[errata] ${channel}: ${waiting.length} parked awaiting node drain`);
|
|
53859
|
+
}
|
|
53860
|
+
return;
|
|
53861
|
+
}
|
|
53842
53862
|
const groups = /* @__PURE__ */ new Map();
|
|
53843
53863
|
for (const q of queued) {
|
|
53844
53864
|
const g = groups.get(q.sessionKey) ?? [];
|
|
@@ -53883,7 +53903,7 @@ function createWorkspaceEngine(opts) {
|
|
|
53883
53903
|
witnessQueue = enqueueWitnesses(witnessQueue, stillUnmatched, Date.now());
|
|
53884
53904
|
saveWitnessQueue(witnessQueuePath(paths.configDir), witnessQueue);
|
|
53885
53905
|
console.log(
|
|
53886
|
-
`[errata] ${channel}: ${formatDisposition({ recorded, unmatched, duplicate, selfGated })}` + (queued.length > 0 ? ` (incl. ${queued.length} replayed)` : "")
|
|
53906
|
+
`[errata] ${channel}: ${formatDisposition({ recorded, unmatched, duplicate, selfGated })}` + (queued.length > 0 ? ` (incl. ${queued.length} replayed)` : "") + (waiting.length > 0 ? ` (${waiting.length} awaiting drain)` : "")
|
|
53887
53907
|
);
|
|
53888
53908
|
appendWitnessLedger(paths.configDir, {
|
|
53889
53909
|
ts: Date.now(),
|
|
@@ -53892,7 +53912,8 @@ function createWorkspaceEngine(opts) {
|
|
|
53892
53912
|
unmatched,
|
|
53893
53913
|
duplicate,
|
|
53894
53914
|
selfGated,
|
|
53895
|
-
parked: pendingFor(witnessQueue, channel).length
|
|
53915
|
+
parked: pendingFor(witnessQueue, channel).length,
|
|
53916
|
+
awaitingDrain: waiting.length
|
|
53896
53917
|
});
|
|
53897
53918
|
};
|
|
53898
53919
|
if (typeof cloud.reportContradictions === "function") {
|