@inerrata-corporation/errata 2.0.17-dev.3464 → 2.0.17-dev.3465
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 +24 -5
- package/errata.mjs +168 -79
- package/package.json +1 -1
package/consolidate-worker.mjs
CHANGED
|
@@ -15656,9 +15656,6 @@ function projectSymbolId(projectSalt, projectId, relPath, qname, kind) {
|
|
|
15656
15656
|
const path = normalizeSymbolPath(relPath);
|
|
15657
15657
|
return `sym_${createHmac("sha256", projectSalt).update(`${projectId}:${path}:${qname}:${kind}`).digest("hex").slice(0, 24)}`;
|
|
15658
15658
|
}
|
|
15659
|
-
function isMembraneSaltedId(id) {
|
|
15660
|
-
return typeof id === "string" && /^(orgn_|teamn_|projn_)/.test(id);
|
|
15661
|
-
}
|
|
15662
15659
|
var init_project_symbol = __esm({
|
|
15663
15660
|
"../../packages/shared/src/project-symbol.ts"() {
|
|
15664
15661
|
"use strict";
|
|
@@ -18584,6 +18581,18 @@ init_src();
|
|
|
18584
18581
|
// src/instance-receipts.ts
|
|
18585
18582
|
var INSTANCE_SEMANTIC_EDGE_TYPES = ["CAUSED_BY", "SOLVED_BY"];
|
|
18586
18583
|
var INSTANCE_ANCHOR_EDGE_TYPES = ["OCCURS_IN", "DEPENDS_ON", "PERTAIN_TO", "CONCERNS"];
|
|
18584
|
+
function instanceCloudWithdrawal(n, destination, getMeta) {
|
|
18585
|
+
const id = n.attrs["source"] === "cloud" ? n.attrs["cloudNodeId"] ?? n.id : instanceReceipt(n, destination)["cloudNodeId"];
|
|
18586
|
+
if (typeof id !== "string") return false;
|
|
18587
|
+
const raw = getMeta(`history-correction:${id}`);
|
|
18588
|
+
if (!raw) return false;
|
|
18589
|
+
try {
|
|
18590
|
+
const correction = JSON.parse(raw);
|
|
18591
|
+
return correction.nodeId === id && correction.action === "quarantine" && correction.sourceSupport !== "supported";
|
|
18592
|
+
} catch {
|
|
18593
|
+
return false;
|
|
18594
|
+
}
|
|
18595
|
+
}
|
|
18587
18596
|
function receiptMap(attrs) {
|
|
18588
18597
|
const value = attrs["instanceReceipts"];
|
|
18589
18598
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
@@ -19474,7 +19483,7 @@ function stripCodebaseScope(scope) {
|
|
|
19474
19483
|
}
|
|
19475
19484
|
function contributedWireId(n, destinationKey) {
|
|
19476
19485
|
const cloudId = instanceReceipt(n, destinationKey)["cloudNodeId"];
|
|
19477
|
-
return
|
|
19486
|
+
return typeof cloudId === "string" && cloudId ? cloudId : n.id;
|
|
19478
19487
|
}
|
|
19479
19488
|
var WIRE_CANONICAL_ID_MIN = 6;
|
|
19480
19489
|
var SHIP_TERMINAL_REFUSALS = 3;
|
|
@@ -19482,7 +19491,7 @@ function refusalFingerprint(reason, description) {
|
|
|
19482
19491
|
return digest(`${reason}\0${description}`);
|
|
19483
19492
|
}
|
|
19484
19493
|
function isRetryableRefusal(reason) {
|
|
19485
|
-
return /\bretry\b/i.test(reason);
|
|
19494
|
+
return reason === "blocked" || /\bretry\b/i.test(reason);
|
|
19486
19495
|
}
|
|
19487
19496
|
function isTerminallyRefused(n) {
|
|
19488
19497
|
const reason = String(n.attrs["shipRefusedReason"] ?? "");
|
|
@@ -19602,6 +19611,8 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
19602
19611
|
const semanticEndpoints = /* @__PURE__ */ new Map();
|
|
19603
19612
|
const includedByLabel = /* @__PURE__ */ new Map();
|
|
19604
19613
|
const composition = {
|
|
19614
|
+
cloudWithdrawn: 0,
|
|
19615
|
+
withdrawnAnchorTargets: 0,
|
|
19605
19616
|
privateTargetMissing: 0,
|
|
19606
19617
|
candidates: 0,
|
|
19607
19618
|
shipped: 0,
|
|
@@ -19670,6 +19681,10 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
19670
19681
|
composition.ignored++;
|
|
19671
19682
|
continue;
|
|
19672
19683
|
}
|
|
19684
|
+
if (instanceCloudWithdrawal(n, opts.destinationKey, (key) => store.getMeta?.(key) ?? opts.sharedStore?.getMeta?.(key))) {
|
|
19685
|
+
composition.cloudWithdrawn++;
|
|
19686
|
+
continue;
|
|
19687
|
+
}
|
|
19673
19688
|
const contributedAtSeq = instanceReceipt(n, opts.destinationKey)["contributedAtSeq"];
|
|
19674
19689
|
if (typeof contributedAtSeq === "number" && (n.lastReinforcedAtSeq ?? 0) <= contributedAtSeq) {
|
|
19675
19690
|
composition.watermarked++;
|
|
@@ -19718,6 +19733,10 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
19718
19733
|
for (const e of store.outEdges(sourceId, [...ANCHOR_EDGES])) {
|
|
19719
19734
|
const t = nodeOf(e.to);
|
|
19720
19735
|
if (!t || !ANCHOR_TARGET_LABELS.includes(t.label)) continue;
|
|
19736
|
+
if (instanceCloudWithdrawal(t, opts.destinationKey, (key) => store.getMeta?.(key) ?? opts.sharedStore?.getMeta?.(key))) {
|
|
19737
|
+
composition.withdrawnAnchorTargets++;
|
|
19738
|
+
continue;
|
|
19739
|
+
}
|
|
19721
19740
|
if (e.type === "OCCURS_IN" && t.label !== "Language") continue;
|
|
19722
19741
|
if (e.type === "DEPENDS_ON" && t.label !== "Package") continue;
|
|
19723
19742
|
if (e.type === "PERTAIN_TO" && t.label !== "Domain") continue;
|
package/errata.mjs
CHANGED
|
@@ -26155,6 +26155,8 @@ var init_oauth = __esm({
|
|
|
26155
26155
|
|
|
26156
26156
|
// ../../packages/cloud-client/src/client.ts
|
|
26157
26157
|
import { randomUUID } from "node:crypto";
|
|
26158
|
+
import { gzip } from "node:zlib";
|
|
26159
|
+
import { promisify } from "node:util";
|
|
26158
26160
|
function wirePerContext(value) {
|
|
26159
26161
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
26160
26162
|
const out2 = {};
|
|
@@ -26406,7 +26408,7 @@ function parseRestErrorEnvelope(text) {
|
|
|
26406
26408
|
return null;
|
|
26407
26409
|
}
|
|
26408
26410
|
}
|
|
26409
|
-
var asWireCount, INGEST_NODE_CHUNK, INGEST_EDGE_CHUNK, E6B_PUBLIC_CONTEXT_SENTINEL, CloudClient, CloudError;
|
|
26411
|
+
var asWireCount, INGEST_NODE_CHUNK, INGEST_EDGE_CHUNK, E6B_PUBLIC_CONTEXT_SENTINEL, gzipAsync, CloudClient, CloudError;
|
|
26410
26412
|
var init_client = __esm({
|
|
26411
26413
|
"../../packages/cloud-client/src/client.ts"() {
|
|
26412
26414
|
"use strict";
|
|
@@ -26416,7 +26418,9 @@ var init_client = __esm({
|
|
|
26416
26418
|
INGEST_NODE_CHUNK = 8;
|
|
26417
26419
|
INGEST_EDGE_CHUNK = 32;
|
|
26418
26420
|
E6B_PUBLIC_CONTEXT_SENTINEL = "00000000-0000-4e6b-8000-000000000e6b";
|
|
26421
|
+
gzipAsync = promisify(gzip);
|
|
26419
26422
|
CloudClient = class {
|
|
26423
|
+
compressedRoutes = /* @__PURE__ */ new Set();
|
|
26420
26424
|
baseUrl;
|
|
26421
26425
|
apiKey;
|
|
26422
26426
|
accessToken;
|
|
@@ -26648,7 +26652,7 @@ var init_client = __esm({
|
|
|
26648
26652
|
merged.nodes.push(...r.nodes);
|
|
26649
26653
|
merged.edges.push(...r.edges);
|
|
26650
26654
|
for (const rn of r.nodes) {
|
|
26651
|
-
if (rn.nodeId && rn.nodeId !== rn.canonicalId &&
|
|
26655
|
+
if (rn.nodeId && rn.nodeId !== rn.canonicalId && rn.decision !== "rejected") {
|
|
26652
26656
|
echoedCloudId.set(rn.canonicalId, rn.nodeId);
|
|
26653
26657
|
}
|
|
26654
26658
|
}
|
|
@@ -27080,12 +27084,23 @@ var init_client = __esm({
|
|
|
27080
27084
|
const ac = new AbortController();
|
|
27081
27085
|
const tid = setTimeout(() => ac.abort(), this.timeoutMs);
|
|
27082
27086
|
try {
|
|
27083
|
-
const
|
|
27087
|
+
const serialized = body2 === void 0 ? void 0 : JSON.stringify(body2);
|
|
27088
|
+
const compressible = method === "POST" && (path2 === "/v2/ingest" || /^\/v2\/projects\/[^/]+\/history\/units$/.test(path2));
|
|
27089
|
+
const send = async (compressed2) => this.fetchFn(url2, {
|
|
27084
27090
|
method,
|
|
27085
|
-
headers,
|
|
27086
|
-
body:
|
|
27091
|
+
headers: compressed2 ? { ...headers, "content-encoding": "gzip" } : headers,
|
|
27092
|
+
body: compressed2 && serialized !== void 0 ? new Uint8Array(await gzipAsync(serialized)) : serialized,
|
|
27087
27093
|
signal: ac.signal
|
|
27088
27094
|
});
|
|
27095
|
+
let compressed = compressible && this.compressedRoutes.has(path2);
|
|
27096
|
+
let res = await send(compressed);
|
|
27097
|
+
if (!res.ok && compressible && !compressed && serialized !== void 0) {
|
|
27098
|
+
const text = await res.clone().text();
|
|
27099
|
+
if (isIntermediaryRejection(new CloudError(`HTTP ${res.status} ${text.slice(0, 200)}`, res.status))) {
|
|
27100
|
+
compressed = true;
|
|
27101
|
+
res = await send(true);
|
|
27102
|
+
}
|
|
27103
|
+
}
|
|
27089
27104
|
if (!res.ok) {
|
|
27090
27105
|
const text = await res.text();
|
|
27091
27106
|
const envelope = parseRestErrorEnvelope(text);
|
|
@@ -27095,6 +27110,7 @@ var init_client = __esm({
|
|
|
27095
27110
|
envelope?.code
|
|
27096
27111
|
);
|
|
27097
27112
|
}
|
|
27113
|
+
if (compressed) this.compressedRoutes.add(path2);
|
|
27098
27114
|
return await res.json();
|
|
27099
27115
|
} finally {
|
|
27100
27116
|
clearTimeout(tid);
|
|
@@ -64914,7 +64930,7 @@ var require_mock_interceptor = __commonJS({
|
|
|
64914
64930
|
var require_mock_client = __commonJS({
|
|
64915
64931
|
"../../node_modules/.pnpm/undici@6.24.1/node_modules/undici/lib/mock/mock-client.js"(exports, module2) {
|
|
64916
64932
|
"use strict";
|
|
64917
|
-
var { promisify:
|
|
64933
|
+
var { promisify: promisify5 } = __require("node:util");
|
|
64918
64934
|
var Client = require_client();
|
|
64919
64935
|
var { buildMockDispatch } = require_mock_utils();
|
|
64920
64936
|
var {
|
|
@@ -64954,7 +64970,7 @@ var require_mock_client = __commonJS({
|
|
|
64954
64970
|
return new MockInterceptor(opts, this[kDispatches]);
|
|
64955
64971
|
}
|
|
64956
64972
|
async [kClose]() {
|
|
64957
|
-
await
|
|
64973
|
+
await promisify5(this[kOriginalClose])();
|
|
64958
64974
|
this[kConnected] = 0;
|
|
64959
64975
|
this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
|
|
64960
64976
|
}
|
|
@@ -64967,7 +64983,7 @@ var require_mock_client = __commonJS({
|
|
|
64967
64983
|
var require_mock_pool = __commonJS({
|
|
64968
64984
|
"../../node_modules/.pnpm/undici@6.24.1/node_modules/undici/lib/mock/mock-pool.js"(exports, module2) {
|
|
64969
64985
|
"use strict";
|
|
64970
|
-
var { promisify:
|
|
64986
|
+
var { promisify: promisify5 } = __require("node:util");
|
|
64971
64987
|
var Pool = require_pool();
|
|
64972
64988
|
var { buildMockDispatch } = require_mock_utils();
|
|
64973
64989
|
var {
|
|
@@ -65007,7 +65023,7 @@ var require_mock_pool = __commonJS({
|
|
|
65007
65023
|
return new MockInterceptor(opts, this[kDispatches]);
|
|
65008
65024
|
}
|
|
65009
65025
|
async [kClose]() {
|
|
65010
|
-
await
|
|
65026
|
+
await promisify5(this[kOriginalClose])();
|
|
65011
65027
|
this[kConnected] = 0;
|
|
65012
65028
|
this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
|
|
65013
65029
|
}
|
|
@@ -73728,6 +73744,46 @@ import { execFileSync as execFileSync5 } from "node:child_process";
|
|
|
73728
73744
|
import { existsSync as existsSync28, statSync as statSync8, appendFileSync as appendFileSync4, readdirSync as readdirSync10, renameSync as renameSync4, readFileSync as readFileSync32, writeFileSync as writeFileSync23 } from "node:fs";
|
|
73729
73745
|
import { basename as basename7, join as join35, relative as relative6, sep as sep4 } from "node:path";
|
|
73730
73746
|
|
|
73747
|
+
// src/coalesced-file-pass.ts
|
|
73748
|
+
function createCoalescedFilePass(delayMs, run3, onError) {
|
|
73749
|
+
const pending = /* @__PURE__ */ new Set();
|
|
73750
|
+
let timer;
|
|
73751
|
+
let running = false;
|
|
73752
|
+
let stopped = false;
|
|
73753
|
+
const clear = () => {
|
|
73754
|
+
if (timer) clearTimeout(timer);
|
|
73755
|
+
timer = void 0;
|
|
73756
|
+
pending.clear();
|
|
73757
|
+
};
|
|
73758
|
+
const schedule = () => {
|
|
73759
|
+
if (stopped || running || !pending.size) return;
|
|
73760
|
+
if (timer) clearTimeout(timer);
|
|
73761
|
+
timer = setTimeout(() => {
|
|
73762
|
+
timer = void 0;
|
|
73763
|
+
const paths = [...pending];
|
|
73764
|
+
pending.clear();
|
|
73765
|
+
running = true;
|
|
73766
|
+
void Promise.resolve().then(() => run3(paths)).catch(onError).finally(() => {
|
|
73767
|
+
running = false;
|
|
73768
|
+
schedule();
|
|
73769
|
+
});
|
|
73770
|
+
}, delayMs);
|
|
73771
|
+
};
|
|
73772
|
+
return {
|
|
73773
|
+
add(path2) {
|
|
73774
|
+
if (!stopped) {
|
|
73775
|
+
pending.add(path2);
|
|
73776
|
+
schedule();
|
|
73777
|
+
}
|
|
73778
|
+
},
|
|
73779
|
+
clear,
|
|
73780
|
+
stop() {
|
|
73781
|
+
stopped = true;
|
|
73782
|
+
clear();
|
|
73783
|
+
}
|
|
73784
|
+
};
|
|
73785
|
+
}
|
|
73786
|
+
|
|
73731
73787
|
// src/source-watcher.ts
|
|
73732
73788
|
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
73733
73789
|
import { statSync as statSync5, watch as watch2 } from "node:fs";
|
|
@@ -82176,7 +82232,7 @@ function createWatchBreaker(deps) {
|
|
|
82176
82232
|
}
|
|
82177
82233
|
|
|
82178
82234
|
// src/engine.ts
|
|
82179
|
-
var DAEMON_VERSION = true ? "2.0.17-dev.
|
|
82235
|
+
var DAEMON_VERSION = true ? "2.0.17-dev.3465" : "2.0.0-alpha.0";
|
|
82180
82236
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
82181
82237
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
82182
82238
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -82327,7 +82383,8 @@ function createWorkspaceEngine(opts) {
|
|
|
82327
82383
|
let watchBreaker = null;
|
|
82328
82384
|
let lastActivityTs = Date.now();
|
|
82329
82385
|
let stopGit = null;
|
|
82330
|
-
let
|
|
82386
|
+
let fsReindex;
|
|
82387
|
+
let stopping = false;
|
|
82331
82388
|
if (!opts.skipWatchers) {
|
|
82332
82389
|
const watchTargets = gitSourceWatchTargets(opts.workspaceRoot);
|
|
82333
82390
|
watcher = createSourceWatcher(watchTargets, {
|
|
@@ -82387,6 +82444,7 @@ function createWorkspaceEngine(opts) {
|
|
|
82387
82444
|
for (const e of identityEvaluations) auditIdentity(t, e);
|
|
82388
82445
|
return r;
|
|
82389
82446
|
} catch (err2) {
|
|
82447
|
+
if (stopping) throw err2;
|
|
82390
82448
|
console.warn(
|
|
82391
82449
|
"[errata] reindex worker unavailable, running inline:",
|
|
82392
82450
|
err2 instanceof Error ? err2.message : err2
|
|
@@ -82403,51 +82461,46 @@ function createWorkspaceEngine(opts) {
|
|
|
82403
82461
|
done();
|
|
82404
82462
|
}
|
|
82405
82463
|
};
|
|
82406
|
-
const dirty = /* @__PURE__ */ new Set();
|
|
82407
82464
|
let gitOpMuteUntil = 0;
|
|
82408
|
-
|
|
82409
|
-
if (
|
|
82410
|
-
|
|
82411
|
-
|
|
82412
|
-
|
|
82413
|
-
|
|
82414
|
-
|
|
82415
|
-
|
|
82416
|
-
|
|
82417
|
-
|
|
82418
|
-
|
|
82419
|
-
|
|
82420
|
-
|
|
82421
|
-
|
|
82422
|
-
|
|
82423
|
-
|
|
82465
|
+
fsReindex = createCoalescedFilePass(REINDEX_DEBOUNCE_MS, async (changed) => {
|
|
82466
|
+
if (stopping) return;
|
|
82467
|
+
const t = Date.now();
|
|
82468
|
+
const relChanged = changed.map((p) => relative6(opts.workspaceRoot, p).split(sep4).join("/"));
|
|
82469
|
+
const causal = causalBuffer.correlate(relChanged, t) ?? void 0;
|
|
82470
|
+
await runReindexPass(
|
|
82471
|
+
`fs-reindex:${profile.name} (${changed.length} files)`,
|
|
82472
|
+
changed,
|
|
82473
|
+
t,
|
|
82474
|
+
causal?.declaredRenames
|
|
82475
|
+
).then((r) => {
|
|
82476
|
+
if (stopping) return;
|
|
82477
|
+
if (r.filesReindexed > 0) {
|
|
82478
|
+
console.log(
|
|
82479
|
+
`[errata] incremental reindex: ${r.filesReindexed} file(s), +${r.nodesEmitted} nodes / +${r.edgesEmitted} edges`
|
|
82480
|
+
);
|
|
82481
|
+
if (r.continuations.length > 0) {
|
|
82424
82482
|
console.log(
|
|
82425
|
-
`[errata]
|
|
82483
|
+
`[errata] identity: ${r.continuations.map((c) => `${c.kind}(${c.confidence.toFixed(2)})`).join(", ")}`
|
|
82426
82484
|
);
|
|
82427
|
-
if (r.continuations.length > 0) {
|
|
82428
|
-
console.log(
|
|
82429
|
-
`[errata] identity: ${r.continuations.map((c) => `${c.kind}(${c.confidence.toFixed(2)})`).join(", ")}`
|
|
82430
|
-
);
|
|
82431
|
-
}
|
|
82432
|
-
const epId = recordEpisode(store, profile.id, t, r.delta, causal);
|
|
82433
|
-
if (epId) {
|
|
82434
|
-
const d = r.delta;
|
|
82435
|
-
console.log(
|
|
82436
|
-
`[errata] ${epId}: +${d.symbolsAdded} ~${d.symbolsChanged} -${d.symbolsRemoved} symbols, +${d.edgesAdded}/-${d.edgesRemoved} edges` + (causal ? ` \xB7 causal[${causal.tool}${causal.intentHints.length ? ":" + causal.intentHints.join(",") : ""}]` : "")
|
|
82437
|
-
);
|
|
82438
|
-
}
|
|
82439
82485
|
}
|
|
82440
|
-
|
|
82441
|
-
|
|
82442
|
-
|
|
82443
|
-
|
|
82444
|
-
|
|
82486
|
+
const epId = recordEpisode(store, profile.id, t, r.delta, causal);
|
|
82487
|
+
if (epId) {
|
|
82488
|
+
const d = r.delta;
|
|
82489
|
+
console.log(
|
|
82490
|
+
`[errata] ${epId}: +${d.symbolsAdded} ~${d.symbolsChanged} -${d.symbolsRemoved} symbols, +${d.edgesAdded}/-${d.edgesRemoved} edges` + (causal ? ` \xB7 causal[${causal.tool}${causal.intentHints.length ? ":" + causal.intentHints.join(",") : ""}]` : "")
|
|
82491
|
+
);
|
|
82492
|
+
}
|
|
82493
|
+
}
|
|
82494
|
+
});
|
|
82495
|
+
}, (err2) => {
|
|
82496
|
+
if (stopping) return;
|
|
82497
|
+
console.warn("[errata] incremental reindex failed:", err2);
|
|
82498
|
+
});
|
|
82445
82499
|
const markDirty = (p) => {
|
|
82446
82500
|
if (Date.now() < gitOpMuteUntil) return;
|
|
82447
82501
|
if (IGNORED_PATH.test(p)) return;
|
|
82448
82502
|
if (!/\.(ts|tsx|js|jsx|mjs|cjs|py)$/i.test(p)) return;
|
|
82449
|
-
|
|
82450
|
-
scheduleFlush();
|
|
82503
|
+
fsReindex.add(p);
|
|
82451
82504
|
};
|
|
82452
82505
|
watcher.on("add", markDirty);
|
|
82453
82506
|
watcher.on("change", markDirty);
|
|
@@ -82455,11 +82508,7 @@ function createWorkspaceEngine(opts) {
|
|
|
82455
82508
|
const handleGitEvent = async (ev) => {
|
|
82456
82509
|
if (ev.kind !== "commit") {
|
|
82457
82510
|
gitOpMuteUntil = Date.now() + GIT_OP_MUTE_MS;
|
|
82458
|
-
|
|
82459
|
-
if (flushTimer) {
|
|
82460
|
-
clearTimeout(flushTimer);
|
|
82461
|
-
flushTimer = null;
|
|
82462
|
-
}
|
|
82511
|
+
fsReindex.clear();
|
|
82463
82512
|
}
|
|
82464
82513
|
if (!ev.oldSha || !ev.newSha || ev.oldSha === ev.newSha) return;
|
|
82465
82514
|
const t = Date.now();
|
|
@@ -84805,6 +84854,8 @@ B: ${b}`,
|
|
|
84805
84854
|
}
|
|
84806
84855
|
},
|
|
84807
84856
|
async stop() {
|
|
84857
|
+
stopping = true;
|
|
84858
|
+
fsReindex?.stop();
|
|
84808
84859
|
clearInterval(fileActivityTimer);
|
|
84809
84860
|
fileActivity.stop();
|
|
84810
84861
|
if (stopGit) stopGit();
|
|
@@ -84814,7 +84865,6 @@ B: ${b}`,
|
|
|
84814
84865
|
await watcher.close();
|
|
84815
84866
|
noteWatcherClosed();
|
|
84816
84867
|
}
|
|
84817
|
-
if (flushTimer) clearTimeout(flushTimer);
|
|
84818
84868
|
for (const tmr of diagTimers.values()) clearTimeout(tmr);
|
|
84819
84869
|
diagTimers.clear();
|
|
84820
84870
|
if (ctxRefreshTimer) clearTimeout(ctxRefreshTimer);
|
|
@@ -84925,8 +84975,8 @@ init_profile2();
|
|
|
84925
84975
|
// src/project-link.ts
|
|
84926
84976
|
init_profile2();
|
|
84927
84977
|
import { execFile as execFile3 } from "node:child_process";
|
|
84928
|
-
import { promisify } from "node:util";
|
|
84929
|
-
var execFileAsync =
|
|
84978
|
+
import { promisify as promisify2 } from "node:util";
|
|
84979
|
+
var execFileAsync = promisify2(execFile3);
|
|
84930
84980
|
function isClaimedElsewhere(err2) {
|
|
84931
84981
|
if (!err2 || typeof err2 !== "object") return false;
|
|
84932
84982
|
const e = err2;
|
|
@@ -85095,6 +85145,18 @@ function instanceEdgeReceipts(sent, received, cloudIds) {
|
|
|
85095
85145
|
).map(([group]) => group));
|
|
85096
85146
|
return { complete: (source, kind) => complete.has(groupKey(source, kind)) };
|
|
85097
85147
|
}
|
|
85148
|
+
function instanceCloudWithdrawal(n, destination, getMeta) {
|
|
85149
|
+
const id = n.attrs["source"] === "cloud" ? n.attrs["cloudNodeId"] ?? n.id : instanceReceipt(n, destination)["cloudNodeId"];
|
|
85150
|
+
if (typeof id !== "string") return false;
|
|
85151
|
+
const raw2 = getMeta(`history-correction:${id}`);
|
|
85152
|
+
if (!raw2) return false;
|
|
85153
|
+
try {
|
|
85154
|
+
const correction = JSON.parse(raw2);
|
|
85155
|
+
return correction.nodeId === id && correction.action === "quarantine" && correction.sourceSupport !== "supported";
|
|
85156
|
+
} catch {
|
|
85157
|
+
return false;
|
|
85158
|
+
}
|
|
85159
|
+
}
|
|
85098
85160
|
var FIELDS = ["contributedAtSeq", "cloudNodeId", "anchorsContributedDigest", "projectAnchorsContributedDigest", "semanticEdgesContributedDigest", "shipRefusedSinceSeq", "shipRefusedCount", "shipRefusedReason", "shipRefusedFingerprint"];
|
|
85099
85161
|
function instanceDestinationKey(input) {
|
|
85100
85162
|
return createHash18("sha256").update(JSON.stringify([
|
|
@@ -85139,7 +85201,6 @@ function acceptedInstanceReceipt(current, sent, decision, destination, mirrorLeg
|
|
|
85139
85201
|
}
|
|
85140
85202
|
|
|
85141
85203
|
// src/multi.ts
|
|
85142
|
-
init_src();
|
|
85143
85204
|
init_dist();
|
|
85144
85205
|
init_src5();
|
|
85145
85206
|
import { existsSync as existsSync34, readFileSync as readFileSync36, unlinkSync as unlinkSync5, writeFileSync as writeFileSync26 } from "node:fs";
|
|
@@ -85546,7 +85607,7 @@ function compositionCounters(c) {
|
|
|
85546
85607
|
}
|
|
85547
85608
|
function contributedWireId(n, destinationKey) {
|
|
85548
85609
|
const cloudId = instanceReceipt(n, destinationKey)["cloudNodeId"];
|
|
85549
|
-
return
|
|
85610
|
+
return typeof cloudId === "string" && cloudId ? cloudId : n.id;
|
|
85550
85611
|
}
|
|
85551
85612
|
var WIRE_CANONICAL_ID_MIN = 6;
|
|
85552
85613
|
var SHIP_TERMINAL_REFUSALS = 3;
|
|
@@ -85554,7 +85615,7 @@ function refusalFingerprint(reason, description) {
|
|
|
85554
85615
|
return digest(`${reason}\0${description}`);
|
|
85555
85616
|
}
|
|
85556
85617
|
function isRetryableRefusal(reason) {
|
|
85557
|
-
return /\bretry\b/i.test(reason);
|
|
85618
|
+
return reason === "blocked" || /\bretry\b/i.test(reason);
|
|
85558
85619
|
}
|
|
85559
85620
|
function isTerminallyRefused(n) {
|
|
85560
85621
|
const reason = String(n.attrs["shipRefusedReason"] ?? "");
|
|
@@ -85674,6 +85735,8 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
85674
85735
|
const semanticEndpoints = /* @__PURE__ */ new Map();
|
|
85675
85736
|
const includedByLabel = /* @__PURE__ */ new Map();
|
|
85676
85737
|
const composition = {
|
|
85738
|
+
cloudWithdrawn: 0,
|
|
85739
|
+
withdrawnAnchorTargets: 0,
|
|
85677
85740
|
privateTargetMissing: 0,
|
|
85678
85741
|
candidates: 0,
|
|
85679
85742
|
shipped: 0,
|
|
@@ -85742,6 +85805,10 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
85742
85805
|
composition.ignored++;
|
|
85743
85806
|
continue;
|
|
85744
85807
|
}
|
|
85808
|
+
if (instanceCloudWithdrawal(n, opts.destinationKey, (key) => store.getMeta?.(key) ?? opts.sharedStore?.getMeta?.(key))) {
|
|
85809
|
+
composition.cloudWithdrawn++;
|
|
85810
|
+
continue;
|
|
85811
|
+
}
|
|
85745
85812
|
const contributedAtSeq = instanceReceipt(n, opts.destinationKey)["contributedAtSeq"];
|
|
85746
85813
|
if (typeof contributedAtSeq === "number" && (n.lastReinforcedAtSeq ?? 0) <= contributedAtSeq) {
|
|
85747
85814
|
composition.watermarked++;
|
|
@@ -85790,6 +85857,10 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
85790
85857
|
for (const e of store.outEdges(sourceId, [...ANCHOR_EDGES])) {
|
|
85791
85858
|
const t = nodeOf(e.to);
|
|
85792
85859
|
if (!t || !ANCHOR_TARGET_LABELS.includes(t.label)) continue;
|
|
85860
|
+
if (instanceCloudWithdrawal(t, opts.destinationKey, (key) => store.getMeta?.(key) ?? opts.sharedStore?.getMeta?.(key))) {
|
|
85861
|
+
composition.withdrawnAnchorTargets++;
|
|
85862
|
+
continue;
|
|
85863
|
+
}
|
|
85793
85864
|
if (e.type === "OCCURS_IN" && t.label !== "Language") continue;
|
|
85794
85865
|
if (e.type === "DEPENDS_ON" && t.label !== "Package") continue;
|
|
85795
85866
|
if (e.type === "PERTAIN_TO" && t.label !== "Domain") continue;
|
|
@@ -86921,10 +86992,10 @@ async function hydrateProject(opts) {
|
|
|
86921
86992
|
init_src11();
|
|
86922
86993
|
init_src();
|
|
86923
86994
|
import { execFile as execFile4 } from "node:child_process";
|
|
86924
|
-
import { promisify as
|
|
86995
|
+
import { promisify as promisify3 } from "node:util";
|
|
86925
86996
|
import { extname as extname3 } from "node:path";
|
|
86926
86997
|
init_profile2();
|
|
86927
|
-
var exec =
|
|
86998
|
+
var exec = promisify3(execFile4);
|
|
86928
86999
|
var KINDS = { function: "Function", class: "Class", method: "Method", interface: "Interface", const: "Const", enum: "Enum", typealias: "TypeAlias", namespace: "Namespace", property: "Property" };
|
|
86929
87000
|
var inFlight = /* @__PURE__ */ new Map();
|
|
86930
87001
|
async function syncHistoryRevision(opts) {
|
|
@@ -87044,7 +87115,7 @@ init_src();
|
|
|
87044
87115
|
import { execFile as execFile5 } from "node:child_process";
|
|
87045
87116
|
import { readFileSync as readFileSync35 } from "node:fs";
|
|
87046
87117
|
import { join as join39 } from "node:path";
|
|
87047
|
-
import { promisify as
|
|
87118
|
+
import { promisify as promisify4 } from "node:util";
|
|
87048
87119
|
|
|
87049
87120
|
// src/history-walk.ts
|
|
87050
87121
|
var LOCKFILE_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -87578,11 +87649,12 @@ async function historicalAnchors(input) {
|
|
|
87578
87649
|
|
|
87579
87650
|
// src/project-history.ts
|
|
87580
87651
|
init_profile2();
|
|
87581
|
-
var execFileAsync2 =
|
|
87652
|
+
var execFileAsync2 = promisify4(execFile5);
|
|
87582
87653
|
var HISTORY_EXTRACTOR_VERSION = "history-2";
|
|
87583
87654
|
var LEASE_POLL_MS = 2e4;
|
|
87584
87655
|
var RECOVERY_DEADLINE_MS = 15 * 6e4;
|
|
87585
87656
|
var DEFAULT_LOOKAHEAD = 2;
|
|
87657
|
+
var CONTENT_TRANSPORT_VERSION = 1;
|
|
87586
87658
|
async function defaultGit(root, args2) {
|
|
87587
87659
|
const { stdout } = await execFileAsync2("git", ["-C", root, ...args2], { maxBuffer: 64 * 1024 * 1024, windowsHide: true });
|
|
87588
87660
|
return stdout;
|
|
@@ -87725,8 +87797,13 @@ async function walk10(root, input, client, opts, readBlob) {
|
|
|
87725
87797
|
const dryRun = !consents.contributeHistory;
|
|
87726
87798
|
const headSha = (await git3(root, ["rev-parse", "HEAD"])).trim();
|
|
87727
87799
|
const since = profile.historyStage?.watermarkSha ?? null;
|
|
87728
|
-
const
|
|
87729
|
-
const
|
|
87800
|
+
const enumerate = opts.enumerate ?? enumerateUnits;
|
|
87801
|
+
const pendingUnits = await enumerate(root, since ? { since } : {});
|
|
87802
|
+
const unitKey = (u) => `${u.sha}/${u.subIndex}`;
|
|
87803
|
+
const recoveryKeys = new Set(dryRun ? [] : (profile.historyStage?.coverageGaps ?? []).filter((g) => g.reason === "edge-blocked" && (g.transportVersion ?? 0) < CONTENT_TRANSPORT_VERSION).map(unitKey));
|
|
87804
|
+
const oldUnits = recoveryKeys.size ? (await enumerate(root)).filter((u) => recoveryKeys.has(unitKey(u))) : [];
|
|
87805
|
+
const units = [...oldUnits, ...pendingUnits.filter((u) => !oldUnits.some((old) => unitKey(old) === unitKey(u)))];
|
|
87806
|
+
const total = (profile.historyStage?.unitsDone ?? 0) + pendingUnits.filter((u) => !recoveryKeys.has(unitKey(u))).length;
|
|
87730
87807
|
const anchor = profile.historyStage?.backfillAnchor ? { ...profile.historyStage.backfillAnchor } : { index: Number((await git3(root, ["rev-list", "--first-parent", "--count", headSha])).trim()) - 1 };
|
|
87731
87808
|
profile = stage(profile, { state: "scanning", unitsTotal: total, headSha, lastError: void 0, backfillAnchor: anchor }, now);
|
|
87732
87809
|
persist(profile);
|
|
@@ -87760,7 +87837,7 @@ async function walk10(root, input, client, opts, readBlob) {
|
|
|
87760
87837
|
const launched = /* @__PURE__ */ new Map();
|
|
87761
87838
|
const cap = opts.maxUnits;
|
|
87762
87839
|
const edgeParked = /* @__PURE__ */ new Set();
|
|
87763
|
-
const parkedEarlier = new Set((profile.historyStage?.coverageGaps ?? []).filter((g) => g.reason === "edge-blocked"
|
|
87840
|
+
const parkedEarlier = new Set((profile.historyStage?.coverageGaps ?? []).filter((g) => g.reason === "edge-blocked" && !recoveryKeys.has(unitKey(g))).map(unitKey));
|
|
87764
87841
|
units.forEach((u, j) => {
|
|
87765
87842
|
if (parkedEarlier.has(`${u.sha}/${u.subIndex}`)) edgeParked.add(j);
|
|
87766
87843
|
});
|
|
@@ -87838,12 +87915,14 @@ async function walk10(root, input, client, opts, readBlob) {
|
|
|
87838
87915
|
const u = units[k];
|
|
87839
87916
|
if (cap !== void 0 && processed >= cap) break;
|
|
87840
87917
|
const label = `${u.sha.slice(0, 12)}${u.subIndex ? `/${u.subIndex}` : ""}`;
|
|
87841
|
-
const
|
|
87918
|
+
const recovering = recoveryKeys.has(unitKey(u));
|
|
87919
|
+
const walkIncrement = recovering ? 0 : 1;
|
|
87920
|
+
const doneSoFar = (profile.historyStage?.unitsDone ?? 0) + walkIncrement;
|
|
87842
87921
|
const group = byIndex.get(u.index) ?? [u];
|
|
87843
87922
|
const positionSha = u.groupSha ?? u.sha;
|
|
87844
|
-
const lastInPosition = group[group.length - 1] === u;
|
|
87923
|
+
const lastInPosition = !recovering && group[group.length - 1] === u;
|
|
87845
87924
|
if (u.skip) {
|
|
87846
|
-
counts = addCounts(counts, { commitsWalked:
|
|
87925
|
+
counts = addCounts(counts, { commitsWalked: walkIncrement });
|
|
87847
87926
|
profile = stage(profile, { state: dryRun ? "extracting" : "contributing", unitsDone: doneSoFar, counts, ...lastInPosition ? { watermarkSha: positionSha } : {} }, now);
|
|
87848
87927
|
persist(profile);
|
|
87849
87928
|
processed += 1;
|
|
@@ -87858,7 +87937,7 @@ async function walk10(root, input, client, opts, readBlob) {
|
|
|
87858
87937
|
continue;
|
|
87859
87938
|
}
|
|
87860
87939
|
const { body: body2, prepMs } = await prepare(k);
|
|
87861
|
-
profile = stage(profile, { state: dryRun ? "extracting" : "contributing", unitsDone: doneSoFar -
|
|
87940
|
+
profile = stage(profile, { state: dryRun ? "extracting" : "contributing", unitsDone: doneSoFar - walkIncrement, lastError: void 0 }, now);
|
|
87862
87941
|
persist(profile);
|
|
87863
87942
|
response = await reportHistoryStage(client, profile, log);
|
|
87864
87943
|
if (response?.stopRequested) {
|
|
@@ -87936,8 +88015,10 @@ async function walk10(root, input, client, opts, readBlob) {
|
|
|
87936
88015
|
const runId = `edge-blocked:${u.sha}/${u.subIndex}`;
|
|
87937
88016
|
const gaps = [...profile.historyStage?.coverageGaps ?? []];
|
|
87938
88017
|
const known = gaps.some((g) => g.runId === runId);
|
|
87939
|
-
counts = addCounts(counts, { commitsWalked:
|
|
87940
|
-
|
|
88018
|
+
counts = addCounts(counts, { commitsWalked: walkIncrement, deferredUnits: known ? 0 : 1 });
|
|
88019
|
+
const gap = { sha: u.sha, subIndex: u.subIndex, runId, reason: "edge-blocked", transportVersion: CONTENT_TRANSPORT_VERSION };
|
|
88020
|
+
if (!known) gaps.push(gap);
|
|
88021
|
+
else gaps[gaps.findIndex((g) => g.runId === runId)] = gap;
|
|
87941
88022
|
profile = stage(profile, { coverageGaps: gaps.slice(-1e3), unitsDone: doneSoFar, counts, ...lastInPosition ? { watermarkSha: positionSha } : {} }, now);
|
|
87942
88023
|
persist(profile);
|
|
87943
88024
|
processed += 1;
|
|
@@ -87954,18 +88035,18 @@ async function walk10(root, input, client, opts, readBlob) {
|
|
|
87954
88035
|
return { profile, processed, state: "paused" };
|
|
87955
88036
|
}
|
|
87956
88037
|
const packages = new Set(outcome.result.nodes.filter((n) => n.decision !== "rejected" && n.canonicalId.startsWith("pkg:")).map((n) => n.canonicalId)).size;
|
|
87957
|
-
counts = addCounts(counts, { commitsWalked:
|
|
88038
|
+
counts = addCounts(counts, { commitsWalked: walkIncrement, changesExtracted: 1, pairs: outcome.receipt.keptPairs, claims: outcome.receipt.claims, anchors: outcome.receipt.anchors, packages });
|
|
87958
88039
|
log(`[errata] history ${label}: ${outcome.result.nodes.length} nodes, ${outcome.result.edges.length} edges (${outcome.receipt.keptPairs} pairs, ${outcome.receipt.claims} claims)${unitDecisions(outcome.receipt)}${unitTiming(started2, prepMs, outcome.receipt)}`);
|
|
87959
88040
|
break;
|
|
87960
88041
|
}
|
|
87961
88042
|
case "replayed": {
|
|
87962
|
-
counts = addCounts(counts, { commitsWalked:
|
|
88043
|
+
counts = addCounts(counts, { commitsWalked: walkIncrement, changesExtracted: 1, pairs: outcome.receipt.keptPairs, claims: outcome.receipt.claims, anchors: outcome.receipt.anchors });
|
|
87963
88044
|
log(`[errata] history ${label}: replayed (${outcome.result.nodes.length} nodes already in)`);
|
|
87964
88045
|
break;
|
|
87965
88046
|
}
|
|
87966
88047
|
case "empty":
|
|
87967
88048
|
case "dry-run":
|
|
87968
|
-
counts = addCounts(counts, { commitsWalked:
|
|
88049
|
+
counts = addCounts(counts, { commitsWalked: walkIncrement, changesExtracted: outcome.status === "dry-run" ? 1 : 0, pairs: outcome.receipt.keptPairs, claims: outcome.receipt.claims });
|
|
87969
88050
|
log(`[errata] history ${label}: ${outcome.status} (${outcome.receipt.keptPairs} pairs, dropped ${outcome.receipt.droppedByEvidence} by evidence, ${outcome.receipt.droppedByAnchor} by anchor)${unitDecisions(outcome.receipt)}${unitTiming(started2, prepMs, outcome.receipt)}`);
|
|
87970
88051
|
break;
|
|
87971
88052
|
case "refused":
|
|
@@ -87977,8 +88058,10 @@ async function walk10(root, input, client, opts, readBlob) {
|
|
|
87977
88058
|
case "error":
|
|
87978
88059
|
if (outcome.status === "error" && outcome.parked && outcome.runId && ["deferred-context", "deferred-budget"].includes(outcome.errorCode ?? "")) {
|
|
87979
88060
|
const gaps = [...profile.historyStage?.coverageGaps ?? []];
|
|
88061
|
+
const recoveredGap = recovering ? gaps.findIndex((g) => g.reason === "edge-blocked" && unitKey(g) === unitKey(u)) : -1;
|
|
88062
|
+
if (recoveredGap >= 0) gaps.splice(recoveredGap, 1);
|
|
87980
88063
|
const known = gaps.some((g) => g.runId === outcome.runId);
|
|
87981
|
-
counts = addCounts(counts, { commitsWalked:
|
|
88064
|
+
counts = addCounts(counts, { commitsWalked: walkIncrement, deferredUnits: known || recoveredGap >= 0 ? 0 : 1 });
|
|
87982
88065
|
if (!known) gaps.push({ sha: u.sha, subIndex: u.subIndex, runId: outcome.runId, reason: outcome.errorCode });
|
|
87983
88066
|
profile = stage(profile, { coverageGaps: gaps.slice(-1e3) }, now);
|
|
87984
88067
|
log(`[errata] history ${label}: deferred (${outcome.errorCode}); coverage gap retained as ${outcome.runId}`);
|
|
@@ -87989,6 +88072,12 @@ async function walk10(root, input, client, opts, readBlob) {
|
|
|
87989
88072
|
await reportHistoryStage(client, profile, log);
|
|
87990
88073
|
return { profile, processed, state: "paused" };
|
|
87991
88074
|
}
|
|
88075
|
+
if (recovering && ["completed", "replayed", "empty"].includes(outcome.status)) {
|
|
88076
|
+
const gaps = (profile.historyStage?.coverageGaps ?? []).filter((g) => !(g.reason === "edge-blocked" && unitKey(g) === unitKey(u)));
|
|
88077
|
+
counts.deferredUnits = Math.max(0, (counts.deferredUnits ?? 0) - 1);
|
|
88078
|
+
profile = stage(profile, { coverageGaps: gaps }, now);
|
|
88079
|
+
log(`[errata] history ${label}: recovered retained edge-blocked source`);
|
|
88080
|
+
}
|
|
87992
88081
|
profile = stage(profile, { unitsDone: doneSoFar, counts, ...lastInPosition ? { watermarkSha: positionSha } : {} }, now);
|
|
87993
88082
|
persist(profile);
|
|
87994
88083
|
processed += 1;
|
|
@@ -90403,7 +90492,7 @@ async function startMultiDaemon(opts = {}) {
|
|
|
90403
90492
|
const rejectedEdges = res.result.edges.filter((re) => re.decision === "rejected");
|
|
90404
90493
|
const cloudIds = /* @__PURE__ */ new Map();
|
|
90405
90494
|
for (const node2 of res.result.nodes) {
|
|
90406
|
-
if (
|
|
90495
|
+
if (node2.nodeId && node2.decision !== "rejected") cloudIds.set(node2.canonicalId, node2.nodeId);
|
|
90407
90496
|
}
|
|
90408
90497
|
for (const localId of /* @__PURE__ */ new Set([
|
|
90409
90498
|
...Object.keys(instances.anchorDigests),
|
|
@@ -90412,7 +90501,7 @@ async function startMultiDaemon(opts = {}) {
|
|
|
90412
90501
|
])) {
|
|
90413
90502
|
const owner = owningStore(localId);
|
|
90414
90503
|
const cloudId = owner && instanceReceipt(owner.n, destinationKey)["cloudNodeId"];
|
|
90415
|
-
if (
|
|
90504
|
+
if (typeof cloudId === "string" && cloudId) cloudIds.set(localId, cloudId);
|
|
90416
90505
|
}
|
|
90417
90506
|
const edgeReceipts = instanceEdgeReceipts(instances.edges, res.result.edges, cloudIds);
|
|
90418
90507
|
if (rejectedEdges.length > 0) {
|
|
@@ -90454,7 +90543,7 @@ async function startMultiDaemon(opts = {}) {
|
|
|
90454
90543
|
nowHeld.push({ id, reason });
|
|
90455
90544
|
}
|
|
90456
90545
|
};
|
|
90457
|
-
for (const id of blocked) noteRefused(id, "blocked", () => blockedRepeat++);
|
|
90546
|
+
for (const id of blocked) noteRefused(id, "blocked-gzip", () => blockedRepeat++);
|
|
90458
90547
|
for (const [id, why] of rejected) noteRefused(id, why, () => rejectedRepeat++);
|
|
90459
90548
|
if (nowHeld.length > 0) {
|
|
90460
90549
|
console.warn(
|