@inerrata-corporation/errata 2.0.6-dev.2533 → 2.0.6-dev.2559
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 +136 -11
- package/package.json +1 -1
- package/pass-worker.mjs +3 -0
package/errata.mjs
CHANGED
|
@@ -20548,6 +20548,7 @@ function upgradeAnchorHintsForFile(store, relPath, workspaceId2, ts) {
|
|
|
20548
20548
|
function upgradeAnchorHints(store, workspaceId2, ts) {
|
|
20549
20549
|
let upgraded = 0;
|
|
20550
20550
|
let standing = 0;
|
|
20551
|
+
let unresolvable = 0;
|
|
20551
20552
|
const filesByPath = /* @__PURE__ */ new Map();
|
|
20552
20553
|
for (const f of store.findNodesByLabel("File")) {
|
|
20553
20554
|
if (f.attrs["workspaceId"] && f.attrs["workspaceId"] !== workspaceId2) continue;
|
|
@@ -20558,9 +20559,13 @@ function upgradeAnchorHints(store, workspaceId2, ts) {
|
|
|
20558
20559
|
if (p.validTo != null || p.attrs["resolvedAt"]) continue;
|
|
20559
20560
|
const hint = openAnchorHint(p);
|
|
20560
20561
|
if (!hint) continue;
|
|
20561
|
-
standing++;
|
|
20562
20562
|
const file2 = filesByPath.get(hint.path.trim().replace(/^\.?\//, ""));
|
|
20563
|
-
|
|
20563
|
+
if (!file2 || !isAnchorableCodePath(hint.path)) {
|
|
20564
|
+
unresolvable++;
|
|
20565
|
+
continue;
|
|
20566
|
+
}
|
|
20567
|
+
standing++;
|
|
20568
|
+
const changedAt = Number(file2.attrs["contentChangedAt"] ?? 0);
|
|
20564
20569
|
if (changedAt <= hint.ts) continue;
|
|
20565
20570
|
if (anchorProblemToWorkingFile(store, p.id, hint.path, workspaceId2, ts, "hint-confirmed")) {
|
|
20566
20571
|
consumeAnchorHint(store, p, ts);
|
|
@@ -20568,7 +20573,7 @@ function upgradeAnchorHints(store, workspaceId2, ts) {
|
|
|
20568
20573
|
standing--;
|
|
20569
20574
|
}
|
|
20570
20575
|
}
|
|
20571
|
-
return { upgraded, standing };
|
|
20576
|
+
return { upgraded, standing, unresolvable };
|
|
20572
20577
|
}
|
|
20573
20578
|
function resolveDesignProblemByStatement(store, statement, fixNote, t) {
|
|
20574
20579
|
const problemId = identityId({ kind: "DesignProblem", statement });
|
|
@@ -28832,7 +28837,7 @@ function buildAgentInstruction(opts = {}) {
|
|
|
28832
28837
|
tail
|
|
28833
28838
|
].join("\n");
|
|
28834
28839
|
}
|
|
28835
|
-
var TAG_EXAMPLE, GLOSS;
|
|
28840
|
+
var TAG_EXAMPLE, TAG_OPENERS, GLOSS;
|
|
28836
28841
|
var init_agent_signals = __esm({
|
|
28837
28842
|
"src/agent-signals.ts"() {
|
|
28838
28843
|
"use strict";
|
|
@@ -28888,6 +28893,11 @@ var init_agent_signals = __esm({
|
|
|
28888
28893
|
confirm: (ref) => `(confirm:[${ref}])`,
|
|
28889
28894
|
refute: (ref) => `(refute:[${ref}] one line why)`
|
|
28890
28895
|
};
|
|
28896
|
+
TAG_OPENERS = [
|
|
28897
|
+
...new Set(
|
|
28898
|
+
Object.values(TAG_EXAMPLE).map((example) => /^(\([a-z][\w-]*:|\[[!?])/i.exec(example("x"))?.[1]?.toLowerCase()).filter((opener) => opener !== void 0)
|
|
28899
|
+
)
|
|
28900
|
+
];
|
|
28891
28901
|
GLOSS = {
|
|
28892
28902
|
prior: "a shown prior helped, or you work in a primed language/package",
|
|
28893
28903
|
problem: "a problem you notice or report \u2014 any bug, finding, or thing wrong; about specific code? name the file: [!what's wrong @ src/file.ts:42]",
|
|
@@ -33807,6 +33817,8 @@ function upsertFile(store, id, f, workspaceId2, skip) {
|
|
|
33807
33817
|
contentHash = createHash4("sha256").update(readFileSync10(f.absPath)).digest("hex");
|
|
33808
33818
|
} catch {
|
|
33809
33819
|
}
|
|
33820
|
+
const carried = { ...store.getNode(id)?.attrs ?? {} };
|
|
33821
|
+
for (const owned of ["contentHash", "indexSkipped", "symbolCount"]) delete carried[owned];
|
|
33810
33822
|
const node2 = {
|
|
33811
33823
|
id,
|
|
33812
33824
|
label: "File",
|
|
@@ -33825,6 +33837,7 @@ function upsertFile(store, id, f, workspaceId2, skip) {
|
|
|
33825
33837
|
community: null,
|
|
33826
33838
|
stability: "stable",
|
|
33827
33839
|
attrs: {
|
|
33840
|
+
...carried,
|
|
33828
33841
|
absPath: f.absPath,
|
|
33829
33842
|
relPath: f.relPath,
|
|
33830
33843
|
size: f.size,
|
|
@@ -74145,15 +74158,54 @@ function clauseBefore(sentence, idx) {
|
|
|
74145
74158
|
}
|
|
74146
74159
|
var FIX_RATIONALE_MIN = 12;
|
|
74147
74160
|
var FIX_RATIONALE_WINDOW = 160;
|
|
74161
|
+
var SIBLING_MARKUP_SOURCES = [
|
|
74162
|
+
CITE_GROUP_RE,
|
|
74163
|
+
FLAG_RE,
|
|
74164
|
+
FIX_LONG_RE,
|
|
74165
|
+
CAUSE_LONG_RE,
|
|
74166
|
+
CONFIRM_LONG_RE,
|
|
74167
|
+
REFUTE_LONG_RE,
|
|
74168
|
+
ATTEMPT_RE,
|
|
74169
|
+
CONSTRAINT_RE
|
|
74170
|
+
].map((re) => ({ source: re.source, flags: re.flags.includes("g") ? re.flags : `${re.flags}g` }));
|
|
74171
|
+
function maskSiblingMarkup(sentence, tagStart, tagEnd) {
|
|
74172
|
+
let masked = sentence;
|
|
74173
|
+
for (const { source, flags: flags2 } of SIBLING_MARKUP_SOURCES) {
|
|
74174
|
+
masked = masked.replace(new RegExp(source, flags2), (m, ...rest2) => {
|
|
74175
|
+
const at = rest2.find((v) => typeof v === "number");
|
|
74176
|
+
if (at <= tagStart && at + m.length >= tagEnd) return m;
|
|
74177
|
+
return " ".repeat(m.length);
|
|
74178
|
+
});
|
|
74179
|
+
}
|
|
74180
|
+
return masked;
|
|
74181
|
+
}
|
|
74182
|
+
var RESIDUAL_OPENER_RE = new RegExp(
|
|
74183
|
+
TAG_OPENERS.map((o) => o.startsWith("(") ? String.raw`\(\s*${o.slice(1, -1)}\s*:` : o.replace(/[[\]!?]/g, "\\$&")).join("|"),
|
|
74184
|
+
"i"
|
|
74185
|
+
);
|
|
74148
74186
|
function fixRationaleBefore(sentence, idx) {
|
|
74149
|
-
const
|
|
74187
|
+
const masked = maskSiblingMarkup(sentence, idx, idx + 1);
|
|
74188
|
+
let start2 = Math.max(0, idx - FIX_RATIONALE_WINDOW);
|
|
74189
|
+
if (start2 > 0 && /\S/.test(masked[start2 - 1]) && /\S/.test(masked[start2])) {
|
|
74190
|
+
const ws = masked.slice(start2, idx).search(/\s/);
|
|
74191
|
+
start2 = ws < 0 ? idx : start2 + ws;
|
|
74192
|
+
}
|
|
74193
|
+
const win = masked.slice(start2, idx);
|
|
74150
74194
|
const m = /[.;!?—][^.;!?—]*$/.exec(win);
|
|
74151
74195
|
const clause = m ? win.slice(m.index + 1) : win;
|
|
74152
74196
|
return clause.replace(/\s+/g, " ").trim();
|
|
74153
74197
|
}
|
|
74154
74198
|
function fixRationaleAfter(sentence, endIdx) {
|
|
74155
|
-
|
|
74156
|
-
|
|
74199
|
+
if (/^\s*[)\]}]/.test(sentence.slice(endIdx))) return "";
|
|
74200
|
+
const masked = maskSiblingMarkup(sentence, endIdx - 1, endIdx);
|
|
74201
|
+
let end = Math.min(masked.length, endIdx + FIX_RATIONALE_WINDOW);
|
|
74202
|
+
if (end < masked.length && /\S/.test(masked[end - 1]) && /\S/.test(masked[end])) {
|
|
74203
|
+
const lastWs = masked.slice(endIdx, end).search(/\s\S*$/);
|
|
74204
|
+
end = lastWs < 0 ? endIdx : endIdx + lastWs;
|
|
74205
|
+
}
|
|
74206
|
+
let win = masked.slice(endIdx, end);
|
|
74207
|
+
const residual = RESIDUAL_OPENER_RE.exec(win);
|
|
74208
|
+
if (residual) win = win.slice(0, residual.index);
|
|
74157
74209
|
const stripped = win.replace(/^[\s—:–,-]+/, "");
|
|
74158
74210
|
const m = /^[^.;!?—]*/.exec(stripped);
|
|
74159
74211
|
const clause = (m ? m[0] : stripped).replace(/\s+/g, " ").trim();
|
|
@@ -74165,6 +74217,78 @@ function deriveFixRationale(sentence, startIdx, endIdx) {
|
|
|
74165
74217
|
if (before.length >= FIX_RATIONALE_MIN) return before;
|
|
74166
74218
|
return fixRationaleAfter(sentence, endIdx);
|
|
74167
74219
|
}
|
|
74220
|
+
var LEADING_OPENER_RE = new RegExp(String.raw`^(?:${RESIDUAL_OPENER_RE.source})(?:#[a-z][\w-]{0,63})?\s*`, "i");
|
|
74221
|
+
var WRAPPER_PAIRS = [["(", ")"], ["[", "]"]];
|
|
74222
|
+
var LEADING_HANDLES_RE = /^(?:\[[a-z0-9][\w-]{0,80}\]\s*,?\s*)+/i;
|
|
74223
|
+
function leadingBracketClose(t) {
|
|
74224
|
+
const pair = WRAPPER_PAIRS.find(([open2]) => t.startsWith(open2));
|
|
74225
|
+
if (!pair) return null;
|
|
74226
|
+
let depth = 0;
|
|
74227
|
+
for (let i2 = 0; i2 < t.length; i2++) {
|
|
74228
|
+
if (t[i2] === pair[0]) depth++;
|
|
74229
|
+
else if (t[i2] === pair[1] && --depth === 0) return i2;
|
|
74230
|
+
}
|
|
74231
|
+
return -1;
|
|
74232
|
+
}
|
|
74233
|
+
function trailingBracketStray(t) {
|
|
74234
|
+
const pair = WRAPPER_PAIRS.find(([, close]) => t.endsWith(close));
|
|
74235
|
+
if (!pair) return false;
|
|
74236
|
+
let depth = 0;
|
|
74237
|
+
for (const ch of t.slice(0, -1)) {
|
|
74238
|
+
if (ch === pair[0]) depth++;
|
|
74239
|
+
else if (ch === pair[1] && depth > 0) depth--;
|
|
74240
|
+
}
|
|
74241
|
+
return depth === 0;
|
|
74242
|
+
}
|
|
74243
|
+
function cleanTagText(text) {
|
|
74244
|
+
let t = text.replace(/\s+/g, " ").trim();
|
|
74245
|
+
for (let pass = 0; pass < 8; pass++) {
|
|
74246
|
+
const before = t;
|
|
74247
|
+
const close = leadingBracketClose(t);
|
|
74248
|
+
const opener = close === null ? null : LEADING_OPENER_RE.exec(t);
|
|
74249
|
+
if (close === -1) {
|
|
74250
|
+
t = t.slice(opener ? opener[0].length : 1).trim();
|
|
74251
|
+
} else if (opener && close === t.length - 1) {
|
|
74252
|
+
t = t.slice(opener[0].length, -1).trim();
|
|
74253
|
+
}
|
|
74254
|
+
if (opener && t !== before) t = t.replace(LEADING_HANDLES_RE, "").trim();
|
|
74255
|
+
if (trailingBracketStray(t)) t = t.slice(0, -1).trim();
|
|
74256
|
+
if (t === before) break;
|
|
74257
|
+
}
|
|
74258
|
+
return t;
|
|
74259
|
+
}
|
|
74260
|
+
var TAG_TEXT_FIELDS = [
|
|
74261
|
+
"fixRationale",
|
|
74262
|
+
"statement",
|
|
74263
|
+
"causeText",
|
|
74264
|
+
"causeOf",
|
|
74265
|
+
"patternText",
|
|
74266
|
+
"domainText",
|
|
74267
|
+
"packageText",
|
|
74268
|
+
"componentText"
|
|
74269
|
+
];
|
|
74270
|
+
function cleanEmittedTags(tags) {
|
|
74271
|
+
const kept = [];
|
|
74272
|
+
for (const tag of tags) {
|
|
74273
|
+
let emptied = false;
|
|
74274
|
+
for (const field of TAG_TEXT_FIELDS) {
|
|
74275
|
+
const value = tag[field];
|
|
74276
|
+
if (value === void 0) continue;
|
|
74277
|
+
const cleaned = cleanTagText(value);
|
|
74278
|
+
if (field === "fixRationale" && cleaned.length < FIX_RATIONALE_MIN) {
|
|
74279
|
+
delete tag.fixRationale;
|
|
74280
|
+
continue;
|
|
74281
|
+
}
|
|
74282
|
+
if (cleaned.length === 0) emptied = true;
|
|
74283
|
+
tag[field] = cleaned;
|
|
74284
|
+
}
|
|
74285
|
+
const hasReference = tag.handle !== void 0 || (tag.handles?.length ?? 0) > 0 || (tag.refuteHandles?.length ?? 0) > 0;
|
|
74286
|
+
if (emptied && !hasReference) continue;
|
|
74287
|
+
if (tag.kind === "fix" && !hasReference && tag.fixRationale === void 0) continue;
|
|
74288
|
+
kept.push(tag);
|
|
74289
|
+
}
|
|
74290
|
+
return kept;
|
|
74291
|
+
}
|
|
74168
74292
|
function emptyTagDispositions() {
|
|
74169
74293
|
return {
|
|
74170
74294
|
oversizeSegments: 0,
|
|
@@ -74532,7 +74656,7 @@ function parseInlineTagsWithDispositions(text) {
|
|
|
74532
74656
|
}
|
|
74533
74657
|
for (let i2 = seqStart; i2 < out2.length; i2++) out2[i2].seq = seqNo;
|
|
74534
74658
|
}
|
|
74535
|
-
return { tags: out2, dispositions };
|
|
74659
|
+
return { tags: cleanEmittedTags(out2), dispositions };
|
|
74536
74660
|
}
|
|
74537
74661
|
var LABEL_PAIR = {
|
|
74538
74662
|
"Problem>RootCause": "CAUSED_BY",
|
|
@@ -78206,7 +78330,7 @@ function createWatchBreaker(deps) {
|
|
|
78206
78330
|
}
|
|
78207
78331
|
|
|
78208
78332
|
// src/engine.ts
|
|
78209
|
-
var DAEMON_VERSION = true ? "2.0.6-dev.
|
|
78333
|
+
var DAEMON_VERSION = true ? "2.0.6-dev.2559" : "2.0.0-alpha.0";
|
|
78210
78334
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
78211
78335
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
78212
78336
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -80225,7 +80349,7 @@ B: ${b}`,
|
|
|
80225
80349
|
semanticMaintenance() {
|
|
80226
80350
|
const seqBefore = store.currentIngestSeq();
|
|
80227
80351
|
const report = runSemanticMaintenance(store);
|
|
80228
|
-
let hintUpgrade = { upgraded: 0, standing: 0 };
|
|
80352
|
+
let hintUpgrade = { upgraded: 0, standing: 0, unresolvable: 0 };
|
|
80229
80353
|
try {
|
|
80230
80354
|
hintUpgrade = upgradeAnchorHints(store, profile.id, Date.now());
|
|
80231
80355
|
} catch {
|
|
@@ -80242,7 +80366,8 @@ B: ${b}`,
|
|
|
80242
80366
|
claimsEvaluated: report.claimsEvaluated,
|
|
80243
80367
|
seqAdvanced: store.currentIngestSeq() - seqBefore,
|
|
80244
80368
|
anchorHintsUpgraded: hintUpgrade.upgraded,
|
|
80245
|
-
anchorHintsStanding: hintUpgrade.standing
|
|
80369
|
+
anchorHintsStanding: hintUpgrade.standing,
|
|
80370
|
+
anchorHintsUnresolvable: hintUpgrade.unresolvable
|
|
80246
80371
|
});
|
|
80247
80372
|
if (report.revisitsCleared > 0 || report.fixCandidatesSettled > 0 || report.designResolved > 0) {
|
|
80248
80373
|
refreshContextNow();
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -16968,6 +16968,8 @@ function upsertFile(store2, id, f, workspaceId, skip) {
|
|
|
16968
16968
|
contentHash = createHash3("sha256").update(readFileSync2(f.absPath)).digest("hex");
|
|
16969
16969
|
} catch {
|
|
16970
16970
|
}
|
|
16971
|
+
const carried = { ...store2.getNode(id)?.attrs ?? {} };
|
|
16972
|
+
for (const owned of ["contentHash", "indexSkipped", "symbolCount"]) delete carried[owned];
|
|
16971
16973
|
const node = {
|
|
16972
16974
|
id,
|
|
16973
16975
|
label: "File",
|
|
@@ -16986,6 +16988,7 @@ function upsertFile(store2, id, f, workspaceId, skip) {
|
|
|
16986
16988
|
community: null,
|
|
16987
16989
|
stability: "stable",
|
|
16988
16990
|
attrs: {
|
|
16991
|
+
...carried,
|
|
16989
16992
|
absPath: f.absPath,
|
|
16990
16993
|
relPath: f.relPath,
|
|
16991
16994
|
size: f.size,
|