@inerrata-corporation/errata 2.0.17-dev.3538 → 2.0.17-dev.3562

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.
@@ -15796,6 +15796,22 @@ var init_project_wire_attrs = __esm({
15796
15796
  }
15797
15797
  });
15798
15798
 
15799
+ // ../../packages/shared/src/edit-placeholder.ts
15800
+ function isEditPlaceholderSolution(node) {
15801
+ if (node.label !== "Solution") return false;
15802
+ const text = node.description.trim().toLowerCase();
15803
+ if (text.startsWith(AUTO_MINT_PREFIX)) return true;
15804
+ return /^fix for [^\r\n]+ \(episode_[^)]+\)$/.test(text) && !(typeof node.attrs?.["rationale"] === "string" && node.attrs["rationale"].trim());
15805
+ }
15806
+ var AUTO_MINT_PREFIX, EDIT_PLACEHOLDER_RETIREMENT;
15807
+ var init_edit_placeholder = __esm({
15808
+ "../../packages/shared/src/edit-placeholder.ts"() {
15809
+ "use strict";
15810
+ AUTO_MINT_PREFIX = "addressed by an edit to ";
15811
+ EDIT_PLACEHOLDER_RETIREMENT = "edit-placeholder-solution";
15812
+ }
15813
+ });
15814
+
15799
15815
  // ../../packages/shared/src/index.ts
15800
15816
  var init_src = __esm({
15801
15817
  "../../packages/shared/src/index.ts"() {
@@ -15827,6 +15843,7 @@ var init_src = __esm({
15827
15843
  init_triage_canon();
15828
15844
  init_history_text();
15829
15845
  init_project_wire_attrs();
15846
+ init_edit_placeholder();
15830
15847
  }
15831
15848
  });
15832
15849
 
@@ -16331,6 +16348,54 @@ function repairSessionEvidence(input, aliases = /* @__PURE__ */ new Map()) {
16331
16348
  return repaired;
16332
16349
  }
16333
16350
 
16351
+ // ../../packages/local-graph/src/edit-placeholder-retirement.ts
16352
+ init_src();
16353
+ var EDIT_PLACEHOLDER_FLOOR_KEY = "edit-placeholder-retirement-1";
16354
+ function installEditPlaceholderRetirement(db) {
16355
+ if (db.prepare("SELECT value FROM store_meta WHERE key=?").get(EDIT_PLACEHOLDER_FLOOR_KEY)) return;
16356
+ const timestamp = `CAST(unixepoch('subsec') * 1000 AS INTEGER)`;
16357
+ const placeholder = (n) => `(${n}.label='Solution' AND (
16358
+ lower(trim(${n}.description)) LIKE '${AUTO_MINT_PREFIX}%'
16359
+ OR (lower(trim(${n}.description)) GLOB 'fix for * (episode_*)'
16360
+ AND instr(${n}.description,char(10))=0 AND instr(${n}.description,char(13))=0
16361
+ AND trim(coalesce(json_extract(${n}.attrs_json,'$.rationale'),''))='')))`;
16362
+ const contaminated = (n) => `(${n}.label='Claim' AND json_extract(${n}.attrs_json,'$.abstractionLevel')>=2
16363
+ AND EXISTS(SELECT 1 FROM json_each(${n}.attrs_json,'$.members') m JOIN nodes s ON s.id=m.value
16364
+ WHERE ${placeholder("s")} OR json_extract(s.attrs_json,'$.retiredReason')='${EDIT_PLACEHOLDER_RETIREMENT}'))`;
16365
+ const retire = (where, reason) => `UPDATE nodes SET valid_to=coalesce(valid_to,${timestamp}),
16366
+ attrs_json=json_set(attrs_json,'$.retiredReason','${reason}','$.retiredAt',${timestamp})
16367
+ WHERE (valid_to IS NULL OR coalesce(json_extract(attrs_json,'$.retiredReason'),'')<>'${reason}') AND (${where});`;
16368
+ const closeEdges = (where) => `UPDATE edges SET valid_to=${timestamp} WHERE valid_to IS NULL AND (${where});`;
16369
+ const retired = `(SELECT id FROM nodes WHERE json_extract(attrs_json,'$.retiredReason') IN ('${EDIT_PLACEHOLDER_RETIREMENT}','edit-placeholder-member'))`;
16370
+ const markParents = `UPDATE nodes SET attrs_json=json_set(attrs_json,'$.retiredEditPlaceholder',json('true'))
16371
+ WHERE label='Problem' AND coalesce(json_extract(attrs_json,'$.retiredEditPlaceholder'),0)<>1
16372
+ AND id IN (SELECT e.from_id FROM edges e JOIN nodes s ON s.id=e.to_id WHERE e.type='SOLVED_BY'
16373
+ AND s.label='Solution' AND json_extract(s.attrs_json,'$.retiredReason')='${EDIT_PLACEHOLDER_RETIREMENT}');`;
16374
+ db.transaction(() => {
16375
+ db.exec(retire(placeholder("nodes"), EDIT_PLACEHOLDER_RETIREMENT));
16376
+ db.exec(retire(contaminated("nodes"), "edit-placeholder-member"));
16377
+ db.exec(markParents);
16378
+ db.exec(closeEdges(`from_id IN ${retired} OR to_id IN ${retired}`));
16379
+ for (const operation of ["INSERT", "UPDATE OF label,description,attrs_json,valid_to"]) {
16380
+ const suffix = operation.startsWith("INSERT") ? "insert" : "update";
16381
+ db.exec(`CREATE TRIGGER edit_placeholder_nodes_${suffix} AFTER ${operation} ON nodes
16382
+ WHEN NEW.valid_to IS NULL AND (${placeholder("NEW")} OR ${contaminated("NEW")}) BEGIN
16383
+ ${retire(`id=NEW.id AND label='Solution'`, EDIT_PLACEHOLDER_RETIREMENT)}
16384
+ ${retire(contaminated("nodes"), "edit-placeholder-member")}
16385
+ ${markParents}
16386
+ ${closeEdges(`from_id IN ${retired} OR to_id IN ${retired}`)}
16387
+ END;`);
16388
+ db.exec(`CREATE TRIGGER edit_placeholder_edges_${suffix} AFTER ${suffix.toUpperCase()} ON edges
16389
+ WHEN NEW.valid_to IS NULL AND EXISTS(SELECT 1 FROM nodes n WHERE n.id IN (NEW.from_id,NEW.to_id)
16390
+ AND json_extract(n.attrs_json,'$.retiredReason') IN ('${EDIT_PLACEHOLDER_RETIREMENT}','edit-placeholder-member')) BEGIN
16391
+ ${markParents}
16392
+ ${closeEdges("id=NEW.id")}
16393
+ END;`);
16394
+ }
16395
+ db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(EDIT_PLACEHOLDER_FLOOR_KEY, "installed");
16396
+ });
16397
+ }
16398
+
16334
16399
  // ../../packages/local-graph/src/store.ts
16335
16400
  var LOCAL_RULE_OVERRIDES = {
16336
16401
  ANCHORED_AT: {
@@ -16546,6 +16611,7 @@ function rowToEdge(r) {
16546
16611
  };
16547
16612
  }
16548
16613
  var FINGERPRINT_INDEXED_LABELS = ["Problem", "Vulnerability", "Solution", "RootCause"];
16614
+ var NODE_LABELS_CHUNK = 256;
16549
16615
  var SqliteGraphStore = class {
16550
16616
  db;
16551
16617
  // Typed edge lookups build their SQL from the number of types asked for, and
@@ -16582,6 +16648,7 @@ var SqliteGraphStore = class {
16582
16648
  }
16583
16649
  this.db.exec(TEMPORAL_INDEX_SQL);
16584
16650
  installHistoryCacheFloor(this.db);
16651
+ installEditPlaceholderRetirement(this.db);
16585
16652
  if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
16586
16653
  this.db.transaction(() => {
16587
16654
  this.repairSessionAliases();
@@ -17047,6 +17114,19 @@ var SqliteGraphStore = class {
17047
17114
  const row = this.stmts.getNode.get(id);
17048
17115
  return row ? rowToNode(row) : null;
17049
17116
  }
17117
+ nodeLabels(ids) {
17118
+ const width = NODE_LABELS_CHUNK;
17119
+ const stmt = this.typedEdgeStmt(
17120
+ `SELECT id, label FROM nodes WHERE id IN (${Array.from({ length: width }, () => "?").join(",")})`
17121
+ );
17122
+ const labels = /* @__PURE__ */ new Map();
17123
+ for (let i = 0; i < ids.length; i += width) {
17124
+ const chunk = ids.slice(i, i + width);
17125
+ while (chunk.length < width) chunk.push(null);
17126
+ for (const row of stmt.all(...chunk)) labels.set(row.id, row.label);
17127
+ }
17128
+ return labels;
17129
+ }
17050
17130
  getEdge(id) {
17051
17131
  const row = this.stmts.getEdge.get(id);
17052
17132
  return row ? rowToEdge(row) : null;
@@ -17128,8 +17208,8 @@ var SqliteGraphStore = class {
17128
17208
  qname: typeof r.qname === "string" ? r.qname : null
17129
17209
  }));
17130
17210
  }
17131
- findAllVersionsByLabel(label) {
17132
- const rows = this.stmts.findByLabelAll.all(label);
17211
+ findAllVersionsByLabel(label, attribute) {
17212
+ const rows = attribute ? this.db.prepare("SELECT * FROM nodes WHERE label = ? AND json_extract(attrs_json, ?) = ?").all(label, `$.${attribute.path}`, attribute.value) : this.stmts.findByLabelAll.all(label);
17133
17213
  return rows.map(rowToNode);
17134
17214
  }
17135
17215
  searchNodes(opts) {
@@ -17573,8 +17653,8 @@ init_src();
17573
17653
  init_src();
17574
17654
 
17575
17655
  // ../../packages/local-graph/src/design-problem.ts
17656
+ init_src();
17576
17657
  var RECURRENCE_DEBOUNCE_MS = 60 * 60 * 1e3;
17577
- var AUTO_MINT_PREFIX = "addressed by an edit to ";
17578
17658
 
17579
17659
  // ../../packages/local-graph/src/intent.ts
17580
17660
  init_src();
@@ -17589,6 +17669,7 @@ var STATEMENT_PATH_RE = new RegExp(
17589
17669
 
17590
17670
  // ../../packages/local-graph/src/percolate.ts
17591
17671
  init_src2();
17672
+ init_src();
17592
17673
  var PERCOLATING_LABELS = ["Claim", "Problem", "Solution"];
17593
17674
  var PERCOLATING_EDGES = ["CAUSED_BY", "SOLVED_BY", "CONTRADICTS"];
17594
17675
  var PERCOLATING_DRIFT_EDGES = ["CONTINUES", "REVEALED_BY", "SUPERSEDED_BY", "SPLIT_INTO"];
@@ -17610,6 +17691,10 @@ function percolate(l1, l2, opts) {
17610
17691
  l2.transaction(() => {
17611
17692
  for (const label of PERCOLATING_LABELS) {
17612
17693
  for (const n of l1.findNodesByLabel(label)) {
17694
+ if (isEditPlaceholderSolution(n) || n.attrs["retiredReason"]) {
17695
+ result.nodesSkipped++;
17696
+ continue;
17697
+ }
17613
17698
  if (n.label === "Problem" && n.attrs["resolvedAs"] === PROBLEM_RESOLUTION.FALSE_POSITIVE) continue;
17614
17699
  if (n.attrs["source"] === "cloud") {
17615
17700
  const raw = l2.getMeta?.(`history-correction:${String(n.attrs["cloudNodeId"] ?? n.id)}`);
@@ -18213,6 +18298,7 @@ function induceAbstractions(l2, opts) {
18213
18298
  const ids = /* @__PURE__ */ new Set();
18214
18299
  for (const label of PERCOLATING_LABELS) {
18215
18300
  for (const n of l2.findNodesByLabel(label)) {
18301
+ if (isEditPlaceholderSolution(n) || n.attrs["retiredReason"] || n.validTo != null) continue;
18216
18302
  if (Number(n.attrs["abstractionLevel"] ?? ABSTRACTION_LEVEL.CONCRETE) >= ABSTRACTION_LEVEL.PRINCIPLE) {
18217
18303
  continue;
18218
18304
  }
@@ -18410,6 +18496,7 @@ function buildContextIngest(store, profile, daemonVersion, ignorePatterns = [],
18410
18496
 
18411
18497
  // src/instance-ingest.ts
18412
18498
  init_src();
18499
+ init_src();
18413
18500
  init_src2();
18414
18501
 
18415
18502
  // ../../packages/privacy-edge/src/ontology.ts
@@ -19742,7 +19829,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19742
19829
  semanticEndpoints.set(n.id, contributedWireId(n, opts.destinationKey));
19743
19830
  continue;
19744
19831
  }
19745
- if (label === "Solution" && n.description.startsWith(AUTO_MINT_PREFIX)) {
19832
+ if (isEditPlaceholderSolution(n)) {
19746
19833
  composition.autoMint++;
19747
19834
  continue;
19748
19835
  }
package/errata.mjs CHANGED
@@ -17479,6 +17479,22 @@ var init_project_wire_attrs = __esm({
17479
17479
  }
17480
17480
  });
17481
17481
 
17482
+ // ../../packages/shared/src/edit-placeholder.ts
17483
+ function isEditPlaceholderSolution(node2) {
17484
+ if (node2.label !== "Solution") return false;
17485
+ const text = node2.description.trim().toLowerCase();
17486
+ if (text.startsWith(AUTO_MINT_PREFIX)) return true;
17487
+ return /^fix for [^\r\n]+ \(episode_[^)]+\)$/.test(text) && !(typeof node2.attrs?.["rationale"] === "string" && node2.attrs["rationale"].trim());
17488
+ }
17489
+ var AUTO_MINT_PREFIX, EDIT_PLACEHOLDER_RETIREMENT;
17490
+ var init_edit_placeholder = __esm({
17491
+ "../../packages/shared/src/edit-placeholder.ts"() {
17492
+ "use strict";
17493
+ AUTO_MINT_PREFIX = "addressed by an edit to ";
17494
+ EDIT_PLACEHOLDER_RETIREMENT = "edit-placeholder-solution";
17495
+ }
17496
+ });
17497
+
17482
17498
  // ../../packages/shared/src/index.ts
17483
17499
  var src_exports = {};
17484
17500
  __export(src_exports, {
@@ -17495,6 +17511,7 @@ __export(src_exports, {
17495
17511
  ANCHOR_LABEL_QNAME_RE: () => ANCHOR_LABEL_QNAME_RE,
17496
17512
  ANCHOR_REFUSAL_REASONS: () => ANCHOR_REFUSAL_REASONS,
17497
17513
  ANCHOR_SYMBOL_KINDS: () => ANCHOR_SYMBOL_KINDS,
17514
+ AUTO_MINT_PREFIX: () => AUTO_MINT_PREFIX,
17498
17515
  BELIEF_EDGES: () => BELIEF_EDGES,
17499
17516
  BRIDGE_EDGES: () => BRIDGE_EDGES,
17500
17517
  CAUSAL_EDGES: () => CAUSAL_EDGES,
@@ -17516,6 +17533,7 @@ __export(src_exports, {
17516
17533
  EDGE_CONDUCTANCE_OVERRIDES: () => EDGE_CONDUCTANCE_OVERRIDES,
17517
17534
  EDGE_RULES: () => EDGE_RULES,
17518
17535
  EDGE_WEIGHT: () => EDGE_WEIGHT,
17536
+ EDIT_PLACEHOLDER_RETIREMENT: () => EDIT_PLACEHOLDER_RETIREMENT,
17519
17537
  EVIDENCE_EDGES: () => EVIDENCE_EDGES,
17520
17538
  FILE_ANCHOR_QNAME: () => FILE_ANCHOR_QNAME,
17521
17539
  GIT_EDGES: () => GIT_EDGES,
@@ -17612,6 +17630,7 @@ __export(src_exports, {
17612
17630
  isCloudWritableNodeLabel: () => isCloudWritableNodeLabel,
17613
17631
  isCodeLabel: () => isCodeLabel,
17614
17632
  isContextLabel: () => isContextLabel,
17633
+ isEditPlaceholderSolution: () => isEditPlaceholderSolution,
17615
17634
  isInferredSource: () => isInferredSource,
17616
17635
  isManifestPath: () => isManifestPath,
17617
17636
  isMembraneSaltedId: () => isMembraneSaltedId,
@@ -17709,6 +17728,7 @@ var init_src = __esm({
17709
17728
  init_triage_canon();
17710
17729
  init_history_text();
17711
17730
  init_project_wire_attrs();
17731
+ init_edit_placeholder();
17712
17732
  }
17713
17733
  });
17714
17734
 
@@ -18278,6 +18298,60 @@ var init_session_evidence = __esm({
18278
18298
  }
18279
18299
  });
18280
18300
 
18301
+ // ../../packages/local-graph/src/edit-placeholder-retirement.ts
18302
+ function installEditPlaceholderRetirement(db) {
18303
+ if (db.prepare("SELECT value FROM store_meta WHERE key=?").get(EDIT_PLACEHOLDER_FLOOR_KEY)) return;
18304
+ const timestamp = `CAST(unixepoch('subsec') * 1000 AS INTEGER)`;
18305
+ const placeholder = (n) => `(${n}.label='Solution' AND (
18306
+ lower(trim(${n}.description)) LIKE '${AUTO_MINT_PREFIX}%'
18307
+ OR (lower(trim(${n}.description)) GLOB 'fix for * (episode_*)'
18308
+ AND instr(${n}.description,char(10))=0 AND instr(${n}.description,char(13))=0
18309
+ AND trim(coalesce(json_extract(${n}.attrs_json,'$.rationale'),''))='')))`;
18310
+ const contaminated = (n) => `(${n}.label='Claim' AND json_extract(${n}.attrs_json,'$.abstractionLevel')>=2
18311
+ AND EXISTS(SELECT 1 FROM json_each(${n}.attrs_json,'$.members') m JOIN nodes s ON s.id=m.value
18312
+ WHERE ${placeholder("s")} OR json_extract(s.attrs_json,'$.retiredReason')='${EDIT_PLACEHOLDER_RETIREMENT}'))`;
18313
+ const retire = (where, reason) => `UPDATE nodes SET valid_to=coalesce(valid_to,${timestamp}),
18314
+ attrs_json=json_set(attrs_json,'$.retiredReason','${reason}','$.retiredAt',${timestamp})
18315
+ WHERE (valid_to IS NULL OR coalesce(json_extract(attrs_json,'$.retiredReason'),'')<>'${reason}') AND (${where});`;
18316
+ const closeEdges = (where) => `UPDATE edges SET valid_to=${timestamp} WHERE valid_to IS NULL AND (${where});`;
18317
+ const retired = `(SELECT id FROM nodes WHERE json_extract(attrs_json,'$.retiredReason') IN ('${EDIT_PLACEHOLDER_RETIREMENT}','edit-placeholder-member'))`;
18318
+ const markParents = `UPDATE nodes SET attrs_json=json_set(attrs_json,'$.retiredEditPlaceholder',json('true'))
18319
+ WHERE label='Problem' AND coalesce(json_extract(attrs_json,'$.retiredEditPlaceholder'),0)<>1
18320
+ AND id IN (SELECT e.from_id FROM edges e JOIN nodes s ON s.id=e.to_id WHERE e.type='SOLVED_BY'
18321
+ AND s.label='Solution' AND json_extract(s.attrs_json,'$.retiredReason')='${EDIT_PLACEHOLDER_RETIREMENT}');`;
18322
+ db.transaction(() => {
18323
+ db.exec(retire(placeholder("nodes"), EDIT_PLACEHOLDER_RETIREMENT));
18324
+ db.exec(retire(contaminated("nodes"), "edit-placeholder-member"));
18325
+ db.exec(markParents);
18326
+ db.exec(closeEdges(`from_id IN ${retired} OR to_id IN ${retired}`));
18327
+ for (const operation of ["INSERT", "UPDATE OF label,description,attrs_json,valid_to"]) {
18328
+ const suffix = operation.startsWith("INSERT") ? "insert" : "update";
18329
+ db.exec(`CREATE TRIGGER edit_placeholder_nodes_${suffix} AFTER ${operation} ON nodes
18330
+ WHEN NEW.valid_to IS NULL AND (${placeholder("NEW")} OR ${contaminated("NEW")}) BEGIN
18331
+ ${retire(`id=NEW.id AND label='Solution'`, EDIT_PLACEHOLDER_RETIREMENT)}
18332
+ ${retire(contaminated("nodes"), "edit-placeholder-member")}
18333
+ ${markParents}
18334
+ ${closeEdges(`from_id IN ${retired} OR to_id IN ${retired}`)}
18335
+ END;`);
18336
+ db.exec(`CREATE TRIGGER edit_placeholder_edges_${suffix} AFTER ${suffix.toUpperCase()} ON edges
18337
+ WHEN NEW.valid_to IS NULL AND EXISTS(SELECT 1 FROM nodes n WHERE n.id IN (NEW.from_id,NEW.to_id)
18338
+ AND json_extract(n.attrs_json,'$.retiredReason') IN ('${EDIT_PLACEHOLDER_RETIREMENT}','edit-placeholder-member')) BEGIN
18339
+ ${markParents}
18340
+ ${closeEdges("id=NEW.id")}
18341
+ END;`);
18342
+ }
18343
+ db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(EDIT_PLACEHOLDER_FLOOR_KEY, "installed");
18344
+ });
18345
+ }
18346
+ var EDIT_PLACEHOLDER_FLOOR_KEY;
18347
+ var init_edit_placeholder_retirement = __esm({
18348
+ "../../packages/local-graph/src/edit-placeholder-retirement.ts"() {
18349
+ "use strict";
18350
+ init_src();
18351
+ EDIT_PLACEHOLDER_FLOOR_KEY = "edit-placeholder-retirement-1";
18352
+ }
18353
+ });
18354
+
18281
18355
  // ../../packages/local-graph/src/store.ts
18282
18356
  function localEdgeViolation(fromLabel, type, toLabel) {
18283
18357
  if (type in LOCAL_RULE_OVERRIDES) {
@@ -18304,7 +18378,7 @@ function graphStoreNeedsPreparation(path2) {
18304
18378
  for (const match2 of (SCHEMA_SQL + TEMPORAL_INDEX_SQL).matchAll(/CREATE INDEX IF NOT EXISTS (\w+)/g)) {
18305
18379
  if (!indexes.has(match2[1])) return true;
18306
18380
  }
18307
- return [SESSION_REPAIR_KEY, HISTORY_CACHE_FLOOR_KEY].some((key) => !db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key));
18381
+ return [SESSION_REPAIR_KEY, HISTORY_CACHE_FLOOR_KEY, EDIT_PLACEHOLDER_FLOOR_KEY].some((key) => !db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key));
18308
18382
  } catch {
18309
18383
  return true;
18310
18384
  } finally {
@@ -18371,7 +18445,7 @@ function rowToEdge(r) {
18371
18445
  function openGraphStore(opts) {
18372
18446
  return new SqliteGraphStore(opts);
18373
18447
  }
18374
- var LOCAL_RULE_OVERRIDES, SCHEMA_VERSION, SESSION_REPAIR_KEY, SESSION_EVIDENCE_PREDICATE, SCHEMA_SQL, TEMPORAL_INDEX_SQL, FINGERPRINT_INDEXED_LABELS, SqliteGraphStore;
18448
+ var LOCAL_RULE_OVERRIDES, SCHEMA_VERSION, SESSION_REPAIR_KEY, SESSION_EVIDENCE_PREDICATE, SCHEMA_SQL, TEMPORAL_INDEX_SQL, FINGERPRINT_INDEXED_LABELS, NODE_LABELS_CHUNK, SqliteGraphStore;
18375
18449
  var init_store = __esm({
18376
18450
  "../../packages/local-graph/src/store.ts"() {
18377
18451
  "use strict";
@@ -18379,6 +18453,7 @@ var init_store = __esm({
18379
18453
  init_src();
18380
18454
  init_history_cache_floor();
18381
18455
  init_session_evidence();
18456
+ init_edit_placeholder_retirement();
18382
18457
  LOCAL_RULE_OVERRIDES = {
18383
18458
  ANCHORED_AT: {
18384
18459
  from: EDGE_RULES["ANCHORED_AT"]?.from,
@@ -18521,6 +18596,7 @@ CREATE INDEX IF NOT EXISTS nodes_live_description ON nodes(description, label) W
18521
18596
  CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_json, '$.anchorHint.path')) WHERE valid_to IS NULL;
18522
18597
  `;
18523
18598
  FINGERPRINT_INDEXED_LABELS = ["Problem", "Vulnerability", "Solution", "RootCause"];
18599
+ NODE_LABELS_CHUNK = 256;
18524
18600
  SqliteGraphStore = class {
18525
18601
  db;
18526
18602
  // Typed edge lookups build their SQL from the number of types asked for, and
@@ -18557,6 +18633,7 @@ CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_js
18557
18633
  }
18558
18634
  this.db.exec(TEMPORAL_INDEX_SQL);
18559
18635
  installHistoryCacheFloor(this.db);
18636
+ installEditPlaceholderRetirement(this.db);
18560
18637
  if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
18561
18638
  this.db.transaction(() => {
18562
18639
  this.repairSessionAliases();
@@ -19022,6 +19099,19 @@ CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_js
19022
19099
  const row = this.stmts.getNode.get(id);
19023
19100
  return row ? rowToNode(row) : null;
19024
19101
  }
19102
+ nodeLabels(ids) {
19103
+ const width = NODE_LABELS_CHUNK;
19104
+ const stmt = this.typedEdgeStmt(
19105
+ `SELECT id, label FROM nodes WHERE id IN (${Array.from({ length: width }, () => "?").join(",")})`
19106
+ );
19107
+ const labels = /* @__PURE__ */ new Map();
19108
+ for (let i2 = 0; i2 < ids.length; i2 += width) {
19109
+ const chunk = ids.slice(i2, i2 + width);
19110
+ while (chunk.length < width) chunk.push(null);
19111
+ for (const row of stmt.all(...chunk)) labels.set(row.id, row.label);
19112
+ }
19113
+ return labels;
19114
+ }
19025
19115
  getEdge(id) {
19026
19116
  const row = this.stmts.getEdge.get(id);
19027
19117
  return row ? rowToEdge(row) : null;
@@ -19103,8 +19193,8 @@ CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_js
19103
19193
  qname: typeof r.qname === "string" ? r.qname : null
19104
19194
  }));
19105
19195
  }
19106
- findAllVersionsByLabel(label) {
19107
- const rows = this.stmts.findByLabelAll.all(label);
19196
+ findAllVersionsByLabel(label, attribute) {
19197
+ const rows = attribute ? this.db.prepare("SELECT * FROM nodes WHERE label = ? AND json_extract(attrs_json, ?) = ?").all(label, `$.${attribute.path}`, attribute.value) : this.stmts.findByLabelAll.all(label);
19108
19198
  return rows.map(rowToNode);
19109
19199
  }
19110
19200
  searchNodes(opts) {
@@ -19524,7 +19614,9 @@ function staticConductance(edgeType) {
19524
19614
  return Math.max(UNKNOWN_CONDUCTANCE, Math.min(1, w / MAX_EDGE_WEIGHT));
19525
19615
  }
19526
19616
  function edgeConductance(edge2) {
19527
- const staticW = staticConductance(edge2.type);
19617
+ return learnedConductance(staticConductance(edge2.type), edge2);
19618
+ }
19619
+ function learnedConductance(staticW, edge2) {
19528
19620
  const s = edge2.navSuccesses ?? 0;
19529
19621
  const f = edge2.navFailures ?? 0;
19530
19622
  const betaMean = (1 + s) / (2 + s + f);
@@ -19840,6 +19932,7 @@ function addDependency(store, opts) {
19840
19932
  }
19841
19933
  function markRevisit(store, node2, reason, ts, answeredWhen) {
19842
19934
  const fresh = store.getNode(node2.id) ?? node2;
19935
+ if (fresh.validTo != null || fresh.attrs["retiredReason"]) return;
19843
19936
  store.updateNode(node2.id, {
19844
19937
  attrs: {
19845
19938
  ...fresh.attrs,
@@ -19900,7 +19993,7 @@ function clearRevisit(store, nodeId, ts) {
19900
19993
  store.updateNode(nodeId, { attrs, lastUpdatedAt: ts });
19901
19994
  }
19902
19995
  function listNeedsRevisit(store, asOf) {
19903
- return store.nodesAsOfWhereTrue(asOf, "revisit").map((n) => ({
19996
+ return store.nodesAsOfWhereTrue(asOf, "revisit").filter((n) => !n.attrs["retiredReason"]).map((n) => ({
19904
19997
  id: n.id,
19905
19998
  label: n.label,
19906
19999
  description: n.description,
@@ -21557,7 +21650,7 @@ function isFragmentFixNote(note) {
21557
21650
  return /^(and|but|or|nor|so|yet|also|plus)\b/i.test(t);
21558
21651
  }
21559
21652
  function isAutoMinted(n) {
21560
- return n.label === "Solution" && String(n.description ?? "").startsWith(AUTO_MINT_PREFIX);
21653
+ return isEditPlaceholderSolution(n);
21561
21654
  }
21562
21655
  function solutionTextKey(text) {
21563
21656
  return text.trim().replace(/\s+/g, " ").toLowerCase();
@@ -21886,7 +21979,7 @@ function reopenAutoClosedProblems(store, t) {
21886
21979
  continue;
21887
21980
  }
21888
21981
  const sols = store.outEdges(p.id, ["SOLVED_BY"]).map((e) => store.getNode(e.to)).filter((n) => n !== null);
21889
- if (sols.length === 0) continue;
21982
+ if (sols.length === 0 && p.attrs["retiredEditPlaceholder"] !== true) continue;
21890
21983
  if (!sols.every((s) => String(s.description ?? "").startsWith(AUTO_MINT_PREFIX))) {
21891
21984
  report.agentDescribed++;
21892
21985
  continue;
@@ -22049,7 +22142,7 @@ function priorExposure(store, nodeId, atSeq) {
22049
22142
  if ((n.attrs["evictedCount"] ?? 0) > 0) return "evicted";
22050
22143
  return "unshown";
22051
22144
  }
22052
- var DESIGN_PROMOTE_AT, STATEMENT_ALIAS_CAP, RECURRENCE_DEBOUNCE_MS, PATTERN_DEDUP_COSINE, PATTERN_ALIAS_CAP, DEDUP_STOPWORDS, SAME_ANCHOR_DEDUP_JACCARD, EMPTY_FOLD_REPORT, SAME_ANCHOR_SCOUT_AUTO_COSINE, SAME_ANCHOR_SCOUT_MIN_COSINE, SAME_ANCHOR_NOMINATE_JACCARD, REOPEN_MIN_SOURCES, RECURRENCE_SOURCES_CAP, CITABLE_PRIOR_LABELS, MAX_ANCHOR_FILES, ENCLOSING_SYMBOL_KINDS, ENCLOSING_WALK_DEPTH, AUTO_MINT_PREFIX, FIX_CANDIDATE_ASK_LIMIT;
22145
+ var DESIGN_PROMOTE_AT, STATEMENT_ALIAS_CAP, RECURRENCE_DEBOUNCE_MS, PATTERN_DEDUP_COSINE, PATTERN_ALIAS_CAP, DEDUP_STOPWORDS, SAME_ANCHOR_DEDUP_JACCARD, EMPTY_FOLD_REPORT, SAME_ANCHOR_SCOUT_AUTO_COSINE, SAME_ANCHOR_SCOUT_MIN_COSINE, SAME_ANCHOR_NOMINATE_JACCARD, REOPEN_MIN_SOURCES, RECURRENCE_SOURCES_CAP, CITABLE_PRIOR_LABELS, MAX_ANCHOR_FILES, ENCLOSING_SYMBOL_KINDS, ENCLOSING_WALK_DEPTH, FIX_CANDIDATE_ASK_LIMIT;
22053
22146
  var init_design_problem = __esm({
22054
22147
  "../../packages/local-graph/src/design-problem.ts"() {
22055
22148
  "use strict";
@@ -22060,6 +22153,7 @@ var init_design_problem = __esm({
22060
22153
  init_src2();
22061
22154
  init_problem_package_link();
22062
22155
  init_problem_dedup();
22156
+ init_src();
22063
22157
  DESIGN_PROMOTE_AT = 1;
22064
22158
  STATEMENT_ALIAS_CAP = 5;
22065
22159
  RECURRENCE_DEBOUNCE_MS = 60 * 60 * 1e3;
@@ -22125,7 +22219,6 @@ var init_design_problem = __esm({
22125
22219
  "Property"
22126
22220
  ]);
22127
22221
  ENCLOSING_WALK_DEPTH = 8;
22128
- AUTO_MINT_PREFIX = "addressed by an edit to ";
22129
22222
  FIX_CANDIDATE_ASK_LIMIT = 5;
22130
22223
  }
22131
22224
  });
@@ -22410,6 +22503,10 @@ function percolate(l1, l2, opts) {
22410
22503
  l2.transaction(() => {
22411
22504
  for (const label of PERCOLATING_LABELS) {
22412
22505
  for (const n of l1.findNodesByLabel(label)) {
22506
+ if (isEditPlaceholderSolution(n) || n.attrs["retiredReason"]) {
22507
+ result.nodesSkipped++;
22508
+ continue;
22509
+ }
22413
22510
  if (n.label === "Problem" && n.attrs["resolvedAs"] === PROBLEM_RESOLUTION.FALSE_POSITIVE) continue;
22414
22511
  if (n.attrs["source"] === "cloud") {
22415
22512
  const raw2 = l2.getMeta?.(`history-correction:${String(n.attrs["cloudNodeId"] ?? n.id)}`);
@@ -22542,6 +22639,7 @@ var init_percolate = __esm({
22542
22639
  "../../packages/local-graph/src/percolate.ts"() {
22543
22640
  "use strict";
22544
22641
  init_src2();
22642
+ init_src();
22545
22643
  PERCOLATING_LABELS = ["Claim", "Problem", "Solution"];
22546
22644
  PERCOLATING_EDGES = ["CAUSED_BY", "SOLVED_BY", "CONTRADICTS"];
22547
22645
  PERCOLATING_DRIFT_EDGES = ["CONTINUES", "REVEALED_BY", "SUPERSEDED_BY", "SPLIT_INTO"];
@@ -22718,9 +22816,28 @@ var init_uncertainty = __esm({
22718
22816
  });
22719
22817
 
22720
22818
  // ../../packages/math/src/discovery.ts
22819
+ function typeRelevance(label) {
22820
+ return TYPE_RELEVANCE[label] ?? DEFAULT_TYPE_RELEVANCE;
22821
+ }
22822
+ var TYPE_RELEVANCE, DEFAULT_TYPE_RELEVANCE;
22721
22823
  var init_discovery = __esm({
22722
22824
  "../../packages/math/src/discovery.ts"() {
22723
22825
  "use strict";
22826
+ TYPE_RELEVANCE = {
22827
+ Solution: 1,
22828
+ Vulnerability: 0.95,
22829
+ RootCause: 0.9,
22830
+ Pattern: 0.8,
22831
+ Problem: 0.7,
22832
+ Technique: 0.7,
22833
+ AntiPattern: 0.7,
22834
+ Weakness: 0.6,
22835
+ Domain: 0.5,
22836
+ Function: 0.4,
22837
+ Class: 0.4,
22838
+ File: 0.3
22839
+ };
22840
+ DEFAULT_TYPE_RELEVANCE = 0.3;
22724
22841
  }
22725
22842
  });
22726
22843
 
@@ -24023,6 +24140,7 @@ function induceAbstractions(l2, opts) {
24023
24140
  const ids = /* @__PURE__ */ new Set();
24024
24141
  for (const label of PERCOLATING_LABELS) {
24025
24142
  for (const n of l2.findNodesByLabel(label)) {
24143
+ if (isEditPlaceholderSolution(n) || n.attrs["retiredReason"] || n.validTo != null) continue;
24026
24144
  if (Number(n.attrs["abstractionLevel"] ?? ABSTRACTION_LEVEL.CONCRETE) >= ABSTRACTION_LEVEL.PRINCIPLE) {
24027
24145
  continue;
24028
24146
  }
@@ -24099,6 +24217,10 @@ function pendingAbstractions(l2) {
24099
24217
  if (Number(n.attrs["abstractionLevel"] ?? ABSTRACTION_LEVEL.CONCRETE) < ABSTRACTION_LEVEL.PRINCIPLE) continue;
24100
24218
  if (n.attrs["provisional"] !== true) continue;
24101
24219
  const memberIds = Array.isArray(n.attrs["members"]) ? n.attrs["members"] : [];
24220
+ if (memberIds.some((id) => {
24221
+ const m = l2.getNode(id);
24222
+ return !m || m.validTo != null || m.attrs["retiredReason"] || isEditPlaceholderSolution(m);
24223
+ })) continue;
24102
24224
  const members = memberIds.map((id) => {
24103
24225
  const m = l2.getNode(id);
24104
24226
  return m ? { id: m.id, label: m.label, description: m.description } : { id, label: "?", description: "(member missing)" };
@@ -24130,13 +24252,19 @@ function parseAbstractionFences(text) {
24130
24252
  }
24131
24253
  function applyAbstractionFence(l2, fence, ts) {
24132
24254
  const node2 = l2.getNode(fence.candidate);
24133
- if (!node2 || node2.label !== "Claim" || Number(node2.attrs["abstractionLevel"] ?? ABSTRACTION_LEVEL.CONCRETE) < ABSTRACTION_LEVEL.PRINCIPLE) {
24255
+ if (!node2 || node2.validTo != null || node2.attrs["retiredReason"] || node2.label !== "Claim" || Number(node2.attrs["abstractionLevel"] ?? ABSTRACTION_LEVEL.CONCRETE) < ABSTRACTION_LEVEL.PRINCIPLE) {
24134
24256
  return { applied: false, principleId: fence.candidate, reason: "no such abstraction candidate" };
24135
24257
  }
24136
24258
  if (node2.attrs["provisional"] !== true) {
24137
24259
  return { applied: false, principleId: fence.candidate, reason: "candidate already distilled" };
24138
24260
  }
24139
24261
  const members = Array.isArray(node2.attrs["members"]) ? node2.attrs["members"] : [];
24262
+ if (members.some((id) => {
24263
+ const m = l2.getNode(id);
24264
+ return !m || m.validTo != null || m.attrs["retiredReason"] || isEditPlaceholderSolution(m);
24265
+ })) {
24266
+ return { applied: false, principleId: fence.candidate, reason: "candidate contains retired or missing evidence" };
24267
+ }
24140
24268
  const want = new Set(members);
24141
24269
  const got = new Set(fence.covers);
24142
24270
  const missing = members.filter((id) => !got.has(id));
@@ -25247,6 +25375,7 @@ __export(src_exports2, {
25247
25375
  isFragmentFixNote: () => isFragmentFixNote,
25248
25376
  isPlaceholderStatement: () => isPlaceholderStatement,
25249
25377
  isUnfilledPlaceholder: () => isUnfilledPlaceholder,
25378
+ learnedConductance: () => learnedConductance,
25250
25379
  linkProblemToLanguages: () => linkProblemToLanguages,
25251
25380
  linkProblemToPackages: () => linkProblemToPackages,
25252
25381
  linkProblemToSymbols: () => linkProblemToSymbols,
@@ -30988,82 +31117,10 @@ function resolveProblem(store, problem, t) {
30988
31117
  if (suppressed) mintSuppressionAntiPattern(store, problem, liveSym, ep, t);
30989
31118
  return null;
30990
31119
  }
30991
- store.mergeEdge({
30992
- id: `edge_${digest({ from: problem.id, type: "FIXED_BY", to: ep.id })}`.slice(0, 24),
30993
- from: problem.id,
30994
- to: ep.id,
30995
- type: "FIXED_BY",
30996
- confidence: 0.7,
30997
- extractionSource: "daemon-extracted",
30998
- createdAt: t,
30999
- lastSeenAt: t,
31000
- navSuccesses: 0,
31001
- navFailures: 0,
31002
- attrs: { resolvedAt: t }
31003
- });
31004
- const solId = `solution_${digest({ logicalId: anchorLogicalId, ep: ep.id }).slice(0, 16)}`;
31005
- const solSeq = store.nextIngestSeq();
31006
- store.mergeNode({
31007
- id: solId,
31008
- label: "Solution",
31009
- description: `fix for ${liveSym.description} (${ep.id})`,
31010
- extractionConfidence: 0.7,
31011
- extractionSource: "daemon-extracted",
31012
- embedding: [],
31013
- cumulativeSurprise: 0,
31014
- peakSurprise: 0,
31015
- cumulativeHits: 1,
31016
- lastUpdatedAt: t,
31017
- createdAt: t,
31018
- createdAtSeq: solSeq,
31019
- lastReinforcedAtSeq: solSeq,
31020
- memoryTier: "short-term",
31021
- pageRank: 0,
31022
- isLandmark: false,
31023
- community: null,
31024
- stability: "forming",
31025
- attrs: {
31026
- episodeId: ep.id,
31027
- anchorLogicalId,
31028
- editSurprise: ep.attrs["editSurprise"] ?? 0,
31029
- workspaceId: problem.attrs["workspaceId"],
31030
- // Resolution-checkpoint marker (Phase 8): this fresh Solution awaits the
31031
- // agent's one-question enrichment pull. Cleared by annotateResolution.
31032
- // Lives on the Solution (a live node) so it survives the Problem's close
31033
- // and is visible cross-process via the shared store.
31034
- enrichmentPending: true,
31035
- problemId: problem.id,
31036
- problemDescription: problem.description,
31037
- symbolName: liveSym.description
31038
- }
31039
- });
31040
- store.mergeEdge({
31041
- id: `edge_${digest({ from: problem.id, type: "SOLVED_BY", to: solId })}`.slice(0, 24),
31042
- from: problem.id,
31043
- to: solId,
31044
- type: "SOLVED_BY",
31045
- confidence: 0.7,
31046
- extractionSource: "daemon-extracted",
31047
- createdAt: t,
31048
- lastSeenAt: t,
31049
- navSuccesses: 0,
31050
- navFailures: 0,
31051
- attrs: {}
31052
- });
31053
- store.mergeEdge({
31054
- id: `edge_${digest({ from: solId, type: "ANCHORED_AT", to: liveSym.id })}`.slice(0, 24),
31055
- from: solId,
31056
- to: liveSym.id,
31057
- type: "ANCHORED_AT",
31058
- confidence: 0.7,
31059
- extractionSource: "daemon-extracted",
31060
- createdAt: t,
31061
- lastSeenAt: t,
31062
- navSuccesses: 0,
31063
- navFailures: 0,
31064
- attrs: {}
31120
+ store.updateNode(problem.id, {
31121
+ attrs: { ...store.getNode(problem.id).attrs, resolvedAs: "edited", resolutionEpisode: ep.id, enrichmentPending: true }
31065
31122
  });
31066
- return solId;
31123
+ return null;
31067
31124
  }
31068
31125
  function mintSuppressionAntiPattern(store, problem, liveSym, ep, t) {
31069
31126
  const code = problem.attrs["diagnosticCode"] ?? "";
@@ -31141,6 +31198,7 @@ function annotateResolution(store, ann, t) {
31141
31198
  for (const pid of ann.problemIds) {
31142
31199
  const problem = store.getNode(pid);
31143
31200
  if (!problem) continue;
31201
+ store.updateNode(pid, { attrs: { ...problem.attrs, enrichmentPending: false } });
31144
31202
  const cause = ann.sharedRootCause ?? ann.perProblem?.find((p) => p.problemId === pid)?.rootCause;
31145
31203
  if (cause) {
31146
31204
  const rc = store.outEdges(pid, ["CAUSED_BY"]).map((e) => store.getNode(e.to)).find((n) => n?.label === "RootCause");
@@ -31211,6 +31269,60 @@ function annotateResolution(store, ann, t) {
31211
31269
  }
31212
31270
  }
31213
31271
  const sol = store.outEdges(pid, ["SOLVED_BY"]).map((e) => store.getNode(e.to)).find((n) => n?.label === "Solution");
31272
+ if (!sol && ann.solutionRationale?.trim()) {
31273
+ const rationale = ann.solutionRationale.trim();
31274
+ const id = `solution_${digest({ rationale }).slice(0, 16)}`;
31275
+ const seq = store.nextIngestSeq();
31276
+ store.mergeNode({
31277
+ id,
31278
+ label: "Solution",
31279
+ description: rationale,
31280
+ extractionSource: "agent-observed",
31281
+ extractionConfidence: conf,
31282
+ validFrom: t,
31283
+ validTo: null,
31284
+ createdAt: t,
31285
+ lastUpdatedAt: t,
31286
+ createdAtSeq: seq,
31287
+ lastReinforcedAtSeq: seq,
31288
+ embedding: [],
31289
+ cumulativeHits: 1,
31290
+ pageRank: 0,
31291
+ cumulativeSurprise: 0,
31292
+ peakSurprise: 0,
31293
+ isLandmark: false,
31294
+ community: null,
31295
+ memoryTier: "short-term",
31296
+ stability: "forming",
31297
+ attrs: { rationale, problemId: pid, enrichmentPending: false, workspaceId: problem.attrs["workspaceId"] }
31298
+ });
31299
+ store.mergeEdge({
31300
+ id: `edge_${digest({ from: pid, type: "SOLVED_BY", to: id }).slice(0, 16)}`,
31301
+ from: pid,
31302
+ to: id,
31303
+ type: "SOLVED_BY",
31304
+ confidence: conf,
31305
+ extractionSource: "agent-observed",
31306
+ createdAt: t,
31307
+ lastSeenAt: t,
31308
+ navSuccesses: 0,
31309
+ navFailures: 0,
31310
+ attrs: {}
31311
+ });
31312
+ const anchor = store.outEdges(pid, ["ANCHORED_AT"])[0];
31313
+ if (anchor) store.mergeEdge({
31314
+ ...anchor,
31315
+ id: `edge_${digest({ from: id, type: "ANCHORED_AT", to: anchor.to }).slice(0, 16)}`,
31316
+ from: id,
31317
+ confidence: conf,
31318
+ extractionSource: "agent-observed",
31319
+ createdAt: t,
31320
+ lastSeenAt: t,
31321
+ navSuccesses: 0,
31322
+ navFailures: 0,
31323
+ attrs: {}
31324
+ });
31325
+ }
31214
31326
  if (sol) {
31215
31327
  const attrs = { ...sol.attrs, enrichmentPending: false };
31216
31328
  if (ann.solutionRationale) attrs["rationale"] = ann.solutionRationale;
@@ -32099,62 +32211,139 @@ async function rankForText(store, text, candidateIds) {
32099
32211
  (r) => r.score > 0
32100
32212
  );
32101
32213
  }
32214
+ function walksRelatedness(type) {
32215
+ if (type === "DEPENDS_ON") return true;
32216
+ if (PAGERANK_EXCLUSIONS.has(type)) return false;
32217
+ return (EDGE_WEIGHT[type] ?? 1) > 0;
32218
+ }
32219
+ function burstStaticConductance(type, seedLabel) {
32220
+ if (type === "ANCHORED_AT") return BURST_ANCHORED_AT_CONDUCTANCE;
32221
+ if (type === "DEPENDS_ON") return seedLabel === "Package" ? staticConductance(type) : BURST_DEPENDS_ON_FLOOR;
32222
+ return staticConductance(type);
32223
+ }
32224
+ function burstConductance(edge2, seedLabel) {
32225
+ return learnedConductance(burstStaticConductance(edge2.type, seedLabel), edge2);
32226
+ }
32102
32227
  function localBurst(store, seedId, opts = {}) {
32103
- const maxHops = opts.maxHops ?? 2;
32228
+ const maxHops = opts.maxHops ?? 3;
32104
32229
  const limit = opts.limit ?? 20;
32105
- const nodeCap = opts.nodeCap ?? 500;
32230
+ const nodeCap = opts.nodeCap ?? 200;
32106
32231
  const seed = store.getNode(seedId);
32107
32232
  if (!seed) return [];
32233
+ const act = /* @__PURE__ */ new Map([[seedId, 1]]);
32108
32234
  const hopOf = /* @__PURE__ */ new Map([[seedId, 0]]);
32109
32235
  const viaOf = /* @__PURE__ */ new Map();
32110
- let frontier = [seedId];
32111
- for (let h = 1; h <= maxHops && hopOf.size < nodeCap; h++) {
32112
- const next = [];
32113
- for (const id of frontier) {
32114
- const neigh = [
32115
- ...store.outEdges(id).map((e) => ({ nb: e.to, via: { edgeType: e.type, parentId: id, forward: true } })),
32116
- ...store.inEdges(id).map((e) => ({ nb: e.from, via: { edgeType: e.type, parentId: id, forward: false } }))
32117
- ];
32118
- for (const { nb, via } of neigh) {
32119
- if (!hopOf.has(nb)) {
32120
- hopOf.set(nb, h);
32121
- viaOf.set(nb, via);
32122
- next.push(nb);
32123
- if (hopOf.size >= nodeCap) break;
32124
- }
32125
- }
32126
- if (hopOf.size >= nodeCap) break;
32127
- }
32128
- frontier = next;
32129
- }
32130
- hopOf.delete(seedId);
32236
+ const expanded = /* @__PURE__ */ new Set();
32237
+ const frontier = new ActivationHeap();
32238
+ frontier.push(seedId, 1);
32239
+ let strongest = 0;
32240
+ while (frontier.size > 0 && expanded.size < nodeCap) {
32241
+ const top = frontier.pop();
32242
+ if (expanded.has(top.id) || top.a < (act.get(top.id) ?? 0)) continue;
32243
+ if (top.a < ACTIVATION_EPSILON || top.a < strongest * BURST_RELATIVE_FLOOR) break;
32244
+ expanded.add(top.id);
32245
+ const hops = hopOf.get(top.id) ?? 0;
32246
+ if (hops >= maxHops) continue;
32247
+ const edges = [
32248
+ ...store.outEdges(top.id).map((e) => ({ e, nb: e.to, forward: true })),
32249
+ ...store.inEdges(top.id).map((e) => ({ e, nb: e.from, forward: false }))
32250
+ ].filter(({ e }) => walksRelatedness(e.type));
32251
+ const damp = BURST_STEP_DAMPING / Math.sqrt(Math.max(1, edges.length));
32252
+ for (const { e, nb, forward } of edges) {
32253
+ if (nb === seedId || expanded.has(nb)) continue;
32254
+ const a = top.a * burstConductance(e, seed.label) * damp;
32255
+ if (a <= (act.get(nb) ?? 0)) continue;
32256
+ act.set(nb, a);
32257
+ if (a > strongest) strongest = a;
32258
+ hopOf.set(nb, hops + 1);
32259
+ viaOf.set(nb, { edgeType: e.type, parentId: top.id, forward });
32260
+ frontier.push(nb, a);
32261
+ }
32262
+ }
32263
+ act.delete(seedId);
32131
32264
  const ctxSeed = seed.embedding.length > 0 ? { seedEmbedding: seed.embedding, seedEmbeddingVersion: seed.attrs["embeddingVersion"] } : {};
32132
32265
  const gated = seed.embedding.length > 0;
32133
- const nodes = [...hopOf.entries()].map(([id, hops]) => ({ node: store.getNode(id), hops })).filter((x) => x.node != null);
32134
- const maxPr = Math.max(1e-9, ...nodes.map((x) => x.node.pageRank));
32266
+ const labelOf = store.nodeLabels([...act.keys()]);
32267
+ const pool = (keep) => [...act.entries()].filter(([id]) => keep(labelOf.get(id) ?? "")).sort((x, y) => y[1] - x[1]).slice(0, BURST_SCORED_CANDIDATES);
32268
+ const isKnowledge = (label) => typeRelevance(label) >= KNOWLEDGE_TYPE_RELEVANCE;
32269
+ const reached = [...pool(isKnowledge), ...pool((l) => !isKnowledge(l))].map(([id, a]) => ({ node: store.getNode(id), a })).filter((x) => x.node != null);
32270
+ const maxPr = Math.max(1e-9, ...reached.map((x) => x.node.pageRank));
32271
+ const maxAct = Math.max(1e-12, ...reached.map((x) => x.a));
32135
32272
  const weights = {
32136
32273
  centralityScale: maxPr,
32137
32274
  ...gated ? { semanticFloor: semanticFloorFor(ctxSeed.seedEmbeddingVersion) } : {},
32138
32275
  ...opts.weights
32139
32276
  };
32140
32277
  const now = store.currentIngestSeq();
32141
- return nodes.map(({ node: node2, hops }) => {
32142
- const r = scoreCandidate(node2, { ...ctxSeed, hops, decay: nodeFreshness(node2, now) }, weights);
32278
+ return reached.map(({ node: node2, a }) => {
32279
+ const r = scoreCandidate(node2, { ...ctxSeed, decay: nodeFreshness(node2, now) }, weights);
32280
+ const score2 = a / maxAct * r.score * typeRelevance(node2.label);
32143
32281
  const via = viaOf.get(node2.id);
32144
- return { id: node2.id, score: r.score, components: r.components, node: node2, hops, ...via ? { via } : {} };
32282
+ return { id: node2.id, score: score2, components: r.components, node: node2, hops: hopOf.get(node2.id) ?? 0, ...via ? { via } : {} };
32145
32283
  }).filter((r) => !gated || r.score > 0).sort((a, b) => b.score - a.score).slice(0, limit);
32146
32284
  }
32285
+ var BURST_STEP_DAMPING, ACTIVATION_EPSILON, BURST_RELATIVE_FLOOR, BURST_SCORED_CANDIDATES, KNOWLEDGE_TYPE_RELEVANCE, BURST_ANCHORED_AT_CONDUCTANCE, BURST_DEPENDS_ON_FLOOR, ActivationHeap;
32147
32286
  var init_relevance_rank = __esm({
32148
32287
  "../../packages/generalizer/src/relevance-rank.ts"() {
32149
32288
  "use strict";
32150
32289
  init_src3();
32151
32290
  init_src4();
32291
+ init_src5();
32292
+ init_src();
32293
+ BURST_STEP_DAMPING = 0.85;
32294
+ ACTIVATION_EPSILON = 1e-6;
32295
+ BURST_RELATIVE_FLOOR = 0.02;
32296
+ BURST_SCORED_CANDIDATES = 150;
32297
+ KNOWLEDGE_TYPE_RELEVANCE = 0.5;
32298
+ BURST_ANCHORED_AT_CONDUCTANCE = 1 / 3;
32299
+ BURST_DEPENDS_ON_FLOOR = 0.1;
32300
+ ActivationHeap = class {
32301
+ items = [];
32302
+ get size() {
32303
+ return this.items.length;
32304
+ }
32305
+ push(id, a) {
32306
+ const items = this.items;
32307
+ items.push({ id, a });
32308
+ let i2 = items.length - 1;
32309
+ while (i2 > 0) {
32310
+ const p = i2 - 1 >> 1;
32311
+ if (items[p].a >= items[i2].a) break;
32312
+ [items[p], items[i2]] = [items[i2], items[p]];
32313
+ i2 = p;
32314
+ }
32315
+ }
32316
+ pop() {
32317
+ const items = this.items;
32318
+ const top = items[0];
32319
+ const last = items.pop();
32320
+ if (items.length > 0 && last) {
32321
+ items[0] = last;
32322
+ let i2 = 0;
32323
+ for (; ; ) {
32324
+ const l = 2 * i2 + 1, r = l + 1;
32325
+ let m = i2;
32326
+ if (l < items.length && items[l].a > items[m].a) m = l;
32327
+ if (r < items.length && items[r].a > items[m].a) m = r;
32328
+ if (m === i2) break;
32329
+ [items[m], items[i2]] = [items[i2], items[m]];
32330
+ i2 = m;
32331
+ }
32332
+ }
32333
+ return top;
32334
+ }
32335
+ };
32152
32336
  }
32153
32337
  });
32154
32338
 
32155
32339
  // ../../packages/generalizer/src/index.ts
32156
32340
  var src_exports3 = {};
32157
32341
  __export(src_exports3, {
32342
+ BURST_ANCHORED_AT_CONDUCTANCE: () => BURST_ANCHORED_AT_CONDUCTANCE,
32343
+ BURST_DEPENDS_ON_FLOOR: () => BURST_DEPENDS_ON_FLOOR,
32344
+ BURST_RELATIVE_FLOOR: () => BURST_RELATIVE_FLOOR,
32345
+ BURST_SCORED_CANDIDATES: () => BURST_SCORED_CANDIDATES,
32346
+ BURST_STEP_DAMPING: () => BURST_STEP_DAMPING,
32158
32347
  FULL_RESCORE_EVERY: () => FULL_RESCORE_EVERY,
32159
32348
  INCREMENTAL_REGION_MAX_FRACTION: () => INCREMENTAL_REGION_MAX_FRACTION,
32160
32349
  anchorByLine: () => anchorByLine,
@@ -32164,6 +32353,8 @@ __export(src_exports3, {
32164
32353
  attributeRootCause: () => attributeRootCause,
32165
32354
  bindCanonicalNeighbors: () => bindCanonicalNeighbors,
32166
32355
  bindResolvedRegressions: () => bindResolvedRegressions,
32356
+ burstConductance: () => burstConductance,
32357
+ burstStaticConductance: () => burstStaticConductance,
32167
32358
  closeProblem: () => closeProblem,
32168
32359
  codeAnchorProjection: () => codeAnchorProjection,
32169
32360
  commandSignature: () => commandSignature,
@@ -43638,7 +43829,7 @@ function collectEnrichmentPulls(store, opts = {}) {
43638
43829
  const byEpisode = /* @__PURE__ */ new Map();
43639
43830
  for (const s of pending) {
43640
43831
  const ep = s.attrs["episodeId"] ?? s.id;
43641
- const e = byEpisode.get(ep) ?? { episodeId: ep, problems: [], solutionIds: [] };
43832
+ const e = byEpisode.get(ep) ?? { episodeId: ep, problems: [], solutionIds: [], problemIds: [] };
43642
43833
  e.problems.push({
43643
43834
  solutionId: s.id,
43644
43835
  problemId: s.attrs["problemId"] ?? null,
@@ -43648,13 +43839,22 @@ function collectEnrichmentPulls(store, opts = {}) {
43648
43839
  e.solutionIds.push(s.id);
43649
43840
  byEpisode.set(ep, e);
43650
43841
  }
43842
+ for (const p of store.findAllVersionsByLabel("Problem", { path: "enrichmentPending", value: 1 })) {
43843
+ if (p.validTo == null || p.attrs["retiredReason"] || p.attrs["resolvedAs"] !== "edited") continue;
43844
+ if (opts.onlyUnsurfaced && p.attrs["enrichmentSurfaced"] === true) continue;
43845
+ const ep = String(p.attrs["resolutionEpisode"] ?? p.id);
43846
+ const e = byEpisode.get(ep) ?? { episodeId: ep, problems: [], solutionIds: [], problemIds: [] };
43847
+ e.problems.push({ solutionId: null, problemId: p.id, problem: p.description });
43848
+ e.problemIds.push(p.id);
43849
+ byEpisode.set(ep, e);
43850
+ }
43651
43851
  return [...byEpisode.values()];
43652
43852
  }
43653
43853
  function takeEnrichmentNudge(store) {
43654
43854
  const pulls = collectEnrichmentPulls(store, { onlyUnsurfaced: true });
43655
43855
  if (pulls.length === 0) return null;
43656
43856
  for (const pull of pulls) {
43657
- for (const id of pull.solutionIds) {
43857
+ for (const id of [...pull.solutionIds, ...pull.problemIds]) {
43658
43858
  const sol = store.getNode(id);
43659
43859
  if (sol) store.updateNode(id, { attrs: { ...sol.attrs, enrichmentSurfaced: true } });
43660
43860
  }
@@ -43662,9 +43862,9 @@ function takeEnrichmentNudge(store) {
43662
43862
  const items = pulls.map((p) => {
43663
43863
  const what = p.problems.map((x) => `${x["fixed"] ? `\`${x["fixed"]}\`` : "a symbol"}${x["problem"] ? ` (${x["problem"]})` : ""}`).join(", ");
43664
43864
  const ids = p.problems.map((x) => x["problemId"]).filter(Boolean);
43665
- return `\u2022 fixed ${what} \u2014 what was the root cause? a pattern? \u2192 errata.annotate_resolution problemIds:${JSON.stringify(ids)}`;
43865
+ return `\u2022 observed ${what} stop failing \u2014 was this fixed? If known, give the root cause and solutionRationale \u2192 errata.annotate_resolution problemIds:${JSON.stringify(ids)}`;
43666
43866
  }).join("\n");
43667
- return `\u26A1 errata \u2014 ${pulls.length} recent fix(es) await a one-line root cause (optional, answer in-flow):
43867
+ return `\u26A1 errata \u2014 ${pulls.length} observed resolution(s) await a one-line root cause and fix explanation (optional, answer in-flow):
43668
43868
  ` + items;
43669
43869
  }
43670
43870
  function takeDiscriminatorNudge(path2) {
@@ -45113,7 +45313,7 @@ var init_mcp = __esm({
45113
45313
  const pulls = collectEnrichmentPulls(store).map((p) => ({
45114
45314
  episodeId: p.episodeId,
45115
45315
  problems: p.problems,
45116
- question: "You just resolved the above. For each (or shared): what was the root cause, and is this an instance of a pattern? One line each."
45316
+ question: "The above stopped failing. If you know why, provide the root cause and solutionRationale (the actual fix); optionally name a pattern. Do not guess."
45117
45317
  }));
45118
45318
  return { count: pulls.length, pulls };
45119
45319
  }
@@ -82434,7 +82634,7 @@ function createWatchBreaker(deps) {
82434
82634
  }
82435
82635
 
82436
82636
  // src/engine.ts
82437
- var DAEMON_VERSION = true ? "2.0.17-dev.3538" : "2.0.0-alpha.0";
82637
+ var DAEMON_VERSION = true ? "2.0.17-dev.3562" : "2.0.0-alpha.0";
82438
82638
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
82439
82639
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
82440
82640
  var GIT_OP_MUTE_MS = 4e3;
@@ -85650,8 +85850,8 @@ function runLockfilePass(opts) {
85650
85850
 
85651
85851
  // src/instance-ingest.ts
85652
85852
  init_src();
85853
+ init_src();
85653
85854
  init_src2();
85654
- init_src5();
85655
85855
  init_src10();
85656
85856
  init_src();
85657
85857
 
@@ -86066,7 +86266,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
86066
86266
  semanticEndpoints.set(n.id, contributedWireId(n, opts.destinationKey));
86067
86267
  continue;
86068
86268
  }
86069
- if (label === "Solution" && n.description.startsWith(AUTO_MINT_PREFIX)) {
86269
+ if (isEditPlaceholderSolution(n)) {
86070
86270
  composition.autoMint++;
86071
86271
  continue;
86072
86272
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.17-dev.3538",
3
+ "version": "2.0.17-dev.3562",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -16206,6 +16206,22 @@ var init_project_wire_attrs = __esm({
16206
16206
  }
16207
16207
  });
16208
16208
 
16209
+ // ../../packages/shared/src/edit-placeholder.ts
16210
+ function isEditPlaceholderSolution(node) {
16211
+ if (node.label !== "Solution") return false;
16212
+ const text = node.description.trim().toLowerCase();
16213
+ if (text.startsWith(AUTO_MINT_PREFIX)) return true;
16214
+ return /^fix for [^\r\n]+ \(episode_[^)]+\)$/.test(text) && !(typeof node.attrs?.["rationale"] === "string" && node.attrs["rationale"].trim());
16215
+ }
16216
+ var AUTO_MINT_PREFIX, EDIT_PLACEHOLDER_RETIREMENT;
16217
+ var init_edit_placeholder = __esm({
16218
+ "../../packages/shared/src/edit-placeholder.ts"() {
16219
+ "use strict";
16220
+ AUTO_MINT_PREFIX = "addressed by an edit to ";
16221
+ EDIT_PLACEHOLDER_RETIREMENT = "edit-placeholder-solution";
16222
+ }
16223
+ });
16224
+
16209
16225
  // ../../packages/shared/src/index.ts
16210
16226
  var init_src = __esm({
16211
16227
  "../../packages/shared/src/index.ts"() {
@@ -16237,6 +16253,7 @@ var init_src = __esm({
16237
16253
  init_triage_canon();
16238
16254
  init_history_text();
16239
16255
  init_project_wire_attrs();
16256
+ init_edit_placeholder();
16240
16257
  }
16241
16258
  });
16242
16259
 
@@ -25360,6 +25377,54 @@ function repairSessionEvidence(input, aliases = /* @__PURE__ */ new Map()) {
25360
25377
  return repaired;
25361
25378
  }
25362
25379
 
25380
+ // ../../packages/local-graph/src/edit-placeholder-retirement.ts
25381
+ init_src();
25382
+ var EDIT_PLACEHOLDER_FLOOR_KEY = "edit-placeholder-retirement-1";
25383
+ function installEditPlaceholderRetirement(db) {
25384
+ if (db.prepare("SELECT value FROM store_meta WHERE key=?").get(EDIT_PLACEHOLDER_FLOOR_KEY)) return;
25385
+ const timestamp = `CAST(unixepoch('subsec') * 1000 AS INTEGER)`;
25386
+ const placeholder = (n) => `(${n}.label='Solution' AND (
25387
+ lower(trim(${n}.description)) LIKE '${AUTO_MINT_PREFIX}%'
25388
+ OR (lower(trim(${n}.description)) GLOB 'fix for * (episode_*)'
25389
+ AND instr(${n}.description,char(10))=0 AND instr(${n}.description,char(13))=0
25390
+ AND trim(coalesce(json_extract(${n}.attrs_json,'$.rationale'),''))='')))`;
25391
+ const contaminated = (n) => `(${n}.label='Claim' AND json_extract(${n}.attrs_json,'$.abstractionLevel')>=2
25392
+ AND EXISTS(SELECT 1 FROM json_each(${n}.attrs_json,'$.members') m JOIN nodes s ON s.id=m.value
25393
+ WHERE ${placeholder("s")} OR json_extract(s.attrs_json,'$.retiredReason')='${EDIT_PLACEHOLDER_RETIREMENT}'))`;
25394
+ const retire = (where, reason) => `UPDATE nodes SET valid_to=coalesce(valid_to,${timestamp}),
25395
+ attrs_json=json_set(attrs_json,'$.retiredReason','${reason}','$.retiredAt',${timestamp})
25396
+ WHERE (valid_to IS NULL OR coalesce(json_extract(attrs_json,'$.retiredReason'),'')<>'${reason}') AND (${where});`;
25397
+ const closeEdges = (where) => `UPDATE edges SET valid_to=${timestamp} WHERE valid_to IS NULL AND (${where});`;
25398
+ const retired = `(SELECT id FROM nodes WHERE json_extract(attrs_json,'$.retiredReason') IN ('${EDIT_PLACEHOLDER_RETIREMENT}','edit-placeholder-member'))`;
25399
+ const markParents = `UPDATE nodes SET attrs_json=json_set(attrs_json,'$.retiredEditPlaceholder',json('true'))
25400
+ WHERE label='Problem' AND coalesce(json_extract(attrs_json,'$.retiredEditPlaceholder'),0)<>1
25401
+ AND id IN (SELECT e.from_id FROM edges e JOIN nodes s ON s.id=e.to_id WHERE e.type='SOLVED_BY'
25402
+ AND s.label='Solution' AND json_extract(s.attrs_json,'$.retiredReason')='${EDIT_PLACEHOLDER_RETIREMENT}');`;
25403
+ db.transaction(() => {
25404
+ db.exec(retire(placeholder("nodes"), EDIT_PLACEHOLDER_RETIREMENT));
25405
+ db.exec(retire(contaminated("nodes"), "edit-placeholder-member"));
25406
+ db.exec(markParents);
25407
+ db.exec(closeEdges(`from_id IN ${retired} OR to_id IN ${retired}`));
25408
+ for (const operation of ["INSERT", "UPDATE OF label,description,attrs_json,valid_to"]) {
25409
+ const suffix = operation.startsWith("INSERT") ? "insert" : "update";
25410
+ db.exec(`CREATE TRIGGER edit_placeholder_nodes_${suffix} AFTER ${operation} ON nodes
25411
+ WHEN NEW.valid_to IS NULL AND (${placeholder("NEW")} OR ${contaminated("NEW")}) BEGIN
25412
+ ${retire(`id=NEW.id AND label='Solution'`, EDIT_PLACEHOLDER_RETIREMENT)}
25413
+ ${retire(contaminated("nodes"), "edit-placeholder-member")}
25414
+ ${markParents}
25415
+ ${closeEdges(`from_id IN ${retired} OR to_id IN ${retired}`)}
25416
+ END;`);
25417
+ db.exec(`CREATE TRIGGER edit_placeholder_edges_${suffix} AFTER ${suffix.toUpperCase()} ON edges
25418
+ WHEN NEW.valid_to IS NULL AND EXISTS(SELECT 1 FROM nodes n WHERE n.id IN (NEW.from_id,NEW.to_id)
25419
+ AND json_extract(n.attrs_json,'$.retiredReason') IN ('${EDIT_PLACEHOLDER_RETIREMENT}','edit-placeholder-member')) BEGIN
25420
+ ${markParents}
25421
+ ${closeEdges("id=NEW.id")}
25422
+ END;`);
25423
+ }
25424
+ db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(EDIT_PLACEHOLDER_FLOOR_KEY, "installed");
25425
+ });
25426
+ }
25427
+
25363
25428
  // ../../packages/local-graph/src/store.ts
25364
25429
  var LOCAL_RULE_OVERRIDES = {
25365
25430
  ANCHORED_AT: {
@@ -25575,6 +25640,7 @@ function rowToEdge(r) {
25575
25640
  };
25576
25641
  }
25577
25642
  var FINGERPRINT_INDEXED_LABELS = ["Problem", "Vulnerability", "Solution", "RootCause"];
25643
+ var NODE_LABELS_CHUNK = 256;
25578
25644
  var SqliteGraphStore = class {
25579
25645
  db;
25580
25646
  // Typed edge lookups build their SQL from the number of types asked for, and
@@ -25611,6 +25677,7 @@ var SqliteGraphStore = class {
25611
25677
  }
25612
25678
  this.db.exec(TEMPORAL_INDEX_SQL);
25613
25679
  installHistoryCacheFloor(this.db);
25680
+ installEditPlaceholderRetirement(this.db);
25614
25681
  if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
25615
25682
  this.db.transaction(() => {
25616
25683
  this.repairSessionAliases();
@@ -26076,6 +26143,19 @@ var SqliteGraphStore = class {
26076
26143
  const row = this.stmts.getNode.get(id);
26077
26144
  return row ? rowToNode(row) : null;
26078
26145
  }
26146
+ nodeLabels(ids) {
26147
+ const width = NODE_LABELS_CHUNK;
26148
+ const stmt = this.typedEdgeStmt(
26149
+ `SELECT id, label FROM nodes WHERE id IN (${Array.from({ length: width }, () => "?").join(",")})`
26150
+ );
26151
+ const labels = /* @__PURE__ */ new Map();
26152
+ for (let i2 = 0; i2 < ids.length; i2 += width) {
26153
+ const chunk = ids.slice(i2, i2 + width);
26154
+ while (chunk.length < width) chunk.push(null);
26155
+ for (const row of stmt.all(...chunk)) labels.set(row.id, row.label);
26156
+ }
26157
+ return labels;
26158
+ }
26079
26159
  getEdge(id) {
26080
26160
  const row = this.stmts.getEdge.get(id);
26081
26161
  return row ? rowToEdge(row) : null;
@@ -26157,8 +26237,8 @@ var SqliteGraphStore = class {
26157
26237
  qname: typeof r.qname === "string" ? r.qname : null
26158
26238
  }));
26159
26239
  }
26160
- findAllVersionsByLabel(label) {
26161
- const rows = this.stmts.findByLabelAll.all(label);
26240
+ findAllVersionsByLabel(label, attribute) {
26241
+ const rows = attribute ? this.db.prepare("SELECT * FROM nodes WHERE label = ? AND json_extract(attrs_json, ?) = ?").all(label, `$.${attribute.path}`, attribute.value) : this.stmts.findByLabelAll.all(label);
26162
26242
  return rows.map(rowToNode);
26163
26243
  }
26164
26244
  searchNodes(opts) {
@@ -26598,6 +26678,7 @@ function addDependency(store2, opts) {
26598
26678
  }
26599
26679
  function markRevisit(store2, node, reason, ts, answeredWhen) {
26600
26680
  const fresh = store2.getNode(node.id) ?? node;
26681
+ if (fresh.validTo != null || fresh.attrs["retiredReason"]) return;
26601
26682
  store2.updateNode(node.id, {
26602
26683
  attrs: {
26603
26684
  ...fresh.attrs,
@@ -26663,7 +26744,7 @@ function clearRevisit(store2, nodeId, ts) {
26663
26744
  store2.updateNode(nodeId, { attrs, lastUpdatedAt: ts });
26664
26745
  }
26665
26746
  function listNeedsRevisit(store2, asOf) {
26666
- return store2.nodesAsOfWhereTrue(asOf, "revisit").map((n) => ({
26747
+ return store2.nodesAsOfWhereTrue(asOf, "revisit").filter((n) => !n.attrs["retiredReason"]).map((n) => ({
26667
26748
  id: n.id,
26668
26749
  label: n.label,
26669
26750
  description: n.description,
@@ -27078,6 +27159,7 @@ function foldDuplicateProblem(store2, dup, survivor, ts) {
27078
27159
  }
27079
27160
 
27080
27161
  // ../../packages/local-graph/src/design-problem.ts
27162
+ init_src();
27081
27163
  function isConstraintProblem(node) {
27082
27164
  return node.attrs["kind"] === "constraint";
27083
27165
  }
@@ -27098,7 +27180,7 @@ var CITABLE_PRIOR_LABELS = /* @__PURE__ */ new Set([
27098
27180
  "AntiPattern"
27099
27181
  ]);
27100
27182
  function isAutoMinted(n) {
27101
- return n.label === "Solution" && String(n.description ?? "").startsWith(AUTO_MINT_PREFIX);
27183
+ return isEditPlaceholderSolution(n);
27102
27184
  }
27103
27185
  function priorsForFile(store2, relPath) {
27104
27186
  const want = relPath.trim().replace(/^\.?\//, "");
@@ -27343,7 +27425,7 @@ function reopenAutoClosedProblems(store2, t) {
27343
27425
  continue;
27344
27426
  }
27345
27427
  const sols = store2.outEdges(p.id, ["SOLVED_BY"]).map((e) => store2.getNode(e.to)).filter((n) => n !== null);
27346
- if (sols.length === 0) continue;
27428
+ if (sols.length === 0 && p.attrs["retiredEditPlaceholder"] !== true) continue;
27347
27429
  if (!sols.every((s) => String(s.description ?? "").startsWith(AUTO_MINT_PREFIX))) {
27348
27430
  report.agentDescribed++;
27349
27431
  continue;
@@ -27358,7 +27440,6 @@ function reopenAutoClosedProblems(store2, t) {
27358
27440
  }
27359
27441
  return report;
27360
27442
  }
27361
- var AUTO_MINT_PREFIX = "addressed by an edit to ";
27362
27443
  function markFixCandidates(store2, t) {
27363
27444
  let resolved = 0;
27364
27445
  for (const p of store2.findNodesByLabel("Problem")) {
@@ -27624,6 +27705,7 @@ function backfillLegacyAnchors(store2, ts) {
27624
27705
 
27625
27706
  // ../../packages/local-graph/src/percolate.ts
27626
27707
  init_src2();
27708
+ init_src();
27627
27709
 
27628
27710
  // ../../packages/local-graph/src/abstraction.ts
27629
27711
  init_src();
@@ -28897,6 +28979,10 @@ function codeAnchorProjection(store2, semanticIds, opts = {}) {
28897
28979
  // ../../packages/generalizer/src/embed-code.ts
28898
28980
  init_src();
28899
28981
 
28982
+ // ../../packages/generalizer/src/relevance-rank.ts
28983
+ init_src();
28984
+ var BURST_ANCHORED_AT_CONDUCTANCE = 1 / 3;
28985
+
28900
28986
  // ../../packages/context-writer/src/agents-md.ts
28901
28987
  init_src();
28902
28988