@inerrata-corporation/errata 2.0.6-dev.2561 → 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 +54 -18
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -78332,7 +78332,7 @@ function createWatchBreaker(deps) {
78332
78332
  }
78333
78333
 
78334
78334
  // src/engine.ts
78335
- var DAEMON_VERSION = true ? "2.0.6-dev.2561" : "2.0.0-alpha.0";
78335
+ var DAEMON_VERSION = true ? "2.0.6-dev.2562" : "2.0.0-alpha.0";
78336
78336
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
78337
78337
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
78338
78338
  var GIT_OP_MUTE_MS = 4e3;
@@ -81895,6 +81895,42 @@ function runNpmInstall(channel) {
81895
81895
  // src/multi.ts
81896
81896
  init_cloud_endpoint_policy();
81897
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
81898
81934
  init_identity2();
81899
81935
 
81900
81936
  // src/project-link.ts
@@ -84759,20 +84795,9 @@ async function startMultiDaemon(opts = {}) {
84759
84795
  }
84760
84796
  const cfg = loadConfig();
84761
84797
  const CLOUD_TIMEOUT_MS = 12e4;
84762
- const initialCloudUrl = normalizeCloudUrl(opts.cloudUrl ?? cfg.cloudUrl);
84763
- const initialCfg = { ...cfg, cloudUrl: initialCloudUrl };
84764
- if (opts.apiKey) {
84765
- initialCfg.apiKey = opts.apiKey;
84766
- initialCfg.accessToken = null;
84767
- initialCfg.refreshToken = null;
84768
- initialCfg.tokenEndpoint = null;
84769
- initialCfg.oauthClientId = null;
84770
- }
84771
- const cloud = authedCloudClient(initialCfg, { timeoutMs: CLOUD_TIMEOUT_MS, daemonVersion: DAEMON_VERSION });
84772
- const cloudNow = () => {
84798
+ const currentCfg = () => {
84773
84799
  const c = loadConfig();
84774
- const baseUrl2 = normalizeCloudUrl(opts.cloudUrl ?? c.cloudUrl);
84775
- const current = { ...c, cloudUrl: baseUrl2 };
84800
+ const current = { ...c, cloudUrl: normalizeCloudUrl(opts.cloudUrl ?? c.cloudUrl) };
84776
84801
  if (opts.apiKey) {
84777
84802
  current.apiKey = opts.apiKey;
84778
84803
  current.accessToken = null;
@@ -84780,8 +84805,14 @@ async function startMultiDaemon(opts = {}) {
84780
84805
  current.tokenEndpoint = null;
84781
84806
  current.oauthClientId = null;
84782
84807
  }
84783
- return authedCloudClient(current, { timeoutMs: CLOUD_TIMEOUT_MS, daemonVersion: DAEMON_VERSION });
84808
+ return current;
84784
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
+ });
84785
84816
  const identityFor = (entry) => {
84786
84817
  if (opts.apiKey) {
84787
84818
  return {
@@ -84956,9 +84987,14 @@ async function startMultiDaemon(opts = {}) {
84956
84987
  noteIdentityBlock(entry.id, entry.name, wsIdentity);
84957
84988
  wsCloud = blockedCloudClient(wsIdentity.reason);
84958
84989
  } else {
84959
- wsCloud = authedCloudClientForProfile(loadConfig(), wsIdentity.profileName, {
84960
- timeoutMs: CLOUD_TIMEOUT_MS,
84961
- 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 })
84962
84998
  });
84963
84999
  console.log(`[identity] workspace "${entry.name}" bound \u2192 profile "${wsIdentity.profileName}"`);
84964
85000
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.2561",
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": {