@inerrata-corporation/errata 2.0.23-dev.4796 → 2.0.23-dev.4821

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.
@@ -16146,7 +16146,25 @@ var TAG_CANONICAL_ID_PREFIXES, TAG_HANDLE_SOURCE, TAG_THREAD_SOURCE, TAG_PLACEHO
16146
16146
  var init_tag_grammar = __esm({
16147
16147
  "../../packages/local-shared/src/tag-grammar.ts"() {
16148
16148
  "use strict";
16149
- TAG_CANONICAL_ID_PREFIXES = ["pat", "sol", "drc", "dcause", "dfix", "dprob", "dvuln", "prob", "claim", "err"];
16149
+ TAG_CANONICAL_ID_PREFIXES = [
16150
+ "motif_community_projn",
16151
+ "motif_community_orgn",
16152
+ "motif",
16153
+ "projn",
16154
+ "orgn",
16155
+ "dtri",
16156
+ "dom",
16157
+ "pat",
16158
+ "sol",
16159
+ "drc",
16160
+ "dcause",
16161
+ "dfix",
16162
+ "dprob",
16163
+ "dvuln",
16164
+ "prob",
16165
+ "claim",
16166
+ "err"
16167
+ ];
16150
16168
  TAG_HANDLE_SOURCE = String.raw`\[([a-z0-9][\w-]{0,80})\]|((?:${TAG_CANONICAL_ID_PREFIXES.join("|")})_[0-9a-f]{6,})`;
16151
16169
  TAG_THREAD_SOURCE = String.raw`#([a-z][\w-]{0,63})`;
16152
16170
  TAG_PLACEHOLDER_HANDLES = /* @__PURE__ */ new Set([
@@ -17607,6 +17625,15 @@ function detectCommunitiesLeiden(input, opts = {}) {
17607
17625
  var DEMAND_HOT = Math.log1p(10);
17608
17626
  var DEMAND_WARM = Math.log1p(5);
17609
17627
 
17628
+ // ../../packages/math/src/reader-evidence.ts
17629
+ var FIELD_CODES = {
17630
+ a: "acceptedCount",
17631
+ c: "corroborationCount",
17632
+ f: "failureReportCount",
17633
+ p: "contradictionPressure"
17634
+ };
17635
+ var FIELDS = Object.values(FIELD_CODES);
17636
+
17610
17637
  // ../../packages/local-graph/src/node-select.ts
17611
17638
  var SELECT_INDEXES = [
17612
17639
  "nodes_live_local_community",
package/errata.mjs CHANGED
@@ -18334,7 +18334,25 @@ var TAG_CANONICAL_ID_PREFIXES, TAG_HANDLE_SOURCE, TAG_THREAD_SOURCE, TAG_PLACEHO
18334
18334
  var init_tag_grammar = __esm({
18335
18335
  "../../packages/local-shared/src/tag-grammar.ts"() {
18336
18336
  "use strict";
18337
- TAG_CANONICAL_ID_PREFIXES = ["pat", "sol", "drc", "dcause", "dfix", "dprob", "dvuln", "prob", "claim", "err"];
18337
+ TAG_CANONICAL_ID_PREFIXES = [
18338
+ "motif_community_projn",
18339
+ "motif_community_orgn",
18340
+ "motif",
18341
+ "projn",
18342
+ "orgn",
18343
+ "dtri",
18344
+ "dom",
18345
+ "pat",
18346
+ "sol",
18347
+ "drc",
18348
+ "dcause",
18349
+ "dfix",
18350
+ "dprob",
18351
+ "dvuln",
18352
+ "prob",
18353
+ "claim",
18354
+ "err"
18355
+ ];
18338
18356
  TAG_HANDLE_SOURCE = String.raw`\[([a-z0-9][\w-]{0,80})\]|((?:${TAG_CANONICAL_ID_PREFIXES.join("|")})_[0-9a-f]{6,})`;
18339
18357
  TAG_THREAD_SOURCE = String.raw`#([a-z][\w-]{0,63})`;
18340
18358
  TAG_PLACEHOLDER_HANDLES = /* @__PURE__ */ new Set([
@@ -19571,7 +19589,7 @@ var init_lineage_integrity = __esm({
19571
19589
  });
19572
19590
 
19573
19591
  // ../../packages/math/src/constants.ts
19574
- var SURPRISE_MOMENTUM, SURPRISE_LEARNING_RATE, SURPRISE_LEARNING_RATE_SCALING, TIER_HALFLIFE_MULTIPLIER, HIT_RATE_SCALING_ALPHA, BASE_HALF_LIFE_SEQ, MOMENTUM_GATE_FLOOR, SURPRISE_RECENCY_LAMBDA_SEQ, NEMORI_SOFT_WRITE_MIN_COSINE, NEMORI_SOFT_WRITE_MAX_COSINE, NEMORI_DEDUP_COSINE, NEMORI_SOFT_ALPHA_MIN, NEMORI_SOFT_ALPHA_MAX, NEMORI_HIGH_SURPRISE_THRESHOLD, NEMORI_PREDICTION_FLOOR, REVIEW_SURPRISE_THRESHOLD, REVIEW_HITS_THRESHOLD;
19592
+ var SURPRISE_MOMENTUM, SURPRISE_LEARNING_RATE, SURPRISE_LEARNING_RATE_SCALING, TIER_HALFLIFE_MULTIPLIER, HIT_RATE_SCALING_ALPHA, BASE_HALF_LIFE_SEQ, MOMENTUM_GATE_FLOOR, EVIDENCE_HALFLIFE_SEQ, EVIDENCE_ACCEPTED_HALFLIFE_MULT, EVIDENCE_DECAY_FLOOR, CORROBORATION_WEIGHT, SURPRISE_RECENCY_LAMBDA_SEQ, NEMORI_SOFT_WRITE_MIN_COSINE, NEMORI_SOFT_WRITE_MAX_COSINE, NEMORI_DEDUP_COSINE, NEMORI_SOFT_ALPHA_MIN, NEMORI_SOFT_ALPHA_MAX, NEMORI_HIGH_SURPRISE_THRESHOLD, NEMORI_PREDICTION_FLOOR, REVIEW_SURPRISE_THRESHOLD, REVIEW_HITS_THRESHOLD;
19575
19593
  var init_constants = __esm({
19576
19594
  "../../packages/math/src/constants.ts"() {
19577
19595
  "use strict";
@@ -19586,6 +19604,10 @@ var init_constants = __esm({
19586
19604
  HIT_RATE_SCALING_ALPHA = 0.5;
19587
19605
  BASE_HALF_LIFE_SEQ = 500;
19588
19606
  MOMENTUM_GATE_FLOOR = 0.5;
19607
+ EVIDENCE_HALFLIFE_SEQ = 500;
19608
+ EVIDENCE_ACCEPTED_HALFLIFE_MULT = 1.5;
19609
+ EVIDENCE_DECAY_FLOOR = 0.3;
19610
+ CORROBORATION_WEIGHT = 0.3;
19589
19611
  SURPRISE_RECENCY_LAMBDA_SEQ = 36e-4;
19590
19612
  NEMORI_SOFT_WRITE_MIN_COSINE = 0.8;
19591
19613
  NEMORI_SOFT_WRITE_MAX_COSINE = 0.88;
@@ -19686,9 +19708,22 @@ var init_momentum = __esm({
19686
19708
  });
19687
19709
 
19688
19710
  // ../../packages/math/src/persistence.ts
19711
+ function reinforcementFactor(count) {
19712
+ const n = Math.max(0, count ?? 0);
19713
+ return 1 + REINFORCEMENT_ALPHA * Math.tanh(n / REINFORCEMENT_K);
19714
+ }
19715
+ function contradictionFactor(pressure) {
19716
+ const p = Math.max(0, pressure ?? 0);
19717
+ return 1 - CONTRADICTION_MAX_DAMPENER * Math.tanh(p / CONTRADICTION_K);
19718
+ }
19719
+ var REINFORCEMENT_ALPHA, REINFORCEMENT_K, CONTRADICTION_MAX_DAMPENER, CONTRADICTION_K;
19689
19720
  var init_persistence = __esm({
19690
19721
  "../../packages/math/src/persistence.ts"() {
19691
19722
  "use strict";
19723
+ REINFORCEMENT_ALPHA = 0.3;
19724
+ REINFORCEMENT_K = 20;
19725
+ CONTRADICTION_MAX_DAMPENER = 0.25;
19726
+ CONTRADICTION_K = 10;
19692
19727
  }
19693
19728
  });
19694
19729
 
@@ -19731,6 +19766,45 @@ var init_decay = __esm({
19731
19766
  });
19732
19767
 
19733
19768
  // ../../packages/math/src/uncertainty.ts
19769
+ function evidenceDecaySeq(referenceSeq, currentIngestSeq, opts) {
19770
+ if (referenceSeq == null || currentIngestSeq == null) return 1;
19771
+ const delta = Math.max(0, currentIngestSeq - referenceSeq);
19772
+ const halfLife = EVIDENCE_HALFLIFE_SEQ * (opts?.isAccepted ? EVIDENCE_ACCEPTED_HALFLIFE_MULT : 1);
19773
+ const raw2 = Math.pow(0.5, delta / halfLife);
19774
+ return Math.max(EVIDENCE_DECAY_FLOOR, Math.min(1, raw2));
19775
+ }
19776
+ function computeNodeUncertainty(node2, currentIngestSeq) {
19777
+ const referenceSeq = node2.lastValidatedAtSeq ?? node2.createdAtSeq;
19778
+ const decay = evidenceDecaySeq(referenceSeq, currentIngestSeq, {
19779
+ isAccepted: node2.validated === true
19780
+ });
19781
+ const acceptedCount = Math.max(0, node2.acceptedCount ?? 0);
19782
+ const corroborationCount = Math.max(0, node2.corroborationCount ?? 0);
19783
+ const failureReportCount = Math.max(0, node2.failureReportCount ?? 0);
19784
+ const decayedValidations = (acceptedCount + CORROBORATION_WEIGHT * corroborationCount) * decay;
19785
+ const decayedFailures = failureReportCount * decay;
19786
+ const alpha = 1 + decayedValidations;
19787
+ const beta = 1 + decayedFailures;
19788
+ const rawUncertainty = beta / (alpha + beta);
19789
+ const uncertainty = Number.isFinite(rawUncertainty) ? rawUncertainty : 0.5;
19790
+ const rawVariance = alpha * beta / ((alpha + beta) ** 2 * (alpha + beta + 1));
19791
+ const variance = Number.isFinite(rawVariance) ? rawVariance : 0;
19792
+ return {
19793
+ nodeId: node2.id,
19794
+ uncertainty: Math.max(0, Math.min(1, uncertainty)),
19795
+ alpha,
19796
+ beta,
19797
+ variance,
19798
+ components: {
19799
+ decayedValidations,
19800
+ decayedFailures,
19801
+ priorStrength: alpha + beta
19802
+ }
19803
+ };
19804
+ }
19805
+ function uncertaintyAdjustedScore(originalScore, uncertainty) {
19806
+ return originalScore * (1.25 - 0.5 * uncertainty);
19807
+ }
19734
19808
  var init_uncertainty = __esm({
19735
19809
  "../../packages/math/src/uncertainty.ts"() {
19736
19810
  "use strict";
@@ -20453,6 +20527,78 @@ var init_pagerank_local = __esm({
20453
20527
  }
20454
20528
  });
20455
20529
 
20530
+ // ../../packages/math/src/rank-knowledge.ts
20531
+ function rankKnowledge(input, weights) {
20532
+ const w = { ...DEFAULT_RANK_KNOWLEDGE_WEIGHTS, ...weights };
20533
+ const semantic = input.semantic == null || !Number.isFinite(input.semantic) ? null : clamp012((input.semantic - w.semanticFloor) / (1 - w.semanticFloor));
20534
+ const lexical = clamp012(input.lexical);
20535
+ const own = semantic == null ? lexical : 1 - (1 - semantic) * (1 - lexical);
20536
+ const relevance = Math.max(own, clamp012(input.inherited ?? 0));
20537
+ const hop = Math.max(w.hopFloor, 1 - w.hopPenalty * Math.max(0, input.hops ?? 0));
20538
+ const e = input.evidence ?? {};
20539
+ const persistence = reinforcementFactor(e.reinforcementCount) * contradictionFactor(e.contradictionPressure);
20540
+ const { uncertainty } = computeNodeUncertainty({
20541
+ id: "",
20542
+ acceptedCount: e.acceptedCount ?? 0,
20543
+ corroborationCount: e.corroborationCount ?? 0,
20544
+ failureReportCount: e.failureReportCount ?? 0
20545
+ });
20546
+ const reliability = uncertaintyAdjustedScore(1, uncertainty);
20547
+ return {
20548
+ score: relevance * hop * persistence * reliability,
20549
+ components: { relevance, semantic, lexical, hop, persistence, reliability, uncertainty }
20550
+ };
20551
+ }
20552
+ function termCoverage(terms, text, weightOf) {
20553
+ if (terms.length === 0) return 0;
20554
+ const hay = text.toLowerCase();
20555
+ let total = 0;
20556
+ let held = 0;
20557
+ for (const t of terms) {
20558
+ const wt = Math.max(0, weightOf(t));
20559
+ total += wt;
20560
+ if (hay.includes(t.toLowerCase())) held += wt;
20561
+ }
20562
+ return total > 0 ? held / total : 0;
20563
+ }
20564
+ function poolEvidence(a, b) {
20565
+ if (!a) return b;
20566
+ if (!b) return a;
20567
+ const keys = ["acceptedCount", "corroborationCount", "failureReportCount", "contradictionPressure", "reinforcementCount"];
20568
+ const out2 = {};
20569
+ for (const k of keys) out2[k] = Math.max(a[k] ?? 0, b[k] ?? 0);
20570
+ return out2;
20571
+ }
20572
+ var DEFAULT_RANK_KNOWLEDGE_WEIGHTS, clamp012;
20573
+ var init_rank_knowledge = __esm({
20574
+ "../../packages/math/src/rank-knowledge.ts"() {
20575
+ "use strict";
20576
+ init_persistence();
20577
+ init_uncertainty();
20578
+ DEFAULT_RANK_KNOWLEDGE_WEIGHTS = {
20579
+ semanticFloor: 0.5,
20580
+ hopPenalty: 0.15,
20581
+ hopFloor: 0.3
20582
+ };
20583
+ clamp012 = (x) => x < 0 ? 0 : x > 1 ? 1 : x;
20584
+ }
20585
+ });
20586
+
20587
+ // ../../packages/math/src/reader-evidence.ts
20588
+ var FIELD_CODES, FIELDS;
20589
+ var init_reader_evidence = __esm({
20590
+ "../../packages/math/src/reader-evidence.ts"() {
20591
+ "use strict";
20592
+ FIELD_CODES = {
20593
+ a: "acceptedCount",
20594
+ c: "corroborationCount",
20595
+ f: "failureReportCount",
20596
+ p: "contradictionPressure"
20597
+ };
20598
+ FIELDS = Object.values(FIELD_CODES);
20599
+ }
20600
+ });
20601
+
20456
20602
  // ../../packages/math/src/index.ts
20457
20603
  var init_src3 = __esm({
20458
20604
  "../../packages/math/src/index.ts"() {
@@ -20480,6 +20626,8 @@ var init_src3 = __esm({
20480
20626
  init_motif_gate();
20481
20627
  init_bko();
20482
20628
  init_pagerank_local();
20629
+ init_rank_knowledge();
20630
+ init_reader_evidence();
20483
20631
  }
20484
20632
  });
20485
20633
 
@@ -27483,6 +27631,22 @@ var init_mechanism_liveness = __esm({
27483
27631
  effectCounter: "refutesStamped",
27484
27632
  note: "RG-mark; reason text is local-only (wire ships nodeId+witnessKey)"
27485
27633
  },
27634
+ {
27635
+ id: "confirm-local-stamp",
27636
+ what: "stamps a harvested confirm / leaned-on witness onto the LOCAL node (confirmedAt/confirmations)",
27637
+ pass: "capture",
27638
+ // The consumer is errata.search's one formula (apps/daemon one-search.ts
27639
+ // localEvidence → packages/math rankKnowledge reliability). Self-gated and
27640
+ // synthetic-gated at harvest, so a quiet counter can also mean every cite
27641
+ // was the session's own — the written-at-all bar, like refutedAt.
27642
+ fed: {
27643
+ labels: ["Problem", "Solution", "RootCause", "Pattern"],
27644
+ attr: "confirmedAt",
27645
+ minFraction: 0
27646
+ },
27647
+ effectCounter: "confirmsStamped",
27648
+ note: "consumed by one-search rankKnowledge; transport to cloud corroborationCount unchanged"
27649
+ },
27486
27650
  {
27487
27651
  id: "regression-recognize",
27488
27652
  what: "marks a resolved problem as resolutionSuspect when it recurs at the door",
@@ -29386,7 +29550,7 @@ function toWirePayload(batch, runId) {
29386
29550
  toCanonicalId: e.to,
29387
29551
  type: e.type,
29388
29552
  attrs: {
29389
- ...typeof e.confidence === "number" ? { confidence: clamp012(e.confidence) } : {},
29553
+ ...typeof e.confidence === "number" ? { confidence: clamp013(e.confidence) } : {},
29390
29554
  ...perContext ? { perContext } : {},
29391
29555
  ...triageDiscriminatorAttrs(e.type, e.attrs),
29392
29556
  // PJ-anchor-version: the two opaque version stamps ride on anchors only.
@@ -29414,7 +29578,7 @@ function toWirePayload(batch, runId) {
29414
29578
  ...symbolSummaries ? { symbolSummaries } : {}
29415
29579
  };
29416
29580
  }
29417
- function clamp012(x) {
29581
+ function clamp013(x) {
29418
29582
  return Math.max(0, Math.min(1, x));
29419
29583
  }
29420
29584
  function compactAttrs(input) {
@@ -29430,7 +29594,7 @@ function textOrThrow(value, field) {
29430
29594
  return text;
29431
29595
  }
29432
29596
  function optionalEdgeAttrs(confidence) {
29433
- return typeof confidence === "number" ? { confidence: clamp012(confidence) } : void 0;
29597
+ return typeof confidence === "number" ? { confidence: clamp013(confidence) } : void 0;
29434
29598
  }
29435
29599
  function makeEdge(fromCanonicalId, type, toCanonicalId, confidence) {
29436
29600
  const attrs = optionalEdgeAttrs(confidence);
@@ -30087,7 +30251,7 @@ var init_client = __esm({
30087
30251
  id: n.canonicalId,
30088
30252
  label: n.label,
30089
30253
  description: n.description,
30090
- extractionConfidence: typeof n.attrs["score"] === "number" ? clamp012(n.attrs["score"]) : 0.5,
30254
+ extractionConfidence: typeof n.attrs["score"] === "number" ? clamp013(n.attrs["score"]) : 0.5,
30091
30255
  extractionSource: INGEST_EXTRACTION_SOURCES.includes(n.attrs["extractionSource"]) ? n.attrs["extractionSource"] : "cold-start-seed",
30092
30256
  embedding: [],
30093
30257
  cumulativeSurprise: 0,
@@ -30107,7 +30271,7 @@ var init_client = __esm({
30107
30271
  from: e.fromCanonicalId,
30108
30272
  to: e.toCanonicalId,
30109
30273
  type: e.type,
30110
- confidence: typeof e.attrs["confidence"] === "number" ? clamp012(e.attrs["confidence"]) : 0.5,
30274
+ confidence: typeof e.attrs["confidence"] === "number" ? clamp013(e.attrs["confidence"]) : 0.5,
30111
30275
  extractionSource: "agent-observed",
30112
30276
  createdAt: now,
30113
30277
  lastSeenAt: now,
@@ -38371,6 +38535,16 @@ function dedupCloudHits(hits) {
38371
38535
  }
38372
38536
  return [...byId.values()];
38373
38537
  }
38538
+ function cloudEvidence(raw2) {
38539
+ if (!raw2 || typeof raw2 !== "object") return void 0;
38540
+ const r = raw2;
38541
+ const out2 = {};
38542
+ for (const k of ["acceptedCount", "corroborationCount", "failureReportCount", "contradictionPressure", "reinforcementCount"]) {
38543
+ const v = r[k];
38544
+ if (typeof v === "number" && Number.isFinite(v) && v > 0) out2[k] = v;
38545
+ }
38546
+ return Object.keys(out2).length ? out2 : void 0;
38547
+ }
38374
38548
  function searchResultToCloudHits(result) {
38375
38549
  const n = result.nodes.length;
38376
38550
  const scores = result.nodes.map((nd) => typeof nd.attrs?.["score"] === "number" ? nd.attrs["score"] : NaN);
@@ -38382,11 +38556,13 @@ function searchResultToCloudHits(result) {
38382
38556
  const communityId = node2.attrs?.["community"];
38383
38557
  const communityLabel = node2.attrs?.["communityLabel"];
38384
38558
  const via = result.via?.[node2.id];
38559
+ const evidence = cloudEvidence(node2.attrs?.["evidence"]);
38385
38560
  return {
38386
38561
  id: node2.id,
38387
38562
  label: node2.label,
38388
38563
  description: node2.description,
38389
38564
  cloudScore,
38565
+ ...evidence ? { evidence } : {},
38390
38566
  ...typeof usage === "number" ? { usageCount: usage } : {},
38391
38567
  ...typeof communityId === "number" ? { community: { id: communityId, label: typeof communityLabel === "string" ? communityLabel : null } } : {},
38392
38568
  ...via ? { via } : {}
@@ -38551,7 +38727,8 @@ async function dualAugment(opts) {
38551
38727
  status: "merged",
38552
38728
  merged,
38553
38729
  seedProvenance,
38554
- seedUsageCount
38730
+ seedUsageCount,
38731
+ cloudEvidence: new Map(deduped.flatMap((h) => h.evidence ? [[h.id, h.evidence]] : []))
38555
38732
  };
38556
38733
  }
38557
38734
  function federationHint(status) {
@@ -38762,6 +38939,124 @@ var init_dual_augment = __esm({
38762
38939
  }
38763
38940
  });
38764
38941
 
38942
+ // src/one-search.ts
38943
+ function localEvidence(attrs) {
38944
+ if (!attrs) return void 0;
38945
+ const n = (k) => {
38946
+ const v = Number(attrs[k]);
38947
+ return Number.isFinite(v) && v > 0 ? v : 0;
38948
+ };
38949
+ const refutations = n("refutations");
38950
+ const evidence = {
38951
+ // Verdict witnesses (prior-tags.ts): `(confirm:)` → confirmations, `(refute:)` → refutations.
38952
+ corroborationCount: n("confirmations"),
38953
+ failureReportCount: refutations,
38954
+ contradictionPressure: refutations * REFUTE_PRESSURE,
38955
+ // Re-observation of the same problem is reinforcement (§5.2), not validation:
38956
+ // `corroborations` here counts the problem being raised again.
38957
+ reinforcementCount: Math.max(n("corroborations"), n("observedCount") - 1)
38958
+ };
38959
+ return Object.values(evidence).some((v) => (v ?? 0) > 0) ? evidence : void 0;
38960
+ }
38961
+ async function rankHits(store, query, hits, opts = {}) {
38962
+ const terms = query.trim().split(/\s+/).filter((t) => t.length >= 2);
38963
+ const texts = hits.map((h) => [h.name ?? h.description ?? "", h.viaText ?? ""].join(" ").trim());
38964
+ const lowered = terms.map((t) => t.toLowerCase());
38965
+ const df = /* @__PURE__ */ new Map();
38966
+ for (const text of texts) {
38967
+ const hay = text.toLowerCase();
38968
+ for (const t of lowered) if (hay.includes(t)) df.set(t, (df.get(t) ?? 0) + 1);
38969
+ }
38970
+ const weightOf = (t) => Math.log(1 + hits.length / (1 + (df.get(t.toLowerCase()) ?? 0)));
38971
+ let vectors = [];
38972
+ let floor;
38973
+ try {
38974
+ const out2 = await (opts.embed ?? defaultEmbed)([query, ...texts]);
38975
+ const q = out2[0];
38976
+ if (q) {
38977
+ floor = semanticFloorFor(q.version);
38978
+ vectors = out2.slice(1).map((v) => v && v.version === q.version ? v : null);
38979
+ vectors.unshift(q);
38980
+ }
38981
+ } catch {
38982
+ vectors = [];
38983
+ }
38984
+ const qv = vectors[0];
38985
+ const weights = floor != null ? { semanticFloor: floor } : void 0;
38986
+ const inputs = hits.map((h, i2) => {
38987
+ const local = store?.getNode(h.id)?.attrs;
38988
+ const cloud = [h.id, ...h.twins ?? []].map((id) => opts.cloudEvidence?.get(id)).reduce((acc, e) => poolEvidence(acc, e), void 0);
38989
+ const cv = vectors[i2 + 1];
38990
+ const evidence = poolEvidence(localEvidence(local), cloud);
38991
+ return {
38992
+ ...qv && cv ? { semantic: cosine(qv.vector, cv.vector) } : {},
38993
+ lexical: termCoverage(terms, texts[i2], weightOf),
38994
+ hops: h.hops ?? 0,
38995
+ ...evidence ? { evidence } : {}
38996
+ };
38997
+ });
38998
+ const indexOf = /* @__PURE__ */ new Map();
38999
+ hits.forEach((h, i2) => {
39000
+ for (const id of [h.id, ...h.twins ?? []]) if (!indexOf.has(id)) indexOf.set(id, i2);
39001
+ });
39002
+ const own = inputs.map((inp) => rankKnowledge(inp, weights).components.relevance);
39003
+ const best = [...own];
39004
+ for (let step = 0; step < INHERIT_DEPTH; step++) {
39005
+ hits.forEach((h, i2) => {
39006
+ const p = h.parentId != null ? indexOf.get(h.parentId) : void 0;
39007
+ if (p != null && p !== i2 && best[p] > best[i2]) best[i2] = best[p];
39008
+ });
39009
+ }
39010
+ const ranked = hits.map((h, i2) => {
39011
+ const r = rankKnowledge({ ...inputs[i2], ...best[i2] > own[i2] ? { inherited: best[i2] } : {} }, weights);
39012
+ return { hit: h, i: i2, r };
39013
+ });
39014
+ ranked.sort((a, b) => b.r.score - a.r.score || a.i - b.i);
39015
+ return ranked.map(({ hit, r }) => ({ ...hit, score: r.score, rank: r.components }));
39016
+ }
39017
+ function interleaveLanes(ranked, isKnowledge, limit) {
39018
+ const lanes = [ranked.filter((r) => isKnowledge(r.label)), ranked.filter((r) => !isKnowledge(r.label))];
39019
+ const out2 = [];
39020
+ for (let i2 = 0; out2.length < limit && i2 < ranked.length; i2++) {
39021
+ const round2 = lanes.flatMap((lane) => lane[i2] ? [lane[i2]] : []).sort((a, b) => (b.score ?? 0) - (a.score ?? 0));
39022
+ for (const hit of round2) if (out2.length < limit) out2.push(hit);
39023
+ }
39024
+ return out2;
39025
+ }
39026
+ function seedQuery(text) {
39027
+ return text.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[^A-Za-z0-9]+/g, " ").trim();
39028
+ }
39029
+ async function rankDualNodes(store, query, nodes, cloudEvidence2) {
39030
+ const withParents = nodes.map((n) => {
39031
+ const parent = n.via?.parentId;
39032
+ return parent ? { ...n, parentId: parent } : n;
39033
+ });
39034
+ const ranked = await rankHits(store, query, withParents, cloudEvidence2 ? { cloudEvidence: cloudEvidence2 } : {});
39035
+ return ranked.map(({ rank, score: score2, ...n }) => ({ ...n, score: score2, why: rankWhy(rank) }));
39036
+ }
39037
+ async function rankSimilarLocal(store, seedText, hits) {
39038
+ const ranked = await rankHits(store, seedQuery(seedText), hits.map((h) => ({ ...h, hops: 0 })));
39039
+ return ranked.map(({ rank, score: score2, hops: _hops, ...h }) => ({ ...h, score: score2, why: rankWhy(rank) }));
39040
+ }
39041
+ function withCite(records, isKnowledge) {
39042
+ return records.map((r) => isKnowledge(String(r["label"])) ? { ...r, cite: String(r["id"]) } : r);
39043
+ }
39044
+ function rankWhy(c) {
39045
+ const r = (x) => Math.round(x * 1e3) / 1e3;
39046
+ return { relevance: r(c.relevance), reliability: r(c.reliability), persistence: r(c.persistence) };
39047
+ }
39048
+ var REFUTE_PRESSURE, INHERIT_DEPTH, defaultEmbed;
39049
+ var init_one_search = __esm({
39050
+ "src/one-search.ts"() {
39051
+ "use strict";
39052
+ init_src4();
39053
+ init_src3();
39054
+ REFUTE_PRESSURE = 0.6;
39055
+ INHERIT_DEPTH = 3;
39056
+ defaultEmbed = async (texts) => texts.map((t) => ({ vector: embed(t), version: EMBEDDING_VERSION }));
39057
+ }
39058
+ });
39059
+
38765
39060
  // src/daemon-generalize-client.ts
38766
39061
  function daemonLoopbackUrl(lockPath = globalDaemonLock()) {
38767
39062
  const url2 = readDaemonLock(lockPath)?.webUiUrl;
@@ -48519,6 +48814,7 @@ var init_mcp = __esm({
48519
48814
  init_identity2();
48520
48815
  init_registry();
48521
48816
  init_dual_augment();
48817
+ init_one_search();
48522
48818
  init_dual_burst();
48523
48819
  init_twin_index();
48524
48820
  init_src5();
@@ -48586,7 +48882,7 @@ var init_mcp = __esm({
48586
48882
  },
48587
48883
  {
48588
48884
  name: "errata.search",
48589
- description: "Find a symbol, string, comment, or the knowledge around them, as a GRAPH search. The query's words pick entry points \u2014 a symbol an identifier names, knowledge carrying the query's words (a literal phrase counts most), the strongest code matches \u2014 and one walk from all of them ranks what sits at their centre, so a Problem anchored on the function you named surfaces without repeating your words. Knowledge and code alternate down the list. Each hit carries `matched` (true = the text matched; false = the walk reached it, with `reachedVia` {edgeType, from}), `score`, and `links` \u2014 its edges to the OTHER hits in this answer, so a Problem \u2014CAUSED_BY\u2192 RootCause or a fix \u2014ANCHORED_AT\u2192 the function reads as a chain. Word order and punctuation don't matter. A comment that documents a symbol resolves to that SYMBOL (the comment rides along as `via` \u2014 it's the why, not the destination); test scaffolding and floating comments sort below production code. When the collective is reachable, results BLEND cross-project knowledge, each tagged `provenance` (local | collective | corroborated) with `usageCount`.",
48885
+ description: "Find a symbol, string, comment, or the knowledge around them, as a GRAPH search. The query's words pick entry points \u2014 a symbol an identifier names, knowledge carrying the query's words (a literal phrase counts most), the strongest code matches \u2014 and one walk from all of them ranks what sits at their centre, so a Problem anchored on the function you named surfaces without repeating your words. Knowledge and code alternate down the list. Each hit carries `matched` (true = the text matched; false = the walk reached it, with `reachedVia` {edgeType, from}), `score`, and `links` \u2014 its edges to the OTHER hits in this answer, so a Problem \u2014CAUSED_BY\u2192 RootCause or a fix \u2014ANCHORED_AT\u2192 the function reads as a chain. Word order and punctuation don't matter. A comment that documents a symbol resolves to that SYMBOL (the comment rides along as `via` \u2014 it's the why, not the destination); test scaffolding and floating comments sort below production code. When the collective is reachable, results BLEND cross-project knowledge, each tagged `provenance` (local | collective | corroborated) with `usageCount`. Local and Network hits are ranked by one formula \u2014 relevance \xD7 evidence \u2014 and each knowledge hit's `why` shows its relevance and reliability. Judge a hit you relied on or ruled out by its `cite`: (confirm:<cite>) or (refute:<cite> why).",
48590
48886
  inputSchema: {
48591
48887
  type: "object",
48592
48888
  properties: {
@@ -48598,12 +48894,20 @@ var init_mcp = __esm({
48598
48894
  handler: async (args2, store, ctx) => {
48599
48895
  const query = String(args2["query"] ?? "");
48600
48896
  const limit = Math.max(1, Math.min(100, Number(args2["limit"] ?? 20)));
48601
- const hits = withLinks(
48602
- store,
48603
- searchWalkEnabled() ? searchGraphWalk(store, query, limit) : searchGraph(store, query, limit).map((h) => ({ ...h, score: h.pageRank, matched: true }))
48604
- );
48897
+ const pool = searchWalkEnabled() ? searchGraphWalk(store, query, limit * 2) : searchGraph(store, query, limit * 2).map((h) => ({ ...h, score: h.pageRank, matched: true }));
48898
+ const viaText = new Map(pool.flatMap((h) => h.via?.text ? [[h.id, h.via.text]] : []));
48899
+ const parentOf = new Map(pool.flatMap((h) => {
48900
+ const from = h.reachedVia?.from;
48901
+ return from ? [[h.id, from]] : [];
48902
+ }));
48903
+ const isKnowledge = (label) => KNOWLEDGE_LABELS.has(label);
48904
+ const rankLocal = async () => interleaveLanes(
48905
+ await rankHits(store, query, pool.map((h) => ({ ...h, name: h.description, ...h.via?.text ? { viaText: h.via.text } : {}, ...parentOf.has(h.id) ? { parentId: parentOf.get(h.id) } : {}, hops: h.matched ? 0 : 1 }))),
48906
+ isKnowledge,
48907
+ limit
48908
+ ).map(({ rank, ...h }) => ({ ...h, why: rankWhy(rank), ...isKnowledge(h.label) ? { cite: h.id } : {} }));
48605
48909
  if (ctx.cloud && query.trim()) {
48606
- const localHits = hits.map((h) => ({
48910
+ const localHits = pool.map((h) => ({
48607
48911
  id: h.id,
48608
48912
  node: { label: h.label, description: h.description },
48609
48913
  score: h.score,
@@ -48615,30 +48919,45 @@ var init_mcp = __esm({
48615
48919
  ...ctx.generalizeSoft ? { generalizeSoft: ctx.generalizeSoft } : {},
48616
48920
  localHits,
48617
48921
  queryText: query,
48618
- limit,
48619
- fuse: "rank"
48922
+ limit
48620
48923
  });
48621
48924
  if (dual.status === "merged") {
48925
+ const ranked = await rankHits(
48926
+ store,
48927
+ query,
48928
+ dual.merged.nodes.map((n) => ({
48929
+ ...n,
48930
+ ...viaText.has(n.id) ? { viaText: viaText.get(n.id) } : {},
48931
+ ...parentOf.get(n.id) ?? n.via?.parentId ? { parentId: parentOf.get(n.id) ?? n.via?.parentId } : {},
48932
+ // A Network entry matched the query; a node it reached by walking carries `via`.
48933
+ hops: n.provenance === "collective" ? n.via ? 1 : 0 : n.hops
48934
+ })),
48935
+ { cloudEvidence: dual.cloudEvidence }
48936
+ );
48937
+ const chosen = interleaveLanes(ranked, isKnowledge, limit);
48938
+ const why = new Map(chosen.map((n) => [n.id, rankWhy(n.rank)]));
48939
+ const formatted = formatDualNodes({ ...dual.merged, nodes: chosen.map(({ rank: _rank, viaText: _via, ...n }) => n) });
48622
48940
  return {
48623
48941
  query,
48624
48942
  collectiveReachable: true,
48625
48943
  collectiveStatus: "merged",
48626
- count: dual.merged.nodes.length,
48944
+ count: formatted.length,
48627
48945
  corroborated: dual.merged.corroboratedCount,
48628
48946
  collective: dual.merged.collectiveCount,
48629
- results: withLinks(store, formatDualNodes(dual.merged))
48947
+ results: withLinks(store, withCite(formatted.map((r) => ({ ...r, why: why.get(String(r["id"])) })), isKnowledge))
48630
48948
  };
48631
48949
  }
48950
+ const local = withLinks(store, await rankLocal());
48632
48951
  return {
48633
48952
  query,
48634
48953
  collectiveReachable: dual.status === "empty",
48635
48954
  collectiveStatus: dual.status,
48636
48955
  ...federationHint(dual.status) ? { collectiveHint: federationHint(dual.status) } : {},
48637
- count: hits.length,
48638
- results: hits
48956
+ count: local.length,
48957
+ results: local
48639
48958
  };
48640
48959
  }
48641
- return hits;
48960
+ return withLinks(store, await rankLocal());
48642
48961
  }
48643
48962
  },
48644
48963
  {
@@ -48816,6 +49135,8 @@ var init_mcp = __esm({
48816
49135
  limit: args2["limit"] != null ? Number(args2["limit"]) : 20
48817
49136
  });
48818
49137
  if (dual.status === "merged") {
49138
+ const nodes = await rankDualNodes(store, seedQuery(seedNode?.description ?? id), dual.merged.nodes, dual.cloudEvidence);
49139
+ const why = new Map(nodes.map((n) => [n.id, n.why]));
48819
49140
  return {
48820
49141
  seed: id,
48821
49142
  ...seedTwinFields(args2, seedNode),
@@ -48823,14 +49144,17 @@ var init_mcp = __esm({
48823
49144
  ...dual.seedUsageCount != null ? { seedUsageCount: dual.seedUsageCount } : {},
48824
49145
  collectiveReachable: true,
48825
49146
  collectiveStatus: "merged",
48826
- count: dual.merged.nodes.length,
49147
+ count: nodes.length,
48827
49148
  corroborated: dual.merged.corroboratedCount,
48828
49149
  collective: dual.merged.collectiveCount,
48829
- results: formatDualNodes(dual.merged)
49150
+ results: withCite(formatDualNodes({ ...dual.merged, nodes }).map((r) => ({ ...r, why: why.get(String(r["id"])) })), (l) => KNOWLEDGE_LABELS.has(l))
48830
49151
  };
48831
49152
  }
48832
49153
  collectiveStatus = dual.status;
48833
49154
  }
49155
+ const localOnly = mergeDualBurst(localHits, [], { twins: storeTwinIndex(store, []), seedId: id });
49156
+ const localNodes = await rankDualNodes(store, seedQuery(seedNode?.description ?? id), localOnly.nodes);
49157
+ const localWhy = new Map(localNodes.map((n) => [n.id, n.why]));
48834
49158
  return {
48835
49159
  seed: id,
48836
49160
  ...seedTwinFields(args2, seedNode),
@@ -48838,12 +49162,8 @@ var init_mcp = __esm({
48838
49162
  collectiveReachable: collectiveStatus === "empty",
48839
49163
  collectiveStatus,
48840
49164
  ...federationHint(collectiveStatus) ? { collectiveHint: federationHint(collectiveStatus) } : {},
48841
- // Same twin fold as the merged path: a hydrated in-store copy of a hit
48842
- // (or of the seed) is not a second entity.
48843
- ...(() => {
48844
- const localOnly = mergeDualBurst(localHits, [], { twins: storeTwinIndex(store, []), seedId: id });
48845
- return { count: localOnly.nodes.length, results: formatDualNodes(localOnly) };
48846
- })()
49165
+ count: localNodes.length,
49166
+ results: withCite(formatDualNodes({ ...localOnly, nodes: localNodes }).map((r) => ({ ...r, why: localWhy.get(String(r["id"])) })), (l) => KNOWLEDGE_LABELS.has(l))
48847
49167
  };
48848
49168
  }
48849
49169
  },
@@ -49436,24 +49756,27 @@ var init_mcp = __esm({
49436
49756
  limit
49437
49757
  });
49438
49758
  if (dual.status === "merged") {
49759
+ const nodes = (await rankDualNodes(store, seedQuery(node2.description), dual.merged.nodes, dual.cloudEvidence)).slice(0, limit);
49760
+ const why = new Map(nodes.map((n) => [n.id, n.why]));
49439
49761
  return {
49440
49762
  seedId: id,
49441
49763
  collectiveReachable: true,
49442
49764
  collectiveStatus: "merged",
49443
- count: dual.merged.nodes.length,
49765
+ count: nodes.length,
49444
49766
  corroborated: dual.merged.corroboratedCount,
49445
49767
  collective: dual.merged.collectiveCount,
49446
- results: formatDualNodes(dual.merged)
49768
+ results: withCite(formatDualNodes({ ...dual.merged, nodes }).map((r) => ({ ...r, why: why.get(String(r["id"])) })), (l) => KNOWLEDGE_LABELS.has(l))
49447
49769
  };
49448
49770
  }
49449
49771
  return {
49450
49772
  ...local,
49773
+ hits: await rankSimilarLocal(store, node2.description, local.hits ?? []),
49451
49774
  collectiveReachable: dual.status === "empty",
49452
49775
  collectiveStatus: dual.status,
49453
49776
  ...federationHint(dual.status) ? { collectiveHint: federationHint(dual.status) } : {}
49454
49777
  };
49455
49778
  }
49456
- return local;
49779
+ return { ...local, hits: await rankSimilarLocal(store, node2.description, local.hits ?? []) };
49457
49780
  }
49458
49781
  },
49459
49782
  {
@@ -81771,7 +82094,10 @@ var CITE_GROUP_RE = /\(((?:[^()\n]|\([^()\n]*\)){1,200})\)/g;
81771
82094
  var HANDLE_RE2 = new RegExp(TAG_HANDLE_SOURCE, "gi");
81772
82095
  var PLACEHOLDER_HANDLES = TAG_PLACEHOLDER_HANDLES;
81773
82096
  var isPlaceholderHandle = (h) => PLACEHOLDER_HANDLES.has(h.toLowerCase());
81774
- var FLAG_BODY_HANDLE_RE = /^(?:[a-z0-9]+(?:-[a-z0-9]+){2,}-(?=[0-9a-f]{0,3}\d)[0-9a-f]{4}|(?:pat|sol|drc|dcause|dfix|dprob|dvuln|prob|claim|err)_[0-9a-f]{6,})$/i;
82097
+ var FLAG_BODY_HANDLE_RE = new RegExp(
82098
+ String.raw`^(?:[a-z0-9]+(?:-[a-z0-9]+){2,}-(?=[0-9a-f]{0,3}\d)[0-9a-f]{4}|(?:${TAG_CANONICAL_ID_PREFIXES.join("|")})_[0-9a-f]{6,})$`,
82099
+ "i"
82100
+ );
81775
82101
  var FIX_PREFIX = /^\s*fix:(?:#([a-z][\w-]{0,63}))?\s*/i;
81776
82102
  var CAUSE_PREFIX = /^\s*cause:(?:#([a-z][\w-]{0,63}))?\s*/i;
81777
82103
  var NEST2_UNIT = String.raw`(?:[^()\n]|\((?:[^()\n]|\([^()\n]*\))*\))`;
@@ -82541,6 +82867,32 @@ function applyLocalRefutations(store, refutes, ts) {
82541
82867
  }
82542
82868
  return out2;
82543
82869
  }
82870
+ function applyLocalConfirmations(store, confirms, ts) {
82871
+ const out2 = { stamped: 0, duplicate: 0, unknownNode: 0 };
82872
+ for (const c of confirms) {
82873
+ const node2 = store.getNode(c.nodeId);
82874
+ if (!node2) {
82875
+ out2.unknownNode++;
82876
+ continue;
82877
+ }
82878
+ const keys = node2.attrs["confirmWitnessKeys"] ?? [];
82879
+ if (keys.includes(c.witnessKey)) {
82880
+ out2.duplicate++;
82881
+ continue;
82882
+ }
82883
+ store.updateNode(c.nodeId, {
82884
+ attrs: {
82885
+ ...node2.attrs,
82886
+ confirmedAt: ts,
82887
+ confirmations: (Number(node2.attrs["confirmations"]) || 0) + 1,
82888
+ confirmWitnessKeys: [...keys, c.witnessKey].slice(-REFUTE_WITNESS_KEYS_CAP)
82889
+ },
82890
+ lastUpdatedAt: ts
82891
+ });
82892
+ out2.stamped++;
82893
+ }
82894
+ return out2;
82895
+ }
82544
82896
  var PRIOR_TAG_INSTRUCTION = buildAgentInstruction();
82545
82897
  function isEdgeElicitationEnabled() {
82546
82898
  return (process.env["EDGE_ELICITATION_ENABLED"] ?? "true").toLowerCase() !== "false";
@@ -82576,8 +82928,15 @@ function readPrimingHandles(path3) {
82576
82928
  return {};
82577
82929
  }
82578
82930
  }
82931
+ var BARE_KNOWLEDGE_ID_RE = new RegExp(
82932
+ String.raw`^(?:${TAG_CANONICAL_ID_PREFIXES.filter((p) => p !== "dom").join("|")})_[0-9a-f]{6,}$`,
82933
+ "i"
82934
+ );
82935
+ function isCloudBornKnowledgeId(store, id) {
82936
+ return !store.getNode(id) && BARE_KNOWLEDGE_ID_RE.test(id);
82937
+ }
82579
82938
  function resolveHandle(store, handle2, handleMap) {
82580
- return handleMap[handle2]?.id ?? (store.getNode(handle2) ? handle2 : void 0);
82939
+ return handleMap[handle2]?.id ?? (store.getNode(handle2) || BARE_KNOWLEDGE_ID_RE.test(handle2) ? handle2 : void 0);
82581
82940
  }
82582
82941
  var CITE_ANCHOR_LABELS = /* @__PURE__ */ new Set(["Problem", "Solution", "RootCause", "Pattern", "Claim", "Technique", "AntiPattern"]);
82583
82942
  var CITE_ANCHOR_PROMOTE_SESSIONS = 2;
@@ -82897,7 +83256,7 @@ function harvestInlineTags(store, text, opts) {
82897
83256
  const targetId = resolveCited(tag.kind, tag.handle);
82898
83257
  const target = targetId ? store.getNode(targetId) : null;
82899
83258
  const citedLabel = target?.label ?? opts.handleMap[tag.handle]?.label;
82900
- if (targetId && citedLabel && CORROBORATABLE_LABELS.has(citedLabel)) {
83259
+ if (targetId && (citedLabel ? CORROBORATABLE_LABELS.has(citedLabel) : isCloudBornKnowledgeId(store, targetId))) {
82901
83260
  if (tag.kind === "confirm") {
82902
83261
  const witnessKey = `corrob:${targetId}:confirm:${digest({ h: tag.handle })}`.slice(0, 72);
82903
83262
  if (!plan.corroborations.some((c) => c.witnessKey === witnessKey)) {
@@ -82917,7 +83276,7 @@ function harvestInlineTags(store, text, opts) {
82917
83276
  const targetId = resolveCited("prior", tag.handle);
82918
83277
  const target = targetId ? store.getNode(targetId) : null;
82919
83278
  const citedLabel = target?.label ?? opts.handleMap[tag.handle]?.label;
82920
- if (targetId && citedLabel && CORROBORATABLE_LABELS.has(citedLabel)) {
83279
+ if (targetId && (citedLabel ? CORROBORATABLE_LABELS.has(citedLabel) : isCloudBornKnowledgeId(store, targetId))) {
82921
83280
  const witnessKey = `corrob:${targetId}:lean:${digest({ h: tag.handle })}`.slice(0, 72);
82922
83281
  if (!plan.corroborations.some((c) => c.witnessKey === witnessKey)) {
82923
83282
  const exposure = typeof store.currentIngestSeq === "function" ? priorExposure(store, targetId, { seq: store.currentIngestSeq(), ts: opts.ts }) : "unshown";
@@ -87527,7 +87886,7 @@ function createWatchBreaker(deps) {
87527
87886
  }
87528
87887
 
87529
87888
  // src/engine.ts
87530
- var DAEMON_VERSION = true ? "2.0.23-dev.4796" : "2.0.0-alpha.0";
87889
+ var DAEMON_VERSION = true ? "2.0.23-dev.4821" : "2.0.0-alpha.0";
87531
87890
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
87532
87891
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
87533
87892
  var GIT_OP_MUTE_MS = 4e3;
@@ -88650,6 +89009,7 @@ function createWorkspaceEngine(opts) {
88650
89009
  let exposureRecent = 0;
88651
89010
  let corroboratedEdges = 0;
88652
89011
  let refutesStamped = 0;
89012
+ let confirmsStamped = 0;
88653
89013
  let recurrencesMarked = 0;
88654
89014
  let reopenedFromRegression = 0;
88655
89015
  let fixHeldConfirmed = 0;
@@ -88838,6 +89198,14 @@ function createWorkspaceEngine(opts) {
88838
89198
  citeAnchorsPromoted += plan.citeAnchorsPromoted;
88839
89199
  const refuteResult = applyLocalRefutations(store, plan.refutes, t);
88840
89200
  refutesStamped += refuteResult.stamped;
89201
+ if (sessions.originOf(sessionId) === void 0) {
89202
+ const confirmResult = applyLocalConfirmations(
89203
+ store,
89204
+ plan.corroborations.filter((c) => store.getNode(c.nodeId)?.attrs["sources"]?.[0] !== sessionId),
89205
+ t
89206
+ );
89207
+ confirmsStamped += confirmResult.stamped;
89208
+ }
88841
89209
  for (const c of plan.corroborations) {
88842
89210
  const node2 = store.getNode(c.nodeId);
88843
89211
  if (node2?.label !== "Solution") continue;
@@ -89522,6 +89890,7 @@ function createWorkspaceEngine(opts) {
89522
89890
  // RG-mark: refute witnesses stamped onto local nodes (the local half of
89523
89891
  // the contradict channel; the wire half rides the witness ledger).
89524
89892
  refutesStamped,
89893
+ confirmsStamped,
89525
89894
  // RG-recognize tier A: resolved problems the door saw recur this pass.
89526
89895
  recurrencesMarked,
89527
89896
  // RG-reopen: closes flipped open on the two-touch evidence bar.
@@ -90912,7 +91281,7 @@ function instanceCloudWithdrawal(n, destination, getMeta) {
90912
91281
  return held;
90913
91282
  }
90914
91283
  }
90915
- var FIELDS = ["cloudWithdrawn", "withdrawnAtCorrectionSeq", "contributedAtSeq", "cloudNodeId", "anchorsContributedDigest", "projectAnchorsContributedDigest", "semanticEdgesContributedDigest", "shipRefusedSinceSeq", "shipRefusedCount", "shipRefusedReason", "shipRefusedFingerprint"];
91284
+ var FIELDS2 = ["cloudWithdrawn", "withdrawnAtCorrectionSeq", "contributedAtSeq", "cloudNodeId", "anchorsContributedDigest", "projectAnchorsContributedDigest", "semanticEdgesContributedDigest", "shipRefusedSinceSeq", "shipRefusedCount", "shipRefusedReason", "shipRefusedFingerprint"];
90916
91285
  function instanceDestinationKey(input) {
90917
91286
  return createHash18("sha256").update(JSON.stringify([
90918
91287
  input.workspace,
@@ -90934,7 +91303,7 @@ function instanceReceipt(n, destination) {
90934
91303
  function updateInstanceReceipt(n, destination, patch, mirrorLegacy) {
90935
91304
  const receipt = { ...instanceReceipt(n, destination), ...patch };
90936
91305
  const attrs = { ...n.attrs, instanceReceipts: { ...receiptMap(n.attrs), [destination]: receipt } };
90937
- if (mirrorLegacy) for (const field of FIELDS) {
91306
+ if (mirrorLegacy) for (const field of FIELDS2) {
90938
91307
  if (field in receipt) attrs[field] = receipt[field];
90939
91308
  else delete attrs[field];
90940
91309
  }
@@ -101580,9 +101949,11 @@ async function cmdLink(args2) {
101580
101949
  saveConfig(synced.config);
101581
101950
  }
101582
101951
  }
101583
- if (!consents.mineHistory) console.log("history: not mined (consent off)");
101584
- else if (reported?.stopRequested) console.log("history: a stop request is standing in the console; the daemon honours it");
101585
- else console.log(`history: consents recorded${consents.contributeHistory ? "" : " (mine only)"} \xB7 the daemon walks the repo on its next pass`);
101952
+ if (historyIngestEnabled()) {
101953
+ if (!consents.mineHistory) console.log("history: not mined (consent off)");
101954
+ else if (reported?.stopRequested) console.log("history: a stop request is standing in the console; the daemon honours it");
101955
+ else console.log(`history: consents recorded${consents.contributeHistory ? "" : " (mine only)"} \xB7 the daemon walks the repo on its next pass`);
101956
+ }
101586
101957
  return;
101587
101958
  } catch (err2) {
101588
101959
  const message2 = err2 instanceof Error ? err2.message : String(err2);
@@ -14867,7 +14867,25 @@ function normalizeParam(v) {
14867
14867
  }
14868
14868
 
14869
14869
  // ../../packages/local-shared/src/tag-grammar.ts
14870
- var TAG_CANONICAL_ID_PREFIXES = ["pat", "sol", "drc", "dcause", "dfix", "dprob", "dvuln", "prob", "claim", "err"];
14870
+ var TAG_CANONICAL_ID_PREFIXES = [
14871
+ "motif_community_projn",
14872
+ "motif_community_orgn",
14873
+ "motif",
14874
+ "projn",
14875
+ "orgn",
14876
+ "dtri",
14877
+ "dom",
14878
+ "pat",
14879
+ "sol",
14880
+ "drc",
14881
+ "dcause",
14882
+ "dfix",
14883
+ "dprob",
14884
+ "dvuln",
14885
+ "prob",
14886
+ "claim",
14887
+ "err"
14888
+ ];
14871
14889
  var TAG_HANDLE_SOURCE = String.raw`\[([a-z0-9][\w-]{0,80})\]|((?:${TAG_CANONICAL_ID_PREFIXES.join("|")})_[0-9a-f]{6,})`;
14872
14890
  var TAG_THREAD_SOURCE = String.raw`#([a-z][\w-]{0,63})`;
14873
14891
  var TAG_PLACEHOLDER_HANDLES = /* @__PURE__ */ new Set([
@@ -16004,6 +16022,15 @@ function pageRankScale(ranks) {
16004
16022
  var DEMAND_HOT = Math.log1p(10);
16005
16023
  var DEMAND_WARM = Math.log1p(5);
16006
16024
 
16025
+ // ../../packages/math/src/reader-evidence.ts
16026
+ var FIELD_CODES = {
16027
+ a: "acceptedCount",
16028
+ c: "corroborationCount",
16029
+ f: "failureReportCount",
16030
+ p: "contradictionPressure"
16031
+ };
16032
+ var FIELDS = Object.values(FIELD_CODES);
16033
+
16007
16034
  // ../../packages/local-graph/src/node-select.ts
16008
16035
  var SELECT_INDEXES = [
16009
16036
  "nodes_live_local_community",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.23-dev.4796",
3
+ "version": "2.0.23-dev.4821",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -16534,7 +16534,25 @@ var TAG_CANONICAL_ID_PREFIXES, TAG_HANDLE_SOURCE, TAG_THREAD_SOURCE, TAG_PLACEHO
16534
16534
  var init_tag_grammar = __esm({
16535
16535
  "../../packages/local-shared/src/tag-grammar.ts"() {
16536
16536
  "use strict";
16537
- TAG_CANONICAL_ID_PREFIXES = ["pat", "sol", "drc", "dcause", "dfix", "dprob", "dvuln", "prob", "claim", "err"];
16537
+ TAG_CANONICAL_ID_PREFIXES = [
16538
+ "motif_community_projn",
16539
+ "motif_community_orgn",
16540
+ "motif",
16541
+ "projn",
16542
+ "orgn",
16543
+ "dtri",
16544
+ "dom",
16545
+ "pat",
16546
+ "sol",
16547
+ "drc",
16548
+ "dcause",
16549
+ "dfix",
16550
+ "dprob",
16551
+ "dvuln",
16552
+ "prob",
16553
+ "claim",
16554
+ "err"
16555
+ ];
16538
16556
  TAG_HANDLE_SOURCE = String.raw`\[([a-z0-9][\w-]{0,80})\]|((?:${TAG_CANONICAL_ID_PREFIXES.join("|")})_[0-9a-f]{6,})`;
16539
16557
  TAG_THREAD_SOURCE = String.raw`#([a-z][\w-]{0,63})`;
16540
16558
  TAG_PLACEHOLDER_HANDLES = /* @__PURE__ */ new Set([
@@ -26976,6 +26994,15 @@ function pagerankLocal(input) {
26976
26994
  return { scores, iterations: iter, converged };
26977
26995
  }
26978
26996
 
26997
+ // ../../packages/math/src/reader-evidence.ts
26998
+ var FIELD_CODES = {
26999
+ a: "acceptedCount",
27000
+ c: "corroborationCount",
27001
+ f: "failureReportCount",
27002
+ p: "contradictionPressure"
27003
+ };
27004
+ var FIELDS = Object.values(FIELD_CODES);
27005
+
26979
27006
  // ../../packages/local-graph/src/node-select.ts
26980
27007
  var SELECT_INDEXES = [
26981
27008
  "nodes_live_local_community",
@@ -30379,6 +30406,22 @@ var MECHANISMS = [
30379
30406
  effectCounter: "refutesStamped",
30380
30407
  note: "RG-mark; reason text is local-only (wire ships nodeId+witnessKey)"
30381
30408
  },
30409
+ {
30410
+ id: "confirm-local-stamp",
30411
+ what: "stamps a harvested confirm / leaned-on witness onto the LOCAL node (confirmedAt/confirmations)",
30412
+ pass: "capture",
30413
+ // The consumer is errata.search's one formula (apps/daemon one-search.ts
30414
+ // localEvidence → packages/math rankKnowledge reliability). Self-gated and
30415
+ // synthetic-gated at harvest, so a quiet counter can also mean every cite
30416
+ // was the session's own — the written-at-all bar, like refutedAt.
30417
+ fed: {
30418
+ labels: ["Problem", "Solution", "RootCause", "Pattern"],
30419
+ attr: "confirmedAt",
30420
+ minFraction: 0
30421
+ },
30422
+ effectCounter: "confirmsStamped",
30423
+ note: "consumed by one-search rankKnowledge; transport to cloud corroborationCount unchanged"
30424
+ },
30382
30425
  {
30383
30426
  id: "regression-recognize",
30384
30427
  what: "marks a resolved problem as resolutionSuspect when it recurs at the door",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "errata-context",
3
- "version": "2.0.23-dev.4796",
3
+ "version": "2.0.23-dev.4821",
4
4
  "description": "A minimal 3D view of loaded Errata priors and recent graph bursts.",
5
5
  "author": {
6
6
  "name": "inErrata"
@@ -1,4 +1,4 @@
1
- 65e39d2985c41acb67f59e3b44bd9eeff584addcae3c7cf6db9006fa89c0bea8 .codex-plugin/plugin.json
1
+ 95faa89c85636250224e047d950eb391ee29839a962e38092b70d21a27aaea62 .codex-plugin/plugin.json
2
2
  a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
3
3
  fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
4
4
  73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js