@inerrata-corporation/errata 2.0.6-dev.2559 → 2.0.6-dev.2562

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 +61 -21
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -23483,6 +23483,7 @@ function evaluateMechanisms(store, invocations = /* @__PURE__ */ new Map(), mech
23483
23483
  const stalled = backlog !== void 0 && backlog > 0 && effectCount === 0 && (inv?.runs ?? 0) >= STALL_MIN_RUNS && span >= STALL_MIN_SPAN_MS && (backlogWas === void 0 || backlog >= backlogWas);
23484
23484
  let verdict;
23485
23485
  if (!inv || inv.runs === 0) verdict = "never-invoked";
23486
+ else if (d.configCounter && inv.lastTotals?.[d.configCounter] === 0) verdict = "unconfigured";
23486
23487
  else if (fed.fraction < (d.fedEdges?.minFraction ?? d.fed?.minFraction ?? 0)) verdict = "starved";
23487
23488
  else if (stalled) verdict = "stalled";
23488
23489
  else if (effectCount === 0) verdict = "no-effect";
@@ -23510,7 +23511,7 @@ function formatMechanismStatus(rows, nowMs) {
23510
23511
  return rows.map((r) => {
23511
23512
  const pct = (r.fedFraction * 100).toFixed(r.fedFraction < 0.01 ? 2 : 1);
23512
23513
  const age = r.lastInvokedMs === void 0 ? "never" : `${Math.max(0, Math.round((nowMs - r.lastInvokedMs) / 6e4))}m ago`;
23513
- const mark = r.verdict === "ok" ? "ok " : r.verdict === "no-effect" ? "IDLE" : r.verdict === "stalled" ? "STUCK" : "DEAD";
23514
+ const mark = r.verdict === "ok" ? "ok " : r.verdict === "no-effect" ? "IDLE" : r.verdict === "unconfigured" ? "OFF" : r.verdict === "stalled" ? "STUCK" : "DEAD";
23514
23515
  const hours = r.spanMs === void 0 ? 0 : Math.floor(r.spanMs / 36e5);
23515
23516
  const over = hours >= 24 ? `${Math.floor(hours / 24)}d` : `${hours}h`;
23516
23517
  const trend = r.verdict === "stalled" && r.backlog !== void 0 ? ` \u2014 ${r.backlog} waiting${r.backlogWas !== void 0 ? ` (was ${r.backlogWas})` : ""}, none cleared in ${over}` : "";
@@ -23717,7 +23718,8 @@ var init_mechanism_liveness = __esm({
23717
23718
  // Standing nominations ARE the judge-less backlog — without the gauge a
23718
23719
  // deployment with no judge configured reads as "nothing to fold".
23719
23720
  backlogCounter: "standing",
23720
- note: "standing > 0 with folded 0 = the judge lane is unconfigured (ERRATA_FOLD_JUDGE / azure env), not an empty queue"
23721
+ configCounter: "judgeConfigured",
23722
+ note: "the ambiguous band needs the opt-in judge: set ERRATA_FOLD_JUDGE=1 + a configured chat provider (azure env), or leave it off and the nominations stand"
23721
23723
  },
23722
23724
  {
23723
23725
  id: "cite-anchor-accrual",
@@ -78330,7 +78332,7 @@ function createWatchBreaker(deps) {
78330
78332
  }
78331
78333
 
78332
78334
  // src/engine.ts
78333
- var DAEMON_VERSION = true ? "2.0.6-dev.2559" : "2.0.0-alpha.0";
78335
+ var DAEMON_VERSION = true ? "2.0.6-dev.2562" : "2.0.0-alpha.0";
78334
78336
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
78335
78337
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
78336
78338
  var GIT_OP_MUTE_MS = 4e3;
@@ -80469,7 +80471,9 @@ B: ${b}`,
80469
80471
  rejected: fj.rejected,
80470
80472
  standing: fj.standing,
80471
80473
  judgeErrors: fj.judgeErrors,
80472
- retargeted: fj.retargeted
80474
+ retargeted: fj.retargeted,
80475
+ // Opt-in lane: 0 tells the liveness watch "off by choice", not "stuck".
80476
+ judgeConfigured: foldJudge ? 1 : 0
80473
80477
  });
80474
80478
  if (fj.folded > 0) {
80475
80479
  console.log(`[errata] fold-judge: folded ${fj.folded} paraphrase pair(s) (${fj.foldedEmbedding} by embedding, ${fj.foldedJudge} by judge), ${fj.standing} standing`);
@@ -81891,6 +81895,42 @@ function runNpmInstall(channel) {
81891
81895
  // src/multi.ts
81892
81896
  init_cloud_endpoint_policy();
81893
81897
  init_cloud_auth();
81898
+
81899
+ // src/live-cloud-client.ts
81900
+ function liveCloudClient(src) {
81901
+ const recheckMs = src.recheckMs ?? 5e3;
81902
+ const now = src.now ?? Date.now;
81903
+ let current = null;
81904
+ let currentKey = "";
81905
+ let checkedAt = -Infinity;
81906
+ const resolve7 = () => {
81907
+ const t = now();
81908
+ if (current && t - checkedAt < recheckMs) return current;
81909
+ checkedAt = t;
81910
+ let cfg;
81911
+ try {
81912
+ cfg = src.read();
81913
+ } catch (err2) {
81914
+ if (current) return current;
81915
+ throw err2;
81916
+ }
81917
+ const key = src.fingerprint(cfg);
81918
+ if (!current || key !== currentKey) {
81919
+ current = src.build(cfg);
81920
+ currentKey = key;
81921
+ }
81922
+ return current;
81923
+ };
81924
+ return new Proxy({}, {
81925
+ get(_target, prop) {
81926
+ const client = resolve7();
81927
+ const value = Reflect.get(client, prop, client);
81928
+ return typeof value === "function" ? value.bind(client) : value;
81929
+ }
81930
+ });
81931
+ }
81932
+
81933
+ // src/multi.ts
81894
81934
  init_identity2();
81895
81935
 
81896
81936
  // src/project-link.ts
@@ -84755,20 +84795,9 @@ async function startMultiDaemon(opts = {}) {
84755
84795
  }
84756
84796
  const cfg = loadConfig();
84757
84797
  const CLOUD_TIMEOUT_MS = 12e4;
84758
- const initialCloudUrl = normalizeCloudUrl(opts.cloudUrl ?? cfg.cloudUrl);
84759
- const initialCfg = { ...cfg, cloudUrl: initialCloudUrl };
84760
- if (opts.apiKey) {
84761
- initialCfg.apiKey = opts.apiKey;
84762
- initialCfg.accessToken = null;
84763
- initialCfg.refreshToken = null;
84764
- initialCfg.tokenEndpoint = null;
84765
- initialCfg.oauthClientId = null;
84766
- }
84767
- const cloud = authedCloudClient(initialCfg, { timeoutMs: CLOUD_TIMEOUT_MS, daemonVersion: DAEMON_VERSION });
84768
- const cloudNow = () => {
84798
+ const currentCfg = () => {
84769
84799
  const c = loadConfig();
84770
- const baseUrl2 = normalizeCloudUrl(opts.cloudUrl ?? c.cloudUrl);
84771
- const current = { ...c, cloudUrl: baseUrl2 };
84800
+ const current = { ...c, cloudUrl: normalizeCloudUrl(opts.cloudUrl ?? c.cloudUrl) };
84772
84801
  if (opts.apiKey) {
84773
84802
  current.apiKey = opts.apiKey;
84774
84803
  current.accessToken = null;
@@ -84776,8 +84805,14 @@ async function startMultiDaemon(opts = {}) {
84776
84805
  current.tokenEndpoint = null;
84777
84806
  current.oauthClientId = null;
84778
84807
  }
84779
- return authedCloudClient(current, { timeoutMs: CLOUD_TIMEOUT_MS, daemonVersion: DAEMON_VERSION });
84808
+ return current;
84780
84809
  };
84810
+ const cloudNow = () => authedCloudClient(currentCfg(), { timeoutMs: CLOUD_TIMEOUT_MS, daemonVersion: DAEMON_VERSION });
84811
+ const cloud = liveCloudClient({
84812
+ read: currentCfg,
84813
+ fingerprint: (c) => JSON.stringify([c.cloudUrl, c.apiKey, c.accessToken, c.refreshToken, c.tokenEndpoint, c.activeInstallationProfile, c.updateChannel]),
84814
+ build: (c) => authedCloudClient(c, { timeoutMs: CLOUD_TIMEOUT_MS, daemonVersion: DAEMON_VERSION })
84815
+ });
84781
84816
  const identityFor = (entry) => {
84782
84817
  if (opts.apiKey) {
84783
84818
  return {
@@ -84952,9 +84987,14 @@ async function startMultiDaemon(opts = {}) {
84952
84987
  noteIdentityBlock(entry.id, entry.name, wsIdentity);
84953
84988
  wsCloud = blockedCloudClient(wsIdentity.reason);
84954
84989
  } else {
84955
- wsCloud = authedCloudClientForProfile(loadConfig(), wsIdentity.profileName, {
84956
- timeoutMs: CLOUD_TIMEOUT_MS,
84957
- daemonVersion: DAEMON_VERSION
84990
+ const profileName = wsIdentity.profileName;
84991
+ wsCloud = liveCloudClient({
84992
+ read: loadConfig,
84993
+ fingerprint: (c) => {
84994
+ const p = c.installationProfiles[profileName];
84995
+ return JSON.stringify([p?.cloudUrl, c.cloudUrl, p?.accessToken, p?.refreshToken, p?.tokenEndpoint, c.updateChannel]);
84996
+ },
84997
+ build: (c) => authedCloudClientForProfile(c, profileName, { timeoutMs: CLOUD_TIMEOUT_MS, daemonVersion: DAEMON_VERSION })
84958
84998
  });
84959
84999
  console.log(`[identity] workspace "${entry.name}" bound \u2192 profile "${wsIdentity.profileName}"`);
84960
85000
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.2559",
3
+ "version": "2.0.6-dev.2562",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {