@inerrata-corporation/errata 2.0.17-dev.3564 → 2.0.17-dev.3571
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 +55 -34
- package/package.json +1 -1
- package/pass-worker.mjs +54 -33
package/errata.mjs
CHANGED
|
@@ -22314,20 +22314,13 @@ var init_intent = __esm({
|
|
|
22314
22314
|
function isLegacyAnchor(attrs) {
|
|
22315
22315
|
return attrs?.["captureTime"] === true && attrs["anchorProvenance"] === void 0;
|
|
22316
22316
|
}
|
|
22317
|
-
function
|
|
22318
|
-
const report = {
|
|
22319
|
-
repaired: [],
|
|
22320
|
-
retiredGuesses: 0,
|
|
22321
|
-
noPathNamed: 0,
|
|
22322
|
-
pathUnknown: 0,
|
|
22323
|
-
alreadyCorrect: 0
|
|
22324
|
-
};
|
|
22317
|
+
function filePathResolver(store) {
|
|
22325
22318
|
const byPath = /* @__PURE__ */ new Map();
|
|
22326
22319
|
for (const f of store.findNodesByLabel("File")) {
|
|
22327
22320
|
const path2 = String(f.attrs["relPath"] ?? f.description ?? "");
|
|
22328
22321
|
if (path2) byPath.set(path2, { id: f.id, path: path2 });
|
|
22329
22322
|
}
|
|
22330
|
-
|
|
22323
|
+
return (named) => {
|
|
22331
22324
|
const exact = byPath.get(named);
|
|
22332
22325
|
if (exact) return exact;
|
|
22333
22326
|
const hits = [...byPath.values()].filter(
|
|
@@ -22335,6 +22328,40 @@ function repairLegacyAnchorsFromStatement(store, ts) {
|
|
|
22335
22328
|
);
|
|
22336
22329
|
return hits.length === 1 ? hits[0] : null;
|
|
22337
22330
|
};
|
|
22331
|
+
}
|
|
22332
|
+
function statementTarget(statement, resolvePath2) {
|
|
22333
|
+
for (const m of statement.matchAll(STATEMENT_PATH_RE)) {
|
|
22334
|
+
const f = resolvePath2(m[0]);
|
|
22335
|
+
if (f) return f;
|
|
22336
|
+
}
|
|
22337
|
+
return null;
|
|
22338
|
+
}
|
|
22339
|
+
function restatedAnchor(problemId, fileId, restatedFrom, ts) {
|
|
22340
|
+
return {
|
|
22341
|
+
id: `edge_${digest({ from: problemId, type: "ANCHORED_AT", to: fileId })}`.slice(0, 24),
|
|
22342
|
+
from: problemId,
|
|
22343
|
+
to: fileId,
|
|
22344
|
+
type: "ANCHORED_AT",
|
|
22345
|
+
// Same confidence a capture-time anchor enters at: the source is the
|
|
22346
|
+
// agent's own statement either way, only the moment of reading differs.
|
|
22347
|
+
confidence: 0.4,
|
|
22348
|
+
extractionSource: "agent-observed",
|
|
22349
|
+
createdAt: ts,
|
|
22350
|
+
lastSeenAt: ts,
|
|
22351
|
+
navSuccesses: 0,
|
|
22352
|
+
navFailures: 0,
|
|
22353
|
+
attrs: { anchorProvenance: "restated", restatedFrom, restatedAt: ts }
|
|
22354
|
+
};
|
|
22355
|
+
}
|
|
22356
|
+
function repairLegacyAnchorsFromStatement(store, ts) {
|
|
22357
|
+
const report = {
|
|
22358
|
+
repaired: [],
|
|
22359
|
+
retiredGuesses: 0,
|
|
22360
|
+
noPathNamed: 0,
|
|
22361
|
+
pathUnknown: 0,
|
|
22362
|
+
alreadyCorrect: 0
|
|
22363
|
+
};
|
|
22364
|
+
const resolvePath2 = filePathResolver(store);
|
|
22338
22365
|
for (const p of store.findNodesByLabel("Problem")) {
|
|
22339
22366
|
try {
|
|
22340
22367
|
const anchors = store.outEdges(p.id, ["ANCHORED_AT"]);
|
|
@@ -22374,25 +22401,7 @@ function repairLegacyAnchorsFromStatement(store, ts) {
|
|
|
22374
22401
|
report.pathUnknown++;
|
|
22375
22402
|
continue;
|
|
22376
22403
|
}
|
|
22377
|
-
store.mergeEdge(
|
|
22378
|
-
id: `edge_${digest({ from: p.id, type: "ANCHORED_AT", to: target.id })}`.slice(0, 24),
|
|
22379
|
-
from: p.id,
|
|
22380
|
-
to: target.id,
|
|
22381
|
-
type: "ANCHORED_AT",
|
|
22382
|
-
// Same confidence a capture-time anchor enters at: the source is the
|
|
22383
|
-
// agent's own statement either way, only the moment of reading differs.
|
|
22384
|
-
confidence: 0.4,
|
|
22385
|
-
extractionSource: "agent-observed",
|
|
22386
|
-
createdAt: ts,
|
|
22387
|
-
lastSeenAt: ts,
|
|
22388
|
-
navSuccesses: 0,
|
|
22389
|
-
navFailures: 0,
|
|
22390
|
-
attrs: {
|
|
22391
|
-
anchorProvenance: "restated",
|
|
22392
|
-
restatedFrom: guessedPaths[0] ?? "",
|
|
22393
|
-
restatedAt: ts
|
|
22394
|
-
}
|
|
22395
|
-
});
|
|
22404
|
+
store.mergeEdge(restatedAnchor(p.id, target.id, guessedPaths[0] ?? "", ts));
|
|
22396
22405
|
for (const e of legacy) {
|
|
22397
22406
|
if (e.to !== target.id) store.closeEdge(e.id, ts);
|
|
22398
22407
|
}
|
|
@@ -22412,23 +22421,35 @@ function backfillLegacyAnchors(store, ts) {
|
|
|
22412
22421
|
const report = {
|
|
22413
22422
|
demotedEdges: 0,
|
|
22414
22423
|
demotedProblems: 0,
|
|
22424
|
+
restatedProblems: 0,
|
|
22415
22425
|
labeledEdges: 0,
|
|
22416
22426
|
suspects: []
|
|
22417
22427
|
};
|
|
22428
|
+
let resolvePath2;
|
|
22418
22429
|
for (const p of store.findNodesByLabel("Problem")) {
|
|
22419
|
-
const legacy = store.outEdges(p.id, ["ANCHORED_AT"]).filter((e) => isLegacyAnchor(e.attrs));
|
|
22420
|
-
if (legacy.length === 0) continue;
|
|
22421
22430
|
const resolved = p.attrs["resolvedAt"] !== void 0;
|
|
22431
|
+
const legacy = store.outEdges(p.id, ["ANCHORED_AT"]).filter((e) => isLegacyAnchor(e.attrs) || !resolved && e.attrs?.["anchorProvenance"] === "legacy");
|
|
22432
|
+
if (legacy.length === 0) continue;
|
|
22422
22433
|
try {
|
|
22423
22434
|
if (!resolved) {
|
|
22424
|
-
|
|
22435
|
+
resolvePath2 ??= filePathResolver(store);
|
|
22436
|
+
const target = statementTarget(String(p.description ?? ""), resolvePath2);
|
|
22437
|
+
if (target) {
|
|
22438
|
+
const guessed = store.getNode(legacy[0].to);
|
|
22439
|
+
store.mergeEdge(
|
|
22440
|
+
restatedAnchor(p.id, target.id, String(guessed?.attrs["relPath"] ?? guessed?.description ?? ""), ts)
|
|
22441
|
+
);
|
|
22442
|
+
report.restatedProblems++;
|
|
22443
|
+
}
|
|
22444
|
+
const retired = legacy.filter((e) => !(target && e.to === target.id));
|
|
22445
|
+
for (const e of retired) {
|
|
22425
22446
|
const file2 = store.getNode(e.to);
|
|
22426
22447
|
const path2 = String(file2?.attrs["relPath"] ?? file2?.description ?? "");
|
|
22427
22448
|
if (path2) recordAnchorHint(store, p.id, path2, "legacy", ts);
|
|
22428
|
-
store.
|
|
22449
|
+
store.closeEdge(e.id, ts);
|
|
22429
22450
|
report.demotedEdges++;
|
|
22430
22451
|
}
|
|
22431
|
-
report.demotedProblems++;
|
|
22452
|
+
if (retired.length > 0) report.demotedProblems++;
|
|
22432
22453
|
continue;
|
|
22433
22454
|
}
|
|
22434
22455
|
for (const e of legacy) {
|
|
@@ -82664,7 +82685,7 @@ function createWatchBreaker(deps) {
|
|
|
82664
82685
|
}
|
|
82665
82686
|
|
|
82666
82687
|
// src/engine.ts
|
|
82667
|
-
var DAEMON_VERSION = true ? "2.0.17-dev.
|
|
82688
|
+
var DAEMON_VERSION = true ? "2.0.17-dev.3571" : "2.0.0-alpha.0";
|
|
82668
82689
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
82669
82690
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
82670
82691
|
var GIT_OP_MUTE_MS = 4e3;
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -27547,20 +27547,13 @@ var STATEMENT_PATH_RE = new RegExp(
|
|
|
27547
27547
|
String.raw`(?:[\w.+-]+\/)+[\w.+-]+\.(?:${anchorableExtensionAlternation()})`,
|
|
27548
27548
|
"g"
|
|
27549
27549
|
);
|
|
27550
|
-
function
|
|
27551
|
-
const report = {
|
|
27552
|
-
repaired: [],
|
|
27553
|
-
retiredGuesses: 0,
|
|
27554
|
-
noPathNamed: 0,
|
|
27555
|
-
pathUnknown: 0,
|
|
27556
|
-
alreadyCorrect: 0
|
|
27557
|
-
};
|
|
27550
|
+
function filePathResolver(store2) {
|
|
27558
27551
|
const byPath = /* @__PURE__ */ new Map();
|
|
27559
27552
|
for (const f of store2.findNodesByLabel("File")) {
|
|
27560
27553
|
const path = String(f.attrs["relPath"] ?? f.description ?? "");
|
|
27561
27554
|
if (path) byPath.set(path, { id: f.id, path });
|
|
27562
27555
|
}
|
|
27563
|
-
|
|
27556
|
+
return (named) => {
|
|
27564
27557
|
const exact = byPath.get(named);
|
|
27565
27558
|
if (exact) return exact;
|
|
27566
27559
|
const hits = [...byPath.values()].filter(
|
|
@@ -27568,6 +27561,40 @@ function repairLegacyAnchorsFromStatement(store2, ts) {
|
|
|
27568
27561
|
);
|
|
27569
27562
|
return hits.length === 1 ? hits[0] : null;
|
|
27570
27563
|
};
|
|
27564
|
+
}
|
|
27565
|
+
function statementTarget(statement, resolvePath) {
|
|
27566
|
+
for (const m of statement.matchAll(STATEMENT_PATH_RE)) {
|
|
27567
|
+
const f = resolvePath(m[0]);
|
|
27568
|
+
if (f) return f;
|
|
27569
|
+
}
|
|
27570
|
+
return null;
|
|
27571
|
+
}
|
|
27572
|
+
function restatedAnchor(problemId, fileId, restatedFrom, ts) {
|
|
27573
|
+
return {
|
|
27574
|
+
id: `edge_${digest({ from: problemId, type: "ANCHORED_AT", to: fileId })}`.slice(0, 24),
|
|
27575
|
+
from: problemId,
|
|
27576
|
+
to: fileId,
|
|
27577
|
+
type: "ANCHORED_AT",
|
|
27578
|
+
// Same confidence a capture-time anchor enters at: the source is the
|
|
27579
|
+
// agent's own statement either way, only the moment of reading differs.
|
|
27580
|
+
confidence: 0.4,
|
|
27581
|
+
extractionSource: "agent-observed",
|
|
27582
|
+
createdAt: ts,
|
|
27583
|
+
lastSeenAt: ts,
|
|
27584
|
+
navSuccesses: 0,
|
|
27585
|
+
navFailures: 0,
|
|
27586
|
+
attrs: { anchorProvenance: "restated", restatedFrom, restatedAt: ts }
|
|
27587
|
+
};
|
|
27588
|
+
}
|
|
27589
|
+
function repairLegacyAnchorsFromStatement(store2, ts) {
|
|
27590
|
+
const report = {
|
|
27591
|
+
repaired: [],
|
|
27592
|
+
retiredGuesses: 0,
|
|
27593
|
+
noPathNamed: 0,
|
|
27594
|
+
pathUnknown: 0,
|
|
27595
|
+
alreadyCorrect: 0
|
|
27596
|
+
};
|
|
27597
|
+
const resolvePath = filePathResolver(store2);
|
|
27571
27598
|
for (const p of store2.findNodesByLabel("Problem")) {
|
|
27572
27599
|
try {
|
|
27573
27600
|
const anchors = store2.outEdges(p.id, ["ANCHORED_AT"]);
|
|
@@ -27607,25 +27634,7 @@ function repairLegacyAnchorsFromStatement(store2, ts) {
|
|
|
27607
27634
|
report.pathUnknown++;
|
|
27608
27635
|
continue;
|
|
27609
27636
|
}
|
|
27610
|
-
store2.mergeEdge(
|
|
27611
|
-
id: `edge_${digest({ from: p.id, type: "ANCHORED_AT", to: target.id })}`.slice(0, 24),
|
|
27612
|
-
from: p.id,
|
|
27613
|
-
to: target.id,
|
|
27614
|
-
type: "ANCHORED_AT",
|
|
27615
|
-
// Same confidence a capture-time anchor enters at: the source is the
|
|
27616
|
-
// agent's own statement either way, only the moment of reading differs.
|
|
27617
|
-
confidence: 0.4,
|
|
27618
|
-
extractionSource: "agent-observed",
|
|
27619
|
-
createdAt: ts,
|
|
27620
|
-
lastSeenAt: ts,
|
|
27621
|
-
navSuccesses: 0,
|
|
27622
|
-
navFailures: 0,
|
|
27623
|
-
attrs: {
|
|
27624
|
-
anchorProvenance: "restated",
|
|
27625
|
-
restatedFrom: guessedPaths[0] ?? "",
|
|
27626
|
-
restatedAt: ts
|
|
27627
|
-
}
|
|
27628
|
-
});
|
|
27637
|
+
store2.mergeEdge(restatedAnchor(p.id, target.id, guessedPaths[0] ?? "", ts));
|
|
27629
27638
|
for (const e of legacy) {
|
|
27630
27639
|
if (e.to !== target.id) store2.closeEdge(e.id, ts);
|
|
27631
27640
|
}
|
|
@@ -27645,23 +27654,35 @@ function backfillLegacyAnchors(store2, ts) {
|
|
|
27645
27654
|
const report = {
|
|
27646
27655
|
demotedEdges: 0,
|
|
27647
27656
|
demotedProblems: 0,
|
|
27657
|
+
restatedProblems: 0,
|
|
27648
27658
|
labeledEdges: 0,
|
|
27649
27659
|
suspects: []
|
|
27650
27660
|
};
|
|
27661
|
+
let resolvePath;
|
|
27651
27662
|
for (const p of store2.findNodesByLabel("Problem")) {
|
|
27652
|
-
const legacy = store2.outEdges(p.id, ["ANCHORED_AT"]).filter((e) => isLegacyAnchor(e.attrs));
|
|
27653
|
-
if (legacy.length === 0) continue;
|
|
27654
27663
|
const resolved = p.attrs["resolvedAt"] !== void 0;
|
|
27664
|
+
const legacy = store2.outEdges(p.id, ["ANCHORED_AT"]).filter((e) => isLegacyAnchor(e.attrs) || !resolved && e.attrs?.["anchorProvenance"] === "legacy");
|
|
27665
|
+
if (legacy.length === 0) continue;
|
|
27655
27666
|
try {
|
|
27656
27667
|
if (!resolved) {
|
|
27657
|
-
|
|
27668
|
+
resolvePath ??= filePathResolver(store2);
|
|
27669
|
+
const target = statementTarget(String(p.description ?? ""), resolvePath);
|
|
27670
|
+
if (target) {
|
|
27671
|
+
const guessed = store2.getNode(legacy[0].to);
|
|
27672
|
+
store2.mergeEdge(
|
|
27673
|
+
restatedAnchor(p.id, target.id, String(guessed?.attrs["relPath"] ?? guessed?.description ?? ""), ts)
|
|
27674
|
+
);
|
|
27675
|
+
report.restatedProblems++;
|
|
27676
|
+
}
|
|
27677
|
+
const retired = legacy.filter((e) => !(target && e.to === target.id));
|
|
27678
|
+
for (const e of retired) {
|
|
27658
27679
|
const file2 = store2.getNode(e.to);
|
|
27659
27680
|
const path = String(file2?.attrs["relPath"] ?? file2?.description ?? "");
|
|
27660
27681
|
if (path) recordAnchorHint(store2, p.id, path, "legacy", ts);
|
|
27661
|
-
store2.
|
|
27682
|
+
store2.closeEdge(e.id, ts);
|
|
27662
27683
|
report.demotedEdges++;
|
|
27663
27684
|
}
|
|
27664
|
-
report.demotedProblems++;
|
|
27685
|
+
if (retired.length > 0) report.demotedProblems++;
|
|
27665
27686
|
continue;
|
|
27666
27687
|
}
|
|
27667
27688
|
for (const e of legacy) {
|