@addai/node 0.11.1 → 0.11.3

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.
@@ -244,6 +244,14 @@ function createDashboardScreen(deps) {
244
244
  if (recent.length)
245
245
  st.recent = recent;
246
246
  st.offline = deps.data.offline();
247
+ // The server can unpair a node out from under a running daemon — the
248
+ // machine removed from the fleet, or its token revoked. The heartbeat
249
+ // notices and clears the local pairing, but this screen was reading
250
+ // `paired` once at startup, so it kept showing the old stats and a header
251
+ // that said Online while every call underneath it came back unauthorized.
252
+ // Re-read it: a node that has lost its pairing should say so and tell you
253
+ // how to come back, not sit there looking healthy and empty.
254
+ st.paired = (0, store_1.isPaired)();
247
255
  // A selected run that has finished is no longer in the band. nowIndex
248
256
  // already reads that as "cursor is in the menu"; drop the id too so the
249
257
  // state doesn't keep pointing at a run nobody can see.
package/dist/tui/data.js CHANGED
@@ -15,8 +15,19 @@ function createDataLayer(deps) {
15
15
  const inflight = new Map();
16
16
  let lastError = null;
17
17
  let offline = false;
18
+ /* One failed call is not an outage.
19
+ RPCs time out at 4s, which a laptop on a busy connection exceeds now and
20
+ then without anything being wrong — the request pump already treats a
21
+ single failure as noise and logs "recovered after 1 consecutive failures".
22
+ The dashboard did not: one blip flipped it to "Offline · retrying" and it
23
+ stayed there until the next success, so the screen contradicted itself,
24
+ reporting the node Online in the header and offline directly underneath.
25
+ Two in a row is a signal; one is weather. */
26
+ let consecutiveFailures = 0;
27
+ const OFFLINE_AFTER = 2;
18
28
  async function fetch(key, name, args) {
19
29
  if (breakerOpen()) {
30
+ // The breaker only opens after repeated failures, so this one is real.
20
31
  offline = true;
21
32
  return cache.get(key) ?? null;
22
33
  }
@@ -27,12 +38,15 @@ function createDataLayer(deps) {
27
38
  try {
28
39
  const res = await call(name, { p_token: deps.token, ...args });
29
40
  cache.set(key, res);
41
+ consecutiveFailures = 0;
30
42
  offline = false;
31
43
  lastError = null;
32
44
  return res;
33
45
  }
34
46
  catch (err) {
35
- offline = true;
47
+ consecutiveFailures += 1;
48
+ if (consecutiveFailures >= OFFLINE_AFTER)
49
+ offline = true;
36
50
  lastError = err.message;
37
51
  return cache.get(key) ?? null;
38
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@addai/node",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "Daemon that pairs a machine with your +Ai account and runs Claude / Codex / Kimi / Gemini agents on its behalf. Reachable via Supabase from Vault, Entity Studio, or any other +Ai surface.",
5
5
  "license": "MIT",
6
6
  "keywords": [