@inerrata-corporation/errata 2.0.6-dev.2266 → 2.0.6-dev.2278
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 +108 -24
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -2286,8 +2286,8 @@ var init_regexes = __esm({
|
|
|
2286
2286
|
_emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
2287
2287
|
ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
2288
2288
|
ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
2289
|
-
mac = (
|
|
2290
|
-
const escapedDelim = escapeRegex(
|
|
2289
|
+
mac = (delimiter2) => {
|
|
2290
|
+
const escapedDelim = escapeRegex(delimiter2 ?? ":");
|
|
2291
2291
|
return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
|
|
2292
2292
|
};
|
|
2293
2293
|
cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
@@ -63559,10 +63559,10 @@ var require_headers = __commonJS({
|
|
|
63559
63559
|
const lowercaseName = isLowerCase ? name2 : name2.toLowerCase();
|
|
63560
63560
|
const exists = this[kHeadersMap].get(lowercaseName);
|
|
63561
63561
|
if (exists) {
|
|
63562
|
-
const
|
|
63562
|
+
const delimiter2 = lowercaseName === "cookie" ? "; " : ", ";
|
|
63563
63563
|
this[kHeadersMap].set(lowercaseName, {
|
|
63564
63564
|
name: exists.name,
|
|
63565
|
-
value: `${exists.value}${
|
|
63565
|
+
value: `${exists.value}${delimiter2}${value}`
|
|
63566
63566
|
});
|
|
63567
63567
|
} else {
|
|
63568
63568
|
this[kHeadersMap].set(lowercaseName, { name: name2, value });
|
|
@@ -73320,7 +73320,7 @@ init_review2();
|
|
|
73320
73320
|
|
|
73321
73321
|
// src/turn.ts
|
|
73322
73322
|
import { closeSync, existsSync as existsSync15, fstatSync, openSync, readdirSync as readdirSync6, readSync, realpathSync, statSync as statSync5 } from "node:fs";
|
|
73323
|
-
import { basename as basename5, dirname as dirname10, join as join18 } from "node:path";
|
|
73323
|
+
import { basename as basename5, delimiter, dirname as dirname10, join as join18, normalize as normalize3 } from "node:path";
|
|
73324
73324
|
import { homedir as homedir4 } from "node:os";
|
|
73325
73325
|
import { createHash as createHash13 } from "node:crypto";
|
|
73326
73326
|
function readFrom(path2, fromByte, maxBytes) {
|
|
@@ -73751,12 +73751,13 @@ function subagentTranscripts(mainTranscriptPath, sessionId) {
|
|
|
73751
73751
|
refs.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
73752
73752
|
return refs;
|
|
73753
73753
|
}
|
|
73754
|
+
function splitPathList(value, sep5 = delimiter) {
|
|
73755
|
+
if (!value) return [];
|
|
73756
|
+
return value.split(sep5).map((d) => d.trim()).filter(Boolean).map((d) => normalize3(d));
|
|
73757
|
+
}
|
|
73754
73758
|
function codexSessionRoots(env2 = process.env, home = homedir4()) {
|
|
73755
73759
|
const roots = /* @__PURE__ */ new Set();
|
|
73756
|
-
const
|
|
73757
|
-
if (explicit) {
|
|
73758
|
-
for (const d of explicit.split(":")) if (d.trim()) roots.add(d.trim());
|
|
73759
|
-
}
|
|
73760
|
+
for (const d of splitPathList(env2["ERRATA_CODEX_SESSIONS_DIRS"])) roots.add(d);
|
|
73760
73761
|
if (env2["CODEX_HOME"]) roots.add(join18(env2["CODEX_HOME"], "sessions"));
|
|
73761
73762
|
roots.add(join18(home, ".codex", "sessions"));
|
|
73762
73763
|
return [...roots];
|
|
@@ -73838,10 +73839,7 @@ function codexRolloutsForCwd(cwd, opts = {}) {
|
|
|
73838
73839
|
}
|
|
73839
73840
|
function geminiSessionRoots(env2 = process.env, home = homedir4()) {
|
|
73840
73841
|
const roots = /* @__PURE__ */ new Set();
|
|
73841
|
-
const
|
|
73842
|
-
if (explicit) {
|
|
73843
|
-
for (const d of explicit.split(":")) if (d.trim()) roots.add(d.trim());
|
|
73844
|
-
}
|
|
73842
|
+
for (const d of splitPathList(env2["ERRATA_GEMINI_SESSIONS_DIRS"])) roots.add(d);
|
|
73845
73843
|
if (env2["GEMINI_CLI_HOME"]) roots.add(join18(env2["GEMINI_CLI_HOME"], ".gemini", "tmp"));
|
|
73846
73844
|
roots.add(join18(home, ".gemini", "tmp"));
|
|
73847
73845
|
return [...roots];
|
|
@@ -73919,10 +73917,7 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
|
|
|
73919
73917
|
}
|
|
73920
73918
|
function opencodeSessionRoots(env2 = process.env, home = homedir4()) {
|
|
73921
73919
|
const roots = /* @__PURE__ */ new Set();
|
|
73922
|
-
const
|
|
73923
|
-
if (explicit) {
|
|
73924
|
-
for (const d of explicit.split(":")) if (d.trim()) roots.add(d.trim());
|
|
73925
|
-
}
|
|
73920
|
+
for (const d of splitPathList(env2["ERRATA_OPENCODE_SESSIONS_DIRS"])) roots.add(d);
|
|
73926
73921
|
if (env2["XDG_DATA_HOME"]) roots.add(join18(env2["XDG_DATA_HOME"], "opencode", "errata"));
|
|
73927
73922
|
roots.add(join18(home, ".local", "share", "opencode", "errata"));
|
|
73928
73923
|
return [...roots];
|
|
@@ -74013,6 +74008,8 @@ var CAUSE_PREFIX = /^\s*cause:(?:#([a-z][\w-]{0,63}))?\s*/i;
|
|
|
74013
74008
|
var NEST2_UNIT = String.raw`(?:[^()\n]|\((?:[^()\n]|\([^()\n]*\))*\))`;
|
|
74014
74009
|
var FIX_LONG_RE = new RegExp(String.raw`\(\s*fix:(?:#([a-z][\w-]{0,63}))?\s*(${NEST2_UNIT}{12,}?)\s*\)`, "gi");
|
|
74015
74010
|
var CAUSE_LONG_RE = new RegExp(String.raw`\(\s*cause:(?:#([a-z][\w-]{0,63}))?\s*(${NEST2_UNIT}{8,}?)\s*\)`, "gi");
|
|
74011
|
+
var CONFIRM_LONG_RE = new RegExp(String.raw`\(\s*confirm:\s*(${NEST2_UNIT}{4,}?)\s*\)`, "gi");
|
|
74012
|
+
var REFUTE_LONG_RE = new RegExp(String.raw`\(\s*refute:\s*(${NEST2_UNIT}{4,}?)\s*\)`, "gi");
|
|
74016
74013
|
var CAUSE_ARROW = /\s+(?:<-|←)\s+/;
|
|
74017
74014
|
var ATTEMPT_RE = /\(\s*(tried|failed):(?:#([a-z][\w-]{0,63}))?\s*((?:[^()\n]|\([^()\n]*\)){8,}?)\s*\)/gi;
|
|
74018
74015
|
var AIDS_PREFIX = /^\s*aids:(?:#([a-z][\w-]{0,63}))?\s*/i;
|
|
@@ -74066,7 +74063,8 @@ function emptyTagDispositions() {
|
|
|
74066
74063
|
causeTooShort: 0,
|
|
74067
74064
|
negated: 0,
|
|
74068
74065
|
unparseable: 0,
|
|
74069
|
-
placeholderEcho: 0
|
|
74066
|
+
placeholderEcho: 0,
|
|
74067
|
+
verdictNoHandle: 0
|
|
74070
74068
|
};
|
|
74071
74069
|
}
|
|
74072
74070
|
function addTagDispositions(a, b) {
|
|
@@ -74077,6 +74075,7 @@ function addTagDispositions(a, b) {
|
|
|
74077
74075
|
a.negated += b.negated;
|
|
74078
74076
|
a.unparseable += b.unparseable;
|
|
74079
74077
|
a.placeholderEcho += b.placeholderEcho;
|
|
74078
|
+
a.verdictNoHandle += b.verdictNoHandle;
|
|
74080
74079
|
}
|
|
74081
74080
|
function parseInlineTags(text) {
|
|
74082
74081
|
return parseInlineTagsWithDispositions(text).tags;
|
|
@@ -74160,6 +74159,8 @@ function parseInlineTagsWithDispositions(text) {
|
|
|
74160
74159
|
} else {
|
|
74161
74160
|
out2.push({ kind: "confirm", handle: handle2, sentence: sfield });
|
|
74162
74161
|
}
|
|
74162
|
+
} else {
|
|
74163
|
+
dispositions.verdictNoHandle++;
|
|
74163
74164
|
}
|
|
74164
74165
|
continue;
|
|
74165
74166
|
}
|
|
@@ -74276,6 +74277,35 @@ function parseInlineTagsWithDispositions(text) {
|
|
|
74276
74277
|
out2.push({ kind: "fix", fixRationale: note, sentence: sfield, ...verbThread ? { threadId: verbThread } : {} });
|
|
74277
74278
|
}
|
|
74278
74279
|
}
|
|
74280
|
+
for (const pass of [
|
|
74281
|
+
{ re: CONFIRM_LONG_RE, refute: false },
|
|
74282
|
+
{ re: REFUTE_LONG_RE, refute: true }
|
|
74283
|
+
]) {
|
|
74284
|
+
pass.re.lastIndex = 0;
|
|
74285
|
+
let vm;
|
|
74286
|
+
while ((vm = pass.re.exec(sentence)) !== null) {
|
|
74287
|
+
if (citeMatched.has(vm.index)) continue;
|
|
74288
|
+
const body2 = vm[1];
|
|
74289
|
+
HANDLE_RE.lastIndex = 0;
|
|
74290
|
+
const h = HANDLE_RE.exec(body2);
|
|
74291
|
+
let handle2 = h ? h[1] ?? h[2] : void 0;
|
|
74292
|
+
if (handle2 && isPlaceholderHandle(handle2)) {
|
|
74293
|
+
dispositions.placeholderEcho++;
|
|
74294
|
+
handle2 = void 0;
|
|
74295
|
+
}
|
|
74296
|
+
if (!handle2) {
|
|
74297
|
+
dispositions.verdictNoHandle++;
|
|
74298
|
+
continue;
|
|
74299
|
+
}
|
|
74300
|
+
if (pass.refute) {
|
|
74301
|
+
const reason = body2.replace(new RegExp(HANDLE_RE.source, "gi"), " ").replace(/\s+/g, " ").trim();
|
|
74302
|
+
if (reason.length >= REFUTE_REASON_MIN) out2.push({ kind: "refute", handle: handle2, statement: reason, sentence: sfield });
|
|
74303
|
+
else dispositions.refuteTooShort++;
|
|
74304
|
+
} else {
|
|
74305
|
+
out2.push({ kind: "confirm", handle: handle2, sentence: sfield });
|
|
74306
|
+
}
|
|
74307
|
+
}
|
|
74308
|
+
}
|
|
74279
74309
|
FLAG_RE.lastIndex = 0;
|
|
74280
74310
|
let f;
|
|
74281
74311
|
while ((f = FLAG_RE.exec(sentence)) !== null) {
|
|
@@ -77521,6 +77551,23 @@ function partitionReplayable(queue, channel, isShipped) {
|
|
|
77521
77551
|
function retireWitnesses(queue, channel, settledKeys) {
|
|
77522
77552
|
return queue.filter((w) => !(w.channel === channel && settledKeys.has(w.witnessKey)));
|
|
77523
77553
|
}
|
|
77554
|
+
var WIRE_SHIPPED_LABELS = /* @__PURE__ */ new Set(["Problem", "Solution", "RootCause"]);
|
|
77555
|
+
var MOTIF_ID_PREFIX = "motif_community_";
|
|
77556
|
+
var CANONICAL_ID_RE = /^(?:pat|sol|drc|dcause|dfix|dprob|prob|claim|err)_[0-9a-f]{6,}$/i;
|
|
77557
|
+
function classifyWitnessTarget(nodeId, getNode) {
|
|
77558
|
+
if (nodeId.startsWith(MOTIF_ID_PREFIX)) {
|
|
77559
|
+
const exemplar = nodeId.slice(MOTIF_ID_PREFIX.length);
|
|
77560
|
+
if (CANONICAL_ID_RE.test(exemplar) && !exemplar.startsWith("pat_")) {
|
|
77561
|
+
const v = classifyWitnessTarget(exemplar, getNode);
|
|
77562
|
+
return v.kind === "deliverable" ? { kind: "translated", nodeId: v.nodeId } : v;
|
|
77563
|
+
}
|
|
77564
|
+
return { kind: "undeliverable", label: "Pattern" };
|
|
77565
|
+
}
|
|
77566
|
+
const n = getNode(nodeId);
|
|
77567
|
+
if (!n) return { kind: "deliverable", nodeId };
|
|
77568
|
+
if (WIRE_SHIPPED_LABELS.has(n.label)) return { kind: "deliverable", nodeId };
|
|
77569
|
+
return { kind: "undeliverable", label: n.label };
|
|
77570
|
+
}
|
|
77524
77571
|
|
|
77525
77572
|
// src/engine.ts
|
|
77526
77573
|
init_witness_ledger();
|
|
@@ -78046,7 +78093,7 @@ function createWatchBreaker(deps) {
|
|
|
78046
78093
|
}
|
|
78047
78094
|
|
|
78048
78095
|
// src/engine.ts
|
|
78049
|
-
var DAEMON_VERSION = true ? "2.0.6-dev.
|
|
78096
|
+
var DAEMON_VERSION = true ? "2.0.6-dev.2278" : "2.0.0-alpha.0";
|
|
78050
78097
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
78051
78098
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
78052
78099
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -79467,8 +79514,39 @@ function createWorkspaceEngine(opts) {
|
|
|
79467
79514
|
const n = store.getNode(nodeId);
|
|
79468
79515
|
return !n || n.attrs["contributedAtSeq"] != null;
|
|
79469
79516
|
};
|
|
79517
|
+
const getNode = (id) => store.getNode(id);
|
|
79518
|
+
let undeliverable = 0;
|
|
79519
|
+
const routedFresh = [];
|
|
79520
|
+
for (const f of fresh) {
|
|
79521
|
+
const v = classifyWitnessTarget(f.nodeId, getNode);
|
|
79522
|
+
if (v.kind === "undeliverable") {
|
|
79523
|
+
undeliverable++;
|
|
79524
|
+
continue;
|
|
79525
|
+
}
|
|
79526
|
+
routedFresh.push({ nodeId: v.nodeId, witnessKey: f.witnessKey });
|
|
79527
|
+
}
|
|
79528
|
+
const healed = [];
|
|
79529
|
+
for (const q of witnessQueue) {
|
|
79530
|
+
if (q.channel !== channel) {
|
|
79531
|
+
healed.push(q);
|
|
79532
|
+
continue;
|
|
79533
|
+
}
|
|
79534
|
+
const v = classifyWitnessTarget(q.nodeId, getNode);
|
|
79535
|
+
if (v.kind === "undeliverable") {
|
|
79536
|
+
undeliverable++;
|
|
79537
|
+
continue;
|
|
79538
|
+
}
|
|
79539
|
+
healed.push(v.nodeId === q.nodeId ? q : { ...q, nodeId: v.nodeId });
|
|
79540
|
+
}
|
|
79541
|
+
witnessQueue = healed;
|
|
79542
|
+
fresh = routedFresh;
|
|
79470
79543
|
const { replay: queued, waiting } = partitionReplayable(witnessQueue, channel, isShipped);
|
|
79471
79544
|
if (fresh.length === 0 && queued.length === 0) {
|
|
79545
|
+
if (undeliverable > 0) {
|
|
79546
|
+
saveWitnessQueue(witnessQueuePath(paths.configDir), witnessQueue);
|
|
79547
|
+
appendWitnessLedger(paths.configDir, { ts: Date.now(), channel, undeliverable, parked: pendingFor(witnessQueue, channel).length });
|
|
79548
|
+
console.log(`[errata] ${channel}: ${undeliverable} witness(es) retired \u2014 cited node class never ships (counted, not parked)`);
|
|
79549
|
+
}
|
|
79472
79550
|
if (waiting.length > 0) {
|
|
79473
79551
|
console.log(`[errata] ${channel}: ${waiting.length} parked awaiting node drain`);
|
|
79474
79552
|
}
|
|
@@ -79520,7 +79598,7 @@ function createWorkspaceEngine(opts) {
|
|
|
79520
79598
|
witnessQueue = enq.queue;
|
|
79521
79599
|
saveWitnessQueue(witnessQueuePath(paths.configDir), witnessQueue);
|
|
79522
79600
|
const lost = enq.dropped.expiredTtl + enq.dropped.exhaustedAttempts + enq.dropped.cappedOverflow;
|
|
79523
|
-
if (lost > 0 || recovered > 0) {
|
|
79601
|
+
if (lost > 0 || recovered > 0 || undeliverable > 0) {
|
|
79524
79602
|
appendPassLedger(paths.configDir, "witness-queue", 0, {
|
|
79525
79603
|
recovered,
|
|
79526
79604
|
replayed: queued.length,
|
|
@@ -79528,7 +79606,8 @@ function createWorkspaceEngine(opts) {
|
|
|
79528
79606
|
parked: pendingFor(witnessQueue, channel).length,
|
|
79529
79607
|
expiredTtl: enq.dropped.expiredTtl,
|
|
79530
79608
|
exhaustedAttempts: enq.dropped.exhaustedAttempts,
|
|
79531
|
-
cappedOverflow: enq.dropped.cappedOverflow
|
|
79609
|
+
cappedOverflow: enq.dropped.cappedOverflow,
|
|
79610
|
+
undeliverable
|
|
79532
79611
|
});
|
|
79533
79612
|
}
|
|
79534
79613
|
console.log(
|
|
@@ -79542,7 +79621,8 @@ function createWorkspaceEngine(opts) {
|
|
|
79542
79621
|
duplicate,
|
|
79543
79622
|
selfGated,
|
|
79544
79623
|
parked: pendingFor(witnessQueue, channel).length,
|
|
79545
|
-
awaitingDrain: waiting.length
|
|
79624
|
+
awaitingDrain: waiting.length,
|
|
79625
|
+
...undeliverable > 0 ? { undeliverable } : {}
|
|
79546
79626
|
});
|
|
79547
79627
|
};
|
|
79548
79628
|
if (typeof cloud.reportContradictions === "function") {
|
|
@@ -79667,6 +79747,9 @@ function createWorkspaceEngine(opts) {
|
|
|
79667
79747
|
tagsNegated: dispositions.negated,
|
|
79668
79748
|
tagsUnparseable: dispositions.unparseable,
|
|
79669
79749
|
tagsPlaceholderEcho: dispositions.placeholderEcho,
|
|
79750
|
+
// HZ-corrob-wire: a verdict group naming no resolvable handle — judged,
|
|
79751
|
+
// but nothing judgeable was cited.
|
|
79752
|
+
tagsVerdictNoHandle: dispositions.verdictNoHandle,
|
|
79670
79753
|
unresolvedHandles,
|
|
79671
79754
|
priorEdgesFlagOff,
|
|
79672
79755
|
priorEdgesNoSource,
|
|
@@ -86381,7 +86464,7 @@ function buildOpencodePluginSource(port, opts = {}) {
|
|
|
86381
86464
|
// file the errata daemon can parse, and tells the daemon on every turn boundary.
|
|
86382
86465
|
// It has no dependencies and never throws into OpenCode.
|
|
86383
86466
|
import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
86384
|
-
import { join } from "node:path";
|
|
86467
|
+
import { delimiter, join, normalize } from "node:path";
|
|
86385
86468
|
import { homedir } from "node:os";
|
|
86386
86469
|
|
|
86387
86470
|
const DAEMON = "http://127.0.0.1:${port}";
|
|
@@ -86391,7 +86474,8 @@ const TOOL_FAILURE_NUDGE = ${JSON.stringify(OPENCODE_TOOL_FAILURE_NUDGE)};
|
|
|
86391
86474
|
|
|
86392
86475
|
function mirrorRoot() {
|
|
86393
86476
|
const explicit = process.env.ERRATA_OPENCODE_SESSIONS_DIRS;
|
|
86394
|
-
|
|
86477
|
+
// Platform delimiter, same as the daemon's splitPathList \u2014 ":" shreds "C:\\x".
|
|
86478
|
+
if (explicit) { const first = explicit.split(delimiter).map((s) => s.trim()).find(Boolean); if (first) return normalize(first); }
|
|
86395
86479
|
if (process.env.XDG_DATA_HOME) return join(process.env.XDG_DATA_HOME, "opencode", "errata");
|
|
86396
86480
|
return join(homedir(), ".local", "share", "opencode", "errata");
|
|
86397
86481
|
}
|