@inerrata-corporation/errata 2.0.2-dev.157 → 2.0.2-dev.161

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 +22 -14
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -50817,14 +50817,16 @@ function generalizePrincipleForSync(principle, level = 2) {
50817
50817
  delete node2.logicalId;
50818
50818
  return node2;
50819
50819
  }
50820
- function buildPrincipleIngest(sharedStore, daemonVersion, ignorePatterns = [], level = 2) {
50820
+ function buildPrincipleIngest(sharedStore, daemonVersion, ignorePatterns = [], level = 2, opts = {}) {
50821
+ const lang = opts.primaryLanguage?.trim().toLowerCase();
50822
+ const claim = lang ? { anchorVisibility: "public", anchor: `lang:${lang}` } : {};
50821
50823
  const selected = sharedStore.findNodesByLabel("Claim").filter((n) => isSyncablePrinciple(n, ignorePatterns));
50822
50824
  for (const n of selected) {
50823
50825
  if (Number(n.attrs["abstractionLevel"] ?? ABSTRACTION_LEVEL.CONCRETE) !== ABSTRACTION_LEVEL.PRINCIPLE || n.attrs["provisional"] !== false) {
50824
50826
  throw new Error(`buildPrincipleIngest: refusing to sync non-canonical-principle ${n.id} \u2014 C7 invariant violated`);
50825
50827
  }
50826
50828
  }
50827
- const nodes = selected.map((n) => generalizePrincipleForSync(n, level));
50829
+ const nodes = selected.map((n) => ({ ...generalizePrincipleForSync(n, level), ...claim }));
50828
50830
  if (nodes.length === 0) return null;
50829
50831
  const base = {
50830
50832
  daemonVersion,
@@ -51995,7 +51997,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
51995
51997
  }
51996
51998
 
51997
51999
  // src/engine.ts
51998
- var DAEMON_VERSION = true ? "2.0.2-dev.157" : "2.0.0-alpha.0";
52000
+ var DAEMON_VERSION = true ? "2.0.2-dev.161" : "2.0.0-alpha.0";
51999
52001
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
52000
52002
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
52001
52003
  var GIT_OP_MUTE_MS = 4e3;
@@ -54433,6 +54435,18 @@ async function startMultiDaemon(opts = {}) {
54433
54435
  startLoopLagMonitor();
54434
54436
  let baseUrl = "";
54435
54437
  const records = [];
54438
+ const machineDominantLanguage = () => {
54439
+ const langCounts = /* @__PURE__ */ new Map();
54440
+ for (const r of records) {
54441
+ for (const l of r.engine.profile.languages ?? []) {
54442
+ const k = String(l).trim().toLowerCase();
54443
+ if (k) langCounts.set(k, (langCounts.get(k) ?? 0) + 1);
54444
+ }
54445
+ }
54446
+ return [...langCounts.entries()].sort(
54447
+ (a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1)
54448
+ )[0]?.[0];
54449
+ };
54436
54450
  const updatePoller = opts.updateCheck ? startUpdatePoller({
54437
54451
  channel: loadConfig().updateChannel,
54438
54452
  onChange: (pending) => {
@@ -54995,7 +55009,10 @@ async function startMultiDaemon(opts = {}) {
54995
55009
  async syncPrinciplesPublic() {
54996
55010
  if (!loadConfig().consent.sync) return { uploaded: 0, skipped: "consent-off" };
54997
55011
  const ignore = loadClaimIgnorePatterns(globalDir());
54998
- const payload = buildPrincipleIngest(sharedStore, DAEMON_VERSION, ignore);
55012
+ const primaryLanguage = machineDominantLanguage();
55013
+ const payload = buildPrincipleIngest(sharedStore, DAEMON_VERSION, ignore, 2, {
55014
+ ...primaryLanguage ? { primaryLanguage } : {}
55015
+ });
54999
55016
  if (!payload) return { uploaded: 0 };
55000
55017
  const res = await cloudNow().ingest(payload);
55001
55018
  return { uploaded: res.accepted };
@@ -55003,16 +55020,7 @@ async function startMultiDaemon(opts = {}) {
55003
55020
  async syncTriagePublic() {
55004
55021
  if (!loadConfig().consent.sync) return { uploaded: 0, skipped: "consent-off" };
55005
55022
  const ignore = loadClaimIgnorePatterns(globalDir());
55006
- const langCounts = /* @__PURE__ */ new Map();
55007
- for (const r of records) {
55008
- for (const l of r.engine.profile.languages ?? []) {
55009
- const k = String(l).trim().toLowerCase();
55010
- if (k) langCounts.set(k, (langCounts.get(k) ?? 0) + 1);
55011
- }
55012
- }
55013
- const primaryLanguage = [...langCounts.entries()].sort(
55014
- (a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1)
55015
- )[0]?.[0];
55023
+ const primaryLanguage = machineDominantLanguage();
55016
55024
  const payload = buildTriageIngest(sharedStore, DAEMON_VERSION, ignore, 2, {
55017
55025
  ...primaryLanguage ? { primaryLanguage } : {}
55018
55026
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.157",
3
+ "version": "2.0.2-dev.161",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {