@inerrata-corporation/errata 2.0.22-dev.4054 → 2.0.22-dev.4071
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 +10 -2
- package/errata.mjs +374 -164
- package/generalize-worker.mjs +3 -1
- package/package.json +1 -1
- package/pass-worker.mjs +117 -33
- package/resources/context-plugin/.codex-plugin/plugin.json +1 -1
- package/resources/context-plugin/SHA256SUMS +1 -1
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,
|
|
@@ -34182,18 +34307,26 @@ var init_recall_signal = __esm({
|
|
|
34182
34307
|
// src/session-registry.ts
|
|
34183
34308
|
import { existsSync as existsSync8, readFileSync as readFileSync6, realpathSync, writeFileSync as writeFileSync7 } from "node:fs";
|
|
34184
34309
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
34185
|
-
import { resolve } from "node:path";
|
|
34310
|
+
import { basename as basename2, dirname as dirname6, resolve } from "node:path";
|
|
34186
34311
|
function shipsFromWorkspace(root, env2 = process.env) {
|
|
34187
34312
|
return Boolean(env2["VITEST"]) || !isScratchWorkspace(root);
|
|
34188
34313
|
}
|
|
34189
34314
|
function isScratchWorkspace(root, tmp = tmpdir2()) {
|
|
34190
34315
|
const norm = (p) => {
|
|
34191
|
-
let
|
|
34316
|
+
let cursor = resolve(p);
|
|
34317
|
+
const suffix = [];
|
|
34318
|
+
while (!existsSync8(cursor)) {
|
|
34319
|
+
const parent = dirname6(cursor);
|
|
34320
|
+
if (parent === cursor) break;
|
|
34321
|
+
suffix.unshift(basename2(cursor));
|
|
34322
|
+
cursor = parent;
|
|
34323
|
+
}
|
|
34192
34324
|
try {
|
|
34193
|
-
|
|
34325
|
+
cursor = resolve(realpathSync.native(cursor), ...suffix);
|
|
34194
34326
|
} catch {
|
|
34327
|
+
cursor = resolve(p);
|
|
34195
34328
|
}
|
|
34196
|
-
return
|
|
34329
|
+
return cursor.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
|
|
34197
34330
|
};
|
|
34198
34331
|
const r = norm(root);
|
|
34199
34332
|
const t = norm(tmp);
|
|
@@ -34665,12 +34798,12 @@ var init_identity2 = __esm({
|
|
|
34665
34798
|
|
|
34666
34799
|
// src/checkout-root.ts
|
|
34667
34800
|
import { existsSync as existsSync12, readFileSync as readFileSync10 } from "node:fs";
|
|
34668
|
-
import { basename as
|
|
34801
|
+
import { basename as basename3, dirname as dirname7, isAbsolute as isAbsolute3, join as join10, resolve as resolve3 } from "node:path";
|
|
34669
34802
|
function nearestGitRoot(dir) {
|
|
34670
34803
|
let cur = resolve3(dir);
|
|
34671
34804
|
for (; ; ) {
|
|
34672
34805
|
if (existsSync12(join10(cur, ".git"))) return cur;
|
|
34673
|
-
const parent =
|
|
34806
|
+
const parent = dirname7(cur);
|
|
34674
34807
|
if (parent === cur) return null;
|
|
34675
34808
|
cur = parent;
|
|
34676
34809
|
}
|
|
@@ -34687,8 +34820,8 @@ function mainCheckoutOfWorktree(root) {
|
|
|
34687
34820
|
return null;
|
|
34688
34821
|
}
|
|
34689
34822
|
const commonDir = resolve3(isAbsolute3(common) ? common : resolve3(gitDir, common));
|
|
34690
|
-
if (
|
|
34691
|
-
const main2 =
|
|
34823
|
+
if (basename3(commonDir) !== ".git") return null;
|
|
34824
|
+
const main2 = dirname7(commonDir);
|
|
34692
34825
|
return existsSync12(join10(main2, ".git")) ? main2 : null;
|
|
34693
34826
|
}
|
|
34694
34827
|
function checkoutRootOf(cwd) {
|
|
@@ -35776,26 +35909,26 @@ function buildFileLexicon(store) {
|
|
|
35776
35909
|
for (const n of store.findNodeFieldsByLabel("File", ["relPath"])) {
|
|
35777
35910
|
const relPath = typeof n.attrs["relPath"] === "string" && n.attrs["relPath"].length > 0 ? n.attrs["relPath"] : n.description;
|
|
35778
35911
|
if (!relPath) continue;
|
|
35779
|
-
const
|
|
35780
|
-
if (!
|
|
35781
|
-
entries.push({ relPath, basename:
|
|
35782
|
-
basenameCount.set(
|
|
35783
|
-
const stem =
|
|
35912
|
+
const basename10 = relPath.split("/").pop();
|
|
35913
|
+
if (!basename10.includes(".")) continue;
|
|
35914
|
+
entries.push({ relPath, basename: basename10 });
|
|
35915
|
+
basenameCount.set(basename10, (basenameCount.get(basename10) ?? 0) + 1);
|
|
35916
|
+
const stem = basename10.slice(0, basename10.indexOf("."));
|
|
35784
35917
|
if (isBareMatchableStem(stem)) {
|
|
35785
35918
|
let s = stemRelPaths.get(stem);
|
|
35786
35919
|
if (!s) stemRelPaths.set(stem, s = /* @__PURE__ */ new Set());
|
|
35787
35920
|
s.add(relPath);
|
|
35788
35921
|
}
|
|
35789
35922
|
}
|
|
35790
|
-
for (const { relPath, basename:
|
|
35923
|
+
for (const { relPath, basename: basename10 } of entries) {
|
|
35791
35924
|
const entry = { relPath };
|
|
35792
|
-
if (relPath !==
|
|
35793
|
-
const conventional = CONVENTION_FILENAMES.has(
|
|
35794
|
-
if (!conventional && !byKey.has(
|
|
35795
|
-
const list = byBasename.get(
|
|
35925
|
+
if (relPath !== basename10) byKey.set(relPath, entry);
|
|
35926
|
+
const conventional = CONVENTION_FILENAMES.has(basename10) || (basenameCount.get(basename10) ?? 0) >= CONVENTION_BASENAME_MIN_FILES;
|
|
35927
|
+
if (!conventional && !byKey.has(basename10)) byKey.set(basename10, entry);
|
|
35928
|
+
const list = byBasename.get(basename10);
|
|
35796
35929
|
if (list) list.push(entry);
|
|
35797
|
-
else byBasename.set(
|
|
35798
|
-
const stem =
|
|
35930
|
+
else byBasename.set(basename10, [entry]);
|
|
35931
|
+
const stem = basename10.slice(0, basename10.indexOf("."));
|
|
35799
35932
|
if (isBareMatchableStem(stem) && !CONVENTION_STEMS.has(stem) && !byStem.has(stem)) {
|
|
35800
35933
|
const dirStems = new Set(
|
|
35801
35934
|
[...stemRelPaths.get(stem) ?? []].map((p) => {
|
|
@@ -35812,8 +35945,8 @@ function resolveFileToken(token, lexicon) {
|
|
|
35812
35945
|
const exact = lexicon.byKey.get(token);
|
|
35813
35946
|
if (exact) return exact;
|
|
35814
35947
|
if (!token.includes("/")) return null;
|
|
35815
|
-
const
|
|
35816
|
-
for (const entry of lexicon.byBasename.get(
|
|
35948
|
+
const basename10 = token.split("/").pop();
|
|
35949
|
+
for (const entry of lexicon.byBasename.get(basename10) ?? []) {
|
|
35817
35950
|
if (entry.relPath === token || entry.relPath.endsWith(`/${token}`)) return entry;
|
|
35818
35951
|
}
|
|
35819
35952
|
return null;
|
|
@@ -35838,9 +35971,9 @@ function fileRolePhrase(relPath, level = 1) {
|
|
|
35838
35971
|
return "a source file";
|
|
35839
35972
|
}
|
|
35840
35973
|
function isSourceFileToken(token) {
|
|
35841
|
-
const
|
|
35842
|
-
if (CONVENTION_FILENAMES.has(
|
|
35843
|
-
const ext =
|
|
35974
|
+
const basename10 = token.split(/[/\\]/).pop() ?? token;
|
|
35975
|
+
if (CONVENTION_FILENAMES.has(basename10)) return false;
|
|
35976
|
+
const ext = basename10.split(".").pop();
|
|
35844
35977
|
return ext !== void 0 && SOURCE_EXTENSIONS.has(ext.toLowerCase());
|
|
35845
35978
|
}
|
|
35846
35979
|
function generalizeFileRefs(text, fileLexicon, level = 1) {
|
|
@@ -42394,18 +42527,18 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
42394
42527
|
|
|
42395
42528
|
// ../../packages/indexer/src/languages/tree-sitter-loader.ts
|
|
42396
42529
|
import { fileURLToPath } from "node:url";
|
|
42397
|
-
import { dirname as
|
|
42530
|
+
import { dirname as dirname8, join as join14 } from "node:path";
|
|
42398
42531
|
import { existsSync as existsSync16, readdirSync as readdirSync3 } from "node:fs";
|
|
42399
42532
|
import { createRequire as createRequire2 } from "node:module";
|
|
42400
42533
|
function entryDir() {
|
|
42401
42534
|
try {
|
|
42402
42535
|
const url2 = import.meta?.url;
|
|
42403
42536
|
if (typeof url2 === "string" && url2.length > 0) {
|
|
42404
|
-
return
|
|
42537
|
+
return dirname8(fileURLToPath(url2));
|
|
42405
42538
|
}
|
|
42406
42539
|
} catch {
|
|
42407
42540
|
}
|
|
42408
|
-
return
|
|
42541
|
+
return dirname8(process.execPath);
|
|
42409
42542
|
}
|
|
42410
42543
|
function findWasmDir() {
|
|
42411
42544
|
const here = entryDir();
|
|
@@ -42421,7 +42554,7 @@ function findWasmDir() {
|
|
|
42421
42554
|
"wasm"
|
|
42422
42555
|
);
|
|
42423
42556
|
if (existsSync16(join14(flat, "tree-sitter-typescript.wasm"))) return flat;
|
|
42424
|
-
dir =
|
|
42557
|
+
dir = dirname8(dir);
|
|
42425
42558
|
}
|
|
42426
42559
|
let root = here;
|
|
42427
42560
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
@@ -42443,7 +42576,7 @@ function findWasmDir() {
|
|
|
42443
42576
|
}
|
|
42444
42577
|
}
|
|
42445
42578
|
}
|
|
42446
|
-
root =
|
|
42579
|
+
root = dirname8(root);
|
|
42447
42580
|
}
|
|
42448
42581
|
throw new Error(
|
|
42449
42582
|
"@vscode/tree-sitter-wasm grammar files not found \u2014 is the package installed?"
|
|
@@ -42457,7 +42590,7 @@ function findRuntimeDir() {
|
|
|
42457
42590
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
42458
42591
|
const flat = join14(dir, "node_modules", "web-tree-sitter");
|
|
42459
42592
|
if (existsSync16(join14(flat, "web-tree-sitter.wasm"))) return flat;
|
|
42460
|
-
dir =
|
|
42593
|
+
dir = dirname8(dir);
|
|
42461
42594
|
}
|
|
42462
42595
|
let root = here;
|
|
42463
42596
|
for (let i2 = 0; i2 < 6; i2++) {
|
|
@@ -42477,7 +42610,7 @@ function findRuntimeDir() {
|
|
|
42477
42610
|
}
|
|
42478
42611
|
}
|
|
42479
42612
|
}
|
|
42480
|
-
root =
|
|
42613
|
+
root = dirname8(root);
|
|
42481
42614
|
}
|
|
42482
42615
|
throw new Error("web-tree-sitter runtime WASM not found");
|
|
42483
42616
|
}
|
|
@@ -76242,8 +76375,8 @@ init_lock();
|
|
|
76242
76375
|
|
|
76243
76376
|
// src/engine.ts
|
|
76244
76377
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
76245
|
-
import { existsSync as existsSync28, statSync as statSync9, appendFileSync as appendFileSync4, readdirSync as
|
|
76246
|
-
import { basename as
|
|
76378
|
+
import { existsSync as existsSync28, statSync as statSync9, appendFileSync as appendFileSync4, readdirSync as readdirSync11, renameSync as renameSync4, readFileSync as readFileSync32, writeFileSync as writeFileSync23 } from "node:fs";
|
|
76379
|
+
import { basename as basename8, join as join35, relative as relative7, sep as sep4 } from "node:path";
|
|
76247
76380
|
|
|
76248
76381
|
// src/coalesced-file-pass.ts
|
|
76249
76382
|
function createCoalescedFilePass(delayMs, run3, onError) {
|
|
@@ -76287,8 +76420,8 @@ function createCoalescedFilePass(delayMs, run3, onError) {
|
|
|
76287
76420
|
|
|
76288
76421
|
// src/source-watcher.ts
|
|
76289
76422
|
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
76290
|
-
import { statSync as statSync6, watch as watch2 } from "node:fs";
|
|
76291
|
-
import { join as join20 } from "node:path";
|
|
76423
|
+
import { readdirSync as readdirSync6, statSync as statSync6, watch as watch2 } from "node:fs";
|
|
76424
|
+
import { isAbsolute as isAbsolute5, join as join20, relative as relative6 } from "node:path";
|
|
76292
76425
|
|
|
76293
76426
|
// ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
|
|
76294
76427
|
import { stat as statcb } from "fs";
|
|
@@ -76443,10 +76576,10 @@ var ReaddirpStream = class extends Readable2 {
|
|
|
76443
76576
|
}
|
|
76444
76577
|
async _formatEntry(dirent, path3) {
|
|
76445
76578
|
let entry;
|
|
76446
|
-
const
|
|
76579
|
+
const basename10 = this._isDirent ? dirent.name : dirent;
|
|
76447
76580
|
try {
|
|
76448
|
-
const fullPath = presolve(pjoin(path3,
|
|
76449
|
-
entry = { path: prelative(this._root, fullPath), fullPath, basename:
|
|
76581
|
+
const fullPath = presolve(pjoin(path3, basename10));
|
|
76582
|
+
entry = { path: prelative(this._root, fullPath), fullPath, basename: basename10 };
|
|
76450
76583
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
76451
76584
|
} catch (err2) {
|
|
76452
76585
|
this._onError(err2);
|
|
@@ -76985,9 +77118,9 @@ var NodeFsHandler = class {
|
|
|
76985
77118
|
_watchWithNodeFs(path3, listener) {
|
|
76986
77119
|
const opts = this.fsw.options;
|
|
76987
77120
|
const directory = sysPath.dirname(path3);
|
|
76988
|
-
const
|
|
77121
|
+
const basename10 = sysPath.basename(path3);
|
|
76989
77122
|
const parent = this.fsw._getWatchedDir(directory);
|
|
76990
|
-
parent.add(
|
|
77123
|
+
parent.add(basename10);
|
|
76991
77124
|
const absolutePath = sysPath.resolve(path3);
|
|
76992
77125
|
const options = {
|
|
76993
77126
|
persistent: opts.persistent
|
|
@@ -76997,7 +77130,7 @@ var NodeFsHandler = class {
|
|
|
76997
77130
|
let closer;
|
|
76998
77131
|
if (opts.usePolling) {
|
|
76999
77132
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
77000
|
-
options.interval = enableBin && isBinaryPath(
|
|
77133
|
+
options.interval = enableBin && isBinaryPath(basename10) ? opts.binaryInterval : opts.interval;
|
|
77001
77134
|
closer = setFsWatchFileListener(path3, absolutePath, options, {
|
|
77002
77135
|
listener,
|
|
77003
77136
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -77019,11 +77152,11 @@ var NodeFsHandler = class {
|
|
|
77019
77152
|
if (this.fsw.closed) {
|
|
77020
77153
|
return;
|
|
77021
77154
|
}
|
|
77022
|
-
const
|
|
77023
|
-
const
|
|
77024
|
-
const parent = this.fsw._getWatchedDir(
|
|
77155
|
+
const dirname17 = sysPath.dirname(file2);
|
|
77156
|
+
const basename10 = sysPath.basename(file2);
|
|
77157
|
+
const parent = this.fsw._getWatchedDir(dirname17);
|
|
77025
77158
|
let prevStats = stats;
|
|
77026
|
-
if (parent.has(
|
|
77159
|
+
if (parent.has(basename10))
|
|
77027
77160
|
return;
|
|
77028
77161
|
const listener = async (path3, newStats) => {
|
|
77029
77162
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
@@ -77048,9 +77181,9 @@ var NodeFsHandler = class {
|
|
|
77048
77181
|
prevStats = newStats2;
|
|
77049
77182
|
}
|
|
77050
77183
|
} catch (error48) {
|
|
77051
|
-
this.fsw._remove(
|
|
77184
|
+
this.fsw._remove(dirname17, basename10);
|
|
77052
77185
|
}
|
|
77053
|
-
} else if (parent.has(
|
|
77186
|
+
} else if (parent.has(basename10)) {
|
|
77054
77187
|
const at = newStats.atimeMs;
|
|
77055
77188
|
const mt = newStats.mtimeMs;
|
|
77056
77189
|
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
|
|
@@ -77297,11 +77430,11 @@ function createPattern(matcher) {
|
|
|
77297
77430
|
if (matcher.path === string4)
|
|
77298
77431
|
return true;
|
|
77299
77432
|
if (matcher.recursive) {
|
|
77300
|
-
const
|
|
77301
|
-
if (!
|
|
77433
|
+
const relative9 = sysPath2.relative(matcher.path, string4);
|
|
77434
|
+
if (!relative9) {
|
|
77302
77435
|
return false;
|
|
77303
77436
|
}
|
|
77304
|
-
return !
|
|
77437
|
+
return !relative9.startsWith("..") && !sysPath2.isAbsolute(relative9);
|
|
77305
77438
|
}
|
|
77306
77439
|
return false;
|
|
77307
77440
|
};
|
|
@@ -78009,6 +78142,7 @@ var NativeSourceWatcher = class extends EventEmitter2 {
|
|
|
78009
78142
|
}
|
|
78010
78143
|
handles = /* @__PURE__ */ new Map();
|
|
78011
78144
|
pending = /* @__PURE__ */ new Map();
|
|
78145
|
+
rescans = /* @__PURE__ */ new Map();
|
|
78012
78146
|
known = /* @__PURE__ */ new Set();
|
|
78013
78147
|
closed = false;
|
|
78014
78148
|
add(target) {
|
|
@@ -78022,18 +78156,27 @@ var NativeSourceWatcher = class extends EventEmitter2 {
|
|
|
78022
78156
|
try {
|
|
78023
78157
|
const h = watch2(target, { recursive: isDir, persistent: true }, (event, name2) => {
|
|
78024
78158
|
const path3 = isDir ? name2 ? join20(target, name2.toString()) : null : target;
|
|
78025
|
-
if (!path3)
|
|
78159
|
+
if (!path3) {
|
|
78160
|
+
this.emit("raw", event, target, { watchedPath: target, filenameMissing: true });
|
|
78161
|
+
this.scheduleReconcile(target, isDir);
|
|
78162
|
+
return;
|
|
78163
|
+
}
|
|
78026
78164
|
this.emit("raw", event, path3, { watchedPath: target });
|
|
78027
78165
|
if (!this.ignored(path3)) this.schedule(path3, event === "rename");
|
|
78028
78166
|
});
|
|
78029
78167
|
h.on("error", () => this.unwatch(target));
|
|
78030
78168
|
this.handles.set(target, h);
|
|
78169
|
+
this.seedKnown(target, isDir);
|
|
78170
|
+
this.scheduleReconcile(target, isDir);
|
|
78031
78171
|
} catch {
|
|
78032
78172
|
}
|
|
78033
78173
|
}
|
|
78034
78174
|
unwatch(target) {
|
|
78035
78175
|
this.handles.get(target)?.close();
|
|
78036
78176
|
this.handles.delete(target);
|
|
78177
|
+
const rescan = this.rescans.get(target);
|
|
78178
|
+
if (rescan) clearTimeout(rescan);
|
|
78179
|
+
this.rescans.delete(target);
|
|
78037
78180
|
}
|
|
78038
78181
|
async close() {
|
|
78039
78182
|
this.closed = true;
|
|
@@ -78041,6 +78184,8 @@ var NativeSourceWatcher = class extends EventEmitter2 {
|
|
|
78041
78184
|
this.handles.clear();
|
|
78042
78185
|
for (const p of this.pending.values()) clearTimeout(p.timer);
|
|
78043
78186
|
this.pending.clear();
|
|
78187
|
+
for (const timer of this.rescans.values()) clearTimeout(timer);
|
|
78188
|
+
this.rescans.clear();
|
|
78044
78189
|
}
|
|
78045
78190
|
schedule(path3, renamed) {
|
|
78046
78191
|
const prev = this.pending.get(path3);
|
|
@@ -78051,6 +78196,51 @@ var NativeSourceWatcher = class extends EventEmitter2 {
|
|
|
78051
78196
|
}, SETTLE_MS);
|
|
78052
78197
|
this.pending.set(path3, { timer, renamed: renamed || (prev?.renamed ?? false) });
|
|
78053
78198
|
}
|
|
78199
|
+
seedKnown(target, isDir) {
|
|
78200
|
+
for (const path3 of this.filesUnder(target, isDir)) this.known.add(path3);
|
|
78201
|
+
}
|
|
78202
|
+
filesUnder(target, isDir) {
|
|
78203
|
+
const files = /* @__PURE__ */ new Set();
|
|
78204
|
+
if (!isDir) {
|
|
78205
|
+
if (!this.ignored(target)) files.add(target);
|
|
78206
|
+
return files;
|
|
78207
|
+
}
|
|
78208
|
+
try {
|
|
78209
|
+
for (const entry of readdirSync6(target, { recursive: true, withFileTypes: true })) {
|
|
78210
|
+
if (!entry.isFile()) continue;
|
|
78211
|
+
const path3 = join20(entry.parentPath, entry.name);
|
|
78212
|
+
if (!this.ignored(path3)) files.add(path3);
|
|
78213
|
+
}
|
|
78214
|
+
} catch {
|
|
78215
|
+
}
|
|
78216
|
+
return files;
|
|
78217
|
+
}
|
|
78218
|
+
scheduleReconcile(target, isDir) {
|
|
78219
|
+
const previous = this.rescans.get(target);
|
|
78220
|
+
if (previous) clearTimeout(previous);
|
|
78221
|
+
const timer = setTimeout(() => {
|
|
78222
|
+
this.rescans.delete(target);
|
|
78223
|
+
if (this.closed || !this.handles.has(target)) return;
|
|
78224
|
+
const current = this.filesUnder(target, isDir);
|
|
78225
|
+
const belongsToTarget = (path3) => {
|
|
78226
|
+
const rel = relative6(target, path3);
|
|
78227
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute5(rel);
|
|
78228
|
+
};
|
|
78229
|
+
for (const path3 of [...this.known]) {
|
|
78230
|
+
if (belongsToTarget(path3) && !current.has(path3)) {
|
|
78231
|
+
this.known.delete(path3);
|
|
78232
|
+
this.emit("unlink", path3);
|
|
78233
|
+
}
|
|
78234
|
+
}
|
|
78235
|
+
for (const path3 of current) {
|
|
78236
|
+
if (!this.known.has(path3)) {
|
|
78237
|
+
this.known.add(path3);
|
|
78238
|
+
this.emit("add", path3);
|
|
78239
|
+
}
|
|
78240
|
+
}
|
|
78241
|
+
}, SETTLE_MS);
|
|
78242
|
+
this.rescans.set(target, timer);
|
|
78243
|
+
}
|
|
78054
78244
|
classify(path3, renamed) {
|
|
78055
78245
|
if (this.closed) return;
|
|
78056
78246
|
let isFile;
|
|
@@ -78510,8 +78700,8 @@ init_review2();
|
|
|
78510
78700
|
|
|
78511
78701
|
// src/turn.ts
|
|
78512
78702
|
init_checkout_root();
|
|
78513
|
-
import { closeSync as closeSync2, existsSync as existsSync19, fstatSync, openSync as openSync2, readdirSync as
|
|
78514
|
-
import { basename as
|
|
78703
|
+
import { closeSync as closeSync2, existsSync as existsSync19, fstatSync, openSync as openSync2, readdirSync as readdirSync7, readSync as readSync2, realpathSync as realpathSync2, statSync as statSync7 } from "node:fs";
|
|
78704
|
+
import { basename as basename6, delimiter, dirname as dirname11, join as join21, normalize as normalize3 } from "node:path";
|
|
78515
78705
|
import { homedir as homedir4 } from "node:os";
|
|
78516
78706
|
import { createHash as createHash16 } from "node:crypto";
|
|
78517
78707
|
function completeJsonlPrefix(buf) {
|
|
@@ -78906,7 +79096,7 @@ function recentTranscripts(cwd, opts = {}) {
|
|
|
78906
79096
|
if (!existsSync19(dir)) return [];
|
|
78907
79097
|
let names;
|
|
78908
79098
|
try {
|
|
78909
|
-
names =
|
|
79099
|
+
names = readdirSync7(dir);
|
|
78910
79100
|
} catch {
|
|
78911
79101
|
return [];
|
|
78912
79102
|
}
|
|
@@ -78922,18 +79112,18 @@ function recentTranscripts(cwd, opts = {}) {
|
|
|
78922
79112
|
continue;
|
|
78923
79113
|
}
|
|
78924
79114
|
if (mtimeMs < since) continue;
|
|
78925
|
-
refs.push({ path: path3, sessionId:
|
|
79115
|
+
refs.push({ path: path3, sessionId: basename6(name2, ".jsonl"), mtimeMs });
|
|
78926
79116
|
}
|
|
78927
79117
|
refs.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
78928
79118
|
return opts.limit ? refs.slice(0, opts.limit) : refs;
|
|
78929
79119
|
}
|
|
78930
79120
|
function subagentTranscripts(mainTranscriptPath, sessionId) {
|
|
78931
79121
|
if (!mainTranscriptPath || !sessionId) return [];
|
|
78932
|
-
const dir = join21(
|
|
79122
|
+
const dir = join21(dirname11(mainTranscriptPath), sessionId, "subagents");
|
|
78933
79123
|
if (!existsSync19(dir)) return [];
|
|
78934
79124
|
let names;
|
|
78935
79125
|
try {
|
|
78936
|
-
names =
|
|
79126
|
+
names = readdirSync7(dir);
|
|
78937
79127
|
} catch {
|
|
78938
79128
|
return [];
|
|
78939
79129
|
}
|
|
@@ -78947,7 +79137,7 @@ function subagentTranscripts(mainTranscriptPath, sessionId) {
|
|
|
78947
79137
|
} catch {
|
|
78948
79138
|
continue;
|
|
78949
79139
|
}
|
|
78950
|
-
refs.push({ path: path3, sessionId:
|
|
79140
|
+
refs.push({ path: path3, sessionId: basename6(name2, ".jsonl"), mtimeMs });
|
|
78951
79141
|
}
|
|
78952
79142
|
refs.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
78953
79143
|
return refs;
|
|
@@ -78964,9 +79154,9 @@ function codexSessionRoots(env2 = process.env, home = homedir4()) {
|
|
|
78964
79154
|
return [...roots];
|
|
78965
79155
|
}
|
|
78966
79156
|
function readCodexRolloutIdentity(path3) {
|
|
78967
|
-
const legacy = `codex:${
|
|
79157
|
+
const legacy = `codex:${basename6(path3, ".jsonl")}`;
|
|
78968
79158
|
const identity = (cwd, id) => {
|
|
78969
|
-
const uuid3 = typeof id === "string" && /^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(id) ? id.toLowerCase() :
|
|
79159
|
+
const uuid3 = typeof id === "string" && /^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(id) ? id.toLowerCase() : basename6(path3, ".jsonl").match(/([a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12})$/i)?.[1]?.toLowerCase();
|
|
78970
79160
|
const sessionId = uuid3 ? `codex:${uuid3}` : legacy;
|
|
78971
79161
|
return { cwd, sessionId, aliases: [legacy, ...uuid3 ? [uuid3] : []].filter((s) => s !== sessionId) };
|
|
78972
79162
|
};
|
|
@@ -79027,7 +79217,7 @@ function codexRolloutsForCwd(cwd, opts = {}) {
|
|
|
79027
79217
|
const { dir, depth } = stack.pop();
|
|
79028
79218
|
let names;
|
|
79029
79219
|
try {
|
|
79030
|
-
names =
|
|
79220
|
+
names = readdirSync7(dir);
|
|
79031
79221
|
} catch {
|
|
79032
79222
|
continue;
|
|
79033
79223
|
}
|
|
@@ -79118,7 +79308,7 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
|
|
|
79118
79308
|
if (!existsSync19(root)) continue;
|
|
79119
79309
|
let slugs;
|
|
79120
79310
|
try {
|
|
79121
|
-
slugs =
|
|
79311
|
+
slugs = readdirSync7(root);
|
|
79122
79312
|
} catch {
|
|
79123
79313
|
continue;
|
|
79124
79314
|
}
|
|
@@ -79126,7 +79316,7 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
|
|
|
79126
79316
|
const chats = join21(root, slug2, "chats");
|
|
79127
79317
|
let names;
|
|
79128
79318
|
try {
|
|
79129
|
-
names =
|
|
79319
|
+
names = readdirSync7(chats);
|
|
79130
79320
|
} catch {
|
|
79131
79321
|
continue;
|
|
79132
79322
|
}
|
|
@@ -79142,7 +79332,7 @@ function geminiTranscriptsForCwd(cwd, opts = {}) {
|
|
|
79142
79332
|
if (!st.isFile() || st.mtimeMs < sinceMs) continue;
|
|
79143
79333
|
const h = readGeminiTranscriptProjectHash(full);
|
|
79144
79334
|
if (!h || !hashes.has(h)) continue;
|
|
79145
|
-
out2.push({ path: full, sessionId: `gemini:${
|
|
79335
|
+
out2.push({ path: full, sessionId: `gemini:${basename6(name2, ".jsonl")}`, mtimeMs: st.mtimeMs });
|
|
79146
79336
|
}
|
|
79147
79337
|
}
|
|
79148
79338
|
}
|
|
@@ -79189,7 +79379,7 @@ function opencodeTranscriptsForCwd(cwd, opts = {}) {
|
|
|
79189
79379
|
if (!existsSync19(root)) continue;
|
|
79190
79380
|
let names;
|
|
79191
79381
|
try {
|
|
79192
|
-
names =
|
|
79382
|
+
names = readdirSync7(root);
|
|
79193
79383
|
} catch {
|
|
79194
79384
|
continue;
|
|
79195
79385
|
}
|
|
@@ -79205,7 +79395,7 @@ function opencodeTranscriptsForCwd(cwd, opts = {}) {
|
|
|
79205
79395
|
if (!st.isFile() || st.mtimeMs < sinceMs) continue;
|
|
79206
79396
|
const dir = readOpencodeTranscriptDirectory(full);
|
|
79207
79397
|
if (!dir || !(want.has(dir) || want.has(dir.replace(/\/+$/, "")))) continue;
|
|
79208
|
-
out2.push({ path: full, sessionId: `opencode:${
|
|
79398
|
+
out2.push({ path: full, sessionId: `opencode:${basename6(name2, ".jsonl")}`, mtimeMs: st.mtimeMs });
|
|
79209
79399
|
}
|
|
79210
79400
|
}
|
|
79211
79401
|
out2.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
@@ -80114,11 +80304,17 @@ function mintPriorEdge(store, source, target, sentence, touched, ts, sessionId)
|
|
|
80114
80304
|
}
|
|
80115
80305
|
return { corroborated, citeAnchorAccrued, citeAnchorPromoted };
|
|
80116
80306
|
}
|
|
80307
|
+
function countExposure(plan, exposure) {
|
|
80308
|
+
if (exposure === "shown") plan.exposureShown++;
|
|
80309
|
+
else if (exposure === "recent") plan.exposureRecent++;
|
|
80310
|
+
else if (exposure === "evicted") plan.exposureEvicted++;
|
|
80311
|
+
else plan.exposureUnshown++;
|
|
80312
|
+
}
|
|
80117
80313
|
function harvestInlineTags(store, text, opts) {
|
|
80118
80314
|
const source = opts.sourceId ? store.getNode(opts.sourceId) : null;
|
|
80119
80315
|
const mintPriors = opts.mintPriors ?? true;
|
|
80120
80316
|
const touched = opts.sessionTouchedIds ?? /* @__PURE__ */ new Set();
|
|
80121
|
-
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: [] };
|
|
80317
|
+
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: [] };
|
|
80122
80318
|
const parsed = parseInlineTagsWithDispositions(text);
|
|
80123
80319
|
const tags = parsed.tags;
|
|
80124
80320
|
plan.dispositions = parsed.dispositions;
|
|
@@ -80328,10 +80524,8 @@ function harvestInlineTags(store, text, opts) {
|
|
|
80328
80524
|
if (tag.kind === "confirm") {
|
|
80329
80525
|
const witnessKey = `corrob:${targetId}:confirm:${digest({ h: tag.handle })}`.slice(0, 72);
|
|
80330
80526
|
if (!plan.corroborations.some((c) => c.witnessKey === witnessKey)) {
|
|
80331
|
-
const exposure = typeof store.currentIngestSeq === "function" ? priorExposure(store, targetId, store.currentIngestSeq()) : "unshown";
|
|
80332
|
-
|
|
80333
|
-
else if (exposure === "evicted") plan.exposureEvicted++;
|
|
80334
|
-
else plan.exposureUnshown++;
|
|
80527
|
+
const exposure = typeof store.currentIngestSeq === "function" ? priorExposure(store, targetId, { seq: store.currentIngestSeq(), ts: opts.ts }) : "unshown";
|
|
80528
|
+
countExposure(plan, exposure);
|
|
80335
80529
|
plan.corroborations.push({ nodeId: targetId, witnessKey, exposure });
|
|
80336
80530
|
}
|
|
80337
80531
|
} else {
|
|
@@ -80349,10 +80543,8 @@ function harvestInlineTags(store, text, opts) {
|
|
|
80349
80543
|
if (targetId && citedLabel && CORROBORATABLE_LABELS.has(citedLabel)) {
|
|
80350
80544
|
const witnessKey = `corrob:${targetId}:lean:${digest({ h: tag.handle })}`.slice(0, 72);
|
|
80351
80545
|
if (!plan.corroborations.some((c) => c.witnessKey === witnessKey)) {
|
|
80352
|
-
const exposure = typeof store.currentIngestSeq === "function" ? priorExposure(store, targetId, store.currentIngestSeq()) : "unshown";
|
|
80353
|
-
|
|
80354
|
-
else if (exposure === "evicted") plan.exposureEvicted++;
|
|
80355
|
-
else plan.exposureUnshown++;
|
|
80546
|
+
const exposure = typeof store.currentIngestSeq === "function" ? priorExposure(store, targetId, { seq: store.currentIngestSeq(), ts: opts.ts }) : "unshown";
|
|
80547
|
+
countExposure(plan, exposure);
|
|
80356
80548
|
plan.corroborations.push({ nodeId: targetId, witnessKey, exposure });
|
|
80357
80549
|
}
|
|
80358
80550
|
}
|
|
@@ -80491,7 +80683,7 @@ ${conversation}` }]
|
|
|
80491
80683
|
// src/constraint-backfill.ts
|
|
80492
80684
|
init_src5();
|
|
80493
80685
|
init_src2();
|
|
80494
|
-
import { existsSync as existsSync20, readFileSync as readFileSync19, readdirSync as
|
|
80686
|
+
import { existsSync as existsSync20, readFileSync as readFileSync19, readdirSync as readdirSync8, writeFileSync as writeFileSync15 } from "node:fs";
|
|
80495
80687
|
import { join as join22 } from "node:path";
|
|
80496
80688
|
import { homedir as homedir5 } from "node:os";
|
|
80497
80689
|
var BACKFILL_VERSION = 1;
|
|
@@ -80525,7 +80717,7 @@ function replay(root) {
|
|
|
80525
80717
|
if (!existsSync20(dir)) return { statements, citedByFix };
|
|
80526
80718
|
let names;
|
|
80527
80719
|
try {
|
|
80528
|
-
names =
|
|
80720
|
+
names = readdirSync8(dir).filter((n) => n.endsWith(".jsonl"));
|
|
80529
80721
|
} catch {
|
|
80530
80722
|
return { statements, citedByFix };
|
|
80531
80723
|
}
|
|
@@ -80765,6 +80957,9 @@ function isolateCensus() {
|
|
|
80765
80957
|
|
|
80766
80958
|
// src/pass-ledger.ts
|
|
80767
80959
|
var PER_KIND_MAX = 100;
|
|
80960
|
+
var LEVEL_TAIL_KINDS = /* @__PURE__ */ new Set(["wm-calibration"]);
|
|
80961
|
+
var LEVEL_TAIL_DAYS = 30;
|
|
80962
|
+
var HOUR_MS = 36e5;
|
|
80768
80963
|
var TRIM_EVERY = 50;
|
|
80769
80964
|
var appendsSinceTrim = /* @__PURE__ */ new Map();
|
|
80770
80965
|
function passLedgerPath(configDir) {
|
|
@@ -80799,16 +80994,28 @@ function appendPassLedger(configDir, kind, durationMs, counts) {
|
|
|
80799
80994
|
appendsSinceTrim.set(path3, 0);
|
|
80800
80995
|
const lines = readFileSync21(path3, "utf8").split("\n").filter(Boolean);
|
|
80801
80996
|
const keptByKind = /* @__PURE__ */ new Map();
|
|
80997
|
+
const tailHours = /* @__PURE__ */ new Map();
|
|
80998
|
+
const tailFloor = Date.now() - LEVEL_TAIL_DAYS * 24 * HOUR_MS;
|
|
80802
80999
|
const kept = [];
|
|
80803
81000
|
for (let i2 = lines.length - 1; i2 >= 0; i2--) {
|
|
80804
|
-
let
|
|
81001
|
+
let entry2;
|
|
80805
81002
|
try {
|
|
80806
|
-
|
|
81003
|
+
entry2 = JSON.parse(lines[i2]);
|
|
80807
81004
|
} catch {
|
|
80808
81005
|
continue;
|
|
80809
81006
|
}
|
|
81007
|
+
const kind2 = String(entry2.kind ?? "");
|
|
80810
81008
|
const n2 = keptByKind.get(kind2) ?? 0;
|
|
80811
|
-
if (n2 >= PER_KIND_MAX)
|
|
81009
|
+
if (n2 >= PER_KIND_MAX) {
|
|
81010
|
+
if (!LEVEL_TAIL_KINDS.has(kind2) || typeof entry2.ts !== "number" || entry2.ts < tailFloor) continue;
|
|
81011
|
+
const hours = tailHours.get(kind2) ?? /* @__PURE__ */ new Set();
|
|
81012
|
+
const hour = Math.floor(entry2.ts / HOUR_MS);
|
|
81013
|
+
if (hours.has(hour)) continue;
|
|
81014
|
+
hours.add(hour);
|
|
81015
|
+
tailHours.set(kind2, hours);
|
|
81016
|
+
kept.push(lines[i2]);
|
|
81017
|
+
continue;
|
|
81018
|
+
}
|
|
80812
81019
|
keptByKind.set(kind2, n2 + 1);
|
|
80813
81020
|
kept.push(lines[i2]);
|
|
80814
81021
|
}
|
|
@@ -83818,11 +84025,11 @@ import {
|
|
|
83818
84025
|
existsSync as existsSync25,
|
|
83819
84026
|
mkdirSync as mkdirSync7,
|
|
83820
84027
|
readFileSync as readFileSync27,
|
|
83821
|
-
readdirSync as
|
|
84028
|
+
readdirSync as readdirSync9,
|
|
83822
84029
|
unlinkSync as unlinkSync4,
|
|
83823
84030
|
writeFileSync as writeFileSync18
|
|
83824
84031
|
} from "node:fs";
|
|
83825
|
-
import { basename as
|
|
84032
|
+
import { basename as basename7, join as join30 } from "node:path";
|
|
83826
84033
|
function skillFileName(id) {
|
|
83827
84034
|
return `${id.replace(/[^A-Za-z0-9_.-]/g, "_")}.md`;
|
|
83828
84035
|
}
|
|
@@ -83845,7 +84052,7 @@ async function syncSkills(paths, client, seed, pins = [], techSeed) {
|
|
|
83845
84052
|
const staleDaemon = res.staleDaemon && res.latestDaemonVersion ? { latest: res.latestDaemonVersion } : void 0;
|
|
83846
84053
|
mkdirSync7(paths.skillsDir, { recursive: true });
|
|
83847
84054
|
if (res.skills.length === 0 && pins.length === 0 && !res.skillsGated) {
|
|
83848
|
-
const existing =
|
|
84055
|
+
const existing = readdirSync9(paths.skillsDir).filter((f) => f.endsWith(".md"));
|
|
83849
84056
|
if (existing.length > 0) return { written: 0, pruned: 0, ...staleDaemon ? { staleDaemon } : {} };
|
|
83850
84057
|
}
|
|
83851
84058
|
const rows = [];
|
|
@@ -83876,9 +84083,9 @@ async function syncSkills(paths, client, seed, pins = [], techSeed) {
|
|
|
83876
84083
|
});
|
|
83877
84084
|
}
|
|
83878
84085
|
let pruned = 0;
|
|
83879
|
-
for (const f of
|
|
84086
|
+
for (const f of readdirSync9(paths.skillsDir)) {
|
|
83880
84087
|
if (!f.endsWith(".md")) continue;
|
|
83881
|
-
if (keep.has(
|
|
84088
|
+
if (keep.has(basename7(f))) continue;
|
|
83882
84089
|
try {
|
|
83883
84090
|
unlinkSync4(join30(paths.skillsDir, f));
|
|
83884
84091
|
pruned++;
|
|
@@ -83902,7 +84109,7 @@ import {
|
|
|
83902
84109
|
lstatSync,
|
|
83903
84110
|
mkdirSync as mkdirSync8,
|
|
83904
84111
|
readFileSync as readFileSync28,
|
|
83905
|
-
readdirSync as
|
|
84112
|
+
readdirSync as readdirSync10,
|
|
83906
84113
|
rmSync as rmSync3,
|
|
83907
84114
|
symlinkSync,
|
|
83908
84115
|
writeFileSync as writeFileSync19
|
|
@@ -83960,7 +84167,7 @@ function skillCiteHandle(s) {
|
|
|
83960
84167
|
function reconcileNamespaced(dir, keep) {
|
|
83961
84168
|
if (!existsSync26(dir)) return 0;
|
|
83962
84169
|
let pruned = 0;
|
|
83963
|
-
for (const name2 of
|
|
84170
|
+
for (const name2 of readdirSync10(dir)) {
|
|
83964
84171
|
if (!name2.startsWith(SKILL_NS) || keep.has(name2)) continue;
|
|
83965
84172
|
try {
|
|
83966
84173
|
rmSync3(join31(dir, name2), { recursive: true, force: true });
|
|
@@ -84163,7 +84370,7 @@ init_profile2();
|
|
|
84163
84370
|
|
|
84164
84371
|
// src/witness-queue.ts
|
|
84165
84372
|
import { readFileSync as readFileSync29, renameSync as renameSync3, writeFileSync as writeFileSync20 } from "node:fs";
|
|
84166
|
-
import { dirname as
|
|
84373
|
+
import { dirname as dirname12, join as join32 } from "node:path";
|
|
84167
84374
|
var WITNESS_QUEUE_CAP = 500;
|
|
84168
84375
|
var WITNESS_TTL_MS = 14 * 24 * 60 * 60 * 1e3;
|
|
84169
84376
|
var WITNESS_MAX_ATTEMPTS = 5;
|
|
@@ -84186,7 +84393,7 @@ function loadWitnessQueueWithLosses(path3) {
|
|
|
84186
84393
|
}
|
|
84187
84394
|
function saveWitnessQueue(path3, queue) {
|
|
84188
84395
|
try {
|
|
84189
|
-
const tmp = join32(
|
|
84396
|
+
const tmp = join32(dirname12(path3), `.${Date.now()}.witness-queue.tmp`);
|
|
84190
84397
|
writeFileSync20(tmp, JSON.stringify(queue), "utf8");
|
|
84191
84398
|
renameSync3(tmp, path3);
|
|
84192
84399
|
} catch {
|
|
@@ -84838,7 +85045,7 @@ function createWatchBreaker(deps) {
|
|
|
84838
85045
|
}
|
|
84839
85046
|
|
|
84840
85047
|
// src/engine.ts
|
|
84841
|
-
var DAEMON_VERSION = true ? "2.0.22-dev.
|
|
85048
|
+
var DAEMON_VERSION = true ? "2.0.22-dev.4071" : "2.0.0-alpha.0";
|
|
84842
85049
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
84843
85050
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
84844
85051
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -84932,7 +85139,7 @@ function gitSourceWatchTargets(root) {
|
|
|
84932
85139
|
if (targets.size > 0) return [...targets];
|
|
84933
85140
|
} catch {
|
|
84934
85141
|
}
|
|
84935
|
-
return
|
|
85142
|
+
return readdirSync11(root, { withFileTypes: true }).filter((e) => e.isDirectory() && !IGNORED_PATH.test(join35(root, String(e.name)) + sep4)).map((e) => join35(root, String(e.name)));
|
|
84936
85143
|
}
|
|
84937
85144
|
function createWorkspaceEngine(opts) {
|
|
84938
85145
|
const paths = workspacePaths(opts.workspaceRoot);
|
|
@@ -85071,7 +85278,7 @@ function createWorkspaceEngine(opts) {
|
|
|
85071
85278
|
fsReindex = createCoalescedFilePass(REINDEX_DEBOUNCE_MS, async (changed) => {
|
|
85072
85279
|
if (stopping) return;
|
|
85073
85280
|
const t = Date.now();
|
|
85074
|
-
const relChanged = changed.map((p) =>
|
|
85281
|
+
const relChanged = changed.map((p) => relative7(opts.workspaceRoot, p).split(sep4).join("/"));
|
|
85075
85282
|
const causal = causalBuffer.correlate(relChanged, t) ?? void 0;
|
|
85076
85283
|
await runReindexPass(
|
|
85077
85284
|
`fs-reindex:${profile.name} (${changed.length} files)`,
|
|
@@ -85885,6 +86092,7 @@ function createWorkspaceEngine(opts) {
|
|
|
85885
86092
|
let exposureShown = 0;
|
|
85886
86093
|
let exposureEvicted = 0;
|
|
85887
86094
|
let exposureUnshown = 0;
|
|
86095
|
+
let exposureRecent = 0;
|
|
85888
86096
|
let corroboratedEdges = 0;
|
|
85889
86097
|
let refutesStamped = 0;
|
|
85890
86098
|
let recurrencesMarked = 0;
|
|
@@ -86101,6 +86309,7 @@ function createWorkspaceEngine(opts) {
|
|
|
86101
86309
|
exposureShown += plan.exposureShown;
|
|
86102
86310
|
exposureEvicted += plan.exposureEvicted;
|
|
86103
86311
|
exposureUnshown += plan.exposureUnshown;
|
|
86312
|
+
exposureRecent += plan.exposureRecent;
|
|
86104
86313
|
if (touchedFileId) touchedFileTurns++;
|
|
86105
86314
|
if ((toolRuns.get(sessionId)?.size ?? 0) > 0) touchedToolTurns++;
|
|
86106
86315
|
const wf = workingFiles.get(sessionId);
|
|
@@ -86763,9 +86972,10 @@ function createWorkspaceEngine(opts) {
|
|
|
86763
86972
|
exposureShown,
|
|
86764
86973
|
exposureEvicted,
|
|
86765
86974
|
exposureUnshown,
|
|
86975
|
+
exposureRecent,
|
|
86766
86976
|
// The sum, so one liveness effectCounter sees an outcome regardless of
|
|
86767
86977
|
// which cell it landed in (WM-join).
|
|
86768
|
-
exposureOutcomes: exposureShown + exposureEvicted + exposureUnshown,
|
|
86978
|
+
exposureOutcomes: exposureShown + exposureEvicted + exposureUnshown + exposureRecent,
|
|
86769
86979
|
// AC-hint-upgrade (harvest seam): edited-this-turn hint promotions.
|
|
86770
86980
|
anchorHintsUpgraded,
|
|
86771
86981
|
// WM-fold funnel (phase 0) — which gate of the same-anchor fold
|
|
@@ -86896,7 +87106,7 @@ function createWorkspaceEngine(opts) {
|
|
|
86896
87106
|
const harvestInFlight = /* @__PURE__ */ new Map();
|
|
86897
87107
|
const repairedSessions = /* @__PURE__ */ new Set();
|
|
86898
87108
|
const harvestTurns = async (inputSessionId, transcriptPath) => {
|
|
86899
|
-
const identity =
|
|
87109
|
+
const identity = basename8(transcriptPath).startsWith("rollout-") ? readCodexRolloutIdentity(transcriptPath) : null;
|
|
86900
87110
|
const sessionId = identity?.sessionId ?? inputSessionId;
|
|
86901
87111
|
const work = (harvestInFlight.get(sessionId) ?? Promise.resolve()).catch(() => {
|
|
86902
87112
|
}).then(async () => {
|
|
@@ -87422,7 +87632,7 @@ B: ${b}`,
|
|
|
87422
87632
|
console.log(
|
|
87423
87633
|
"[errata] sync skipped \u2014 cloud sync consent is off (enable with `errata consent sync on`)"
|
|
87424
87634
|
);
|
|
87425
|
-
const pending = existsSync28(paths.outbox) ?
|
|
87635
|
+
const pending = existsSync28(paths.outbox) ? readdirSync11(paths.outbox).filter((f) => f.endsWith(".json")).length : 0;
|
|
87426
87636
|
return { uploaded: 0, failed: 0, remaining: pending };
|
|
87427
87637
|
}
|
|
87428
87638
|
if (!shipsFromWorkspace(opts.workspaceRoot)) {
|
|
@@ -87434,7 +87644,7 @@ B: ${b}`,
|
|
|
87434
87644
|
console.log(
|
|
87435
87645
|
"[errata] sync held \u2014 this repo is already on errata in another workspace; run `errata link` to join it or create your own project"
|
|
87436
87646
|
);
|
|
87437
|
-
const pending = existsSync28(paths.outbox) ?
|
|
87647
|
+
const pending = existsSync28(paths.outbox) ? readdirSync11(paths.outbox).filter((f) => f.endsWith(".json")).length : 0;
|
|
87438
87648
|
return { uploaded: 0, failed: 0, remaining: pending };
|
|
87439
87649
|
}
|
|
87440
87650
|
try {
|
|
@@ -88150,7 +88360,7 @@ init_profile2();
|
|
|
88150
88360
|
init_session_registry();
|
|
88151
88361
|
|
|
88152
88362
|
// src/public-symbols.ts
|
|
88153
|
-
import { readFileSync as readFileSync34, readdirSync as
|
|
88363
|
+
import { readFileSync as readFileSync34, readdirSync as readdirSync12, existsSync as existsSync31 } from "node:fs";
|
|
88154
88364
|
import { join as join37 } from "node:path";
|
|
88155
88365
|
var HEAD_BYTES = 8 * 1024;
|
|
88156
88366
|
var INDEX_TTL_MS = 10 * 60 * 1e3;
|
|
@@ -88197,7 +88407,7 @@ function internalPackageNames(workspaceRoot) {
|
|
|
88197
88407
|
const groupDir = join37(workspaceRoot, group);
|
|
88198
88408
|
if (!existsSync31(groupDir)) continue;
|
|
88199
88409
|
try {
|
|
88200
|
-
for (const entry of
|
|
88410
|
+
for (const entry of readdirSync12(groupDir)) tryRead(join37(groupDir, entry));
|
|
88201
88411
|
} catch {
|
|
88202
88412
|
}
|
|
88203
88413
|
}
|
|
@@ -89194,7 +89404,7 @@ init_config();
|
|
|
89194
89404
|
|
|
89195
89405
|
// src/update.ts
|
|
89196
89406
|
import { spawn as spawn2 } from "node:child_process";
|
|
89197
|
-
import { isAbsolute as
|
|
89407
|
+
import { isAbsolute as isAbsolute6, join as join38 } from "node:path";
|
|
89198
89408
|
var PACKAGE_NAME = "@inerrata-corporation/errata";
|
|
89199
89409
|
function parse3(v) {
|
|
89200
89410
|
const m = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z][0-9A-Za-z.-]*))?/.exec(v.trim());
|
|
@@ -89339,7 +89549,7 @@ async function runInstalledHookRefresh() {
|
|
|
89339
89549
|
child.on("error", () => resolve10(""));
|
|
89340
89550
|
child.on("close", (code) => resolve10(code === 0 ? output.trim() : ""));
|
|
89341
89551
|
});
|
|
89342
|
-
if (!
|
|
89552
|
+
if (!isAbsolute6(root)) return 1;
|
|
89343
89553
|
return new Promise((resolve10) => {
|
|
89344
89554
|
const child = spawn2(process.execPath, [join38(root, PACKAGE_NAME, "errata.mjs"), "install-hooks", "codex", "--refresh-existing"], {
|
|
89345
89555
|
windowsHide: true,
|
|
@@ -90087,12 +90297,12 @@ var GENERATED_PATH_RES = [
|
|
|
90087
90297
|
];
|
|
90088
90298
|
var RELEASE_SUBJECT_RE = /^(release|bump|chore\(release\)|v?\d+\.\d+\.\d+)/i;
|
|
90089
90299
|
var RELEASE_TAG_RE = /^v?\d+\.\d+/;
|
|
90090
|
-
function
|
|
90300
|
+
function basename9(path3) {
|
|
90091
90301
|
const i2 = path3.lastIndexOf("/");
|
|
90092
90302
|
return i2 < 0 ? path3 : path3.slice(i2 + 1);
|
|
90093
90303
|
}
|
|
90094
90304
|
function isLockfilePath(path3) {
|
|
90095
|
-
const name2 =
|
|
90305
|
+
const name2 = basename9(path3);
|
|
90096
90306
|
return LOCKFILE_NAMES.has(name2) || LOCKFILE_SUFFIX_RE.test(name2);
|
|
90097
90307
|
}
|
|
90098
90308
|
function isGeneratedPath(path3) {
|
|
@@ -91657,12 +91867,12 @@ init_registry();
|
|
|
91657
91867
|
// src/adopt.ts
|
|
91658
91868
|
init_git_remote();
|
|
91659
91869
|
import { existsSync as existsSync33 } from "node:fs";
|
|
91660
|
-
import { dirname as
|
|
91870
|
+
import { dirname as dirname13, join as join41 } from "node:path";
|
|
91661
91871
|
function findGitRoot(absPath) {
|
|
91662
91872
|
let dir = absPath;
|
|
91663
91873
|
for (let depth = 0; depth < 64; depth++) {
|
|
91664
91874
|
if (existsSync33(join41(dir, ".git"))) return dir;
|
|
91665
|
-
const parent =
|
|
91875
|
+
const parent = dirname13(dir);
|
|
91666
91876
|
if (parent === dir) return null;
|
|
91667
91877
|
dir = parent;
|
|
91668
91878
|
}
|
|
@@ -94223,7 +94433,7 @@ function shouldUseOAuthLogin(flags2, env2 = process.env) {
|
|
|
94223
94433
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
94224
94434
|
|
|
94225
94435
|
// src/codex-runtime.ts
|
|
94226
|
-
import { readdirSync as
|
|
94436
|
+
import { readdirSync as readdirSync13, statSync as statSync10 } from "node:fs";
|
|
94227
94437
|
import { join as join42 } from "node:path";
|
|
94228
94438
|
function resolveCodexExecutable(options = {}) {
|
|
94229
94439
|
const platform = options.platform ?? process.platform;
|
|
@@ -94245,7 +94455,7 @@ function resolveCodexExecutable(options = {}) {
|
|
|
94245
94455
|
if (!env2["LOCALAPPDATA"]) return "codex";
|
|
94246
94456
|
const root = join42(env2["LOCALAPPDATA"], "OpenAI", "Codex", "bin");
|
|
94247
94457
|
try {
|
|
94248
|
-
const candidates =
|
|
94458
|
+
const candidates = readdirSync13(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join42(root, entry.name, "codex.exe")).map((path3) => ({ path: path3, mtime: fileTime(path3) })).filter((candidate) => candidate.mtime !== null).sort((a, b) => b.mtime - a.mtime || a.path.localeCompare(b.path));
|
|
94249
94459
|
return candidates[0]?.path ?? "codex";
|
|
94250
94460
|
} catch {
|
|
94251
94461
|
return "codex";
|
|
@@ -95660,8 +95870,8 @@ enabled = ${enabled}
|
|
|
95660
95870
|
|
|
95661
95871
|
// src/codex-hook-refresh.ts
|
|
95662
95872
|
init_checkout_root();
|
|
95663
|
-
import { existsSync as existsSync37, readdirSync as
|
|
95664
|
-
import { dirname as
|
|
95873
|
+
import { existsSync as existsSync37, readdirSync as readdirSync14, readFileSync as readFileSync39 } from "node:fs";
|
|
95874
|
+
import { dirname as dirname14, join as join46, resolve as resolve8 } from "node:path";
|
|
95665
95875
|
init_registry();
|
|
95666
95876
|
function codexHookRoots(roots) {
|
|
95667
95877
|
const found = new Set(roots.map((root) => resolve8(root)));
|
|
@@ -95672,13 +95882,13 @@ function codexHookRoots(roots) {
|
|
|
95672
95882
|
if (!existsSync37(dir)) continue;
|
|
95673
95883
|
let names;
|
|
95674
95884
|
try {
|
|
95675
|
-
names =
|
|
95885
|
+
names = readdirSync14(dir);
|
|
95676
95886
|
} catch {
|
|
95677
95887
|
continue;
|
|
95678
95888
|
}
|
|
95679
95889
|
for (const name2 of names) {
|
|
95680
95890
|
try {
|
|
95681
|
-
const checkout =
|
|
95891
|
+
const checkout = dirname14(readFileSync39(join46(dir, name2, "gitdir"), "utf8").trim());
|
|
95682
95892
|
if (mainCheckoutOfWorktree(checkout) === main2) found.add(checkout);
|
|
95683
95893
|
} catch {
|
|
95684
95894
|
}
|
|
@@ -95702,7 +95912,7 @@ function refreshInstalledCodexRelays(roots = listWorkspaceEntries().map((entry)
|
|
|
95702
95912
|
// src/claude-statusline.ts
|
|
95703
95913
|
import { existsSync as existsSync38, mkdirSync as mkdirSync11, readFileSync as readFileSync40, writeFileSync as writeFileSync29 } from "node:fs";
|
|
95704
95914
|
import { homedir as homedir9 } from "node:os";
|
|
95705
|
-
import { dirname as
|
|
95915
|
+
import { dirname as dirname15, join as join47 } from "node:path";
|
|
95706
95916
|
var STATUSLINE_RELAY_SOURCE = String.raw`// errata-managed: regenerated by errata init / install-hooks claude
|
|
95707
95917
|
import { readFileSync } from 'node:fs';
|
|
95708
95918
|
|
|
@@ -95786,7 +95996,7 @@ function ensureUserStatusLine(opts) {
|
|
|
95786
95996
|
return ownMain ? "kept-own" : "unchanged";
|
|
95787
95997
|
}
|
|
95788
95998
|
Object.assign(settings, next);
|
|
95789
|
-
mkdirSync11(
|
|
95999
|
+
mkdirSync11(dirname15(settingsPath), { recursive: true });
|
|
95790
96000
|
writeFileSync29(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
95791
96001
|
return "installed";
|
|
95792
96002
|
}
|
|
@@ -95807,8 +96017,8 @@ function describeStatusLineOutcome(outcome) {
|
|
|
95807
96017
|
|
|
95808
96018
|
// src/claude-mods.ts
|
|
95809
96019
|
import { createHash as createHash21 } from "node:crypto";
|
|
95810
|
-
import { cpSync as cpSync3, existsSync as existsSync39, mkdirSync as mkdirSync12, readFileSync as readFileSync41, readdirSync as
|
|
95811
|
-
import { delimiter as delimiter2, dirname as
|
|
96020
|
+
import { cpSync as cpSync3, existsSync as existsSync39, mkdirSync as mkdirSync12, readFileSync as readFileSync41, readdirSync as readdirSync15, rmSync as rmSync4, statSync as statSync12, writeFileSync as writeFileSync30 } from "node:fs";
|
|
96021
|
+
import { delimiter as delimiter2, dirname as dirname16, join as join48, relative as relative8, resolve as resolve9, sep as sep5 } from "node:path";
|
|
95812
96022
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
95813
96023
|
var CLAUDE_PLUGIN_DIRS_ENV = "CLAUDE_CODE_PLUGIN_DIRS";
|
|
95814
96024
|
var HASH_FILE = ".errata-mod-hash";
|
|
@@ -95822,9 +96032,9 @@ function isEngineOwned(relPath) {
|
|
|
95822
96032
|
}
|
|
95823
96033
|
function listFiles(root, dir = root) {
|
|
95824
96034
|
const out2 = [];
|
|
95825
|
-
for (const name2 of
|
|
96035
|
+
for (const name2 of readdirSync15(dir)) {
|
|
95826
96036
|
const abs = join48(dir, name2);
|
|
95827
|
-
if (isEngineOwned(
|
|
96037
|
+
if (isEngineOwned(relative8(root, abs))) continue;
|
|
95828
96038
|
if (statSync12(abs).isDirectory()) out2.push(...listFiles(root, abs));
|
|
95829
96039
|
else out2.push(abs);
|
|
95830
96040
|
}
|
|
@@ -95833,7 +96043,7 @@ function listFiles(root, dir = root) {
|
|
|
95833
96043
|
function modHash(dir) {
|
|
95834
96044
|
const h = createHash21("sha256");
|
|
95835
96045
|
for (const abs of listFiles(dir).sort()) {
|
|
95836
|
-
h.update(
|
|
96046
|
+
h.update(relative8(dir, abs).split(sep5).join("/"));
|
|
95837
96047
|
h.update("\0");
|
|
95838
96048
|
h.update(readFileSync41(abs));
|
|
95839
96049
|
h.update("\0");
|
|
@@ -95842,14 +96052,14 @@ function modHash(dir) {
|
|
|
95842
96052
|
}
|
|
95843
96053
|
function bundledMods(bundleDir) {
|
|
95844
96054
|
if (!existsSync39(bundleDir)) return [];
|
|
95845
|
-
return
|
|
96055
|
+
return readdirSync15(bundleDir).filter((name2) => existsSync39(join48(bundleDir, name2, ".claude-plugin", "plugin.json")));
|
|
95846
96056
|
}
|
|
95847
96057
|
function sameDir(a, b) {
|
|
95848
96058
|
const norm = (p) => resolve9(p).replace(/[\\/]+$/, "").toLowerCase();
|
|
95849
96059
|
return norm(a) === norm(b);
|
|
95850
96060
|
}
|
|
95851
96061
|
function isUnder(path3, root) {
|
|
95852
|
-
const rel =
|
|
96062
|
+
const rel = relative8(resolve9(root), resolve9(path3));
|
|
95853
96063
|
return rel !== "" && !rel.startsWith("..") && !rel.includes(":");
|
|
95854
96064
|
}
|
|
95855
96065
|
function off(env2) {
|
|
@@ -95883,7 +96093,7 @@ function currentDirs(settings) {
|
|
|
95883
96093
|
return raw2.split(delimiter2).map((s) => s.trim()).filter(Boolean);
|
|
95884
96094
|
}
|
|
95885
96095
|
function writeSettings(path3, settings) {
|
|
95886
|
-
mkdirSync12(
|
|
96096
|
+
mkdirSync12(dirname16(path3), { recursive: true });
|
|
95887
96097
|
writeFileSync30(path3, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
95888
96098
|
}
|
|
95889
96099
|
function ensureClaudeMods(opts) {
|
|
@@ -95912,7 +96122,7 @@ function ensureClaudeMods(opts) {
|
|
|
95912
96122
|
const hashFile = join48(dest, HASH_FILE);
|
|
95913
96123
|
if (!existsSync39(hashFile) || readFileSync41(hashFile, "utf8") !== hash2) {
|
|
95914
96124
|
rmSync4(dest, { recursive: true, force: true });
|
|
95915
|
-
cpSync3(src, dest, { recursive: true, filter: (p) => !isEngineOwned(
|
|
96125
|
+
cpSync3(src, dest, { recursive: true, filter: (p) => !isEngineOwned(relative8(src, p)) });
|
|
95916
96126
|
writeFileSync30(hashFile, hash2, "utf8");
|
|
95917
96127
|
changed = true;
|
|
95918
96128
|
}
|
|
@@ -98602,9 +98812,9 @@ async function installClaudeHooks(port) {
|
|
|
98602
98812
|
}
|
|
98603
98813
|
async function installClaudeMcpConfig() {
|
|
98604
98814
|
const { mkdirSync: mkdirSync13, existsSync: existsSync41, readFileSync: readFileSync43, writeFileSync: writeFileSync31 } = await import("node:fs");
|
|
98605
|
-
const { join: join50, dirname:
|
|
98815
|
+
const { join: join50, dirname: dirname17 } = await import("node:path");
|
|
98606
98816
|
const file2 = join50(ROOT, ".mcp.json");
|
|
98607
|
-
const dir =
|
|
98817
|
+
const dir = dirname17(file2);
|
|
98608
98818
|
if (!existsSync41(dir)) mkdirSync13(dir, { recursive: true });
|
|
98609
98819
|
let cfg = {};
|
|
98610
98820
|
if (existsSync41(file2)) {
|