@inerrata-corporation/errata 2.0.17-dev.3549 → 2.0.17-dev.3564

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.
@@ -16611,6 +16611,7 @@ function rowToEdge(r) {
16611
16611
  };
16612
16612
  }
16613
16613
  var FINGERPRINT_INDEXED_LABELS = ["Problem", "Vulnerability", "Solution", "RootCause"];
16614
+ var NODE_LABELS_CHUNK = 256;
16614
16615
  var SqliteGraphStore = class {
16615
16616
  db;
16616
16617
  // Typed edge lookups build their SQL from the number of types asked for, and
@@ -17113,6 +17114,19 @@ var SqliteGraphStore = class {
17113
17114
  const row = this.stmts.getNode.get(id);
17114
17115
  return row ? rowToNode(row) : null;
17115
17116
  }
17117
+ nodeLabels(ids) {
17118
+ const width = NODE_LABELS_CHUNK;
17119
+ const stmt = this.typedEdgeStmt(
17120
+ `SELECT id, label FROM nodes WHERE id IN (${Array.from({ length: width }, () => "?").join(",")})`
17121
+ );
17122
+ const labels = /* @__PURE__ */ new Map();
17123
+ for (let i = 0; i < ids.length; i += width) {
17124
+ const chunk = ids.slice(i, i + width);
17125
+ while (chunk.length < width) chunk.push(null);
17126
+ for (const row of stmt.all(...chunk)) labels.set(row.id, row.label);
17127
+ }
17128
+ return labels;
17129
+ }
17116
17130
  getEdge(id) {
17117
17131
  const row = this.stmts.getEdge.get(id);
17118
17132
  return row ? rowToEdge(row) : null;
package/errata.mjs CHANGED
@@ -18445,7 +18445,7 @@ function rowToEdge(r) {
18445
18445
  function openGraphStore(opts) {
18446
18446
  return new SqliteGraphStore(opts);
18447
18447
  }
18448
- var LOCAL_RULE_OVERRIDES, SCHEMA_VERSION, SESSION_REPAIR_KEY, SESSION_EVIDENCE_PREDICATE, SCHEMA_SQL, TEMPORAL_INDEX_SQL, FINGERPRINT_INDEXED_LABELS, SqliteGraphStore;
18448
+ var LOCAL_RULE_OVERRIDES, SCHEMA_VERSION, SESSION_REPAIR_KEY, SESSION_EVIDENCE_PREDICATE, SCHEMA_SQL, TEMPORAL_INDEX_SQL, FINGERPRINT_INDEXED_LABELS, NODE_LABELS_CHUNK, SqliteGraphStore;
18449
18449
  var init_store = __esm({
18450
18450
  "../../packages/local-graph/src/store.ts"() {
18451
18451
  "use strict";
@@ -18596,6 +18596,7 @@ CREATE INDEX IF NOT EXISTS nodes_live_description ON nodes(description, label) W
18596
18596
  CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_json, '$.anchorHint.path')) WHERE valid_to IS NULL;
18597
18597
  `;
18598
18598
  FINGERPRINT_INDEXED_LABELS = ["Problem", "Vulnerability", "Solution", "RootCause"];
18599
+ NODE_LABELS_CHUNK = 256;
18599
18600
  SqliteGraphStore = class {
18600
18601
  db;
18601
18602
  // Typed edge lookups build their SQL from the number of types asked for, and
@@ -19098,6 +19099,19 @@ CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_js
19098
19099
  const row = this.stmts.getNode.get(id);
19099
19100
  return row ? rowToNode(row) : null;
19100
19101
  }
19102
+ nodeLabels(ids) {
19103
+ const width = NODE_LABELS_CHUNK;
19104
+ const stmt = this.typedEdgeStmt(
19105
+ `SELECT id, label FROM nodes WHERE id IN (${Array.from({ length: width }, () => "?").join(",")})`
19106
+ );
19107
+ const labels = /* @__PURE__ */ new Map();
19108
+ for (let i2 = 0; i2 < ids.length; i2 += width) {
19109
+ const chunk = ids.slice(i2, i2 + width);
19110
+ while (chunk.length < width) chunk.push(null);
19111
+ for (const row of stmt.all(...chunk)) labels.set(row.id, row.label);
19112
+ }
19113
+ return labels;
19114
+ }
19101
19115
  getEdge(id) {
19102
19116
  const row = this.stmts.getEdge.get(id);
19103
19117
  return row ? rowToEdge(row) : null;
@@ -19600,7 +19614,9 @@ function staticConductance(edgeType) {
19600
19614
  return Math.max(UNKNOWN_CONDUCTANCE, Math.min(1, w / MAX_EDGE_WEIGHT));
19601
19615
  }
19602
19616
  function edgeConductance(edge2) {
19603
- const staticW = staticConductance(edge2.type);
19617
+ return learnedConductance(staticConductance(edge2.type), edge2);
19618
+ }
19619
+ function learnedConductance(staticW, edge2) {
19604
19620
  const s = edge2.navSuccesses ?? 0;
19605
19621
  const f = edge2.navFailures ?? 0;
19606
19622
  const betaMean = (1 + s) / (2 + s + f);
@@ -22800,9 +22816,28 @@ var init_uncertainty = __esm({
22800
22816
  });
22801
22817
 
22802
22818
  // ../../packages/math/src/discovery.ts
22819
+ function typeRelevance(label) {
22820
+ return TYPE_RELEVANCE[label] ?? DEFAULT_TYPE_RELEVANCE;
22821
+ }
22822
+ var TYPE_RELEVANCE, DEFAULT_TYPE_RELEVANCE;
22803
22823
  var init_discovery = __esm({
22804
22824
  "../../packages/math/src/discovery.ts"() {
22805
22825
  "use strict";
22826
+ TYPE_RELEVANCE = {
22827
+ Solution: 1,
22828
+ Vulnerability: 0.95,
22829
+ RootCause: 0.9,
22830
+ Pattern: 0.8,
22831
+ Problem: 0.7,
22832
+ Technique: 0.7,
22833
+ AntiPattern: 0.7,
22834
+ Weakness: 0.6,
22835
+ Domain: 0.5,
22836
+ Function: 0.4,
22837
+ Class: 0.4,
22838
+ File: 0.3
22839
+ };
22840
+ DEFAULT_TYPE_RELEVANCE = 0.3;
22806
22841
  }
22807
22842
  });
22808
22843
 
@@ -25340,6 +25375,7 @@ __export(src_exports2, {
25340
25375
  isFragmentFixNote: () => isFragmentFixNote,
25341
25376
  isPlaceholderStatement: () => isPlaceholderStatement,
25342
25377
  isUnfilledPlaceholder: () => isUnfilledPlaceholder,
25378
+ learnedConductance: () => learnedConductance,
25343
25379
  linkProblemToLanguages: () => linkProblemToLanguages,
25344
25380
  linkProblemToPackages: () => linkProblemToPackages,
25345
25381
  linkProblemToSymbols: () => linkProblemToSymbols,
@@ -32175,62 +32211,139 @@ async function rankForText(store, text, candidateIds) {
32175
32211
  (r) => r.score > 0
32176
32212
  );
32177
32213
  }
32214
+ function walksRelatedness(type) {
32215
+ if (type === "DEPENDS_ON") return true;
32216
+ if (PAGERANK_EXCLUSIONS.has(type)) return false;
32217
+ return (EDGE_WEIGHT[type] ?? 1) > 0;
32218
+ }
32219
+ function burstStaticConductance(type, seedLabel) {
32220
+ if (type === "ANCHORED_AT") return BURST_ANCHORED_AT_CONDUCTANCE;
32221
+ if (type === "DEPENDS_ON") return seedLabel === "Package" ? staticConductance(type) : BURST_DEPENDS_ON_FLOOR;
32222
+ return staticConductance(type);
32223
+ }
32224
+ function burstConductance(edge2, seedLabel) {
32225
+ return learnedConductance(burstStaticConductance(edge2.type, seedLabel), edge2);
32226
+ }
32178
32227
  function localBurst(store, seedId, opts = {}) {
32179
- const maxHops = opts.maxHops ?? 2;
32228
+ const maxHops = opts.maxHops ?? 3;
32180
32229
  const limit = opts.limit ?? 20;
32181
- const nodeCap = opts.nodeCap ?? 500;
32230
+ const nodeCap = opts.nodeCap ?? 200;
32182
32231
  const seed = store.getNode(seedId);
32183
32232
  if (!seed) return [];
32233
+ const act = /* @__PURE__ */ new Map([[seedId, 1]]);
32184
32234
  const hopOf = /* @__PURE__ */ new Map([[seedId, 0]]);
32185
32235
  const viaOf = /* @__PURE__ */ new Map();
32186
- let frontier = [seedId];
32187
- for (let h = 1; h <= maxHops && hopOf.size < nodeCap; h++) {
32188
- const next = [];
32189
- for (const id of frontier) {
32190
- const neigh = [
32191
- ...store.outEdges(id).map((e) => ({ nb: e.to, via: { edgeType: e.type, parentId: id, forward: true } })),
32192
- ...store.inEdges(id).map((e) => ({ nb: e.from, via: { edgeType: e.type, parentId: id, forward: false } }))
32193
- ];
32194
- for (const { nb, via } of neigh) {
32195
- if (!hopOf.has(nb)) {
32196
- hopOf.set(nb, h);
32197
- viaOf.set(nb, via);
32198
- next.push(nb);
32199
- if (hopOf.size >= nodeCap) break;
32200
- }
32201
- }
32202
- if (hopOf.size >= nodeCap) break;
32203
- }
32204
- frontier = next;
32205
- }
32206
- hopOf.delete(seedId);
32236
+ const expanded = /* @__PURE__ */ new Set();
32237
+ const frontier = new ActivationHeap();
32238
+ frontier.push(seedId, 1);
32239
+ let strongest = 0;
32240
+ while (frontier.size > 0 && expanded.size < nodeCap) {
32241
+ const top = frontier.pop();
32242
+ if (expanded.has(top.id) || top.a < (act.get(top.id) ?? 0)) continue;
32243
+ if (top.a < ACTIVATION_EPSILON || top.a < strongest * BURST_RELATIVE_FLOOR) break;
32244
+ expanded.add(top.id);
32245
+ const hops = hopOf.get(top.id) ?? 0;
32246
+ if (hops >= maxHops) continue;
32247
+ const edges = [
32248
+ ...store.outEdges(top.id).map((e) => ({ e, nb: e.to, forward: true })),
32249
+ ...store.inEdges(top.id).map((e) => ({ e, nb: e.from, forward: false }))
32250
+ ].filter(({ e }) => walksRelatedness(e.type));
32251
+ const damp = BURST_STEP_DAMPING / Math.sqrt(Math.max(1, edges.length));
32252
+ for (const { e, nb, forward } of edges) {
32253
+ if (nb === seedId || expanded.has(nb)) continue;
32254
+ const a = top.a * burstConductance(e, seed.label) * damp;
32255
+ if (a <= (act.get(nb) ?? 0)) continue;
32256
+ act.set(nb, a);
32257
+ if (a > strongest) strongest = a;
32258
+ hopOf.set(nb, hops + 1);
32259
+ viaOf.set(nb, { edgeType: e.type, parentId: top.id, forward });
32260
+ frontier.push(nb, a);
32261
+ }
32262
+ }
32263
+ act.delete(seedId);
32207
32264
  const ctxSeed = seed.embedding.length > 0 ? { seedEmbedding: seed.embedding, seedEmbeddingVersion: seed.attrs["embeddingVersion"] } : {};
32208
32265
  const gated = seed.embedding.length > 0;
32209
- const nodes = [...hopOf.entries()].map(([id, hops]) => ({ node: store.getNode(id), hops })).filter((x) => x.node != null);
32210
- const maxPr = Math.max(1e-9, ...nodes.map((x) => x.node.pageRank));
32266
+ const labelOf = store.nodeLabels([...act.keys()]);
32267
+ const pool = (keep) => [...act.entries()].filter(([id]) => keep(labelOf.get(id) ?? "")).sort((x, y) => y[1] - x[1]).slice(0, BURST_SCORED_CANDIDATES);
32268
+ const isKnowledge = (label) => typeRelevance(label) >= KNOWLEDGE_TYPE_RELEVANCE;
32269
+ const reached = [...pool(isKnowledge), ...pool((l) => !isKnowledge(l))].map(([id, a]) => ({ node: store.getNode(id), a })).filter((x) => x.node != null);
32270
+ const maxPr = Math.max(1e-9, ...reached.map((x) => x.node.pageRank));
32271
+ const maxAct = Math.max(1e-12, ...reached.map((x) => x.a));
32211
32272
  const weights = {
32212
32273
  centralityScale: maxPr,
32213
32274
  ...gated ? { semanticFloor: semanticFloorFor(ctxSeed.seedEmbeddingVersion) } : {},
32214
32275
  ...opts.weights
32215
32276
  };
32216
32277
  const now = store.currentIngestSeq();
32217
- return nodes.map(({ node: node2, hops }) => {
32218
- const r = scoreCandidate(node2, { ...ctxSeed, hops, decay: nodeFreshness(node2, now) }, weights);
32278
+ return reached.map(({ node: node2, a }) => {
32279
+ const r = scoreCandidate(node2, { ...ctxSeed, decay: nodeFreshness(node2, now) }, weights);
32280
+ const score2 = a / maxAct * r.score * typeRelevance(node2.label);
32219
32281
  const via = viaOf.get(node2.id);
32220
- return { id: node2.id, score: r.score, components: r.components, node: node2, hops, ...via ? { via } : {} };
32282
+ return { id: node2.id, score: score2, components: r.components, node: node2, hops: hopOf.get(node2.id) ?? 0, ...via ? { via } : {} };
32221
32283
  }).filter((r) => !gated || r.score > 0).sort((a, b) => b.score - a.score).slice(0, limit);
32222
32284
  }
32285
+ var BURST_STEP_DAMPING, ACTIVATION_EPSILON, BURST_RELATIVE_FLOOR, BURST_SCORED_CANDIDATES, KNOWLEDGE_TYPE_RELEVANCE, BURST_ANCHORED_AT_CONDUCTANCE, BURST_DEPENDS_ON_FLOOR, ActivationHeap;
32223
32286
  var init_relevance_rank = __esm({
32224
32287
  "../../packages/generalizer/src/relevance-rank.ts"() {
32225
32288
  "use strict";
32226
32289
  init_src3();
32227
32290
  init_src4();
32291
+ init_src5();
32292
+ init_src();
32293
+ BURST_STEP_DAMPING = 0.85;
32294
+ ACTIVATION_EPSILON = 1e-6;
32295
+ BURST_RELATIVE_FLOOR = 0.02;
32296
+ BURST_SCORED_CANDIDATES = 150;
32297
+ KNOWLEDGE_TYPE_RELEVANCE = 0.5;
32298
+ BURST_ANCHORED_AT_CONDUCTANCE = 1 / 3;
32299
+ BURST_DEPENDS_ON_FLOOR = 0.1;
32300
+ ActivationHeap = class {
32301
+ items = [];
32302
+ get size() {
32303
+ return this.items.length;
32304
+ }
32305
+ push(id, a) {
32306
+ const items = this.items;
32307
+ items.push({ id, a });
32308
+ let i2 = items.length - 1;
32309
+ while (i2 > 0) {
32310
+ const p = i2 - 1 >> 1;
32311
+ if (items[p].a >= items[i2].a) break;
32312
+ [items[p], items[i2]] = [items[i2], items[p]];
32313
+ i2 = p;
32314
+ }
32315
+ }
32316
+ pop() {
32317
+ const items = this.items;
32318
+ const top = items[0];
32319
+ const last = items.pop();
32320
+ if (items.length > 0 && last) {
32321
+ items[0] = last;
32322
+ let i2 = 0;
32323
+ for (; ; ) {
32324
+ const l = 2 * i2 + 1, r = l + 1;
32325
+ let m = i2;
32326
+ if (l < items.length && items[l].a > items[m].a) m = l;
32327
+ if (r < items.length && items[r].a > items[m].a) m = r;
32328
+ if (m === i2) break;
32329
+ [items[m], items[i2]] = [items[i2], items[m]];
32330
+ i2 = m;
32331
+ }
32332
+ }
32333
+ return top;
32334
+ }
32335
+ };
32228
32336
  }
32229
32337
  });
32230
32338
 
32231
32339
  // ../../packages/generalizer/src/index.ts
32232
32340
  var src_exports3 = {};
32233
32341
  __export(src_exports3, {
32342
+ BURST_ANCHORED_AT_CONDUCTANCE: () => BURST_ANCHORED_AT_CONDUCTANCE,
32343
+ BURST_DEPENDS_ON_FLOOR: () => BURST_DEPENDS_ON_FLOOR,
32344
+ BURST_RELATIVE_FLOOR: () => BURST_RELATIVE_FLOOR,
32345
+ BURST_SCORED_CANDIDATES: () => BURST_SCORED_CANDIDATES,
32346
+ BURST_STEP_DAMPING: () => BURST_STEP_DAMPING,
32234
32347
  FULL_RESCORE_EVERY: () => FULL_RESCORE_EVERY,
32235
32348
  INCREMENTAL_REGION_MAX_FRACTION: () => INCREMENTAL_REGION_MAX_FRACTION,
32236
32349
  anchorByLine: () => anchorByLine,
@@ -32240,6 +32353,8 @@ __export(src_exports3, {
32240
32353
  attributeRootCause: () => attributeRootCause,
32241
32354
  bindCanonicalNeighbors: () => bindCanonicalNeighbors,
32242
32355
  bindResolvedRegressions: () => bindResolvedRegressions,
32356
+ burstConductance: () => burstConductance,
32357
+ burstStaticConductance: () => burstStaticConductance,
32243
32358
  closeProblem: () => closeProblem,
32244
32359
  codeAnchorProjection: () => codeAnchorProjection,
32245
32360
  commandSignature: () => commandSignature,
@@ -32921,6 +33036,7 @@ var init_consent = __esm({
32921
33036
  });
32922
33037
 
32923
33038
  // src/git-remote.ts
33039
+ import { spawnSync } from "node:child_process";
32924
33040
  import { existsSync as existsSync10, readFileSync as readFileSync8, statSync } from "node:fs";
32925
33041
  import { isAbsolute as isAbsolute2, join as join8, resolve as resolve2 } from "node:path";
32926
33042
  function resolveGitDir(root) {
@@ -32968,12 +33084,41 @@ function detectRepoLocator(root, remote) {
32968
33084
  const remotes = readRemotes(root);
32969
33085
  if (remotes.length === 0) return null;
32970
33086
  const pick2 = remote ? remotes.find((r) => r.name === remote) ?? null : remotes.find((r) => r.name === "origin") ?? (remotes.length === 1 ? remotes[0] : null);
32971
- return pick2 ? normalizeRepoLocator(pick2.url) : null;
33087
+ return pick2 ? normalizeRepoLocator(resolveSshHostAlias(pick2.url)) : null;
33088
+ }
33089
+ function sshConfigHostname(alias) {
33090
+ if (resolvedAliases.has(alias)) return resolvedAliases.get(alias);
33091
+ let host = null;
33092
+ try {
33093
+ const out2 = spawnSync("ssh", ["-G", alias], { encoding: "utf8", timeout: 3e3, windowsHide: true });
33094
+ if (out2.status === 0) host = /^hostname\s+(\S+)\s*$/im.exec(out2.stdout)?.[1]?.toLowerCase() ?? null;
33095
+ } catch {
33096
+ host = null;
33097
+ }
33098
+ resolvedAliases.set(alias, host);
33099
+ return host;
32972
33100
  }
33101
+ function resolveSshHostAlias(remoteUrl, resolveHost = sshConfigHostname) {
33102
+ const raw2 = remoteUrl.trim();
33103
+ const m = SSH_URL_REMOTE.exec(raw2) ?? (/^[a-z][a-z0-9+.-]*:\/\//i.test(raw2) ? null : SSH_SCP_REMOTE.exec(raw2));
33104
+ if (!m) return raw2;
33105
+ const prefix = m[1];
33106
+ const alias = m[2];
33107
+ const rest2 = m[3];
33108
+ if (alias.length === 1 || CANONICAL_FORGE_HOSTS.has(alias.toLowerCase())) return raw2;
33109
+ const real = resolveHost(alias);
33110
+ if (!real || real === alias.toLowerCase()) return raw2;
33111
+ return SSH_URL_REMOTE.test(raw2) ? `${prefix}${real}${rest2}` : `${prefix}${real}:${rest2}`;
33112
+ }
33113
+ var CANONICAL_FORGE_HOSTS, SSH_SCP_REMOTE, SSH_URL_REMOTE, resolvedAliases;
32973
33114
  var init_git_remote = __esm({
32974
33115
  "src/git-remote.ts"() {
32975
33116
  "use strict";
32976
33117
  init_src();
33118
+ CANONICAL_FORGE_HOSTS = /* @__PURE__ */ new Set(["github.com", "gitlab.com", "bitbucket.org", "codeberg.org"]);
33119
+ SSH_SCP_REMOTE = /^((?:[^@/]+@)?)([^:/@]+):(?!\/\/)(.+)$/;
33120
+ SSH_URL_REMOTE = /^(ssh:\/\/(?:[^@/]+@)?)([^:/@]+)((?::\d+)?\/.*)$/i;
33121
+ resolvedAliases = /* @__PURE__ */ new Map();
32977
33122
  }
32978
33123
  });
32979
33124
 
@@ -82519,7 +82664,7 @@ function createWatchBreaker(deps) {
82519
82664
  }
82520
82665
 
82521
82666
  // src/engine.ts
82522
- var DAEMON_VERSION = true ? "2.0.17-dev.3549" : "2.0.0-alpha.0";
82667
+ var DAEMON_VERSION = true ? "2.0.17-dev.3564" : "2.0.0-alpha.0";
82523
82668
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
82524
82669
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
82525
82670
  var GIT_OP_MUTE_MS = 4e3;
@@ -91723,7 +91868,7 @@ function shouldUseOAuthLogin(flags2, env2 = process.env) {
91723
91868
  }
91724
91869
 
91725
91870
  // src/doctor.ts
91726
- import { spawnSync } from "node:child_process";
91871
+ import { spawnSync as spawnSync2 } from "node:child_process";
91727
91872
 
91728
91873
  // src/codex-runtime.ts
91729
91874
  import { readdirSync as readdirSync12, statSync as statSync9 } from "node:fs";
@@ -91758,7 +91903,7 @@ function resolveCodexExecutable(options = {}) {
91758
91903
  // src/doctor.ts
91759
91904
  function installedHarnessVersion(bin) {
91760
91905
  try {
91761
- const r = spawnSync(bin === "codex" ? resolveCodexExecutable() : bin, ["--version"], { encoding: "utf8", timeout: 3e3, windowsHide: true });
91906
+ const r = spawnSync2(bin === "codex" ? resolveCodexExecutable() : bin, ["--version"], { encoding: "utf8", timeout: 3e3, windowsHide: true });
91762
91907
  if (r.status !== 0 && !r.stdout) return null;
91763
91908
  const m = /(\d+\.\d+\.\d+)/.exec(`${r.stdout ?? ""}${r.stderr ?? ""}`);
91764
91909
  return m ? m[1] : null;
@@ -92876,8 +93021,9 @@ async function cmdInit() {
92876
93021
  console.log("");
92877
93022
  console.log("Privacy: your code, file contents, and raw error text never leave");
92878
93023
  console.log("this machine \u2014 only scrubbed, canonical lessons can (consent-gated).");
92879
- console.log("Cloud sync + telemetry are OFF in this alpha \u2014 turn them on with:");
92880
- console.log(" errata consent sync on # contribute canonical, scrubbed deltas");
93024
+ console.log("Cloud sync + telemetry are OFF until you choose otherwise:");
93025
+ console.log(" errata link # per repo: pick its project + what it shares, in the Console");
93026
+ console.log(" errata consent sync on # machine default for repos you haven't linked");
92881
93027
  console.log(" errata consent telemetry on # counts-only product metrics");
92882
93028
  console.log("To CONTRIBUTE to the shared graph you must ALSO attest this daemon:");
92883
93029
  console.log(" errata login # console sign-in (OAuth) \u2014 grants graph-write");
@@ -92899,7 +93045,7 @@ async function cmdInit() {
92899
93045
  return;
92900
93046
  }
92901
93047
  console.log("");
92902
- console.log("connecting your cloud account (init links this repo to its project)...");
93048
+ console.log("connecting your cloud account...");
92903
93049
  await cmdLoginOAuth(cfgNow);
92904
93050
  cfgNow = loadConfig();
92905
93051
  if (!hasCloudCredential(cfgNow)) {
@@ -92908,14 +93054,32 @@ async function cmdInit() {
92908
93054
  return;
92909
93055
  }
92910
93056
  }
93057
+ let profileNow = loadProfile(ROOT);
93058
+ if (process.stdout.isTTY && !rest.includes("--no-link") && !rest.includes("--no-login") && profileNow && !profileNow.projectId) {
93059
+ refreshRepoLocator(ROOT, profileNow);
93060
+ if (profileNow.repoLocator) {
93061
+ console.log("");
93062
+ console.log(`linking ${profileNow.repoLocator} to its project (choose org, team and privacy in the Console)...`);
93063
+ await cmdLink(rest.includes("--no-browser") ? ["--no-browser"] : []);
93064
+ if (process.exitCode === 1) {
93065
+ console.log(" (init itself succeeded \u2014 retry the link any time with `errata link`)");
93066
+ process.exitCode = 0;
93067
+ }
93068
+ profileNow = loadProfile(ROOT);
93069
+ }
93070
+ }
92911
93071
  console.log("");
92912
93072
  console.log("Next:");
92913
93073
  console.log(" errata start # observe this repo");
92914
93074
  if (!hasCloudCredential(cfgNow)) {
92915
93075
  console.log(" errata login # connect a cloud account (or: --token <key>)");
92916
93076
  }
92917
- if (!cfgNow.consent.sync) {
92918
- console.log(" errata consent sync on # contribute scrubbed, canonical lessons");
93077
+ if (!profileNow?.projectId) {
93078
+ if (profileNow?.repoLocator) {
93079
+ console.log(" errata link # link this repo to its project (sets its privacy choices)");
93080
+ } else {
93081
+ console.log(" git remote add origin <url> # then: errata link (a project is found by its remote)");
93082
+ }
92919
93083
  }
92920
93084
  console.log(" errata status # verify the whole chain");
92921
93085
  }
@@ -93679,6 +93843,8 @@ async function cmdLink(args2) {
93679
93843
  }
93680
93844
  profile.repoRemote = remote;
93681
93845
  profile.repoLocator = loc;
93846
+ } else {
93847
+ refreshRepoLocator(ROOT, profile);
93682
93848
  }
93683
93849
  if (!wantsLocal) {
93684
93850
  if (!profile.repoLocator) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.17-dev.3549",
3
+ "version": "2.0.17-dev.3564",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -25640,6 +25640,7 @@ function rowToEdge(r) {
25640
25640
  };
25641
25641
  }
25642
25642
  var FINGERPRINT_INDEXED_LABELS = ["Problem", "Vulnerability", "Solution", "RootCause"];
25643
+ var NODE_LABELS_CHUNK = 256;
25643
25644
  var SqliteGraphStore = class {
25644
25645
  db;
25645
25646
  // Typed edge lookups build their SQL from the number of types asked for, and
@@ -26142,6 +26143,19 @@ var SqliteGraphStore = class {
26142
26143
  const row = this.stmts.getNode.get(id);
26143
26144
  return row ? rowToNode(row) : null;
26144
26145
  }
26146
+ nodeLabels(ids) {
26147
+ const width = NODE_LABELS_CHUNK;
26148
+ const stmt = this.typedEdgeStmt(
26149
+ `SELECT id, label FROM nodes WHERE id IN (${Array.from({ length: width }, () => "?").join(",")})`
26150
+ );
26151
+ const labels = /* @__PURE__ */ new Map();
26152
+ for (let i2 = 0; i2 < ids.length; i2 += width) {
26153
+ const chunk = ids.slice(i2, i2 + width);
26154
+ while (chunk.length < width) chunk.push(null);
26155
+ for (const row of stmt.all(...chunk)) labels.set(row.id, row.label);
26156
+ }
26157
+ return labels;
26158
+ }
26145
26159
  getEdge(id) {
26146
26160
  const row = this.stmts.getEdge.get(id);
26147
26161
  return row ? rowToEdge(row) : null;
@@ -28965,6 +28979,10 @@ function codeAnchorProjection(store2, semanticIds, opts = {}) {
28965
28979
  // ../../packages/generalizer/src/embed-code.ts
28966
28980
  init_src();
28967
28981
 
28982
+ // ../../packages/generalizer/src/relevance-rank.ts
28983
+ init_src();
28984
+ var BURST_ANCHORED_AT_CONDUCTANCE = 1 / 3;
28985
+
28968
28986
  // ../../packages/context-writer/src/agents-md.ts
28969
28987
  init_src();
28970
28988