@inerrata-corporation/errata 2.0.6-dev.2169 → 2.0.6-dev.2198

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 +28 -4
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -24738,6 +24738,19 @@ function provenanceHeaders(provenance) {
24738
24738
  ...provenance.agentModel ? { "x-inerrata-agent-model": provenance.agentModel } : {}
24739
24739
  };
24740
24740
  }
24741
+ function parseRestErrorEnvelope(text) {
24742
+ if (!text.trimStart().startsWith("{")) return null;
24743
+ try {
24744
+ const body2 = JSON.parse(text);
24745
+ const error48 = body2?.error;
24746
+ if (!error48 || typeof error48 !== "object") return null;
24747
+ const { code, message: message2 } = error48;
24748
+ if (typeof code !== "string" || !code) return null;
24749
+ return { code, message: typeof message2 === "string" && message2 ? message2 : code };
24750
+ } catch {
24751
+ return null;
24752
+ }
24753
+ }
24741
24754
  var asWireCount, INGEST_NODE_CHUNK, E6B_PUBLIC_CONTEXT_SENTINEL, CloudClient, CloudError;
24742
24755
  var init_client = __esm({
24743
24756
  "../../packages/cloud-client/src/client.ts"() {
@@ -25368,9 +25381,11 @@ var init_client = __esm({
25368
25381
  });
25369
25382
  if (!res.ok) {
25370
25383
  const text = await res.text();
25384
+ const envelope = parseRestErrorEnvelope(text);
25371
25385
  throw new CloudError(
25372
- `${method} ${path2} failed: HTTP ${res.status} ${text.slice(0, 200)}`,
25373
- res.status
25386
+ `${method} ${path2} failed: HTTP ${res.status} ${envelope?.message ?? text.slice(0, 200)}`,
25387
+ res.status,
25388
+ envelope?.code
25374
25389
  );
25375
25390
  }
25376
25391
  return await res.json();
@@ -25381,10 +25396,15 @@ var init_client = __esm({
25381
25396
  };
25382
25397
  CloudError = class extends Error {
25383
25398
  status;
25384
- constructor(message2, status) {
25399
+ /** The server's machine-readable error code, when the body carried a REST
25400
+ * error envelope. Callers branch on this rather than regexing the message —
25401
+ * e.g. `installation_revoked` means reconnect, not re-issue the key. */
25402
+ code;
25403
+ constructor(message2, status, code) {
25385
25404
  super(message2);
25386
25405
  this.name = "CloudError";
25387
25406
  this.status = status;
25407
+ this.code = code ?? null;
25388
25408
  }
25389
25409
  };
25390
25410
  }
@@ -77057,7 +77077,7 @@ function createWatchBreaker(deps) {
77057
77077
  }
77058
77078
 
77059
77079
  // src/engine.ts
77060
- var DAEMON_VERSION = true ? "2.0.6-dev.2169" : "2.0.0-alpha.0";
77080
+ var DAEMON_VERSION = true ? "2.0.6-dev.2198" : "2.0.0-alpha.0";
77061
77081
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
77062
77082
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
77063
77083
  var GIT_OP_MUTE_MS = 4e3;
@@ -86381,6 +86401,10 @@ async function applyToken(cfg, token) {
86381
86401
  return true;
86382
86402
  } catch (err2) {
86383
86403
  console.error(`token rejected by ${cfg.cloudUrl}: ${err2 instanceof Error ? err2.message : err2}`);
86404
+ if (err2 instanceof CloudError && err2.code === "installation_revoked") {
86405
+ console.error(` this connection was revoked in the console \u2014 the key is fine, the profile is gone.`);
86406
+ console.error(` reconnect this machine from the console's Connect page, then: errata login --token <errk_\u2026>`);
86407
+ }
86384
86408
  process.exitCode = 1;
86385
86409
  return false;
86386
86410
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.2169",
3
+ "version": "2.0.6-dev.2198",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {