@inerrata-corporation/errata 2.0.14-dev.3162 → 2.0.14-dev.3228
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 +25 -4
- package/errata.mjs +46 -57
- package/package.json +1 -1
- package/pass-worker.mjs +25 -4
package/consolidate-worker.mjs
CHANGED
|
@@ -15735,6 +15735,13 @@ var init_triage_canon = __esm({
|
|
|
15735
15735
|
}
|
|
15736
15736
|
});
|
|
15737
15737
|
|
|
15738
|
+
// ../../packages/shared/src/project-wire-attrs.ts
|
|
15739
|
+
var init_project_wire_attrs = __esm({
|
|
15740
|
+
"../../packages/shared/src/project-wire-attrs.ts"() {
|
|
15741
|
+
"use strict";
|
|
15742
|
+
}
|
|
15743
|
+
});
|
|
15744
|
+
|
|
15738
15745
|
// ../../packages/shared/src/index.ts
|
|
15739
15746
|
var init_src = __esm({
|
|
15740
15747
|
"../../packages/shared/src/index.ts"() {
|
|
@@ -15764,6 +15771,7 @@ var init_src = __esm({
|
|
|
15764
15771
|
init_taxonomy();
|
|
15765
15772
|
init_triage_canon();
|
|
15766
15773
|
init_history_text();
|
|
15774
|
+
init_project_wire_attrs();
|
|
15767
15775
|
}
|
|
15768
15776
|
});
|
|
15769
15777
|
|
|
@@ -16144,9 +16152,10 @@ init_src();
|
|
|
16144
16152
|
|
|
16145
16153
|
// ../../packages/local-graph/src/history-cache-floor.ts
|
|
16146
16154
|
function installHistoryCacheFloor(db) {
|
|
16147
|
-
const key = "history-cache-withdrawal-floor-
|
|
16155
|
+
const key = "history-cache-withdrawal-floor-3";
|
|
16148
16156
|
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key)) return;
|
|
16149
16157
|
db.transaction(() => {
|
|
16158
|
+
db.exec("DROP TRIGGER IF EXISTS history_cache_nodes_insert; DROP TRIGGER IF EXISTS history_cache_nodes_update;");
|
|
16150
16159
|
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get("history-cache-withdrawal-floor-1")) {
|
|
16151
16160
|
db.exec("DROP INDEX IF EXISTS nodes_cloud_id");
|
|
16152
16161
|
}
|
|
@@ -16164,9 +16173,10 @@ function installHistoryCacheFloor(db) {
|
|
|
16164
16173
|
`);
|
|
16165
16174
|
const lookup = (field) => `(SELECT ${field} FROM history_cache_withdrawals w WHERE w.id = nodes.id)`;
|
|
16166
16175
|
const privacy = `coalesce(${lookup("privacy")}, 0)`;
|
|
16167
|
-
const
|
|
16176
|
+
const source = `coalesce(json_extract(attrs_json, '$.extractionSource'), extraction_source)`;
|
|
16177
|
+
const description = `CASE WHEN ${privacy} THEN CASE WHEN ${source} = 'history-mined' THEN 'History source withdrawn.' ELSE 'Cloud source withdrawn.' END ELSE description END`;
|
|
16168
16178
|
const attrs = `CASE WHEN ${privacy} THEN json_object(
|
|
16169
|
-
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource',
|
|
16179
|
+
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource', ${source},
|
|
16170
16180
|
'historyQuality', json_object('sourceSupport', 'quarantined', 'applicability', 'unknown'),
|
|
16171
16181
|
'historyCorrectionSeq', ${lookup("seq")})
|
|
16172
16182
|
ELSE json_set(json_remove(attrs_json, '$.embeddingVersion'),
|
|
@@ -16179,11 +16189,22 @@ function installHistoryCacheFloor(db) {
|
|
|
16179
16189
|
OR EXISTS(SELECT 1 FROM history_cache_withdrawals w WHERE w.id = nodes.id))
|
|
16180
16190
|
AND (embedding_blob IS NOT NULL OR embedding_json <> '[]' OR is_landmark <> 0
|
|
16181
16191
|
OR description <> ${description} OR attrs_json <> ${attrs});`;
|
|
16192
|
+
const internal = `key IN ('orgId','teamId','groupId','projectId','aliasTexts','aliasCanonicalIds')
|
|
16193
|
+
OR key GLOB 'mergedFrom*' OR key GLOB '*WitnessKeys' OR key GLOB '*Sessions'
|
|
16194
|
+
OR key GLOB 'authoringSession*' OR key GLOB 'contributor*' OR key GLOB 'witnessKeys*'`;
|
|
16195
|
+
const stripMetadata = (scope) => `UPDATE nodes SET attrs_json=(
|
|
16196
|
+
SELECT json_group_object(key, CASE WHEN type IN ('array','object') THEN json(value)
|
|
16197
|
+
WHEN type IN ('true','false') THEN json(type) ELSE value END)
|
|
16198
|
+
FROM json_each(nodes.attrs_json) WHERE NOT (${internal}))
|
|
16199
|
+
WHERE (${scope}) AND json_extract(attrs_json,'$.source')='cloud'
|
|
16200
|
+
AND EXISTS(SELECT 1 FROM store_meta m WHERE m.key='history-correction:' || coalesce(json_extract(nodes.attrs_json,'$.cloudNodeId'),nodes.id) AND json_valid(m.value))
|
|
16201
|
+
AND EXISTS(SELECT 1 FROM json_each(nodes.attrs_json) WHERE ${internal});`;
|
|
16182
16202
|
for (const operation of ["INSERT", "UPDATE"]) {
|
|
16183
16203
|
db.exec(`CREATE TRIGGER IF NOT EXISTS history_cache_nodes_${operation.toLowerCase()}
|
|
16184
|
-
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} END;`);
|
|
16204
|
+
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} ${stripMetadata("id = NEW.id")} END;`);
|
|
16185
16205
|
}
|
|
16186
16206
|
db.exec(repair("json_extract(attrs_json, '$.source') = 'cloud' OR json_extract(attrs_json, '$.historyQuality.sourceSupport') IN ('quarantined','contradicted')"));
|
|
16207
|
+
db.exec(stripMetadata("1=1"));
|
|
16187
16208
|
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(key, "installed");
|
|
16188
16209
|
});
|
|
16189
16210
|
}
|
package/errata.mjs
CHANGED
|
@@ -15493,8 +15493,6 @@ function looksLikeSecretValue(raw2, quoted) {
|
|
|
15493
15493
|
if (raw2.includes("${") || raw2.includes("{{") || raw2.includes("%(")) return false;
|
|
15494
15494
|
if (raw2.startsWith("[redacted:")) return false;
|
|
15495
15495
|
if (quoted) return raw2.length > 0;
|
|
15496
|
-
const lower = raw2.toLowerCase();
|
|
15497
|
-
if (ASSIGNMENT_STOPWORDS.has(lower)) return false;
|
|
15498
15496
|
if (/^(?:process\.env\.|os\.environ(?:\[|\.)|(?:request|response|config|settings|options)\.)/.test(raw2)) return false;
|
|
15499
15497
|
if (/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*\(/.test(raw2)) return false;
|
|
15500
15498
|
return raw2.length > 0;
|
|
@@ -15559,75 +15557,36 @@ function scrubHistoryValue(value) {
|
|
|
15559
15557
|
const clear = (input) => typeof input === "string" ? input.replace(literals, REDACTED_CREDENTIAL) : Array.isArray(input) ? input.map(clear) : input && typeof input === "object" ? Object.fromEntries(Object.entries(input).map(([k, v]) => [k, clear(v)])) : input;
|
|
15560
15558
|
return clear(safe);
|
|
15561
15559
|
}
|
|
15562
|
-
var HISTORY_SCRUBBER_VERSION, REDACTED_CREDENTIAL, REDACTED_EMAIL, cred,
|
|
15560
|
+
var HISTORY_SCRUBBER_VERSION, REDACTED_CREDENTIAL, REDACTED_EMAIL, cred, PASSWORD_PROSE_DESCRIPTORS, CREDENTIAL_RULES, EMAIL_RE;
|
|
15563
15561
|
var init_history_text = __esm({
|
|
15564
15562
|
"../../packages/shared/src/history-text.ts"() {
|
|
15565
15563
|
"use strict";
|
|
15566
|
-
HISTORY_SCRUBBER_VERSION = "history-scrub-
|
|
15564
|
+
HISTORY_SCRUBBER_VERSION = "history-scrub-5";
|
|
15567
15565
|
REDACTED_CREDENTIAL = "[redacted:credential]";
|
|
15568
15566
|
REDACTED_EMAIL = "[redacted:email]";
|
|
15569
15567
|
cred = () => REDACTED_CREDENTIAL;
|
|
15570
|
-
|
|
15571
|
-
"string",
|
|
15572
|
-
"boolean",
|
|
15573
|
-
"number",
|
|
15568
|
+
PASSWORD_PROSE_DESCRIPTORS = /* @__PURE__ */ new Set([
|
|
15574
15569
|
"required",
|
|
15575
15570
|
"optional",
|
|
15576
15571
|
"undefined",
|
|
15577
15572
|
"unknown",
|
|
15578
|
-
"function",
|
|
15579
|
-
"process",
|
|
15580
|
-
"request",
|
|
15581
|
-
"response",
|
|
15582
|
-
"password",
|
|
15583
|
-
"secret",
|
|
15584
|
-
"token",
|
|
15585
|
-
"tokens",
|
|
15586
|
-
"credential",
|
|
15587
|
-
"credentials",
|
|
15588
|
-
"bearer",
|
|
15589
|
-
"basic",
|
|
15590
|
-
"example",
|
|
15591
15573
|
"redacted",
|
|
15592
15574
|
"nullable",
|
|
15593
|
-
"readonly",
|
|
15594
|
-
"override",
|
|
15595
|
-
"abstract",
|
|
15596
|
-
"interface",
|
|
15597
|
-
"constant",
|
|
15598
|
-
"variable",
|
|
15599
|
-
"property",
|
|
15600
|
-
"parameter",
|
|
15601
|
-
"argument",
|
|
15602
|
-
"callback",
|
|
15603
|
-
"promise",
|
|
15604
|
-
"settings",
|
|
15605
|
-
"options",
|
|
15606
|
-
"default",
|
|
15607
15575
|
"disabled",
|
|
15608
15576
|
"enabled",
|
|
15609
|
-
"internal",
|
|
15610
|
-
"external",
|
|
15611
|
-
"protected",
|
|
15612
15577
|
"provided",
|
|
15613
|
-
"resolved",
|
|
15614
15578
|
"rejected",
|
|
15615
|
-
"expected",
|
|
15616
|
-
"received",
|
|
15617
15579
|
"salt",
|
|
15618
15580
|
"hash",
|
|
15619
15581
|
"hashed",
|
|
15620
|
-
"hashing"
|
|
15621
|
-
"authentication",
|
|
15622
|
-
"field",
|
|
15623
|
-
"format"
|
|
15582
|
+
"hashing"
|
|
15624
15583
|
]);
|
|
15625
15584
|
CREDENTIAL_RULES = [
|
|
15626
15585
|
// Human-written seed/reset notes omit assignment punctuation: password `…`
|
|
15627
15586
|
// or password (…). Preserve names of fields and hash components.
|
|
15628
15587
|
{
|
|
15629
15588
|
re: /\b((?:password|passwd|passphrase|pwd)\s+)(["'`(])([^\s"'`,;)}\]]+)(["'`)])/gi,
|
|
15630
|
-
replace: (m) => !
|
|
15589
|
+
replace: (m) => !(m[2] === "(" && PASSWORD_PROSE_DESCRIPTORS.has((m[3] ?? "").toLowerCase())) && looksLikeSecretValue(m[3] ?? "", true) ? `${m[1]}${m[2]}${REDACTED_CREDENTIAL}${m[4]}` : null
|
|
15631
15590
|
},
|
|
15632
15591
|
// "with SeedValue42! credentials" and "with SeedValue42!/seeded account".
|
|
15633
15592
|
// Require mixed-case letters plus a digit, or a password-like special char;
|
|
@@ -15657,7 +15616,7 @@ var init_history_text = __esm({
|
|
|
15657
15616
|
re: /\b((?:password|passwd|passphrase|pwd)\s+(?:is|was|of)\s+)(["'\x60]?)([^\s"'\x60,;)}\]]+)/gi,
|
|
15658
15617
|
replace: (m) => {
|
|
15659
15618
|
const value = m[3] ?? "";
|
|
15660
|
-
if (
|
|
15619
|
+
if (!m[2] && PASSWORD_PROSE_DESCRIPTORS.has(value.toLowerCase()) || value.startsWith("[redacted:") || /\$\{|\{\{|process\./.test(value)) return null;
|
|
15661
15620
|
return `${m[1]}${m[2]}${REDACTED_CREDENTIAL}`;
|
|
15662
15621
|
}
|
|
15663
15622
|
},
|
|
@@ -15693,8 +15652,9 @@ var init_history_text = __esm({
|
|
|
15693
15652
|
},
|
|
15694
15653
|
// Assignments after key-ish names: `password=...`, `API_KEY: "..."`,
|
|
15695
15654
|
// `"client_secret": "..."`, `AWS_SECRET_ACCESS_KEY=...`, 32+ hex/base64 after
|
|
15696
|
-
// any of them.
|
|
15697
|
-
// `password
|
|
15655
|
+
// any of them. Recognizable expressions such as `process.env.X` survive.
|
|
15656
|
+
// Bare `password: string` is ambiguous with YAML containing a literal weak
|
|
15657
|
+
// password, so it is redacted. A stopword is never proof of safe code.
|
|
15698
15658
|
{
|
|
15699
15659
|
re: /((?:[A-Za-z0-9_.-]*?)(?:password|passwd|passphrase|pwd|secret|token|api[_-]?key|apikey|access[_-]?key|private[_-]?key|auth[_-]?key|credential)(?:[A-Za-z0-9_-]*))(["']?\s*(?:=>|=|:)\s*)(["'`]?)([^\s"'`,;)}\]]+)/gi,
|
|
15700
15660
|
replace: (m) => {
|
|
@@ -17318,6 +17278,18 @@ var init_triage_canon = __esm({
|
|
|
17318
17278
|
}
|
|
17319
17279
|
});
|
|
17320
17280
|
|
|
17281
|
+
// ../../packages/shared/src/project-wire-attrs.ts
|
|
17282
|
+
function projectWireAttrs(obj) {
|
|
17283
|
+
return Object.fromEntries(Object.entries(obj).filter(
|
|
17284
|
+
([key]) => !/^(?:orgId|teamId|groupId|projectId|aliasTexts|aliasCanonicalIds|mergedFrom.*|.*WitnessKeys|.*Sessions|authoringSession.*|contributor.*|witnessKeys.*)$/.test(key)
|
|
17285
|
+
));
|
|
17286
|
+
}
|
|
17287
|
+
var init_project_wire_attrs = __esm({
|
|
17288
|
+
"../../packages/shared/src/project-wire-attrs.ts"() {
|
|
17289
|
+
"use strict";
|
|
17290
|
+
}
|
|
17291
|
+
});
|
|
17292
|
+
|
|
17321
17293
|
// ../../packages/shared/src/index.ts
|
|
17322
17294
|
var src_exports = {};
|
|
17323
17295
|
__export(src_exports, {
|
|
@@ -17477,6 +17449,7 @@ __export(src_exports, {
|
|
|
17477
17449
|
problemIdFromError: () => problemIdFromError,
|
|
17478
17450
|
projectSaltedNodeId: () => projectSaltedNodeId,
|
|
17479
17451
|
projectSymbolId: () => projectSymbolId,
|
|
17452
|
+
projectWireAttrs: () => projectWireAttrs,
|
|
17480
17453
|
provenanceBand: () => provenanceBand,
|
|
17481
17454
|
resolveCanonical: () => resolveCanonical,
|
|
17482
17455
|
resolveCanonicalId: () => resolveCanonicalId,
|
|
@@ -17531,6 +17504,7 @@ var init_src = __esm({
|
|
|
17531
17504
|
init_taxonomy();
|
|
17532
17505
|
init_triage_canon();
|
|
17533
17506
|
init_history_text();
|
|
17507
|
+
init_project_wire_attrs();
|
|
17534
17508
|
}
|
|
17535
17509
|
});
|
|
17536
17510
|
|
|
@@ -17958,9 +17932,10 @@ var init_src2 = __esm({
|
|
|
17958
17932
|
|
|
17959
17933
|
// ../../packages/local-graph/src/history-cache-floor.ts
|
|
17960
17934
|
function installHistoryCacheFloor(db) {
|
|
17961
|
-
const key = "history-cache-withdrawal-floor-
|
|
17935
|
+
const key = "history-cache-withdrawal-floor-3";
|
|
17962
17936
|
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key)) return;
|
|
17963
17937
|
db.transaction(() => {
|
|
17938
|
+
db.exec("DROP TRIGGER IF EXISTS history_cache_nodes_insert; DROP TRIGGER IF EXISTS history_cache_nodes_update;");
|
|
17964
17939
|
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get("history-cache-withdrawal-floor-1")) {
|
|
17965
17940
|
db.exec("DROP INDEX IF EXISTS nodes_cloud_id");
|
|
17966
17941
|
}
|
|
@@ -17978,9 +17953,10 @@ function installHistoryCacheFloor(db) {
|
|
|
17978
17953
|
`);
|
|
17979
17954
|
const lookup = (field) => `(SELECT ${field} FROM history_cache_withdrawals w WHERE w.id = nodes.id)`;
|
|
17980
17955
|
const privacy = `coalesce(${lookup("privacy")}, 0)`;
|
|
17981
|
-
const
|
|
17956
|
+
const source = `coalesce(json_extract(attrs_json, '$.extractionSource'), extraction_source)`;
|
|
17957
|
+
const description = `CASE WHEN ${privacy} THEN CASE WHEN ${source} = 'history-mined' THEN 'History source withdrawn.' ELSE 'Cloud source withdrawn.' END ELSE description END`;
|
|
17982
17958
|
const attrs = `CASE WHEN ${privacy} THEN json_object(
|
|
17983
|
-
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource',
|
|
17959
|
+
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource', ${source},
|
|
17984
17960
|
'historyQuality', json_object('sourceSupport', 'quarantined', 'applicability', 'unknown'),
|
|
17985
17961
|
'historyCorrectionSeq', ${lookup("seq")})
|
|
17986
17962
|
ELSE json_set(json_remove(attrs_json, '$.embeddingVersion'),
|
|
@@ -17993,11 +17969,22 @@ function installHistoryCacheFloor(db) {
|
|
|
17993
17969
|
OR EXISTS(SELECT 1 FROM history_cache_withdrawals w WHERE w.id = nodes.id))
|
|
17994
17970
|
AND (embedding_blob IS NOT NULL OR embedding_json <> '[]' OR is_landmark <> 0
|
|
17995
17971
|
OR description <> ${description} OR attrs_json <> ${attrs});`;
|
|
17972
|
+
const internal = `key IN ('orgId','teamId','groupId','projectId','aliasTexts','aliasCanonicalIds')
|
|
17973
|
+
OR key GLOB 'mergedFrom*' OR key GLOB '*WitnessKeys' OR key GLOB '*Sessions'
|
|
17974
|
+
OR key GLOB 'authoringSession*' OR key GLOB 'contributor*' OR key GLOB 'witnessKeys*'`;
|
|
17975
|
+
const stripMetadata = (scope) => `UPDATE nodes SET attrs_json=(
|
|
17976
|
+
SELECT json_group_object(key, CASE WHEN type IN ('array','object') THEN json(value)
|
|
17977
|
+
WHEN type IN ('true','false') THEN json(type) ELSE value END)
|
|
17978
|
+
FROM json_each(nodes.attrs_json) WHERE NOT (${internal}))
|
|
17979
|
+
WHERE (${scope}) AND json_extract(attrs_json,'$.source')='cloud'
|
|
17980
|
+
AND EXISTS(SELECT 1 FROM store_meta m WHERE m.key='history-correction:' || coalesce(json_extract(nodes.attrs_json,'$.cloudNodeId'),nodes.id) AND json_valid(m.value))
|
|
17981
|
+
AND EXISTS(SELECT 1 FROM json_each(nodes.attrs_json) WHERE ${internal});`;
|
|
17996
17982
|
for (const operation of ["INSERT", "UPDATE"]) {
|
|
17997
17983
|
db.exec(`CREATE TRIGGER IF NOT EXISTS history_cache_nodes_${operation.toLowerCase()}
|
|
17998
|
-
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} END;`);
|
|
17984
|
+
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} ${stripMetadata("id = NEW.id")} END;`);
|
|
17999
17985
|
}
|
|
18000
17986
|
db.exec(repair("json_extract(attrs_json, '$.source') = 'cloud' OR json_extract(attrs_json, '$.historyQuality.sourceSupport') IN ('quarantined','contradicted')"));
|
|
17987
|
+
db.exec(stripMetadata("1=1"));
|
|
18001
17988
|
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(key, "installed");
|
|
18002
17989
|
});
|
|
18003
17990
|
}
|
|
@@ -81266,7 +81253,7 @@ function createWatchBreaker(deps) {
|
|
|
81266
81253
|
}
|
|
81267
81254
|
|
|
81268
81255
|
// src/engine.ts
|
|
81269
|
-
var DAEMON_VERSION = true ? "2.0.14-dev.
|
|
81256
|
+
var DAEMON_VERSION = true ? "2.0.14-dev.3228" : "2.0.0-alpha.0";
|
|
81270
81257
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
81271
81258
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
81272
81259
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -85307,6 +85294,7 @@ init_src11();
|
|
|
85307
85294
|
init_profile2();
|
|
85308
85295
|
|
|
85309
85296
|
// src/history-corrections.ts
|
|
85297
|
+
init_src();
|
|
85310
85298
|
init_profile2();
|
|
85311
85299
|
function applyHistoryCorrections(store, page) {
|
|
85312
85300
|
let changed = 0;
|
|
@@ -85321,15 +85309,16 @@ function applyHistoryCorrections(store, page) {
|
|
|
85321
85309
|
for (const node2 of copies) {
|
|
85322
85310
|
if (node2.attrs["source"] !== "cloud" || node2.attrs["cloudNodeId"] && node2.attrs["cloudNodeId"] !== correction.nodeId || Number(node2.attrs["historyCorrectionSeq"] ?? 0) >= correction.seq) continue;
|
|
85323
85311
|
const quality = { sourceSupport: correction.sourceSupport ?? (privacy ? "quarantined" : "unreviewed"), applicability: "unknown" };
|
|
85312
|
+
const historical = node2.extractionSource === "history-mined" || node2.attrs["extractionSource"] === "history-mined";
|
|
85324
85313
|
store.mergeNode({
|
|
85325
85314
|
...node2,
|
|
85326
85315
|
lastUpdatedAt: Date.now(),
|
|
85327
|
-
...privacy ? { description: "History source withdrawn.", embedding: [], isLandmark: false } : {},
|
|
85316
|
+
...privacy ? { description: historical ? "History source withdrawn." : "Cloud source withdrawn.", embedding: [], isLandmark: false } : {},
|
|
85328
85317
|
attrs: {
|
|
85329
|
-
...privacy ? {} : node2.attrs,
|
|
85318
|
+
...privacy ? {} : projectWireAttrs(node2.attrs),
|
|
85330
85319
|
source: "cloud",
|
|
85331
85320
|
cloudNodeId: correction.nodeId,
|
|
85332
|
-
extractionSource:
|
|
85321
|
+
extractionSource: node2.extractionSource,
|
|
85333
85322
|
historyQuality: quality,
|
|
85334
85323
|
historyCorrectionSeq: correction.seq
|
|
85335
85324
|
}
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -15537,6 +15537,13 @@ var init_triage_canon = __esm({
|
|
|
15537
15537
|
}
|
|
15538
15538
|
});
|
|
15539
15539
|
|
|
15540
|
+
// ../../packages/shared/src/project-wire-attrs.ts
|
|
15541
|
+
var init_project_wire_attrs = __esm({
|
|
15542
|
+
"../../packages/shared/src/project-wire-attrs.ts"() {
|
|
15543
|
+
"use strict";
|
|
15544
|
+
}
|
|
15545
|
+
});
|
|
15546
|
+
|
|
15540
15547
|
// ../../packages/shared/src/index.ts
|
|
15541
15548
|
var init_src = __esm({
|
|
15542
15549
|
"../../packages/shared/src/index.ts"() {
|
|
@@ -15566,6 +15573,7 @@ var init_src = __esm({
|
|
|
15566
15573
|
init_taxonomy();
|
|
15567
15574
|
init_triage_canon();
|
|
15568
15575
|
init_history_text();
|
|
15576
|
+
init_project_wire_attrs();
|
|
15569
15577
|
}
|
|
15570
15578
|
});
|
|
15571
15579
|
|
|
@@ -24561,9 +24569,10 @@ init_src();
|
|
|
24561
24569
|
|
|
24562
24570
|
// ../../packages/local-graph/src/history-cache-floor.ts
|
|
24563
24571
|
function installHistoryCacheFloor(db) {
|
|
24564
|
-
const key = "history-cache-withdrawal-floor-
|
|
24572
|
+
const key = "history-cache-withdrawal-floor-3";
|
|
24565
24573
|
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key)) return;
|
|
24566
24574
|
db.transaction(() => {
|
|
24575
|
+
db.exec("DROP TRIGGER IF EXISTS history_cache_nodes_insert; DROP TRIGGER IF EXISTS history_cache_nodes_update;");
|
|
24567
24576
|
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get("history-cache-withdrawal-floor-1")) {
|
|
24568
24577
|
db.exec("DROP INDEX IF EXISTS nodes_cloud_id");
|
|
24569
24578
|
}
|
|
@@ -24581,9 +24590,10 @@ function installHistoryCacheFloor(db) {
|
|
|
24581
24590
|
`);
|
|
24582
24591
|
const lookup = (field) => `(SELECT ${field} FROM history_cache_withdrawals w WHERE w.id = nodes.id)`;
|
|
24583
24592
|
const privacy = `coalesce(${lookup("privacy")}, 0)`;
|
|
24584
|
-
const
|
|
24593
|
+
const source = `coalesce(json_extract(attrs_json, '$.extractionSource'), extraction_source)`;
|
|
24594
|
+
const description = `CASE WHEN ${privacy} THEN CASE WHEN ${source} = 'history-mined' THEN 'History source withdrawn.' ELSE 'Cloud source withdrawn.' END ELSE description END`;
|
|
24585
24595
|
const attrs = `CASE WHEN ${privacy} THEN json_object(
|
|
24586
|
-
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource',
|
|
24596
|
+
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource', ${source},
|
|
24587
24597
|
'historyQuality', json_object('sourceSupport', 'quarantined', 'applicability', 'unknown'),
|
|
24588
24598
|
'historyCorrectionSeq', ${lookup("seq")})
|
|
24589
24599
|
ELSE json_set(json_remove(attrs_json, '$.embeddingVersion'),
|
|
@@ -24596,11 +24606,22 @@ function installHistoryCacheFloor(db) {
|
|
|
24596
24606
|
OR EXISTS(SELECT 1 FROM history_cache_withdrawals w WHERE w.id = nodes.id))
|
|
24597
24607
|
AND (embedding_blob IS NOT NULL OR embedding_json <> '[]' OR is_landmark <> 0
|
|
24598
24608
|
OR description <> ${description} OR attrs_json <> ${attrs});`;
|
|
24609
|
+
const internal = `key IN ('orgId','teamId','groupId','projectId','aliasTexts','aliasCanonicalIds')
|
|
24610
|
+
OR key GLOB 'mergedFrom*' OR key GLOB '*WitnessKeys' OR key GLOB '*Sessions'
|
|
24611
|
+
OR key GLOB 'authoringSession*' OR key GLOB 'contributor*' OR key GLOB 'witnessKeys*'`;
|
|
24612
|
+
const stripMetadata = (scope) => `UPDATE nodes SET attrs_json=(
|
|
24613
|
+
SELECT json_group_object(key, CASE WHEN type IN ('array','object') THEN json(value)
|
|
24614
|
+
WHEN type IN ('true','false') THEN json(type) ELSE value END)
|
|
24615
|
+
FROM json_each(nodes.attrs_json) WHERE NOT (${internal}))
|
|
24616
|
+
WHERE (${scope}) AND json_extract(attrs_json,'$.source')='cloud'
|
|
24617
|
+
AND EXISTS(SELECT 1 FROM store_meta m WHERE m.key='history-correction:' || coalesce(json_extract(nodes.attrs_json,'$.cloudNodeId'),nodes.id) AND json_valid(m.value))
|
|
24618
|
+
AND EXISTS(SELECT 1 FROM json_each(nodes.attrs_json) WHERE ${internal});`;
|
|
24599
24619
|
for (const operation of ["INSERT", "UPDATE"]) {
|
|
24600
24620
|
db.exec(`CREATE TRIGGER IF NOT EXISTS history_cache_nodes_${operation.toLowerCase()}
|
|
24601
|
-
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} END;`);
|
|
24621
|
+
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} ${stripMetadata("id = NEW.id")} END;`);
|
|
24602
24622
|
}
|
|
24603
24623
|
db.exec(repair("json_extract(attrs_json, '$.source') = 'cloud' OR json_extract(attrs_json, '$.historyQuality.sourceSupport') IN ('quarantined','contradicted')"));
|
|
24624
|
+
db.exec(stripMetadata("1=1"));
|
|
24604
24625
|
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(key, "installed");
|
|
24605
24626
|
});
|
|
24606
24627
|
}
|