@inerrata-corporation/errata 2.0.23 → 2.0.24-dev.5107
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/THIRD-PARTY-NOTICES.md +31 -4
- package/consolidate-worker.mjs +109 -17
- package/errata.mjs +5310 -2146
- package/generalize-worker.mjs +79 -10
- package/package.json +1 -1
- package/pass-worker.mjs +421 -35
- package/resources/context-plugin/.codex-plugin/plugin.json +1 -1
- package/resources/context-plugin/SHA256SUMS +5 -5
- package/resources/context-plugin/THIRD-PARTY-NOTICES.md +29 -1
- package/resources/context-plugin/dist/client.js +265 -202
- package/resources/context-plugin/dist/mcp-server.mjs +141 -47
- package/resources/context-plugin/dist/panel.html +265 -202
- package/resources/models/potion-base-8M.q8.bin +0 -0
package/generalize-worker.mjs
CHANGED
|
@@ -14867,7 +14867,25 @@ function normalizeParam(v) {
|
|
|
14867
14867
|
}
|
|
14868
14868
|
|
|
14869
14869
|
// ../../packages/local-shared/src/tag-grammar.ts
|
|
14870
|
-
var TAG_CANONICAL_ID_PREFIXES = [
|
|
14870
|
+
var TAG_CANONICAL_ID_PREFIXES = [
|
|
14871
|
+
"motif_community_projn",
|
|
14872
|
+
"motif_community_orgn",
|
|
14873
|
+
"motif",
|
|
14874
|
+
"projn",
|
|
14875
|
+
"orgn",
|
|
14876
|
+
"dtri",
|
|
14877
|
+
"dom",
|
|
14878
|
+
"pat",
|
|
14879
|
+
"sol",
|
|
14880
|
+
"drc",
|
|
14881
|
+
"dcause",
|
|
14882
|
+
"dfix",
|
|
14883
|
+
"dprob",
|
|
14884
|
+
"dvuln",
|
|
14885
|
+
"prob",
|
|
14886
|
+
"claim",
|
|
14887
|
+
"err"
|
|
14888
|
+
];
|
|
14871
14889
|
var TAG_HANDLE_SOURCE = String.raw`\[([a-z0-9][\w-]{0,80})\]|((?:${TAG_CANONICAL_ID_PREFIXES.join("|")})_[0-9a-f]{6,})`;
|
|
14872
14890
|
var TAG_THREAD_SOURCE = String.raw`#([a-z][\w-]{0,63})`;
|
|
14873
14891
|
var TAG_PLACEHOLDER_HANDLES = /* @__PURE__ */ new Set([
|
|
@@ -16004,13 +16022,23 @@ function pageRankScale(ranks) {
|
|
|
16004
16022
|
var DEMAND_HOT = Math.log1p(10);
|
|
16005
16023
|
var DEMAND_WARM = Math.log1p(5);
|
|
16006
16024
|
|
|
16025
|
+
// ../../packages/math/src/reader-evidence.ts
|
|
16026
|
+
var FIELD_CODES = {
|
|
16027
|
+
a: "acceptedCount",
|
|
16028
|
+
c: "corroborationCount",
|
|
16029
|
+
f: "failureReportCount",
|
|
16030
|
+
p: "contradictionPressure"
|
|
16031
|
+
};
|
|
16032
|
+
var FIELDS = Object.values(FIELD_CODES);
|
|
16033
|
+
|
|
16007
16034
|
// ../../packages/local-graph/src/node-select.ts
|
|
16008
16035
|
var SELECT_INDEXES = [
|
|
16009
16036
|
"nodes_live_local_community",
|
|
16010
16037
|
"nodes_live_fold_candidate",
|
|
16011
16038
|
"nodes_live_resolved",
|
|
16012
16039
|
"nodes_live_fix_candidate",
|
|
16013
|
-
"nodes_live_anchor_hint"
|
|
16040
|
+
"nodes_live_anchor_hint",
|
|
16041
|
+
"nodes_live_created_v2"
|
|
16014
16042
|
];
|
|
16015
16043
|
var EMBEDDING_DIM_SQL = "(CASE WHEN length(embedding_blob) >= 4 THEN length(embedding_blob) / 4 ELSE COALESCE(json_array_length(embedding_json), 0) END)";
|
|
16016
16044
|
var KEY = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/;
|
|
@@ -16331,7 +16359,10 @@ CREATE UNIQUE INDEX IF NOT EXISTS edges_triple ON edges(from_id, type, to_id);
|
|
|
16331
16359
|
`;
|
|
16332
16360
|
var TEMPORAL_INDEX_SQL = `
|
|
16333
16361
|
CREATE INDEX IF NOT EXISTS nodes_live ON nodes(label, valid_to);
|
|
16334
|
-
|
|
16362
|
+
-- Dropped: a prefix of nodes_live_page_rank (valid_to, page_rank), which serves
|
|
16363
|
+
-- the live count and the "any live node?" check as a covering index too. It was
|
|
16364
|
+
-- re-keyed on every close and revive: ~11 KB of a symbol flip's ~80 KB.
|
|
16365
|
+
DROP INDEX IF EXISTS nodes_live_count;
|
|
16335
16366
|
-- Problems by recency (the only label read newest-first). Over every live row,
|
|
16336
16367
|
-- each write that stamps last_updated_at moved a code symbol's entry from a
|
|
16337
16368
|
-- scattered leaf: ~19 KB per position-only symbol rewrite on a 1.1 GB store.
|
|
@@ -16343,7 +16374,13 @@ CREATE INDEX IF NOT EXISTS nodes_live_problem_recent ON nodes(label, last_update
|
|
|
16343
16374
|
-- walks nodes_live and reads every live row of the label to test created_at:
|
|
16344
16375
|
-- 56 MB per guard on a 1.1 GB store, to learn there was nothing to do. valid_to
|
|
16345
16376
|
-- is a key column so the planner prefers this over nodes_live (one more term).
|
|
16346
|
-
|
|
16377
|
+
-- last_updated_at rides along for errata.recent on code labels, which names this
|
|
16378
|
+
-- index: the filter runs on index entries, not on every row of the label (79 ms
|
|
16379
|
+
-- \u2192 3 ms for Function on a 1.1 GB store). It costs no extra writes: a close or
|
|
16380
|
+
-- revive already re-keys this index, and mergeNodeIfChanged leaves a symbol's
|
|
16381
|
+
-- last_updated_at alone when only its position moved.
|
|
16382
|
+
DROP INDEX IF EXISTS nodes_live_created;
|
|
16383
|
+
CREATE INDEX IF NOT EXISTS nodes_live_created_v2 ON nodes(label, valid_to, created_at, last_updated_at) WHERE valid_to IS NULL;
|
|
16347
16384
|
-- Community members (the skills pull reads them twice per session boundary):
|
|
16348
16385
|
-- ~15% of semantic nodes carry a localCommunity, and without this every live
|
|
16349
16386
|
-- semantic row was read to find them (168 MB \u2192 18 MB per read).
|
|
@@ -16528,6 +16565,12 @@ function sameSqlValue(a, b) {
|
|
|
16528
16565
|
if (a instanceof Uint8Array && b instanceof Uint8Array) return Buffer.compare(a, b) === 0;
|
|
16529
16566
|
return false;
|
|
16530
16567
|
}
|
|
16568
|
+
var POSITION_ATTRS = ["startByte", "endByte", "startRow"];
|
|
16569
|
+
function attrsJsonWithoutPositions(attrs) {
|
|
16570
|
+
const rest = { ...attrs };
|
|
16571
|
+
for (const k of POSITION_ATTRS) delete rest[k];
|
|
16572
|
+
return JSON.stringify(rest);
|
|
16573
|
+
}
|
|
16531
16574
|
var PRIOR_TAG_MARKER = '"priorTag":true';
|
|
16532
16575
|
var SqliteGraphStore = class {
|
|
16533
16576
|
db;
|
|
@@ -16628,7 +16671,7 @@ var SqliteGraphStore = class {
|
|
|
16628
16671
|
lastUpdatedOf: this.db.prepare("SELECT last_updated_at AS t, attrs_json FROM nodes WHERE id = ?"),
|
|
16629
16672
|
labelOf: this.db.prepare("SELECT label FROM nodes WHERE id = ?"),
|
|
16630
16673
|
nodeContent: this.db.prepare(
|
|
16631
|
-
"SELECT label, description, extraction_confidence, extraction_source, stability, valid_to, attrs_json FROM nodes WHERE id = ?"
|
|
16674
|
+
"SELECT label, description, extraction_confidence, extraction_source, stability, valid_to, last_updated_at, attrs_json FROM nodes WHERE id = ?"
|
|
16632
16675
|
),
|
|
16633
16676
|
edgeContent: this.db.prepare(
|
|
16634
16677
|
"SELECT confidence, valid_to, attrs_json FROM edges WHERE from_id = ? AND type = ? AND to_id = ?"
|
|
@@ -17041,11 +17084,23 @@ var SqliteGraphStore = class {
|
|
|
17041
17084
|
* rank, community, landmark, surprise, hits, tier and the vector belong to
|
|
17042
17085
|
* the passes that compute them, and a skipped write leaves them as they are
|
|
17043
17086
|
* where a merge would have reset them to the producer's defaults. Returns
|
|
17044
|
-
* whether it wrote.
|
|
17087
|
+
* whether it wrote.
|
|
17088
|
+
*
|
|
17089
|
+
* A live row whose only change is its position keeps its lastUpdatedAt, so
|
|
17090
|
+
* that stamp means "this symbol's content changed": what errata.recent lists
|
|
17091
|
+
* and the fix-candidate ask reads, and what lets nodes_live_created_v2 carry
|
|
17092
|
+
* it without being re-keyed by every edit above a symbol. A closed row is
|
|
17093
|
+
* always stamped: reviveReobserved reopens what this pass stamped. */
|
|
17045
17094
|
mergeNodeIfChanged(node) {
|
|
17046
17095
|
const row = this.stmts.nodeContent.get(node.id);
|
|
17047
|
-
if (row
|
|
17048
|
-
|
|
17096
|
+
if (!row || row.valid_to !== null || row.label !== node.label || row.description !== node.description || row.extraction_confidence !== node.extractionConfidence || row.stability !== node.stability || EXPOSURE_ATTRS.some((k) => node.attrs?.[k] !== void 0)) {
|
|
17097
|
+
this.mergeNode(node);
|
|
17098
|
+
return true;
|
|
17099
|
+
}
|
|
17100
|
+
const attrs = node.attrs ?? {};
|
|
17101
|
+
if (row.attrs_json === JSON.stringify(attrs)) return false;
|
|
17102
|
+
const moved = attrsJsonWithoutPositions(JSON.parse(row.attrs_json)) === attrsJsonWithoutPositions(attrs);
|
|
17103
|
+
this.mergeNode(moved ? { ...node, lastUpdatedAt: row.last_updated_at } : node);
|
|
17049
17104
|
return true;
|
|
17050
17105
|
}
|
|
17051
17106
|
updateNode(id, patch) {
|
|
@@ -17125,8 +17180,8 @@ var SqliteGraphStore = class {
|
|
|
17125
17180
|
stmt2 = this.db.prepare(
|
|
17126
17181
|
// Ordered, not left to the planner: readers take "first row wins" (the
|
|
17127
17182
|
// symbol lexicon's name winner and doc pick), and the order otherwise
|
|
17128
|
-
// followed whichever partial index the planner chose.
|
|
17129
|
-
// serves
|
|
17183
|
+
// followed whichever partial index the planner chose. nodes_live_created_v2
|
|
17184
|
+
// serves it, sorting rowids only within an equal created_at.
|
|
17130
17185
|
`SELECT id, description, community, extraction_confidence${cols} FROM nodes WHERE label = ? AND valid_to IS NULL ORDER BY created_at, rowid`
|
|
17131
17186
|
);
|
|
17132
17187
|
this.fieldStmts.set(cacheKey, stmt2);
|
|
@@ -18019,6 +18074,20 @@ var CREDIT_FAMILY = [
|
|
|
18019
18074
|
...JUSTIFICATION_EDGES
|
|
18020
18075
|
];
|
|
18021
18076
|
|
|
18077
|
+
// ../../packages/embedding/src/bands.ts
|
|
18078
|
+
var DESIGNED_FOR_MINILM = {
|
|
18079
|
+
dedup: 0.88,
|
|
18080
|
+
softWriteMin: 0.8,
|
|
18081
|
+
bindMin: 0.78,
|
|
18082
|
+
nearMiss: 0.72,
|
|
18083
|
+
judgeMin: 0.5,
|
|
18084
|
+
predictionFloor: 0.5,
|
|
18085
|
+
relevanceFloor: 0.25,
|
|
18086
|
+
relatedWeak: 0.35,
|
|
18087
|
+
relatedStrong: 0.45
|
|
18088
|
+
};
|
|
18089
|
+
var UNKNOWN = { ...DESIGNED_FOR_MINILM, relevanceFloor: 0.5 };
|
|
18090
|
+
|
|
18022
18091
|
// ../../packages/local-graph/src/design-problem.ts
|
|
18023
18092
|
var RECURRENCE_DEBOUNCE_MS = 60 * 60 * 1e3;
|
|
18024
18093
|
|