@inerrata-corporation/errata 2.0.22-dev.4068 → 2.0.22-dev.4074
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/consolidate-worker.mjs
CHANGED
|
@@ -16814,7 +16814,7 @@ function compileNodeSelect(q) {
|
|
|
16814
16814
|
}
|
|
16815
16815
|
const orderParams = !q.orderBy && q.labels.length > 1 ? [...q.labels] : [];
|
|
16816
16816
|
const limit = q.limit !== void 0 ? ` LIMIT ${Math.max(0, Math.floor(q.limit))}` : "";
|
|
16817
|
-
const sql = `SELECT id, label, description, created_at, last_updated_at, page_rank, cumulative_hits, extraction_confidence, extraction_source, community, created_at_seq, last_reinforced_at_seq, valid_to, ${EMBEDDING_DIM_SQL} AS embedding_dim${q.withEmbedding ? ", embedding_blob, embedding_json" : ""}${attrCols} FROM nodes WHERE ${where} ORDER BY ${order}${limit}`;
|
|
16817
|
+
const sql = `SELECT id, label, description, created_at, last_updated_at, page_rank, cumulative_hits, extraction_confidence, extraction_source, community, created_at_seq, last_reinforced_at_seq, valid_to, logical_id, version, ${EMBEDDING_DIM_SQL} AS embedding_dim${q.withEmbedding ? ", embedding_blob, embedding_json" : ""}${attrCols} FROM nodes WHERE ${where} ORDER BY ${order}${limit}`;
|
|
16818
16818
|
return { sql, params: [...params, ...orderParams] };
|
|
16819
16819
|
}
|
|
16820
16820
|
function decodeAttr(value, type) {
|
|
@@ -16855,6 +16855,8 @@ function decodeSelectedRow(r, attrs, decodeVector) {
|
|
|
16855
16855
|
...r["created_at_seq"] != null ? { createdAtSeq: r["created_at_seq"] } : {},
|
|
16856
16856
|
...r["last_reinforced_at_seq"] != null ? { lastReinforcedAtSeq: r["last_reinforced_at_seq"] } : {},
|
|
16857
16857
|
validTo: r["valid_to"] ?? null,
|
|
16858
|
+
logicalId: r["logical_id"] ?? r["id"],
|
|
16859
|
+
version: Number(r["version"] ?? 1),
|
|
16858
16860
|
embeddingDim: Number(r["embedding_dim"] ?? 0),
|
|
16859
16861
|
...decodeVector ? { embedding: decodeVector(r["embedding_blob"], r["embedding_json"] ?? "[]") } : {},
|
|
16860
16862
|
attrs: out
|
|
@@ -18308,6 +18310,7 @@ init_src();
|
|
|
18308
18310
|
// ../../packages/local-graph/src/design-problem.ts
|
|
18309
18311
|
init_src();
|
|
18310
18312
|
var RECURRENCE_DEBOUNCE_MS = 60 * 60 * 1e3;
|
|
18313
|
+
var EXPOSURE_LOG_KEYS = ["exposureLog", "exposureLogSince", "exposureLogStart", "exposureTrimmed", "exposureFirst"];
|
|
18311
18314
|
|
|
18312
18315
|
// ../../packages/local-graph/src/intent.ts
|
|
18313
18316
|
init_src();
|
|
@@ -18368,7 +18371,7 @@ function percolate(l1, l2, opts) {
|
|
|
18368
18371
|
validFrom: opts.ts,
|
|
18369
18372
|
validTo: null,
|
|
18370
18373
|
attrs: {
|
|
18371
|
-
...n.attrs,
|
|
18374
|
+
...withoutExposureLog(n.attrs),
|
|
18372
18375
|
abstractionLevel: ABSTRACTION_LEVEL.CONCRETE,
|
|
18373
18376
|
observedInProjects: [ws]
|
|
18374
18377
|
}
|
|
@@ -18427,6 +18430,11 @@ function percolate(l1, l2, opts) {
|
|
|
18427
18430
|
result.touched = [...touched];
|
|
18428
18431
|
return result;
|
|
18429
18432
|
}
|
|
18433
|
+
function withoutExposureLog(attrs) {
|
|
18434
|
+
const out = { ...attrs };
|
|
18435
|
+
for (const k of EXPOSURE_LOG_KEYS) delete out[k];
|
|
18436
|
+
return out;
|
|
18437
|
+
}
|
|
18430
18438
|
|
|
18431
18439
|
// ../../packages/local-graph/src/abstraction.ts
|
|
18432
18440
|
init_src();
|
package/errata.mjs
CHANGED
|
@@ -19510,7 +19510,7 @@ function compileNodeSelect(q) {
|
|
|
19510
19510
|
}
|
|
19511
19511
|
const orderParams = !q.orderBy && q.labels.length > 1 ? [...q.labels] : [];
|
|
19512
19512
|
const limit = q.limit !== void 0 ? ` LIMIT ${Math.max(0, Math.floor(q.limit))}` : "";
|
|
19513
|
-
const sql = `SELECT id, label, description, created_at, last_updated_at, page_rank, cumulative_hits, extraction_confidence, extraction_source, community, created_at_seq, last_reinforced_at_seq, valid_to, ${EMBEDDING_DIM_SQL} AS embedding_dim${q.withEmbedding ? ", embedding_blob, embedding_json" : ""}${attrCols} FROM nodes WHERE ${where} ORDER BY ${order}${limit}`;
|
|
19513
|
+
const sql = `SELECT id, label, description, created_at, last_updated_at, page_rank, cumulative_hits, extraction_confidence, extraction_source, community, created_at_seq, last_reinforced_at_seq, valid_to, logical_id, version, ${EMBEDDING_DIM_SQL} AS embedding_dim${q.withEmbedding ? ", embedding_blob, embedding_json" : ""}${attrCols} FROM nodes WHERE ${where} ORDER BY ${order}${limit}`;
|
|
19514
19514
|
return { sql, params: [...params, ...orderParams] };
|
|
19515
19515
|
}
|
|
19516
19516
|
function decodeAttr(value, type) {
|
|
@@ -19551,6 +19551,8 @@ function decodeSelectedRow(r, attrs, decodeVector) {
|
|
|
19551
19551
|
...r["created_at_seq"] != null ? { createdAtSeq: r["created_at_seq"] } : {},
|
|
19552
19552
|
...r["last_reinforced_at_seq"] != null ? { lastReinforcedAtSeq: r["last_reinforced_at_seq"] } : {},
|
|
19553
19553
|
validTo: r["valid_to"] ?? null,
|
|
19554
|
+
logicalId: r["logical_id"] ?? r["id"],
|
|
19555
|
+
version: Number(r["version"] ?? 1),
|
|
19554
19556
|
embeddingDim: Number(r["embedding_dim"] ?? 0),
|
|
19555
19557
|
...decodeVector ? { embedding: decodeVector(r["embedding_blob"], r["embedding_json"] ?? "[]") } : {},
|
|
19556
19558
|
attrs: out2
|
|
@@ -22394,16 +22396,19 @@ function foldDuplicateProblem(store, dup, survivor, ts) {
|
|
|
22394
22396
|
if (!surv) return;
|
|
22395
22397
|
const sources = new Set(surv.attrs["sources"] ?? []);
|
|
22396
22398
|
for (const s of dup.attrs["sources"] ?? []) sources.add(s);
|
|
22397
|
-
const
|
|
22398
|
-
const
|
|
22399
|
-
const
|
|
22399
|
+
const samePass = dup.createdAt === surv.createdAt;
|
|
22400
|
+
const [held, restated] = dup.createdAt < surv.createdAt ? [dup, surv] : [surv, dup];
|
|
22401
|
+
const at = {
|
|
22402
|
+
seq: restated.createdAtSeq ?? restated.attrs["createdAtSeq"] ?? store.currentIngestSeq(),
|
|
22403
|
+
ts: restated.createdAt
|
|
22404
|
+
};
|
|
22405
|
+
const exposure = samePass ? null : priorExposure(store, held.id, at);
|
|
22400
22406
|
store.updateNode(survivor.id, {
|
|
22401
22407
|
attrs: {
|
|
22402
22408
|
...surv.attrs,
|
|
22403
22409
|
sources: [...sources],
|
|
22404
22410
|
corroborations: corroborations(surv) + corroborations(dup) + 1,
|
|
22405
|
-
|
|
22406
|
-
lastReinforceExposure: exposure
|
|
22411
|
+
...exposure ? exposureOutcomeAttrs(surv, exposure, at) : {}
|
|
22407
22412
|
},
|
|
22408
22413
|
cumulativeHits: (surv.cumulativeHits ?? 0) + (dup.cumulativeHits ?? 0),
|
|
22409
22414
|
lastUpdatedAt: ts
|
|
@@ -23001,15 +23006,14 @@ function foldSameAnchorProblem(store, relPath, workspaceId2, statement, source,
|
|
|
23001
23006
|
if (!sources.includes(source)) {
|
|
23002
23007
|
const corroborations2 = (existing.attrs["corroborations"] ?? 0) + 1;
|
|
23003
23008
|
const promoted = corroborations2 >= DESIGN_PROMOTE_AT;
|
|
23004
|
-
const
|
|
23005
|
-
const
|
|
23009
|
+
const at = { seq: store.currentIngestSeq(), ts };
|
|
23010
|
+
const exposure = priorExposure(store, existing.id, at);
|
|
23006
23011
|
store.updateNode(existing.id, {
|
|
23007
23012
|
attrs: {
|
|
23008
23013
|
...existing.attrs,
|
|
23009
23014
|
sources: [...sources, source],
|
|
23010
23015
|
corroborations: corroborations2,
|
|
23011
|
-
|
|
23012
|
-
lastReinforceExposure: exposure,
|
|
23016
|
+
...exposureOutcomeAttrs(existing, exposure, at),
|
|
23013
23017
|
...promoted ? { provisional: false } : {}
|
|
23014
23018
|
},
|
|
23015
23019
|
cumulativeHits: (existing.cumulativeHits ?? 0) + 1,
|
|
@@ -23591,12 +23595,19 @@ function clearSettledFixCandidates(store, t) {
|
|
|
23591
23595
|
return report;
|
|
23592
23596
|
}
|
|
23593
23597
|
function recordRenderLedger(store, ledger, seq, ts) {
|
|
23598
|
+
const retrieved = new Set(ledger.shown.filter((i2) => i2.band === void 0 || !RECENCY_BANDS.has(i2.band)).map((i2) => i2.id));
|
|
23594
23599
|
const bump = (ids, field) => {
|
|
23595
23600
|
let n = 0;
|
|
23596
23601
|
for (const id of new Set(ids.map((i2) => i2.id))) {
|
|
23597
23602
|
const node2 = store.getNode(id);
|
|
23598
23603
|
if (!node2) continue;
|
|
23599
23604
|
const attrs = { ...node2.attrs };
|
|
23605
|
+
if (field === "shownCount" && attrs["firstShownAt"] === void 0) {
|
|
23606
|
+
attrs["firstShownAt"] = attrs["firstShownAtSeq"] !== void 0 || attrs["lastShownAtSeq"] !== void 0 ? 0 : ts;
|
|
23607
|
+
}
|
|
23608
|
+
if (field === "evictedCount" && attrs["firstEvictedAt"] === void 0) {
|
|
23609
|
+
attrs["firstEvictedAt"] = attrs["lastEvictedAtSeq"] !== void 0 || (attrs["evictedCount"] ?? 0) > 0 ? 0 : ts;
|
|
23610
|
+
}
|
|
23600
23611
|
attrs[field] = (attrs[field] ?? 0) + 1;
|
|
23601
23612
|
if (field === "shownCount") {
|
|
23602
23613
|
attrs["lastShownAtSeq"] = seq;
|
|
@@ -23604,8 +23615,10 @@ function recordRenderLedger(store, ledger, seq, ts) {
|
|
|
23604
23615
|
const counted = attrs["shownSinceTouchAt"] === node2.lastUpdatedAt ? Number(attrs["shownSinceTouch"] ?? 0) : 0;
|
|
23605
23616
|
attrs["shownSinceTouch"] = counted + 1;
|
|
23606
23617
|
attrs["shownSinceTouchAt"] = node2.lastUpdatedAt;
|
|
23618
|
+
logImpression(attrs, ts, retrieved.has(id) ? "r" : "c");
|
|
23607
23619
|
} else {
|
|
23608
23620
|
attrs["lastEvictedAtSeq"] = seq;
|
|
23621
|
+
logImpression(attrs, ts, "e");
|
|
23609
23622
|
}
|
|
23610
23623
|
store.updateNode(id, { attrs, lastUpdatedAt: node2.lastUpdatedAt });
|
|
23611
23624
|
n++;
|
|
@@ -23620,17 +23633,96 @@ function recordRenderLedger(store, ledger, seq, ts) {
|
|
|
23620
23633
|
});
|
|
23621
23634
|
return { shown, evicted };
|
|
23622
23635
|
}
|
|
23623
|
-
function
|
|
23636
|
+
function exposureLog(attrs) {
|
|
23637
|
+
const raw2 = attrs["exposureLog"];
|
|
23638
|
+
if (!Array.isArray(raw2)) return [];
|
|
23639
|
+
return raw2.filter(
|
|
23640
|
+
(e) => Array.isArray(e) && typeof e[0] === "number" && (e[1] === "r" || e[1] === "c" || e[1] === "e")
|
|
23641
|
+
);
|
|
23642
|
+
}
|
|
23643
|
+
function logImpression(attrs, ts, kind) {
|
|
23644
|
+
const log = exposureLog(attrs);
|
|
23645
|
+
if (attrs["exposureLogStart"] === void 0) attrs["exposureLogStart"] = ts;
|
|
23646
|
+
if (attrs["exposureLogSince"] === void 0) attrs["exposureLogSince"] = ts;
|
|
23647
|
+
const first = attrs["exposureFirst"] ?? {};
|
|
23648
|
+
if (first[kind] === void 0) attrs["exposureFirst"] = { ...first, [kind]: ts };
|
|
23649
|
+
log.push([ts, kind]);
|
|
23650
|
+
const trimmed = { ...attrs["exposureTrimmed"] ?? {} };
|
|
23651
|
+
while (log.length > EXPOSURE_LOG_MAX) {
|
|
23652
|
+
const [t, k] = log.shift();
|
|
23653
|
+
trimmed[k] = Math.max(trimmed[k] ?? -Infinity, t);
|
|
23654
|
+
}
|
|
23655
|
+
if (Object.keys(trimmed).length > 0) {
|
|
23656
|
+
attrs["exposureTrimmed"] = trimmed;
|
|
23657
|
+
attrs["exposureLogSince"] = log[0][0];
|
|
23658
|
+
}
|
|
23659
|
+
attrs["exposureLog"] = log;
|
|
23660
|
+
}
|
|
23661
|
+
function priorExposure(store, nodeId, at) {
|
|
23624
23662
|
const n = store.getNode(nodeId);
|
|
23625
23663
|
if (!n || !n.attrs) return "unshown";
|
|
23626
|
-
const
|
|
23627
|
-
|
|
23628
|
-
const
|
|
23629
|
-
|
|
23630
|
-
|
|
23664
|
+
const a = n.attrs;
|
|
23665
|
+
const num3 = (k) => typeof a[k] === "number" ? a[k] : void 0;
|
|
23666
|
+
const since = num3("lastOutcomeAt");
|
|
23667
|
+
const outOfOrder = since !== void 0 && at.ts <= since;
|
|
23668
|
+
const lo = outOfOrder || since === void 0 ? -Infinity : since;
|
|
23669
|
+
const kinds = ["r", "c", "e"];
|
|
23670
|
+
const seen = { r: false, c: false, e: false };
|
|
23671
|
+
const maybe = { r: outOfOrder, c: outOfOrder, e: outOfOrder };
|
|
23672
|
+
for (const [t, kind] of exposureLog(a)) if (t > lo && t <= at.ts) seen[kind] = true;
|
|
23673
|
+
const logSince = num3("exposureLogSince");
|
|
23674
|
+
const trimmed = a["exposureTrimmed"] ?? {};
|
|
23675
|
+
if (logSince !== void 0 && lo < logSince) {
|
|
23676
|
+
for (const k of kinds) {
|
|
23677
|
+
const t = trimmed[k];
|
|
23678
|
+
if (typeof t !== "number" || t <= lo) continue;
|
|
23679
|
+
if (t <= at.ts) seen[k] = true;
|
|
23680
|
+
else maybe[k] = true;
|
|
23681
|
+
}
|
|
23682
|
+
}
|
|
23683
|
+
const firstShownAt = num3("firstShownAt");
|
|
23684
|
+
const firstEvictedAt = num3("firstEvictedAt");
|
|
23685
|
+
const legacyShowSeq = num3("firstShownAtSeq") ?? num3("lastShownAtSeq");
|
|
23686
|
+
const legacyShown = firstShownAt === 0 || firstShownAt === void 0 && legacyShowSeq !== void 0;
|
|
23687
|
+
const legacyEvicted = firstEvictedAt === 0 || firstEvictedAt === void 0 && (num3("lastEvictedAtSeq") !== void 0 || (num3("evictedCount") ?? 0) > 0);
|
|
23688
|
+
const logStart = num3("exposureLogStart");
|
|
23689
|
+
const beforeLog = logStart === void 0 || lo < logStart;
|
|
23690
|
+
if (beforeLog && legacyShown) maybe.r = true;
|
|
23691
|
+
if (beforeLog && legacyEvicted) maybe.e = true;
|
|
23692
|
+
const first = a["exposureFirst"] ?? {};
|
|
23693
|
+
const legacyBy = (seq) => logStart !== void 0 && at.ts >= logStart ? true : seq !== void 0 && seq <= at.seq;
|
|
23694
|
+
const happenedBy = {
|
|
23695
|
+
r: typeof first["r"] === "number" && first["r"] <= at.ts || legacyShown && legacyBy(legacyShowSeq),
|
|
23696
|
+
c: typeof first["c"] === "number" && first["c"] <= at.ts,
|
|
23697
|
+
e: typeof first["e"] === "number" && first["e"] <= at.ts || legacyEvicted && (legacyBy(num3("lastEvictedAtSeq")) || a["lastEvictedAtSeq"] === void 0 && (num3("evictedCount") ?? 0) > 0)
|
|
23698
|
+
};
|
|
23699
|
+
const present = (k) => seen[k] || maybe[k] && happenedBy[k];
|
|
23700
|
+
if (present("r")) return "shown";
|
|
23701
|
+
if (present("c")) return "recent";
|
|
23702
|
+
if (present("e")) return "evicted";
|
|
23631
23703
|
return "unshown";
|
|
23632
23704
|
}
|
|
23633
|
-
|
|
23705
|
+
function passivelyShowable(n) {
|
|
23706
|
+
const quality = n.attrs["historyQuality"];
|
|
23707
|
+
const evaluatedAt = quality && typeof quality === "object" ? quality["evaluatedAtCommit"] : void 0;
|
|
23708
|
+
return historyReadPolicy(n, {
|
|
23709
|
+
mode: "passive",
|
|
23710
|
+
atCommit: typeof evaluatedAt === "string" ? evaluatedAt : void 0
|
|
23711
|
+
}).allow;
|
|
23712
|
+
}
|
|
23713
|
+
function exposureOutcomeAttrs(node2, exposure, at) {
|
|
23714
|
+
const attrs = node2.attrs;
|
|
23715
|
+
const field = `reinforce${exposure[0].toUpperCase()}${exposure.slice(1)}Count`;
|
|
23716
|
+
const prev = attrs["lastOutcomeAt"];
|
|
23717
|
+
const queryOnly = exposure === "unshown" && !passivelyShowable(node2);
|
|
23718
|
+
return {
|
|
23719
|
+
[field]: (attrs[field] ?? 0) + 1,
|
|
23720
|
+
...queryOnly ? { reinforceUnshownQueryOnlyCount: (attrs["reinforceUnshownQueryOnlyCount"] ?? 0) + 1 } : {},
|
|
23721
|
+
lastReinforceExposure: exposure,
|
|
23722
|
+
lastOutcomeAt: typeof prev === "number" ? Math.max(prev, at.ts) : at.ts
|
|
23723
|
+
};
|
|
23724
|
+
}
|
|
23725
|
+
var DESIGN_PROMOTE_AT, ANCHOR_LABELS, ANCHOR_KEYS, 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, MEMBER_VISIBILITIES, FIX_CANDIDATE_ASK_LIMIT, RECENCY_BANDS, EXPOSURE_LOG_MAX, EXPOSURE_LOG_KEYS;
|
|
23634
23726
|
var init_design_problem = __esm({
|
|
23635
23727
|
"../../packages/local-graph/src/design-problem.ts"() {
|
|
23636
23728
|
"use strict";
|
|
@@ -23711,6 +23803,9 @@ var init_design_problem = __esm({
|
|
|
23711
23803
|
ENCLOSING_WALK_DEPTH = 8;
|
|
23712
23804
|
MEMBER_VISIBILITIES = /* @__PURE__ */ new Set(["project", "team", "org"]);
|
|
23713
23805
|
FIX_CANDIDATE_ASK_LIMIT = 5;
|
|
23806
|
+
RECENCY_BANDS = /* @__PURE__ */ new Set(["recentProblems", "recentResolved", "recentConstraints"]);
|
|
23807
|
+
EXPOSURE_LOG_MAX = 32;
|
|
23808
|
+
EXPOSURE_LOG_KEYS = ["exposureLog", "exposureLogSince", "exposureLogStart", "exposureTrimmed", "exposureFirst"];
|
|
23714
23809
|
}
|
|
23715
23810
|
});
|
|
23716
23811
|
|
|
@@ -24060,7 +24155,7 @@ function percolate(l1, l2, opts) {
|
|
|
24060
24155
|
validFrom: opts.ts,
|
|
24061
24156
|
validTo: null,
|
|
24062
24157
|
attrs: {
|
|
24063
|
-
...n.attrs,
|
|
24158
|
+
...withoutExposureLog(n.attrs),
|
|
24064
24159
|
abstractionLevel: ABSTRACTION_LEVEL.CONCRETE,
|
|
24065
24160
|
observedInProjects: [ws]
|
|
24066
24161
|
}
|
|
@@ -24168,11 +24263,17 @@ function migrateProjectAlias(l2, opts) {
|
|
|
24168
24263
|
}
|
|
24169
24264
|
return { nodesRewritten, edgesRewritten };
|
|
24170
24265
|
}
|
|
24266
|
+
function withoutExposureLog(attrs) {
|
|
24267
|
+
const out2 = { ...attrs };
|
|
24268
|
+
for (const k of EXPOSURE_LOG_KEYS) delete out2[k];
|
|
24269
|
+
return out2;
|
|
24270
|
+
}
|
|
24171
24271
|
var PERCOLATING_LABELS, PERCOLATING_EDGES, PERCOLATING_DRIFT_EDGES, PROVENANCE_LABELS;
|
|
24172
24272
|
var init_percolate = __esm({
|
|
24173
24273
|
"../../packages/local-graph/src/percolate.ts"() {
|
|
24174
24274
|
"use strict";
|
|
24175
24275
|
init_src2();
|
|
24276
|
+
init_design_problem();
|
|
24176
24277
|
init_src();
|
|
24177
24278
|
PERCOLATING_LABELS = ["Claim", "Problem", "Solution"];
|
|
24178
24279
|
PERCOLATING_EDGES = ["CAUSED_BY", "SOLVED_BY", "CONTRADICTS"];
|
|
@@ -25978,39 +26079,54 @@ var init_mechanism_liveness = __esm({
|
|
|
25978
26079
|
// ../../packages/local-graph/src/wm-calibration.ts
|
|
25979
26080
|
function wmCalibrationCells(store) {
|
|
25980
26081
|
const cells = {
|
|
26082
|
+
calibrationSchema: WM_CALIBRATION_SCHEMA,
|
|
25981
26083
|
shownNodes: 0,
|
|
25982
26084
|
shownImpressions: 0,
|
|
25983
26085
|
evictedNodes: 0,
|
|
25984
26086
|
evictedImpressions: 0,
|
|
25985
26087
|
reinforceShown: 0,
|
|
26088
|
+
reinforceRecent: 0,
|
|
25986
26089
|
reinforceEvicted: 0,
|
|
25987
26090
|
reinforceUnshown: 0,
|
|
25988
|
-
|
|
26091
|
+
reinforceUnshownQueryOnly: 0,
|
|
26092
|
+
reinforcedNodes: 0,
|
|
26093
|
+
reinforcedShownNodes: 0
|
|
25989
26094
|
};
|
|
26095
|
+
const newest = /* @__PURE__ */ new Map();
|
|
25990
26096
|
for (const label of WM_CALIBRATION_LABELS) {
|
|
25991
|
-
for (const n of store.
|
|
25992
|
-
const
|
|
25993
|
-
const
|
|
25994
|
-
if (
|
|
25995
|
-
|
|
25996
|
-
|
|
25997
|
-
|
|
25998
|
-
|
|
25999
|
-
|
|
26000
|
-
|
|
26001
|
-
|
|
26002
|
-
|
|
26003
|
-
|
|
26004
|
-
|
|
26005
|
-
|
|
26006
|
-
cells.
|
|
26007
|
-
cells.
|
|
26008
|
-
|
|
26009
|
-
|
|
26097
|
+
for (const n of store.selectNodes({ labels: [label], attrs: WM_CALIBRATION_KEYS, includeClosed: true })) {
|
|
26098
|
+
const live3 = n.validTo === null;
|
|
26099
|
+
const prev = newest.get(n.logicalId);
|
|
26100
|
+
if (prev && (prev.live || !live3 && prev.version >= n.version)) continue;
|
|
26101
|
+
newest.set(n.logicalId, { version: n.version, live: live3, attrs: n.attrs });
|
|
26102
|
+
}
|
|
26103
|
+
}
|
|
26104
|
+
for (const { attrs } of newest.values()) {
|
|
26105
|
+
const shown = num(attrs["shownCount"]);
|
|
26106
|
+
const evicted = num(attrs["evictedCount"]);
|
|
26107
|
+
if (shown > 0) {
|
|
26108
|
+
cells.shownNodes++;
|
|
26109
|
+
cells.shownImpressions += shown;
|
|
26110
|
+
}
|
|
26111
|
+
if (evicted > 0) {
|
|
26112
|
+
cells.evictedNodes++;
|
|
26113
|
+
cells.evictedImpressions += evicted;
|
|
26114
|
+
}
|
|
26115
|
+
const rs = num(attrs["reinforceShownCount"]);
|
|
26116
|
+
const rr = num(attrs["reinforceRecentCount"]);
|
|
26117
|
+
const re = num(attrs["reinforceEvictedCount"]);
|
|
26118
|
+
const ru = num(attrs["reinforceUnshownCount"]);
|
|
26119
|
+
cells.reinforceShown += rs;
|
|
26120
|
+
cells.reinforceRecent += rr;
|
|
26121
|
+
cells.reinforceEvicted += re;
|
|
26122
|
+
cells.reinforceUnshown += ru;
|
|
26123
|
+
cells.reinforceUnshownQueryOnly += num(attrs["reinforceUnshownQueryOnlyCount"]);
|
|
26124
|
+
if (rs + rr + re + ru > 0) cells.reinforcedNodes++;
|
|
26125
|
+
if (rs > 0) cells.reinforcedShownNodes++;
|
|
26010
26126
|
}
|
|
26011
26127
|
return cells;
|
|
26012
26128
|
}
|
|
26013
|
-
var WM_CALIBRATION_LABELS, num, WM_CALIBRATION_KEYS;
|
|
26129
|
+
var WM_CALIBRATION_LABELS, WM_CALIBRATION_SCHEMA, num, WM_CALIBRATION_KEYS;
|
|
26014
26130
|
var init_wm_calibration = __esm({
|
|
26015
26131
|
"../../packages/local-graph/src/wm-calibration.ts"() {
|
|
26016
26132
|
"use strict";
|
|
@@ -26022,13 +26138,16 @@ var init_wm_calibration = __esm({
|
|
|
26022
26138
|
"Technique",
|
|
26023
26139
|
"AntiPattern"
|
|
26024
26140
|
];
|
|
26141
|
+
WM_CALIBRATION_SCHEMA = 2;
|
|
26025
26142
|
num = (v) => typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
26026
26143
|
WM_CALIBRATION_KEYS = [
|
|
26027
26144
|
"shownCount",
|
|
26028
26145
|
"evictedCount",
|
|
26029
26146
|
"reinforceShownCount",
|
|
26147
|
+
"reinforceRecentCount",
|
|
26030
26148
|
"reinforceEvictedCount",
|
|
26031
|
-
"reinforceUnshownCount"
|
|
26149
|
+
"reinforceUnshownCount",
|
|
26150
|
+
"reinforceUnshownQueryOnlyCount"
|
|
26032
26151
|
];
|
|
26033
26152
|
}
|
|
26034
26153
|
});
|
|
@@ -26042,6 +26161,8 @@ __export(src_exports2, {
|
|
|
26042
26161
|
CODE_REACH_EDGES: () => CODE_REACH_EDGES,
|
|
26043
26162
|
CREDIT_FAMILY: () => CREDIT_FAMILY,
|
|
26044
26163
|
DEFAULT_MIN_COVERAGE: () => DEFAULT_MIN_COVERAGE,
|
|
26164
|
+
EXPOSURE_LOG_KEYS: () => EXPOSURE_LOG_KEYS,
|
|
26165
|
+
EXPOSURE_LOG_MAX: () => EXPOSURE_LOG_MAX,
|
|
26045
26166
|
FINGERPRINT_INDEXED_LABELS: () => FINGERPRINT_INDEXED_LABELS,
|
|
26046
26167
|
FIX_CANDIDATE_ASK_LIMIT: () => FIX_CANDIDATE_ASK_LIMIT,
|
|
26047
26168
|
FOLD_EMBED_AUTO_COSINE: () => FOLD_EMBED_AUTO_COSINE,
|
|
@@ -26059,6 +26180,7 @@ __export(src_exports2, {
|
|
|
26059
26180
|
PERCOLATING_DRIFT_EDGES: () => PERCOLATING_DRIFT_EDGES,
|
|
26060
26181
|
PERCOLATING_EDGES: () => PERCOLATING_EDGES,
|
|
26061
26182
|
PERCOLATING_LABELS: () => PERCOLATING_LABELS,
|
|
26183
|
+
RECENCY_BANDS: () => RECENCY_BANDS,
|
|
26062
26184
|
RECURRENCE_DEBOUNCE_MS: () => RECURRENCE_DEBOUNCE_MS,
|
|
26063
26185
|
REOPEN_MIN_SOURCES: () => REOPEN_MIN_SOURCES,
|
|
26064
26186
|
SAME_ANCHOR_DEDUP_JACCARD: () => SAME_ANCHOR_DEDUP_JACCARD,
|
|
@@ -26069,6 +26191,7 @@ __export(src_exports2, {
|
|
|
26069
26191
|
STALL_MIN_SPAN_MS: () => STALL_MIN_SPAN_MS,
|
|
26070
26192
|
SqliteGraphStore: () => SqliteGraphStore,
|
|
26071
26193
|
WM_CALIBRATION_LABELS: () => WM_CALIBRATION_LABELS,
|
|
26194
|
+
WM_CALIBRATION_SCHEMA: () => WM_CALIBRATION_SCHEMA,
|
|
26072
26195
|
WORKSPACE_SCAN_CAP: () => WORKSPACE_SCAN_CAP,
|
|
26073
26196
|
addDependency: () => addDependency,
|
|
26074
26197
|
aggregateClaimConfidence: () => aggregateClaimConfidence,
|
|
@@ -26106,6 +26229,7 @@ __export(src_exports2, {
|
|
|
26106
26229
|
evaluateDependency: () => evaluateDependency,
|
|
26107
26230
|
evaluateFed: () => evaluateFed,
|
|
26108
26231
|
evaluateMechanisms: () => evaluateMechanisms,
|
|
26232
|
+
exposureOutcomeAttrs: () => exposureOutcomeAttrs,
|
|
26109
26233
|
findMintTimeDuplicate: () => findMintTimeDuplicate,
|
|
26110
26234
|
findOrCreatePackage: () => findOrCreatePackage,
|
|
26111
26235
|
findPath: () => findPath,
|
|
@@ -26160,6 +26284,7 @@ __export(src_exports2, {
|
|
|
26160
26284
|
parseSemver: () => parseSemver,
|
|
26161
26285
|
parseShareFence: () => parseShareFence,
|
|
26162
26286
|
parseTriageFences: () => parseTriageFences,
|
|
26287
|
+
passivelyShowable: () => passivelyShowable,
|
|
26163
26288
|
pendingAbstractions: () => pendingAbstractions,
|
|
26164
26289
|
pendingDiscriminators: () => pendingDiscriminators,
|
|
26165
26290
|
percolate: () => percolate,
|
|
@@ -33225,8 +33350,7 @@ async function embedNodesByLabels(store, labels, opts = {}) {
|
|
|
33225
33350
|
versionsSeen: {}
|
|
33226
33351
|
};
|
|
33227
33352
|
const hashOnly = opts.mode === "hash";
|
|
33228
|
-
const
|
|
33229
|
-
const todo = [];
|
|
33353
|
+
const candidates = [];
|
|
33230
33354
|
for (const label of labels) {
|
|
33231
33355
|
for (const node2 of store.selectNodes({
|
|
33232
33356
|
labels: [label],
|
|
@@ -33245,15 +33369,24 @@ async function embedNodesByLabels(store, labels, opts = {}) {
|
|
|
33245
33369
|
report.skippedFresh++;
|
|
33246
33370
|
continue;
|
|
33247
33371
|
}
|
|
33248
|
-
|
|
33249
|
-
|
|
33250
|
-
|
|
33251
|
-
|
|
33252
|
-
|
|
33253
|
-
|
|
33254
|
-
|
|
33255
|
-
|
|
33372
|
+
candidates.push({ node: node2, existingVersion });
|
|
33373
|
+
}
|
|
33374
|
+
}
|
|
33375
|
+
if (candidates.length === 0) {
|
|
33376
|
+
report.durationMs = Date.now() - started2;
|
|
33377
|
+
return report;
|
|
33378
|
+
}
|
|
33379
|
+
const currentVersion = hashOnly ? EMBEDDING_VERSION : (await embedBatchWithModelOrHash(["probe"]))[0]?.version ?? "unknown";
|
|
33380
|
+
const todo = [];
|
|
33381
|
+
for (const { node: node2, existingVersion } of candidates) {
|
|
33382
|
+
if (!opts.force && existingVersion === currentVersion && node2.embeddingDim > 0) {
|
|
33383
|
+
report.skippedFresh++;
|
|
33384
|
+
continue;
|
|
33256
33385
|
}
|
|
33386
|
+
const text = buildText(store, node2);
|
|
33387
|
+
if (!text) continue;
|
|
33388
|
+
const embedding = node2.embeddingDim > 0 ? store.getNode(node2.id).embedding : [];
|
|
33389
|
+
todo.push(embeddingSnapshot({ ...node2, embedding }, text));
|
|
33257
33390
|
}
|
|
33258
33391
|
for (let i2 = 0; i2 < todo.length; i2 += BATCH_SIZE) {
|
|
33259
33392
|
const batch = todo.slice(i2, i2 + BATCH_SIZE);
|
|
@@ -80179,11 +80312,17 @@ function mintPriorEdge(store, source, target, sentence, touched, ts, sessionId)
|
|
|
80179
80312
|
}
|
|
80180
80313
|
return { corroborated, citeAnchorAccrued, citeAnchorPromoted };
|
|
80181
80314
|
}
|
|
80315
|
+
function countExposure(plan, exposure) {
|
|
80316
|
+
if (exposure === "shown") plan.exposureShown++;
|
|
80317
|
+
else if (exposure === "recent") plan.exposureRecent++;
|
|
80318
|
+
else if (exposure === "evicted") plan.exposureEvicted++;
|
|
80319
|
+
else plan.exposureUnshown++;
|
|
80320
|
+
}
|
|
80182
80321
|
function harvestInlineTags(store, text, opts) {
|
|
80183
80322
|
const source = opts.sourceId ? store.getNode(opts.sourceId) : null;
|
|
80184
80323
|
const mintPriors = opts.mintPriors ?? true;
|
|
80185
80324
|
const touched = opts.sessionTouchedIds ?? /* @__PURE__ */ new Set();
|
|
80186
|
-
const plan = { priorEdges: 0, corroboratedEdges: 0, citeAnchorsAccrued: 0, citeAnchorsPromoted: 0, exposureShown: 0, exposureEvicted: 0, exposureUnshown: 0, problems: [], fixes: [], triages: [], causalLinks: [], attempts: [], unresolvedFixes: [], unresolvedHandles: [], priorEdgesSuppressed: { flagOff: 0, noSource: 0 }, dispositions: emptyTagDispositions(), transfers: [], solutionLinks: [], instances: [], patterns: [], domains: [], packages: [], components: [], refutes: [], corroborations: [] };
|
|
80325
|
+
const plan = { priorEdges: 0, corroboratedEdges: 0, citeAnchorsAccrued: 0, citeAnchorsPromoted: 0, exposureShown: 0, exposureEvicted: 0, exposureUnshown: 0, exposureRecent: 0, problems: [], fixes: [], triages: [], causalLinks: [], attempts: [], unresolvedFixes: [], unresolvedHandles: [], priorEdgesSuppressed: { flagOff: 0, noSource: 0 }, dispositions: emptyTagDispositions(), transfers: [], solutionLinks: [], instances: [], patterns: [], domains: [], packages: [], components: [], refutes: [], corroborations: [] };
|
|
80187
80326
|
const parsed = parseInlineTagsWithDispositions(text);
|
|
80188
80327
|
const tags = parsed.tags;
|
|
80189
80328
|
plan.dispositions = parsed.dispositions;
|
|
@@ -80393,10 +80532,8 @@ function harvestInlineTags(store, text, opts) {
|
|
|
80393
80532
|
if (tag.kind === "confirm") {
|
|
80394
80533
|
const witnessKey = `corrob:${targetId}:confirm:${digest({ h: tag.handle })}`.slice(0, 72);
|
|
80395
80534
|
if (!plan.corroborations.some((c) => c.witnessKey === witnessKey)) {
|
|
80396
|
-
const exposure = typeof store.currentIngestSeq === "function" ? priorExposure(store, targetId, store.currentIngestSeq()) : "unshown";
|
|
80397
|
-
|
|
80398
|
-
else if (exposure === "evicted") plan.exposureEvicted++;
|
|
80399
|
-
else plan.exposureUnshown++;
|
|
80535
|
+
const exposure = typeof store.currentIngestSeq === "function" ? priorExposure(store, targetId, { seq: store.currentIngestSeq(), ts: opts.ts }) : "unshown";
|
|
80536
|
+
countExposure(plan, exposure);
|
|
80400
80537
|
plan.corroborations.push({ nodeId: targetId, witnessKey, exposure });
|
|
80401
80538
|
}
|
|
80402
80539
|
} else {
|
|
@@ -80414,10 +80551,8 @@ function harvestInlineTags(store, text, opts) {
|
|
|
80414
80551
|
if (targetId && citedLabel && CORROBORATABLE_LABELS.has(citedLabel)) {
|
|
80415
80552
|
const witnessKey = `corrob:${targetId}:lean:${digest({ h: tag.handle })}`.slice(0, 72);
|
|
80416
80553
|
if (!plan.corroborations.some((c) => c.witnessKey === witnessKey)) {
|
|
80417
|
-
const exposure = typeof store.currentIngestSeq === "function" ? priorExposure(store, targetId, store.currentIngestSeq()) : "unshown";
|
|
80418
|
-
|
|
80419
|
-
else if (exposure === "evicted") plan.exposureEvicted++;
|
|
80420
|
-
else plan.exposureUnshown++;
|
|
80554
|
+
const exposure = typeof store.currentIngestSeq === "function" ? priorExposure(store, targetId, { seq: store.currentIngestSeq(), ts: opts.ts }) : "unshown";
|
|
80555
|
+
countExposure(plan, exposure);
|
|
80421
80556
|
plan.corroborations.push({ nodeId: targetId, witnessKey, exposure });
|
|
80422
80557
|
}
|
|
80423
80558
|
}
|
|
@@ -80830,6 +80965,9 @@ function isolateCensus() {
|
|
|
80830
80965
|
|
|
80831
80966
|
// src/pass-ledger.ts
|
|
80832
80967
|
var PER_KIND_MAX = 100;
|
|
80968
|
+
var LEVEL_TAIL_KINDS = /* @__PURE__ */ new Set(["wm-calibration"]);
|
|
80969
|
+
var LEVEL_TAIL_DAYS = 30;
|
|
80970
|
+
var HOUR_MS = 36e5;
|
|
80833
80971
|
var TRIM_EVERY = 50;
|
|
80834
80972
|
var appendsSinceTrim = /* @__PURE__ */ new Map();
|
|
80835
80973
|
function passLedgerPath(configDir) {
|
|
@@ -80864,16 +81002,28 @@ function appendPassLedger(configDir, kind, durationMs, counts) {
|
|
|
80864
81002
|
appendsSinceTrim.set(path3, 0);
|
|
80865
81003
|
const lines = readFileSync21(path3, "utf8").split("\n").filter(Boolean);
|
|
80866
81004
|
const keptByKind = /* @__PURE__ */ new Map();
|
|
81005
|
+
const tailHours = /* @__PURE__ */ new Map();
|
|
81006
|
+
const tailFloor = Date.now() - LEVEL_TAIL_DAYS * 24 * HOUR_MS;
|
|
80867
81007
|
const kept = [];
|
|
80868
81008
|
for (let i2 = lines.length - 1; i2 >= 0; i2--) {
|
|
80869
|
-
let
|
|
81009
|
+
let entry2;
|
|
80870
81010
|
try {
|
|
80871
|
-
|
|
81011
|
+
entry2 = JSON.parse(lines[i2]);
|
|
80872
81012
|
} catch {
|
|
80873
81013
|
continue;
|
|
80874
81014
|
}
|
|
81015
|
+
const kind2 = String(entry2.kind ?? "");
|
|
80875
81016
|
const n2 = keptByKind.get(kind2) ?? 0;
|
|
80876
|
-
if (n2 >= PER_KIND_MAX)
|
|
81017
|
+
if (n2 >= PER_KIND_MAX) {
|
|
81018
|
+
if (!LEVEL_TAIL_KINDS.has(kind2) || typeof entry2.ts !== "number" || entry2.ts < tailFloor) continue;
|
|
81019
|
+
const hours = tailHours.get(kind2) ?? /* @__PURE__ */ new Set();
|
|
81020
|
+
const hour = Math.floor(entry2.ts / HOUR_MS);
|
|
81021
|
+
if (hours.has(hour)) continue;
|
|
81022
|
+
hours.add(hour);
|
|
81023
|
+
tailHours.set(kind2, hours);
|
|
81024
|
+
kept.push(lines[i2]);
|
|
81025
|
+
continue;
|
|
81026
|
+
}
|
|
80877
81027
|
keptByKind.set(kind2, n2 + 1);
|
|
80878
81028
|
kept.push(lines[i2]);
|
|
80879
81029
|
}
|
|
@@ -84903,7 +85053,7 @@ function createWatchBreaker(deps) {
|
|
|
84903
85053
|
}
|
|
84904
85054
|
|
|
84905
85055
|
// src/engine.ts
|
|
84906
|
-
var DAEMON_VERSION = true ? "2.0.22-dev.
|
|
85056
|
+
var DAEMON_VERSION = true ? "2.0.22-dev.4074" : "2.0.0-alpha.0";
|
|
84907
85057
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
84908
85058
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
84909
85059
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -85950,6 +86100,7 @@ function createWorkspaceEngine(opts) {
|
|
|
85950
86100
|
let exposureShown = 0;
|
|
85951
86101
|
let exposureEvicted = 0;
|
|
85952
86102
|
let exposureUnshown = 0;
|
|
86103
|
+
let exposureRecent = 0;
|
|
85953
86104
|
let corroboratedEdges = 0;
|
|
85954
86105
|
let refutesStamped = 0;
|
|
85955
86106
|
let recurrencesMarked = 0;
|
|
@@ -86166,6 +86317,7 @@ function createWorkspaceEngine(opts) {
|
|
|
86166
86317
|
exposureShown += plan.exposureShown;
|
|
86167
86318
|
exposureEvicted += plan.exposureEvicted;
|
|
86168
86319
|
exposureUnshown += plan.exposureUnshown;
|
|
86320
|
+
exposureRecent += plan.exposureRecent;
|
|
86169
86321
|
if (touchedFileId) touchedFileTurns++;
|
|
86170
86322
|
if ((toolRuns.get(sessionId)?.size ?? 0) > 0) touchedToolTurns++;
|
|
86171
86323
|
const wf = workingFiles.get(sessionId);
|
|
@@ -86828,9 +86980,10 @@ function createWorkspaceEngine(opts) {
|
|
|
86828
86980
|
exposureShown,
|
|
86829
86981
|
exposureEvicted,
|
|
86830
86982
|
exposureUnshown,
|
|
86983
|
+
exposureRecent,
|
|
86831
86984
|
// The sum, so one liveness effectCounter sees an outcome regardless of
|
|
86832
86985
|
// which cell it landed in (WM-join).
|
|
86833
|
-
exposureOutcomes: exposureShown + exposureEvicted + exposureUnshown,
|
|
86986
|
+
exposureOutcomes: exposureShown + exposureEvicted + exposureUnshown + exposureRecent,
|
|
86834
86987
|
// AC-hint-upgrade (harvest seam): edited-this-turn hint promotions.
|
|
86835
86988
|
anchorHintsUpgraded,
|
|
86836
86989
|
// WM-fold funnel (phase 0) — which gate of the same-anchor fold
|
package/generalize-worker.mjs
CHANGED
|
@@ -15222,7 +15222,7 @@ function compileNodeSelect(q) {
|
|
|
15222
15222
|
}
|
|
15223
15223
|
const orderParams = !q.orderBy && q.labels.length > 1 ? [...q.labels] : [];
|
|
15224
15224
|
const limit = q.limit !== void 0 ? ` LIMIT ${Math.max(0, Math.floor(q.limit))}` : "";
|
|
15225
|
-
const sql = `SELECT id, label, description, created_at, last_updated_at, page_rank, cumulative_hits, extraction_confidence, extraction_source, community, created_at_seq, last_reinforced_at_seq, valid_to, ${EMBEDDING_DIM_SQL} AS embedding_dim${q.withEmbedding ? ", embedding_blob, embedding_json" : ""}${attrCols} FROM nodes WHERE ${where} ORDER BY ${order}${limit}`;
|
|
15225
|
+
const sql = `SELECT id, label, description, created_at, last_updated_at, page_rank, cumulative_hits, extraction_confidence, extraction_source, community, created_at_seq, last_reinforced_at_seq, valid_to, logical_id, version, ${EMBEDDING_DIM_SQL} AS embedding_dim${q.withEmbedding ? ", embedding_blob, embedding_json" : ""}${attrCols} FROM nodes WHERE ${where} ORDER BY ${order}${limit}`;
|
|
15226
15226
|
return { sql, params: [...params, ...orderParams] };
|
|
15227
15227
|
}
|
|
15228
15228
|
function decodeAttr(value, type) {
|
|
@@ -15263,6 +15263,8 @@ function decodeSelectedRow(r, attrs, decodeVector) {
|
|
|
15263
15263
|
...r["created_at_seq"] != null ? { createdAtSeq: r["created_at_seq"] } : {},
|
|
15264
15264
|
...r["last_reinforced_at_seq"] != null ? { lastReinforcedAtSeq: r["last_reinforced_at_seq"] } : {},
|
|
15265
15265
|
validTo: r["valid_to"] ?? null,
|
|
15266
|
+
logicalId: r["logical_id"] ?? r["id"],
|
|
15267
|
+
version: Number(r["version"] ?? 1),
|
|
15266
15268
|
embeddingDim: Number(r["embedding_dim"] ?? 0),
|
|
15267
15269
|
...decodeVector ? { embedding: decodeVector(r["embedding_blob"], r["embedding_json"] ?? "[]") } : {},
|
|
15268
15270
|
attrs: out
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -26081,7 +26081,7 @@ function compileNodeSelect(q) {
|
|
|
26081
26081
|
}
|
|
26082
26082
|
const orderParams = !q.orderBy && q.labels.length > 1 ? [...q.labels] : [];
|
|
26083
26083
|
const limit = q.limit !== void 0 ? ` LIMIT ${Math.max(0, Math.floor(q.limit))}` : "";
|
|
26084
|
-
const sql = `SELECT id, label, description, created_at, last_updated_at, page_rank, cumulative_hits, extraction_confidence, extraction_source, community, created_at_seq, last_reinforced_at_seq, valid_to, ${EMBEDDING_DIM_SQL} AS embedding_dim${q.withEmbedding ? ", embedding_blob, embedding_json" : ""}${attrCols} FROM nodes WHERE ${where} ORDER BY ${order}${limit}`;
|
|
26084
|
+
const sql = `SELECT id, label, description, created_at, last_updated_at, page_rank, cumulative_hits, extraction_confidence, extraction_source, community, created_at_seq, last_reinforced_at_seq, valid_to, logical_id, version, ${EMBEDDING_DIM_SQL} AS embedding_dim${q.withEmbedding ? ", embedding_blob, embedding_json" : ""}${attrCols} FROM nodes WHERE ${where} ORDER BY ${order}${limit}`;
|
|
26085
26085
|
return { sql, params: [...params, ...orderParams] };
|
|
26086
26086
|
}
|
|
26087
26087
|
function decodeAttr(value, type) {
|
|
@@ -26122,6 +26122,8 @@ function decodeSelectedRow(r, attrs, decodeVector) {
|
|
|
26122
26122
|
...r["created_at_seq"] != null ? { createdAtSeq: r["created_at_seq"] } : {},
|
|
26123
26123
|
...r["last_reinforced_at_seq"] != null ? { lastReinforcedAtSeq: r["last_reinforced_at_seq"] } : {},
|
|
26124
26124
|
validTo: r["valid_to"] ?? null,
|
|
26125
|
+
logicalId: r["logical_id"] ?? r["id"],
|
|
26126
|
+
version: Number(r["version"] ?? 1),
|
|
26125
26127
|
embeddingDim: Number(r["embedding_dim"] ?? 0),
|
|
26126
26128
|
...decodeVector ? { embedding: decodeVector(r["embedding_blob"], r["embedding_json"] ?? "[]") } : {},
|
|
26127
26129
|
attrs: out2
|
|
@@ -28023,16 +28025,19 @@ function foldDuplicateProblem(store2, dup, survivor, ts) {
|
|
|
28023
28025
|
if (!surv) return;
|
|
28024
28026
|
const sources = new Set(surv.attrs["sources"] ?? []);
|
|
28025
28027
|
for (const s of dup.attrs["sources"] ?? []) sources.add(s);
|
|
28026
|
-
const
|
|
28027
|
-
const
|
|
28028
|
-
const
|
|
28028
|
+
const samePass = dup.createdAt === surv.createdAt;
|
|
28029
|
+
const [held, restated] = dup.createdAt < surv.createdAt ? [dup, surv] : [surv, dup];
|
|
28030
|
+
const at = {
|
|
28031
|
+
seq: restated.createdAtSeq ?? restated.attrs["createdAtSeq"] ?? store2.currentIngestSeq(),
|
|
28032
|
+
ts: restated.createdAt
|
|
28033
|
+
};
|
|
28034
|
+
const exposure = samePass ? null : priorExposure(store2, held.id, at);
|
|
28029
28035
|
store2.updateNode(survivor.id, {
|
|
28030
28036
|
attrs: {
|
|
28031
28037
|
...surv.attrs,
|
|
28032
28038
|
sources: [...sources],
|
|
28033
28039
|
corroborations: corroborations(surv) + corroborations(dup) + 1,
|
|
28034
|
-
|
|
28035
|
-
lastReinforceExposure: exposure
|
|
28040
|
+
...exposure ? exposureOutcomeAttrs(surv, exposure, at) : {}
|
|
28036
28041
|
},
|
|
28037
28042
|
cumulativeHits: (surv.cumulativeHits ?? 0) + (dup.cumulativeHits ?? 0),
|
|
28038
28043
|
lastUpdatedAt: ts
|
|
@@ -28456,16 +28461,77 @@ function clearSettledFixCandidates(store2, t) {
|
|
|
28456
28461
|
}
|
|
28457
28462
|
return report;
|
|
28458
28463
|
}
|
|
28459
|
-
function
|
|
28464
|
+
function exposureLog(attrs) {
|
|
28465
|
+
const raw = attrs["exposureLog"];
|
|
28466
|
+
if (!Array.isArray(raw)) return [];
|
|
28467
|
+
return raw.filter(
|
|
28468
|
+
(e) => Array.isArray(e) && typeof e[0] === "number" && (e[1] === "r" || e[1] === "c" || e[1] === "e")
|
|
28469
|
+
);
|
|
28470
|
+
}
|
|
28471
|
+
function priorExposure(store2, nodeId, at) {
|
|
28460
28472
|
const n = store2.getNode(nodeId);
|
|
28461
28473
|
if (!n || !n.attrs) return "unshown";
|
|
28462
|
-
const
|
|
28463
|
-
|
|
28464
|
-
const
|
|
28465
|
-
|
|
28466
|
-
|
|
28474
|
+
const a = n.attrs;
|
|
28475
|
+
const num2 = (k) => typeof a[k] === "number" ? a[k] : void 0;
|
|
28476
|
+
const since = num2("lastOutcomeAt");
|
|
28477
|
+
const outOfOrder = since !== void 0 && at.ts <= since;
|
|
28478
|
+
const lo = outOfOrder || since === void 0 ? -Infinity : since;
|
|
28479
|
+
const kinds = ["r", "c", "e"];
|
|
28480
|
+
const seen = { r: false, c: false, e: false };
|
|
28481
|
+
const maybe = { r: outOfOrder, c: outOfOrder, e: outOfOrder };
|
|
28482
|
+
for (const [t, kind] of exposureLog(a)) if (t > lo && t <= at.ts) seen[kind] = true;
|
|
28483
|
+
const logSince = num2("exposureLogSince");
|
|
28484
|
+
const trimmed = a["exposureTrimmed"] ?? {};
|
|
28485
|
+
if (logSince !== void 0 && lo < logSince) {
|
|
28486
|
+
for (const k of kinds) {
|
|
28487
|
+
const t = trimmed[k];
|
|
28488
|
+
if (typeof t !== "number" || t <= lo) continue;
|
|
28489
|
+
if (t <= at.ts) seen[k] = true;
|
|
28490
|
+
else maybe[k] = true;
|
|
28491
|
+
}
|
|
28492
|
+
}
|
|
28493
|
+
const firstShownAt = num2("firstShownAt");
|
|
28494
|
+
const firstEvictedAt = num2("firstEvictedAt");
|
|
28495
|
+
const legacyShowSeq = num2("firstShownAtSeq") ?? num2("lastShownAtSeq");
|
|
28496
|
+
const legacyShown = firstShownAt === 0 || firstShownAt === void 0 && legacyShowSeq !== void 0;
|
|
28497
|
+
const legacyEvicted = firstEvictedAt === 0 || firstEvictedAt === void 0 && (num2("lastEvictedAtSeq") !== void 0 || (num2("evictedCount") ?? 0) > 0);
|
|
28498
|
+
const logStart = num2("exposureLogStart");
|
|
28499
|
+
const beforeLog = logStart === void 0 || lo < logStart;
|
|
28500
|
+
if (beforeLog && legacyShown) maybe.r = true;
|
|
28501
|
+
if (beforeLog && legacyEvicted) maybe.e = true;
|
|
28502
|
+
const first = a["exposureFirst"] ?? {};
|
|
28503
|
+
const legacyBy = (seq) => logStart !== void 0 && at.ts >= logStart ? true : seq !== void 0 && seq <= at.seq;
|
|
28504
|
+
const happenedBy = {
|
|
28505
|
+
r: typeof first["r"] === "number" && first["r"] <= at.ts || legacyShown && legacyBy(legacyShowSeq),
|
|
28506
|
+
c: typeof first["c"] === "number" && first["c"] <= at.ts,
|
|
28507
|
+
e: typeof first["e"] === "number" && first["e"] <= at.ts || legacyEvicted && (legacyBy(num2("lastEvictedAtSeq")) || a["lastEvictedAtSeq"] === void 0 && (num2("evictedCount") ?? 0) > 0)
|
|
28508
|
+
};
|
|
28509
|
+
const present = (k) => seen[k] || maybe[k] && happenedBy[k];
|
|
28510
|
+
if (present("r")) return "shown";
|
|
28511
|
+
if (present("c")) return "recent";
|
|
28512
|
+
if (present("e")) return "evicted";
|
|
28467
28513
|
return "unshown";
|
|
28468
28514
|
}
|
|
28515
|
+
function passivelyShowable(n) {
|
|
28516
|
+
const quality = n.attrs["historyQuality"];
|
|
28517
|
+
const evaluatedAt = quality && typeof quality === "object" ? quality["evaluatedAtCommit"] : void 0;
|
|
28518
|
+
return historyReadPolicy(n, {
|
|
28519
|
+
mode: "passive",
|
|
28520
|
+
atCommit: typeof evaluatedAt === "string" ? evaluatedAt : void 0
|
|
28521
|
+
}).allow;
|
|
28522
|
+
}
|
|
28523
|
+
function exposureOutcomeAttrs(node, exposure, at) {
|
|
28524
|
+
const attrs = node.attrs;
|
|
28525
|
+
const field = `reinforce${exposure[0].toUpperCase()}${exposure.slice(1)}Count`;
|
|
28526
|
+
const prev = attrs["lastOutcomeAt"];
|
|
28527
|
+
const queryOnly = exposure === "unshown" && !passivelyShowable(node);
|
|
28528
|
+
return {
|
|
28529
|
+
[field]: (attrs[field] ?? 0) + 1,
|
|
28530
|
+
...queryOnly ? { reinforceUnshownQueryOnlyCount: (attrs["reinforceUnshownQueryOnlyCount"] ?? 0) + 1 } : {},
|
|
28531
|
+
lastReinforceExposure: exposure,
|
|
28532
|
+
lastOutcomeAt: typeof prev === "number" ? Math.max(prev, at.ts) : at.ts
|
|
28533
|
+
};
|
|
28534
|
+
}
|
|
28469
28535
|
|
|
28470
28536
|
// ../../packages/local-graph/src/intent.ts
|
|
28471
28537
|
init_src();
|
|
@@ -29158,45 +29224,63 @@ var WM_CALIBRATION_LABELS = [
|
|
|
29158
29224
|
"Technique",
|
|
29159
29225
|
"AntiPattern"
|
|
29160
29226
|
];
|
|
29227
|
+
var WM_CALIBRATION_SCHEMA = 2;
|
|
29161
29228
|
var num = (v) => typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
29162
29229
|
var WM_CALIBRATION_KEYS = [
|
|
29163
29230
|
"shownCount",
|
|
29164
29231
|
"evictedCount",
|
|
29165
29232
|
"reinforceShownCount",
|
|
29233
|
+
"reinforceRecentCount",
|
|
29166
29234
|
"reinforceEvictedCount",
|
|
29167
|
-
"reinforceUnshownCount"
|
|
29235
|
+
"reinforceUnshownCount",
|
|
29236
|
+
"reinforceUnshownQueryOnlyCount"
|
|
29168
29237
|
];
|
|
29169
29238
|
function wmCalibrationCells(store2) {
|
|
29170
29239
|
const cells = {
|
|
29240
|
+
calibrationSchema: WM_CALIBRATION_SCHEMA,
|
|
29171
29241
|
shownNodes: 0,
|
|
29172
29242
|
shownImpressions: 0,
|
|
29173
29243
|
evictedNodes: 0,
|
|
29174
29244
|
evictedImpressions: 0,
|
|
29175
29245
|
reinforceShown: 0,
|
|
29246
|
+
reinforceRecent: 0,
|
|
29176
29247
|
reinforceEvicted: 0,
|
|
29177
29248
|
reinforceUnshown: 0,
|
|
29178
|
-
|
|
29249
|
+
reinforceUnshownQueryOnly: 0,
|
|
29250
|
+
reinforcedNodes: 0,
|
|
29251
|
+
reinforcedShownNodes: 0
|
|
29179
29252
|
};
|
|
29253
|
+
const newest = /* @__PURE__ */ new Map();
|
|
29180
29254
|
for (const label of WM_CALIBRATION_LABELS) {
|
|
29181
|
-
for (const n of store2.
|
|
29182
|
-
const
|
|
29183
|
-
const
|
|
29184
|
-
if (
|
|
29185
|
-
|
|
29186
|
-
|
|
29187
|
-
|
|
29188
|
-
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
cells.
|
|
29197
|
-
cells.
|
|
29198
|
-
|
|
29199
|
-
|
|
29255
|
+
for (const n of store2.selectNodes({ labels: [label], attrs: WM_CALIBRATION_KEYS, includeClosed: true })) {
|
|
29256
|
+
const live = n.validTo === null;
|
|
29257
|
+
const prev = newest.get(n.logicalId);
|
|
29258
|
+
if (prev && (prev.live || !live && prev.version >= n.version)) continue;
|
|
29259
|
+
newest.set(n.logicalId, { version: n.version, live, attrs: n.attrs });
|
|
29260
|
+
}
|
|
29261
|
+
}
|
|
29262
|
+
for (const { attrs } of newest.values()) {
|
|
29263
|
+
const shown = num(attrs["shownCount"]);
|
|
29264
|
+
const evicted = num(attrs["evictedCount"]);
|
|
29265
|
+
if (shown > 0) {
|
|
29266
|
+
cells.shownNodes++;
|
|
29267
|
+
cells.shownImpressions += shown;
|
|
29268
|
+
}
|
|
29269
|
+
if (evicted > 0) {
|
|
29270
|
+
cells.evictedNodes++;
|
|
29271
|
+
cells.evictedImpressions += evicted;
|
|
29272
|
+
}
|
|
29273
|
+
const rs = num(attrs["reinforceShownCount"]);
|
|
29274
|
+
const rr = num(attrs["reinforceRecentCount"]);
|
|
29275
|
+
const re = num(attrs["reinforceEvictedCount"]);
|
|
29276
|
+
const ru = num(attrs["reinforceUnshownCount"]);
|
|
29277
|
+
cells.reinforceShown += rs;
|
|
29278
|
+
cells.reinforceRecent += rr;
|
|
29279
|
+
cells.reinforceEvicted += re;
|
|
29280
|
+
cells.reinforceUnshown += ru;
|
|
29281
|
+
cells.reinforceUnshownQueryOnly += num(attrs["reinforceUnshownQueryOnlyCount"]);
|
|
29282
|
+
if (rs + rr + re + ru > 0) cells.reinforcedNodes++;
|
|
29283
|
+
if (rs > 0) cells.reinforcedShownNodes++;
|
|
29200
29284
|
}
|
|
29201
29285
|
return cells;
|
|
29202
29286
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
fe984b8b1cdd56eb598e74a61485e191c89e632163f5e27d35184130dafdb81c .codex-plugin/plugin.json
|
|
2
2
|
a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
|
|
3
3
|
fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
|
|
4
4
|
73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js
|