@inerrata-corporation/errata 2.0.6-dev.2029 → 2.0.6-dev.2047

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.
Files changed (2) hide show
  1. package/errata.mjs +71 -42
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -77047,7 +77047,7 @@ function createWatchBreaker(deps) {
77047
77047
  }
77048
77048
 
77049
77049
  // src/engine.ts
77050
- var DAEMON_VERSION = true ? "2.0.6-dev.2029" : "2.0.0-alpha.0";
77050
+ var DAEMON_VERSION = true ? "2.0.6-dev.2047" : "2.0.0-alpha.0";
77051
77051
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
77052
77052
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
77053
77053
  var GIT_OP_MUTE_MS = 4e3;
@@ -80487,42 +80487,12 @@ async function ensureProjectLink(root, profile, client) {
80487
80487
  }
80488
80488
 
80489
80489
  // src/project-hydrate.ts
80490
- var DEFAULT_LIMIT = 50;
80491
- async function hydrateProject(opts) {
80492
- const { root, profile, store, cloud } = opts;
80493
- if (!profile.projectId) return { hydrated: false, reason: "no-project" };
80494
- if (profile.projectHydratedAt) return { hydrated: false, reason: "already-hydrated" };
80495
- try {
80496
- const res = await cloud.getProjectPriors(profile.projectId, opts.limit ?? DEFAULT_LIMIT);
80497
- let landedNodes = 0;
80498
- for (const n of res.nodes) {
80499
- if (store.getNode(n.id)) continue;
80500
- store.mergeNode(n);
80501
- landedNodes++;
80502
- }
80503
- let landedEdges = 0;
80504
- for (const e of res.edges) {
80505
- if (!store.getNode(e.from) || !store.getNode(e.to)) continue;
80506
- if (store.getEdge(e.id)) continue;
80507
- store.mergeEdge(e);
80508
- landedEdges++;
80509
- }
80510
- profile.projectHydratedAt = Date.now();
80511
- saveProfile(root, profile);
80512
- return { hydrated: true, nodes: landedNodes, edges: landedEdges };
80513
- } catch (err2) {
80514
- return {
80515
- hydrated: false,
80516
- reason: "error",
80517
- detail: err2 instanceof Error ? err2.message : String(err2)
80518
- };
80519
- }
80520
- }
80490
+ init_src11();
80521
80491
 
80522
80492
  // src/project-reanchor.ts
80523
80493
  init_src();
80524
80494
  init_src11();
80525
- var DEFAULT_LIMIT2 = 50;
80495
+ var DEFAULT_LIMIT = 50;
80526
80496
  var ANCHOR_SYMBOL_KINDS = [
80527
80497
  "Function",
80528
80498
  "Class",
@@ -80556,6 +80526,10 @@ function buildReverseSymbolMap(opts) {
80556
80526
  }
80557
80527
  return reverse;
80558
80528
  }
80529
+ function anchorConfidence(attrs) {
80530
+ const v = typeof attrs["extractionConfidence"] === "number" ? attrs["extractionConfidence"] : attrs["confidence"];
80531
+ return typeof v === "number" && Number.isFinite(v) ? Math.max(0, Math.min(1, v)) : null;
80532
+ }
80559
80533
  var ANCHOR_SOURCE_KINDS = [
80560
80534
  "Problem",
80561
80535
  "Solution",
@@ -80635,7 +80609,7 @@ async function reanchorProject(opts) {
80635
80609
  const reverse = buildReverseSymbolMap({ store, salt, projectId: profile.projectId });
80636
80610
  if (reverse.size === 0) return { reanchored: false, reason: "no-local-symbols" };
80637
80611
  try {
80638
- const res = await cloud.getProjectPriors(profile.projectId, opts.limit ?? DEFAULT_LIMIT2);
80612
+ const res = await cloud.getProjectPriors(profile.projectId, opts.limit ?? DEFAULT_LIMIT);
80639
80613
  const now = Date.now();
80640
80614
  const own = lazy2(() => buildOwnKnowledgeMap({ store, salt }));
80641
80615
  let anchors = 0;
@@ -80658,7 +80632,7 @@ async function reanchorProject(opts) {
80658
80632
  from,
80659
80633
  to: localTo,
80660
80634
  type: "ANCHORED_AT",
80661
- confidence: typeof a.attrs["confidence"] === "number" ? Math.max(0, Math.min(1, a.attrs["confidence"])) : 0.5,
80635
+ confidence: anchorConfidence(a.attrs) ?? 0.5,
80662
80636
  extractionSource: "agent-observed",
80663
80637
  createdAt: now,
80664
80638
  lastSeenAt: now,
@@ -80739,7 +80713,7 @@ async function syncProjectAnchors(opts) {
80739
80713
  from,
80740
80714
  to: localTo,
80741
80715
  type: "ANCHORED_AT",
80742
- confidence: typeof a.attrs["confidence"] === "number" ? Math.max(0, Math.min(1, a.attrs["confidence"])) : existing?.confidence ?? 0.5,
80716
+ confidence: anchorConfidence(a.attrs) ?? existing?.confidence ?? 0.5,
80743
80717
  extractionSource: "agent-observed",
80744
80718
  createdAt: existing?.createdAt ?? now,
80745
80719
  lastSeenAt: now,
@@ -80770,6 +80744,50 @@ async function syncProjectAnchors(opts) {
80770
80744
  }
80771
80745
  }
80772
80746
 
80747
+ // src/project-hydrate.ts
80748
+ var DEFAULT_LIMIT2 = 50;
80749
+ async function hydrateProject(opts) {
80750
+ const { root, profile, store, cloud, salt } = opts;
80751
+ if (!profile.projectId) return { hydrated: false, reason: "no-project" };
80752
+ if (profile.projectHydratedAt) return { hydrated: false, reason: "already-hydrated" };
80753
+ try {
80754
+ const res = await cloud.getProjectPriors(profile.projectId, opts.limit ?? DEFAULT_LIMIT2);
80755
+ const own = buildOwnKnowledgeMap({ store, salt });
80756
+ const localId = (id) => store.getNode(id) ? id : own.get(id) ?? null;
80757
+ let landedNodes = 0;
80758
+ let ownNodes = 0;
80759
+ for (const n of res.nodes) {
80760
+ if (store.getNode(n.id)) continue;
80761
+ if (own.has(n.id)) {
80762
+ ownNodes++;
80763
+ continue;
80764
+ }
80765
+ store.mergeNode(n);
80766
+ landedNodes++;
80767
+ }
80768
+ let landedEdges = 0;
80769
+ for (const e of res.edges) {
80770
+ const from = localId(e.from);
80771
+ const to = localId(e.to);
80772
+ if (!from || !to) continue;
80773
+ if (store.outEdges(from, [e.type]).some((x) => x.to === to)) continue;
80774
+ const id = from === e.from && to === e.to ? e.id : edgeId(from, e.type, to);
80775
+ if (store.getEdge(id)) continue;
80776
+ store.mergeEdge({ ...e, id, from, to });
80777
+ landedEdges++;
80778
+ }
80779
+ profile.projectHydratedAt = Date.now();
80780
+ saveProfile(root, profile);
80781
+ return { hydrated: true, nodes: landedNodes, edges: landedEdges, own: ownNodes };
80782
+ } catch (err2) {
80783
+ return {
80784
+ hydrated: false,
80785
+ reason: "error",
80786
+ detail: err2 instanceof Error ? err2.message : String(err2)
80787
+ };
80788
+ }
80789
+ }
80790
+
80773
80791
  // src/project-history.ts
80774
80792
  init_src7();
80775
80793
  init_src();
@@ -83809,18 +83827,29 @@ async function startMultiDaemon(opts = {}) {
83809
83827
  } else if (out2.reason === "error") {
83810
83828
  console.warn(`[errata] project link failed for ${r.engine.profile.name}: ${out2.detail}`);
83811
83829
  }
83812
- const hyd = await hydrateProject({
83830
+ let primeSalt = null;
83831
+ if (r.engine.profile.projectId && !r.engine.profile.projectHydratedAt) {
83832
+ try {
83833
+ primeSalt = (await resolveProjectSymbolSalt(client, r.engine.profile.projectId)).salt;
83834
+ } catch (err2) {
83835
+ console.warn(
83836
+ `[errata] project prime deferred for ${r.engine.profile.name}: salt unavailable (${err2 instanceof Error ? err2.message : String(err2)})`
83837
+ );
83838
+ }
83839
+ }
83840
+ const hyd = primeSalt ? await hydrateProject({
83813
83841
  root: r.root,
83814
83842
  profile: r.engine.profile,
83815
83843
  store: r.engine.store,
83816
- cloud: client
83817
- });
83818
- if (hyd.hydrated) {
83844
+ cloud: client,
83845
+ salt: primeSalt
83846
+ }) : null;
83847
+ if (hyd?.hydrated) {
83819
83848
  r.engine.markContextDirty();
83820
83849
  console.log(
83821
- `[errata] primed ${r.engine.profile.name} from project \u2014 ${hyd.nodes} priors, ${hyd.edges} links`
83850
+ `[errata] primed ${r.engine.profile.name} from project \u2014 ${hyd.nodes} priors, ${hyd.edges} links (${hyd.own} already this checkout's own)`
83822
83851
  );
83823
- } else if (hyd.reason === "error") {
83852
+ } else if (hyd && !hyd.hydrated && hyd.reason === "error") {
83824
83853
  console.warn(`[errata] project prime failed for ${r.engine.profile.name}: ${hyd.detail}`);
83825
83854
  }
83826
83855
  if (r.engine.profile.projectId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.2029",
3
+ "version": "2.0.6-dev.2047",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {