@beeos-ai/device-agent 0.9.7 → 0.9.9

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.
@@ -4,7 +4,7 @@
4
4
  * Bridges device-agent's `IDeviceIdentity` (which exposes a `KeyPair`
5
5
  * with raw 32-byte private/public Ed25519 keys) to the
6
6
  * `Identity` interface consumed by `@beeos-ai/message-sdk`'s
7
- * `createTokenProvider`.
7
+ * `buildAgentAuthHeaders`.
8
8
  *
9
9
  * The actual Ed25519 signing reuses the same `sign()` helper from
10
10
  * `@beeos-ai/bridge-client` that powers `agent-gateway-client.ts` —
@@ -15,6 +15,21 @@
15
15
  import { type Identity } from "@beeos-ai/message-sdk/auth";
16
16
  import type { TokenProvider } from "@beeos-ai/message-sdk";
17
17
  import type { KeyPair } from "../ports/identity.js";
18
+ /**
19
+ * Structured error thrown when the Agent Gateway rejects the
20
+ * messaging-token request. Carries the HTTP `status` so callers can
21
+ * distinguish a definitive `401` (instance deleted / unbound — the
22
+ * Ed25519 key is no longer recognised) from transient `5xx` / network
23
+ * failures. The shared SDK `createTokenProvider` only throws a plain
24
+ * `Error` with the status buried in the message string, which is why
25
+ * this provider owns the fetch (it still reuses the SDK's
26
+ * `buildAgentAuthHeaders` so the Ed25519 wire format cannot drift).
27
+ */
28
+ export declare class MessagingTokenError extends Error {
29
+ readonly status?: number | undefined;
30
+ readonly body?: string | undefined;
31
+ constructor(message: string, status?: number | undefined, body?: string | undefined);
32
+ }
18
33
  export interface DeviceMessagingTokenProviderOptions {
19
34
  /** Agent Gateway base URL (e.g. `https://agent-gw.beeos.ai`). */
20
35
  agentGatewayUrl: string;
@@ -40,5 +55,11 @@ export declare function keypairToIdentity(keypair: KeyPair): Identity;
40
55
  * public key (pod-is-principal), so the `identityId` argument passed
41
56
  * to the returned function is ignored on the wire — callers should
42
57
  * still re-read `tok.identityId` after the first call.
58
+ *
59
+ * Owns the fetch (rather than delegating to the SDK's
60
+ * `createTokenProvider`) purely so a non-OK response surfaces as a
61
+ * typed {@link MessagingTokenError} with a numeric `status`. The
62
+ * Ed25519 header construction is still delegated to the SDK's
63
+ * `buildAgentAuthHeaders`, so the wire format stays single-sourced.
43
64
  */
44
65
  export declare function createDeviceMessagingTokenProvider(opts: DeviceMessagingTokenProviderOptions): TokenProvider;
@@ -4,7 +4,7 @@
4
4
  * Bridges device-agent's `IDeviceIdentity` (which exposes a `KeyPair`
5
5
  * with raw 32-byte private/public Ed25519 keys) to the
6
6
  * `Identity` interface consumed by `@beeos-ai/message-sdk`'s
7
- * `createTokenProvider`.
7
+ * `buildAgentAuthHeaders`.
8
8
  *
9
9
  * The actual Ed25519 signing reuses the same `sign()` helper from
10
10
  * `@beeos-ai/bridge-client` that powers `agent-gateway-client.ts` —
@@ -13,7 +13,27 @@
13
13
  * endpoints.
14
14
  */
15
15
  import * as crypto from "node:crypto";
16
- import { createTokenProvider, } from "@beeos-ai/message-sdk/auth";
16
+ import { buildAgentAuthHeaders, } from "@beeos-ai/message-sdk/auth";
17
+ /**
18
+ * Structured error thrown when the Agent Gateway rejects the
19
+ * messaging-token request. Carries the HTTP `status` so callers can
20
+ * distinguish a definitive `401` (instance deleted / unbound — the
21
+ * Ed25519 key is no longer recognised) from transient `5xx` / network
22
+ * failures. The shared SDK `createTokenProvider` only throws a plain
23
+ * `Error` with the status buried in the message string, which is why
24
+ * this provider owns the fetch (it still reuses the SDK's
25
+ * `buildAgentAuthHeaders` so the Ed25519 wire format cannot drift).
26
+ */
27
+ export class MessagingTokenError extends Error {
28
+ status;
29
+ body;
30
+ constructor(message, status, body) {
31
+ super(message);
32
+ this.status = status;
33
+ this.body = body;
34
+ this.name = "MessagingTokenError";
35
+ }
36
+ }
17
37
  // PKCS8 prefix that wraps a raw 32-byte Ed25519 seed so node:crypto's
18
38
  // createPrivateKey can ingest it. Identical to the prefix used by
19
39
  // @beeos-ai/bridge-client and beeos-claw's agent-auth.
@@ -44,6 +64,8 @@ export function keypairToIdentity(keypair) {
44
64
  },
45
65
  };
46
66
  }
67
+ /** Agent Gateway messaging-token endpoint path. */
68
+ const MESSAGING_TOKEN_PATH = "/api/v1/messaging/token";
47
69
  /**
48
70
  * Build a ready-to-use `TokenProvider` for `MessageClient`. The
49
71
  * provider POSTs to `${agentGatewayUrl}/api/v1/messaging/token` with
@@ -54,12 +76,48 @@ export function keypairToIdentity(keypair) {
54
76
  * public key (pod-is-principal), so the `identityId` argument passed
55
77
  * to the returned function is ignored on the wire — callers should
56
78
  * still re-read `tok.identityId` after the first call.
79
+ *
80
+ * Owns the fetch (rather than delegating to the SDK's
81
+ * `createTokenProvider`) purely so a non-OK response surfaces as a
82
+ * typed {@link MessagingTokenError} with a numeric `status`. The
83
+ * Ed25519 header construction is still delegated to the SDK's
84
+ * `buildAgentAuthHeaders`, so the wire format stays single-sourced.
57
85
  */
58
86
  export function createDeviceMessagingTokenProvider(opts) {
59
- return createTokenProvider({
60
- agentGatewayUrl: opts.agentGatewayUrl,
61
- identity: keypairToIdentity(opts.keypair),
62
- fetchImpl: opts.fetchImpl,
63
- });
87
+ const baseUrl = opts.agentGatewayUrl.replace(/\/+$/, "");
88
+ const fetchImpl = opts.fetchImpl ?? fetch;
89
+ const identity = keypairToIdentity(opts.keypair);
90
+ return async (identityId) => {
91
+ const url = `${baseUrl}${MESSAGING_TOKEN_PATH}`;
92
+ const headers = {
93
+ "Content-Type": "application/json",
94
+ ...(await buildAgentAuthHeaders("POST", MESSAGING_TOKEN_PATH, identity)),
95
+ };
96
+ const body = {};
97
+ if (identityId)
98
+ body.principal_id = identityId;
99
+ const resp = await fetchImpl(url, {
100
+ method: "POST",
101
+ headers,
102
+ body: JSON.stringify(body),
103
+ });
104
+ if (!resp.ok) {
105
+ const text = await resp.text().catch(() => "");
106
+ throw new MessagingTokenError(`messaging-token POST ${MESSAGING_TOKEN_PATH} returned ${resp.status}: ${text}`, resp.status, text);
107
+ }
108
+ // Agent Gateway returns snake_case (mirrors the MS REST shape).
109
+ // Translate to the camelCase TokenResponse the SDK consumes.
110
+ const raw = (await resp.json());
111
+ return {
112
+ token: String(raw.token ?? ""),
113
+ centrifugoUrl: String(raw.centrifugo_url ?? ""),
114
+ serviceUrl: typeof raw.service_url === "string" ? raw.service_url : undefined,
115
+ identityId: String(raw.principal_id ?? identityId),
116
+ expiresAt: typeof raw.expires_at === "number" ? raw.expires_at : 0,
117
+ channels: Array.isArray(raw.channels)
118
+ ? raw.channels.filter((c) => typeof c === "string")
119
+ : undefined,
120
+ };
121
+ };
64
122
  }
65
123
  //# sourceMappingURL=token-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"token-provider.js","sourceRoot":"","sources":["../../src/messaging/token-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EACL,mBAAmB,GAEpB,MAAM,4BAA4B,CAAC;AAKpC,sEAAsE;AACtE,kEAAkE;AAClE,uDAAuD;AACvD,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CACtC,kCAAkC,EAClC,KAAK,CACN,CAAC;AAUF;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,OAAO;QACL,eAAe,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACxE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;YACd,MAAM,OAAO,GACX,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,EAAE;gBAC9B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;oBACZ,oBAAoB;oBACpB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;iBAChC,CAAC;gBACJ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACtC,MAAM,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC;gBACrC,GAAG,EAAE,OAAO;gBACZ,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,OAAO;aACd,CAAC,CAAC;YACH,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QACvE,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kCAAkC,CAChD,IAAyC;IAEzC,OAAO,mBAAmB,CAAC;QACzB,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,QAAQ,EAAE,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC;QACzC,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"token-provider.js","sourceRoot":"","sources":["../../src/messaging/token-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EACL,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AAKpC;;;;;;;;;GASG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAGjC;IACA;IAHX,YACE,OAAe,EACN,MAAe,EACf,IAAa;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,WAAM,GAAN,MAAM,CAAS;QACf,SAAI,GAAJ,IAAI,CAAS;QAGtB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,sEAAsE;AACtE,kEAAkE;AAClE,uDAAuD;AACvD,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CACtC,kCAAkC,EAClC,KAAK,CACN,CAAC;AAUF;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,OAAO;QACL,eAAe,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAA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C,CAAE,GAAG,CAAC,QAAsB,CAAC,MAAM,CAChC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAC1C;gBACH,CAAC,CAAC,SAAS;SACd,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -91,7 +91,17 @@ export class AgentSyncPlugin {
91
91
  }
92
92
  catch (e) {
93
93
  const ae = e;
94
- log.warn({ err: ae.message, status: ae.status, body: ae.body }, "agent-sync: sync failed (non-fatal)");
94
+ if (ae.status === 401) {
95
+ // A definitive 401 is categorically different from a transient
96
+ // failure: the platform no longer recognises this device's
97
+ // Ed25519 key (instance deleted / unbound). Surface it loudly so
98
+ // operators see it in `fleet logs` rather than burying it in a
99
+ // generic warn alongside network blips.
100
+ log.error({ err: ae.message, status: ae.status, body: ae.body }, "agent-sync: agents/sync rejected with 401 — the platform no longer recognises this device's Ed25519 key (instance deleted/unbound); the agent will be absent from the platform directory until re-bound (see scripts/device-rebind-guide.md)");
101
+ }
102
+ else {
103
+ log.warn({ err: ae.message, status: ae.status, body: ae.body }, "agent-sync: sync failed (non-fatal)");
104
+ }
95
105
  }
96
106
  }
97
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/agent-sync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAEL,UAAU,GAGX,MAAM,wCAAwC,CAAC;AAYhD,MAAM,OAAO,eAAe;IAMG;IALpB,IAAI,GAAG,YAAY,CAAC;IACrB,GAAG,CAAiB;IACpB,KAAK,GAA0B,IAAI,CAAC;IACpC,OAAO,GAAG,KAAK,CAAC;IAExB,YAA6B,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAG,CAAC;IAEvD,IAAI,CAAC,GAAkB;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,IAAI,C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,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;aACjF,EACD,uCAAuC,CACxC,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,EAAE,GAAG,CAAsB,CAAC;YAClC,IAAI,EAAE,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACtB,+DAA+D;gBAC/D,2DAA2D;gBAC3D,iEAAiE;gBACjE,+DAA+D;gBAC/D,wCAAwC;gBACxC,GAAG,CAAC,KAAK,CACP,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,EACrD,8OAA8O,CAC/O,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,IAAI,CACN,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,EACrD,qCAAqC,CACtC,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -26,6 +26,16 @@
26
26
  * schedules a retry with exponential backoff (30s → 60s → 120s → 240s,
27
27
  * capped at 300s) and keeps trying forever until either `connect`
28
28
  * succeeds or `stop()` cancels the loop.
29
+ *
30
+ * Reconnect model (two layers, do not conflate):
31
+ * - Transient blips AFTER a successful connect are handled by
32
+ * centrifuge-js internally (it stays in `connecting` and retries).
33
+ * - A TERMINAL disconnect (centrifuge-js gave up) surfaces as the
34
+ * client `disconnect` event; the plugin re-arms the opening loop
35
+ * (`rearmConnectLoop`) so the device self-heals without a fleet
36
+ * restart. This is the fix for the historical "USB unplug killed
37
+ * message-bus" report — the real trigger was a terminal Centrifugo
38
+ * disconnect with no re-arm, not any active health-driven teardown.
29
39
  */
30
40
  import { MessageClient, type TokenProvider } from "@beeos-ai/message-sdk";
31
41
  import type { Logger } from "../../logger/index.js";
@@ -101,13 +111,42 @@ export declare class MessageBusPlugin implements AgentPlugin {
101
111
  private legacyDeprecationLogged;
102
112
  private connectSettled;
103
113
  private resolveConnectSettled;
114
+ /**
115
+ * Guards against running more than one connect loop concurrently. The
116
+ * loop can be (re-)armed from two places — `start()` and the terminal
117
+ * `disconnect` listener — so re-entrancy must be a no-op.
118
+ */
119
+ private loopActive;
120
+ /** Consecutive definitive 401s; reset to 0 on any successful token fetch. */
121
+ private consecutiveAuthFailures;
122
+ /** True once we have connected at least once in this process. */
123
+ private everConnected;
124
+ /**
125
+ * Set when persistent 401s indicate the platform instance is gone.
126
+ * Terminal: the connect loop stops and is NOT re-armed. Distinct from
127
+ * `stopped` (which is shutdown) so observers can tell the two apart.
128
+ */
129
+ private invalidated;
104
130
  constructor(opts?: MessageBusPluginOptions);
105
131
  init(ctx: PluginContext): Promise<void>;
106
132
  start(): Promise<void>;
107
133
  stop(): Promise<void>;
108
134
  get principalId(): string;
135
+ /**
136
+ * True when persistent 401s have led us to conclude the platform
137
+ * instance is gone and we have halted reconnect. Surfaced for
138
+ * diagnostics (e.g. status endpoints / structured health snapshots).
139
+ */
140
+ get instanceSuspectedInvalid(): boolean;
109
141
  whenSettled(): Promise<void>;
110
142
  private runConnectLoop;
143
+ /**
144
+ * Re-arm the connect loop after a TERMINAL Centrifugo disconnect (the
145
+ * SDK has given up its own internal reconnect). Resets the backoff
146
+ * cursor so recovery starts from the shortest delay, then kicks a fresh
147
+ * loop (no-op if one is already running or we're shutting down).
148
+ */
149
+ private rearmConnectLoop;
111
150
  /**
112
151
  * Single connect attempt. Returns `true` on success, `false` on any
113
152
  * failure (caller should schedule a retry).
@@ -115,9 +154,34 @@ export declare class MessageBusPlugin implements AgentPlugin {
115
154
  * Each attempt builds a FRESH `MessageClient` — re-using one across
116
155
  * reconnects would carry stale handlers and confuse centrifuge-js
117
156
  * internal state. The client has its own internal reconnect once
118
- * `.connect()` succeeds; this loop is for the OPENING handshake only.
157
+ * `.connect()` succeeds; this loop opens the handshake and is re-armed
158
+ * by the `disconnect` listener on terminal failure (see class docstring).
119
159
  */
120
160
  private tryConnectOnce;
161
+ /**
162
+ * Wrap a token provider so consecutive definitive `401`s are counted.
163
+ * A `401` means the Agent Gateway no longer recognises this device's
164
+ * Ed25519 key — i.e. the platform instance was deleted / unbound. We
165
+ * reset the counter on any success, and only count `401` (transient
166
+ * `5xx` / network errors keep retrying without polluting the count).
167
+ */
168
+ private instrumentTokenProvider;
169
+ /**
170
+ * Fired once when 401s cross the threshold. Always emits a loud,
171
+ * actionable error (the authoritative ops signal via `fleet logs`).
172
+ * Halts reconnect ONLY if we had previously connected — a never-yet-
173
+ * connected agent might just be racing platform provisioning (the
174
+ * instance's `agentPublicKey` not seeded yet), and must keep trying;
175
+ * but an instance that WAS working and now returns 401 is genuinely
176
+ * gone, so we stop hammering and wait for a re-bind.
177
+ */
178
+ private onPersistentAuthFailure;
179
+ /**
180
+ * Terminal stop on instance invalidation. Unlike `stop()` (shutdown),
181
+ * this is driven by the platform having dropped the instance. Cancels
182
+ * retries, tears down any live client, and prevents re-arm.
183
+ */
184
+ private markInvalidated;
121
185
  private nextDelayMs;
122
186
  private logAttemptFailure;
123
187
  private logRetryScheduled;
@@ -26,9 +26,19 @@
26
26
  * schedules a retry with exponential backoff (30s → 60s → 120s → 240s,
27
27
  * capped at 300s) and keeps trying forever until either `connect`
28
28
  * succeeds or `stop()` cancels the loop.
29
+ *
30
+ * Reconnect model (two layers, do not conflate):
31
+ * - Transient blips AFTER a successful connect are handled by
32
+ * centrifuge-js internally (it stays in `connecting` and retries).
33
+ * - A TERMINAL disconnect (centrifuge-js gave up) surfaces as the
34
+ * client `disconnect` event; the plugin re-arms the opening loop
35
+ * (`rearmConnectLoop`) so the device self-heals without a fleet
36
+ * restart. This is the fix for the historical "USB unplug killed
37
+ * message-bus" report — the real trigger was a terminal Centrifugo
38
+ * disconnect with no re-arm, not any active health-driven teardown.
29
39
  */
30
40
  import { MessageClient, } from "@beeos-ai/message-sdk";
31
- import { createDeviceMessagingTokenProvider } from "../../messaging/token-provider.js";
41
+ import { createDeviceMessagingTokenProvider, MessagingTokenError, } from "../../messaging/token-provider.js";
32
42
  import { MessageClientBusyReplyHandler } from "./busy-reply.js";
33
43
  import { buildMessageBusCancelHandler, MESSAGE_TYPE_CHAT_CANCEL, } from "./cancel.js";
34
44
  import { buildMessageBusInboundHandler } from "./inbound.js";
@@ -51,6 +61,16 @@ export const DEFAULT_RETRY_SCHEDULE_MS = Object.freeze([
51
61
  ]);
52
62
  /** Attempt indices (1-based) where a `warn` log is preferred over `debug`. */
53
63
  const WARN_ATTEMPT_INDICES = new Set([1, 3, 5, 10]);
64
+ /**
65
+ * How many CONSECUTIVE definitive `401` messaging-token responses we
66
+ * tolerate before concluding the platform no longer recognises this
67
+ * device instance (deleted / unbound). With the default backoff this is
68
+ * ~7-8 minutes of solid 401s — well past any transient Agent Gateway
69
+ * blip, but short enough to give the operator a prompt signal. Only a
70
+ * `401` increments the counter; `5xx` / network / timeout do not (they
71
+ * are genuinely transient and must keep retrying).
72
+ */
73
+ const MAX_CONSECUTIVE_AUTH_FAILURES = 5;
54
74
  export class MessageBusPlugin {
55
75
  opts;
56
76
  name = "message-bus";
@@ -66,6 +86,23 @@ export class MessageBusPlugin {
66
86
  legacyDeprecationLogged = false;
67
87
  connectSettled = Promise.resolve();
68
88
  resolveConnectSettled = () => undefined;
89
+ /**
90
+ * Guards against running more than one connect loop concurrently. The
91
+ * loop can be (re-)armed from two places — `start()` and the terminal
92
+ * `disconnect` listener — so re-entrancy must be a no-op.
93
+ */
94
+ loopActive = false;
95
+ // Instance-invalidation detection (persistent 401 on messaging-token).
96
+ /** Consecutive definitive 401s; reset to 0 on any successful token fetch. */
97
+ consecutiveAuthFailures = 0;
98
+ /** True once we have connected at least once in this process. */
99
+ everConnected = false;
100
+ /**
101
+ * Set when persistent 401s indicate the platform instance is gone.
102
+ * Terminal: the connect loop stops and is NOT re-armed. Distinct from
103
+ * `stopped` (which is shutdown) so observers can tell the two apart.
104
+ */
105
+ invalidated = false;
69
106
  constructor(opts = {}) {
70
107
  this.opts = opts;
71
108
  }
@@ -120,33 +157,68 @@ export class MessageBusPlugin {
120
157
  get principalId() {
121
158
  return this.resolvedPrincipalId;
122
159
  }
160
+ /**
161
+ * True when persistent 401s have led us to conclude the platform
162
+ * instance is gone and we have halted reconnect. Surfaced for
163
+ * diagnostics (e.g. status endpoints / structured health snapshots).
164
+ */
165
+ get instanceSuspectedInvalid() {
166
+ return this.invalidated;
167
+ }
123
168
  whenSettled() {
124
169
  return this.connectSettled;
125
170
  }
126
171
  // ── Internals ──────────────────────────────────────────────────────────
127
172
  async runConnectLoop() {
128
- const ctx = this.ctx;
129
- const log = ctx.log;
130
- while (!this.stopped) {
131
- this.connectAttempt += 1;
132
- const ok = await this.tryConnectOnce(this.connectAttempt);
133
- if (ok) {
134
- this.resolveConnectSettled();
135
- return;
136
- }
137
- if (this.stopped) {
138
- this.resolveConnectSettled();
139
- return;
140
- }
141
- const delayMs = this.nextDelayMs(this.connectAttempt);
142
- this.logRetryScheduled(this.connectAttempt, delayMs, log);
143
- const cancelled = await this.sleep(delayMs);
144
- if (cancelled) {
145
- this.resolveConnectSettled();
146
- return;
173
+ // Re-entrancy guard: start() and the terminal-disconnect re-arm path
174
+ // can both call this; only one loop may run at a time.
175
+ if (this.loopActive)
176
+ return;
177
+ this.loopActive = true;
178
+ try {
179
+ const ctx = this.ctx;
180
+ const log = ctx.log;
181
+ while (!this.stopped && !this.invalidated) {
182
+ this.connectAttempt += 1;
183
+ const ok = await this.tryConnectOnce(this.connectAttempt);
184
+ if (ok) {
185
+ this.resolveConnectSettled();
186
+ return;
187
+ }
188
+ if (this.stopped || this.invalidated) {
189
+ this.resolveConnectSettled();
190
+ return;
191
+ }
192
+ const delayMs = this.nextDelayMs(this.connectAttempt);
193
+ this.logRetryScheduled(this.connectAttempt, delayMs, log);
194
+ const cancelled = await this.sleep(delayMs);
195
+ if (cancelled) {
196
+ this.resolveConnectSettled();
197
+ return;
198
+ }
147
199
  }
200
+ this.resolveConnectSettled();
148
201
  }
149
- this.resolveConnectSettled();
202
+ finally {
203
+ this.loopActive = false;
204
+ }
205
+ }
206
+ /**
207
+ * Re-arm the connect loop after a TERMINAL Centrifugo disconnect (the
208
+ * SDK has given up its own internal reconnect). Resets the backoff
209
+ * cursor so recovery starts from the shortest delay, then kicks a fresh
210
+ * loop (no-op if one is already running or we're shutting down).
211
+ */
212
+ rearmConnectLoop() {
213
+ if (this.stopped || this.invalidated)
214
+ return;
215
+ this.client = null;
216
+ if (this.tracker) {
217
+ this.tracker.reset();
218
+ this.tracker = null;
219
+ }
220
+ this.connectAttempt = 0;
221
+ void this.runConnectLoop();
150
222
  }
151
223
  /**
152
224
  * Single connect attempt. Returns `true` on success, `false` on any
@@ -155,15 +227,19 @@ export class MessageBusPlugin {
155
227
  * Each attempt builds a FRESH `MessageClient` — re-using one across
156
228
  * reconnects would carry stale handlers and confuse centrifuge-js
157
229
  * internal state. The client has its own internal reconnect once
158
- * `.connect()` succeeds; this loop is for the OPENING handshake only.
230
+ * `.connect()` succeeds; this loop opens the handshake and is re-armed
231
+ * by the `disconnect` listener on terminal failure (see class docstring).
159
232
  */
160
233
  async tryConnectOnce(attempt) {
161
234
  const ctx = this.ctx;
162
235
  const log = ctx.log;
163
236
  const keypair = this.opts.keypair;
164
237
  const agentGatewayUrl = ctx.config.agentGatewayUrl;
165
- const tokenProvider = this.opts.tokenProviderFactory?.({ agentGatewayUrl, keypair }) ??
238
+ const baseTokenProvider = this.opts.tokenProviderFactory?.({ agentGatewayUrl, keypair }) ??
166
239
  createDeviceMessagingTokenProvider({ agentGatewayUrl, keypair });
240
+ // Wrap so EVERY token fetch — the opening probe below AND centrifuge-js's
241
+ // internal JWT refreshes — funnels through the 401 detector.
242
+ const tokenProvider = this.instrumentTokenProvider(baseTokenProvider, log);
167
243
  // Probe the token once so we can pin identityId + serviceUrl + WSS
168
244
  // URL on the client. MessageClient itself will refresh the JWT
169
245
  // via centrifuge-js's internal refresh loop on every connect.
@@ -234,6 +310,17 @@ export class MessageBusPlugin {
234
310
  log.error({ err: err instanceof Error ? err.message : String(err), type: msg.type }, "message-bus: dispatch handler threw");
235
311
  }
236
312
  });
313
+ // EventEmitter rule: an emitted "error" with no listener becomes
314
+ // an unhandled exception and crashes the entire fleet daemon. The
315
+ // SDK forwards every Centrifugo transport error here (see
316
+ // message-sdk/client.js — `this.emit("error", ...)`), and these
317
+ // fire on every network blip / DNS hiccup / WebSocket close. The
318
+ // connect loop itself already handles reconnection via the
319
+ // tryConnectOnce backoff, so we only need to absorb the event
320
+ // and log it.
321
+ client.on("error", (err) => {
322
+ log.warn({ err: err instanceof Error ? err.message : String(err) }, "message-bus: client error (recovered by reconnect loop)");
323
+ });
237
324
  client.once("connect", () => {
238
325
  log.info({
239
326
  principalId,
@@ -242,6 +329,27 @@ export class MessageBusPlugin {
242
329
  attempt,
243
330
  }, "message-bus: connected");
244
331
  });
332
+ // Terminal-disconnect re-arm. centrifuge-js keeps transient blips in
333
+ // its `connecting` state and reconnects on its own (re-emitting
334
+ // `connect`); it only surfaces a `disconnect` here when it has GIVEN
335
+ // UP for good (non-recoverable close code, or token refresh failing
336
+ // past its tolerance). Without this, the opening loop — which exits
337
+ // after the first successful connect — would never re-fire and the
338
+ // device would silently stop receiving messages until fleet restart.
339
+ //
340
+ // Guards:
341
+ // - `this.stopped` → shutdown initiated, do not re-arm.
342
+ // - `this.client !== client` → this is a stale / failed-handshake
343
+ // client (we only assign `this.client` after a successful
344
+ // connect), so the connect loop already owns its lifecycle.
345
+ client.on("disconnect", (info) => {
346
+ if (this.stopped || this.invalidated)
347
+ return;
348
+ if (this.client !== client)
349
+ return;
350
+ log.warn({ code: info.code, reason: info.reason }, "message-bus: terminal disconnect — re-arming connect loop");
351
+ this.rearmConnectLoop();
352
+ });
245
353
  try {
246
354
  await client.connect({ identityId: principalId });
247
355
  }
@@ -258,8 +366,77 @@ export class MessageBusPlugin {
258
366
  this.client = client;
259
367
  this.tracker = tracker;
260
368
  this.resolvedPrincipalId = principalId;
369
+ this.everConnected = true;
261
370
  return true;
262
371
  }
372
+ /**
373
+ * Wrap a token provider so consecutive definitive `401`s are counted.
374
+ * A `401` means the Agent Gateway no longer recognises this device's
375
+ * Ed25519 key — i.e. the platform instance was deleted / unbound. We
376
+ * reset the counter on any success, and only count `401` (transient
377
+ * `5xx` / network errors keep retrying without polluting the count).
378
+ */
379
+ instrumentTokenProvider(provider, log) {
380
+ return async (identityId) => {
381
+ try {
382
+ const tok = await provider(identityId);
383
+ this.consecutiveAuthFailures = 0;
384
+ return tok;
385
+ }
386
+ catch (err) {
387
+ if (err instanceof MessagingTokenError && err.status === 401) {
388
+ this.consecutiveAuthFailures += 1;
389
+ if (this.consecutiveAuthFailures === MAX_CONSECUTIVE_AUTH_FAILURES) {
390
+ this.onPersistentAuthFailure(log);
391
+ }
392
+ }
393
+ throw err;
394
+ }
395
+ };
396
+ }
397
+ /**
398
+ * Fired once when 401s cross the threshold. Always emits a loud,
399
+ * actionable error (the authoritative ops signal via `fleet logs`).
400
+ * Halts reconnect ONLY if we had previously connected — a never-yet-
401
+ * connected agent might just be racing platform provisioning (the
402
+ * instance's `agentPublicKey` not seeded yet), and must keep trying;
403
+ * but an instance that WAS working and now returns 401 is genuinely
404
+ * gone, so we stop hammering and wait for a re-bind.
405
+ */
406
+ onPersistentAuthFailure(log) {
407
+ log.error({
408
+ consecutiveAuthFailures: this.consecutiveAuthFailures,
409
+ everConnected: this.everConnected,
410
+ }, this.everConnected
411
+ ? "message-bus: messaging-token rejected with 401 repeatedly after a working connection — this device instance is no longer recognised by the platform (deleted/unbound). Halting reconnect; re-bind the device (see scripts/device-rebind-guide.md) to restore messaging."
412
+ : "message-bus: messaging-token rejected with 401 repeatedly and we have never connected — the platform instance may not be provisioned yet, or the binding is stale. Will keep retrying; if this persists, re-bind the device (see scripts/device-rebind-guide.md).");
413
+ if (this.everConnected) {
414
+ this.markInvalidated();
415
+ }
416
+ }
417
+ /**
418
+ * Terminal stop on instance invalidation. Unlike `stop()` (shutdown),
419
+ * this is driven by the platform having dropped the instance. Cancels
420
+ * retries, tears down any live client, and prevents re-arm.
421
+ */
422
+ markInvalidated() {
423
+ if (this.invalidated)
424
+ return;
425
+ this.invalidated = true;
426
+ this.cancelPendingRetry();
427
+ const client = this.client;
428
+ this.client = null;
429
+ if (client) {
430
+ void client.disconnect().catch(() => {
431
+ /* best-effort teardown of a now-orphaned subscription */
432
+ });
433
+ }
434
+ if (this.tracker) {
435
+ this.tracker.reset();
436
+ this.tracker = null;
437
+ }
438
+ this.resolveConnectSettled();
439
+ }
263
440
  nextDelayMs(attempt) {
264
441
  const schedule = this.opts.retrySchedule ?? DEFAULT_RETRY_SCHEDULE_MS;
265
442
  const idx = Math.min(attempt - 1, schedule.length - 1);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/message-bus/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EACL,aAAa,GAGd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kCAAkC,EAAE,MAAM,mCAAmC,CAAC;AAIvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsB,MAAM,CAAC,MAAM,CAAC;IACxE,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;CACR,CAAC,CAAC;AAEH,8EAA8E;AAC9E,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAA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CAAC,CAAC,OAAO,CAAC;QACzC,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beeos-ai/device-agent",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "BeeOS device-agent — Android/desktop AI control agent (TypeScript) speaking ACP over Bridge WebSocket. Connects to a sibling device-mcp-server process for device control.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",