@addai/node 0.11.1 → 0.11.2
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.
- package/dist/tui/data.js +15 -1
- package/package.json +1 -1
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
|
-
|
|
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.
|
|
3
|
+
"version": "0.11.2",
|
|
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": [
|