@econ-v1/domain 7.6.161 → 7.6.162
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/events/index.d.ts +4 -3
- package/dist/events/index.d.ts.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/models/node-status.d.ts +30 -0
- package/dist/models/node-status.d.ts.map +1 -0
- package/dist/services/remote-status.d.ts +78 -0
- package/dist/services/remote-status.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/events/index.js +3 -2
- package/src/index.js +9 -0
- package/src/models/node-status.js +131 -0
- package/src/services/remote-status.js +163 -0
package/dist/events/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @typedef {(typeof KERNEL_EVENT_TYPES)[number]} CoreKernelEventType */
|
|
2
2
|
/** @typedef {AppEventType | CoreKernelEventType} KernelEventType */
|
|
3
|
-
/** @typedef {{ readonly "client-presence.changed": { readonly deviceId: string }, readonly "client-storage.state-changed": { readonly code?: string, readonly message?: string, readonly status: "ready" | "recovery-required" | "starting" }, readonly "offline.stage-progress-changed": {}, readonly "offline.stage-readiness-changed": { readonly readiness: OfflineStageReadiness }, readonly "offline.identity-invalidated": { readonly scope: OfflineIdentityScope }, readonly "app.data.changed": { readonly appName: string, readonly cursor: string, readonly revision: string, readonly stream: string }, readonly "app.data.committed": { readonly appName: string, readonly cursor: string, readonly revision: string, readonly stream: string }, readonly "device-cleanup.changed": { readonly state?: string }, readonly "domain.entity-changed": { readonly entity?: "push" | string, readonly action: "created" | "deleted" | "updated", readonly entityId: string, readonly entityType: string }, readonly "onboarding.flow-changed": { readonly stepId: string }, readonly "outbox.state-changed": { readonly intent: OutboxIntent }, readonly "room.job-stream": RoomJobStreamPayload, readonly "room.turn-stream": RoomTurnStreamPayload, readonly "stage.catalog-invalidated": { readonly reason: string }, readonly "query.invalidated": { readonly name: QueryName }, readonly "stage.registry-changed": { readonly appNames: readonly string[] }, readonly "shell.stage.app-changed": { readonly app: string | null }, readonly "sync.delta-applied": { readonly domain: string, readonly cursor: string }, readonly "transport.request-loop-suspected": { readonly caller: string, readonly operation: string, readonly action: "suspected" | "cleared", readonly enforced: false }, readonly "transport.request-budget-exceeded": { readonly scope?: "caller" | "total", readonly operation?: string, readonly enforced?: boolean, readonly caller: string, readonly observedRate: number, readonly action: "delayed" | "refused" | "suspended" | "cleared", readonly retryAfterMs: number }, readonly "transport.state-changed": { readonly state: TransportState }, readonly "connectivity.changed": { readonly reachability: "online" | "unreachable" | "session-required" | "unknown" }, readonly "ip-pool.health-changed": { readonly connectionState: "closed" | "filtered" | "open" | "unknown", readonly consecutiveFailures: number, readonly ipEntryId: string, readonly isHealthy: boolean, readonly latencyMs?: number } }} KernelEventPayloads */
|
|
3
|
+
/** @typedef {{ readonly "client-presence.changed": { readonly deviceId: string }, readonly "client-storage.state-changed": { readonly code?: string, readonly message?: string, readonly status: "ready" | "recovery-required" | "starting" }, readonly "offline.stage-progress-changed": {}, readonly "offline.stage-readiness-changed": { readonly readiness: OfflineStageReadiness }, readonly "offline.identity-invalidated": { readonly scope: OfflineIdentityScope }, readonly "app.data.changed": { readonly appName: string, readonly cursor: string, readonly revision: string, readonly stream: string }, readonly "app.data.committed": { readonly appName: string, readonly cursor: string, readonly revision: string, readonly stream: string }, readonly "device-cleanup.changed": { readonly state?: string }, readonly "domain.entity-changed": { readonly entity?: "push" | string, readonly action: "created" | "deleted" | "updated", readonly entityId: string, readonly entityType: string }, readonly "onboarding.flow-changed": { readonly stepId: string }, readonly "outbox.state-changed": { readonly intent: OutboxIntent }, readonly "room.job-stream": RoomJobStreamPayload, readonly "room.turn-stream": RoomTurnStreamPayload, readonly "stage.catalog-invalidated": { readonly reason: string }, readonly "query.invalidated": { readonly name: QueryName }, readonly "stage.registry-changed": { readonly appNames: readonly string[] }, readonly "shell.stage.app-changed": { readonly app: string | null }, readonly "sync.delta-applied": { readonly domain: string, readonly cursor: string }, readonly "transport.request-loop-suspected": { readonly caller: string, readonly operation: string, readonly action: "suspected" | "cleared", readonly enforced: false }, readonly "transport.request-budget-exceeded": { readonly scope?: "caller" | "total", readonly operation?: string, readonly enforced?: boolean, readonly caller: string, readonly observedRate: number, readonly action: "delayed" | "refused" | "suspended" | "cleared", readonly retryAfterMs: number }, readonly "transport.state-changed": { readonly state: TransportState }, readonly "connectivity.changed": { readonly reachability: "online" | "unreachable" | "session-required" | "unknown" }, readonly "node.remote-status.changed": {}, readonly "ip-pool.health-changed": { readonly connectionState: "closed" | "filtered" | "open" | "unknown", readonly consecutiveFailures: number, readonly ipEntryId: string, readonly isHealthy: boolean, readonly latencyMs?: number } }} KernelEventPayloads */
|
|
4
4
|
/** @template {KernelEventType} T @typedef {T extends CoreKernelEventType ? KernelEventPayloads[T] : AppEventPayload} KernelEventPayload */
|
|
5
5
|
/** @template {KernelEventType} T @typedef {{ readonly occurredAt: string, readonly payload: KernelEventPayload<T>, readonly type: T }} KernelEventByType */
|
|
6
6
|
/** @typedef {{ readonly occurredAt: string, readonly payload: AppEventPayload, readonly type: AppEventType }} AppDomainEvent */
|
|
@@ -25,8 +25,8 @@ export function appEventScope(value: string): AppEventType | undefined;
|
|
|
25
25
|
export function appEventType(resource: string, instance?: string): AppEventType;
|
|
26
26
|
/** @param {string} value @returns {value is QueryName} */
|
|
27
27
|
export function isQueryName(value: string): value is QueryName;
|
|
28
|
-
/** @type {readonly ["transport.request-loop-suspected", "transport.request-budget-exceeded", "transport.state-changed", "stage.catalog-invalidated", "stage.registry-changed", "query.invalidated", "outbox.state-changed", "domain.entity-changed", "sync.delta-applied", "client-storage.state-changed", "offline.stage-progress-changed", "offline.stage-readiness-changed", "offline.identity-invalidated", "app.data.changed", "app.data.committed", "onboarding.flow-changed", "device-cleanup.changed", "room.turn-stream", "room.job-stream", "connectivity.changed", "ip-pool.health-changed", "shell.stage.app-changed", "client-presence.changed"]} */
|
|
29
|
-
export const KERNEL_EVENT_TYPES: readonly ["transport.request-loop-suspected", "transport.request-budget-exceeded", "transport.state-changed", "stage.catalog-invalidated", "stage.registry-changed", "query.invalidated", "outbox.state-changed", "domain.entity-changed", "sync.delta-applied", "client-storage.state-changed", "offline.stage-progress-changed", "offline.stage-readiness-changed", "offline.identity-invalidated", "app.data.changed", "app.data.committed", "onboarding.flow-changed", "device-cleanup.changed", "room.turn-stream", "room.job-stream", "connectivity.changed", "ip-pool.health-changed", "shell.stage.app-changed", "client-presence.changed"];
|
|
28
|
+
/** @type {readonly ["transport.request-loop-suspected", "transport.request-budget-exceeded", "transport.state-changed", "stage.catalog-invalidated", "stage.registry-changed", "query.invalidated", "outbox.state-changed", "domain.entity-changed", "sync.delta-applied", "client-storage.state-changed", "offline.stage-progress-changed", "offline.stage-readiness-changed", "offline.identity-invalidated", "app.data.changed", "app.data.committed", "onboarding.flow-changed", "device-cleanup.changed", "room.turn-stream", "room.job-stream", "connectivity.changed", "node.remote-status.changed", "ip-pool.health-changed", "shell.stage.app-changed", "client-presence.changed"]} */
|
|
29
|
+
export const KERNEL_EVENT_TYPES: readonly ["transport.request-loop-suspected", "transport.request-budget-exceeded", "transport.state-changed", "stage.catalog-invalidated", "stage.registry-changed", "query.invalidated", "outbox.state-changed", "domain.entity-changed", "sync.delta-applied", "client-storage.state-changed", "offline.stage-progress-changed", "offline.stage-readiness-changed", "offline.identity-invalidated", "app.data.changed", "app.data.committed", "onboarding.flow-changed", "device-cleanup.changed", "room.turn-stream", "room.job-stream", "connectivity.changed", "node.remote-status.changed", "ip-pool.health-changed", "shell.stage.app-changed", "client-presence.changed"];
|
|
30
30
|
export type CoreKernelEventType = (typeof KERNEL_EVENT_TYPES)[number];
|
|
31
31
|
export type KernelEventType = AppEventType | CoreKernelEventType;
|
|
32
32
|
export type KernelEventPayloads = {
|
|
@@ -111,6 +111,7 @@ export type KernelEventPayloads = {
|
|
|
111
111
|
readonly "connectivity.changed": {
|
|
112
112
|
readonly reachability: "online" | "unreachable" | "session-required" | "unknown";
|
|
113
113
|
};
|
|
114
|
+
readonly "node.remote-status.changed": {};
|
|
114
115
|
readonly "ip-pool.health-changed": {
|
|
115
116
|
readonly connectionState: "closed" | "filtered" | "open" | "unknown";
|
|
116
117
|
readonly consecutiveFailures: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.js"],"names":[],"mappings":"AAsEA,yEAAyE;AACzE,oEAAoE;AAUpE,o+EAAo+E;AACp+E,2IAA2I;AAC3I,4JAA4J;AAC5J,gIAAgI;AAChI,wHAAwH;AAExH,kJAAkJ;AAClJ,kCADoC,CAAC,SAAtB,mBAAoB,SAAW,WAAW,QAAgB,CAAC,GAAiB,KAAK,IAAI,OAAO,CAAC,WAAW,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAG7I;AAED,oEAAoE;AACpE,6CADY,MAAM,GAAkB,KAAK,IAAI,mBAAmB,CAK/D;AAED,6DAA6D;AAC7D,sCADY,MAAM,GAAkB,KAAK,IAAI,YAAY,CAGxD;AAED,gEAAgE;AAChE,yCADY,MAAM,GAAkB,KAAK,IAAI,eAAe,CAG3D;AAED,0DAA0D;AAC1D,wCADY,MAAM,GAAkB,MAAM,GAAG,SAAS,CAGrD;AAED,0DAA0D;AAC1D,wCADY,MAAM,GAAkB,MAAM,GAAG,SAAS,CAGrD;AAED,gEAAgE;AAChE,qCADY,MAAM,GAAkB,YAAY,GAAG,SAAS,CAI3D;AAED,kFAAkF;AAClF,uCADY,MAAM,aAAmB,MAAM,GAAuB,YAAY,CAU7E;AAED,0DAA0D;AAC1D,mCADY,MAAM,GAAkB,KAAK,IAAI,SAAS,CAGrD;AAlGD,gqBAAgqB;AAChqB,iCADW,SAAS,CAAC,kCAAkC,EAAE,mCAAmC,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,wBA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C;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE;mCAC7R;IAAE,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { DeviceCleanupService } from "./services/device-cleanup-service.js";
|
|
|
15
15
|
export { LcdDecisionService } from "./services/lcd-decision-service.js";
|
|
16
16
|
export { OwnerClaimService } from "./services/owner-claim-service.js";
|
|
17
17
|
export { HomeGossipMirror } from "./services/home-gossip-mirror.js";
|
|
18
|
+
export { projectRemoteStatus } from "./services/remote-status.js";
|
|
18
19
|
export type ClientError = import("./errors/index.js").ClientError;
|
|
19
20
|
export type DomainErrorCode = import("./errors/index.js").DomainErrorCode;
|
|
20
21
|
export type ErrorOptions<TCode extends string> = import("./errors/index.js").ErrorOptions<TCode>;
|
|
@@ -259,6 +260,11 @@ export type PushSupport = import("./models/push.js").PushSupport;
|
|
|
259
260
|
export type TransportRungName = import("./network/route-order.js").TransportRungName;
|
|
260
261
|
export type TransportOrigin = import("./network/route-order.js").TransportOrigin;
|
|
261
262
|
export type RouteSpeedTier = import("./network/route-speed.js").RouteSpeedTier;
|
|
263
|
+
export type NodeStatus = import("./models/node-status.js").NodeStatus;
|
|
264
|
+
export type NodeStatusState = import("./models/node-status.js").NodeStatusState;
|
|
265
|
+
export type NodeStatusReason = import("./models/node-status.js").NodeStatusReason;
|
|
266
|
+
export type RemoteStatus = import("./services/remote-status.js").RemoteStatus;
|
|
267
|
+
export type RemoteStatusKind = import("./services/remote-status.js").RemoteStatusKind;
|
|
262
268
|
export { DOMAIN_ERROR_CODES, DomainError, SYNC_ERROR_CODES, SyncError, TRANSPORT_ERROR_CODES, TransportError } from "./errors/index.js";
|
|
263
269
|
export { appEventInstance, appEventResource, appEventScope, appEventType, isAppEventType, isCoreKernelEvent, isCoreKernelEventType, isKernelEventType, isQueryName, KERNEL_EVENT_TYPES } from "./events/index.js";
|
|
264
270
|
export { REVISIONED_DOMAINS, AGENT_STATUSES, parseAgentValue, parseGraphValue, APP_DATA_MAX_PAYLOAD_BYTES, assertAppDataPayload, compareAppDataRevision, isAppDataSyncResponse, isNodeAppBudgetState, isNodeAppLaneKind, isNodeAppMemoryAttribution, isNodeAppMemoryAvailability, isNodeAppMemoryBudgetBasis, isNodeAppMemorySource, isNodeAppMemoryTrendVerdict, isNodeAppMemoryUnavailableReason, isNodeAppPressureState, isNodeAppRuntimeMode, isNodeAppTerminationReason, NODE_APP_BUDGET_STATES, NODE_APP_LANE_KINDS, NODE_APP_MEMORY_ATTRIBUTIONS, NODE_APP_MEMORY_AVAILABILITIES, NODE_APP_MEMORY_BUDGET_BASES, NODE_APP_MEMORY_SOURCES, NODE_APP_MEMORY_TREND_VERDICTS, NODE_APP_MEMORY_UNAVAILABLE_REASONS, NODE_APP_PRESSURE_STATES, NODE_APP_RUNTIME_MODES, NODE_APP_TERMINATION_REASONS, REVISIONED_COMMAND_NAMES, createAgentUpdateCommand, createGraphUpdateCommand, createResolveRevisionConflictCommand, createRevisionedUpdateCommand, canonicalOutboxPayload, isDelegationActive, isDevicePublicIdentity, normalizeDelegation, publicIdentityDiagnostic } from "./models/index.js";
|
|
@@ -288,5 +294,6 @@ export { safeOpenPath, parsePushPayload, derivePushDeviceStatus, isPushTag } fro
|
|
|
288
294
|
export { classifyOrigin, routeOrder } from "./network/route-order.js";
|
|
289
295
|
export { ROUTE_SPEED_TIERS, speedTier } from "./network/route-speed.js";
|
|
290
296
|
export { formatNodeLabel, shortNodeId } from "./services/node-label.js";
|
|
297
|
+
export { NODE_STATUS_SIGNING_DOMAIN, parseNodeStatus } from "./models/node-status.js";
|
|
291
298
|
export { DEFAULT_ROUTE_SELECTION_POLICY, ROUTE_SELECTION_DEFAULTS } from "./network/route-selection.js";
|
|
292
299
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;0BAGa,OAAO,mBAAmB,EAAE,WAAW;8BAGvC,OAAO,mBAAmB,EAAE,eAAe;yBAGlC,KAAK,SAAd,MAAQ,IACR,OAAO,mBAAmB,EAAE,YAAY,CAAC,KAAK,CAAC;sCAG/C,OAAO,mBAAmB,EAAE,uBAAuB;8BAG1C,KAAK,SAAd,MAAQ,EACC,KAAK,SAAd,MAAQ,IACR,OAAO,mBAAmB,EAAE,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC;4BAG3D,OAAO,mBAAmB,EAAE,aAAa;iCAGzC,OAAO,mBAAmB,EAAE,kBAAkB;0BAG9C,OAAO,mBAAmB,EAAE,WAAW;6BAEtC,OAAO,mBAAmB,EAAE,cAAc;8BAC1C,OAAO,mBAAmB,EAAE,eAAe;2BAC3C,OAAO,mBAAmB,EAAE,YAAY;kCACxC,OAAO,mBAAmB,EAAE,mBAAmB;8BAE9B,CAAC,SAAlB,eAAgB,IACjB,OAAO,mBAAmB,EAAE,iBAAiB,CAAC,CAAC,CAAC;+BAG9B,CAAC,SAAlB,eAAgB,IACjB,OAAO,mBAAmB,EAAE,kB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,yCAAyC,EAAE,8BAA8B;wCAGhF,OAAO,yCAAyC,EAAE,yBAAyB;0CAG3E,OAAO,yCAAyC,EAAE,2BAA2B;2CAG7E,OAAO,yCAAyC,EAAE,4BAA4B;gCA2C7E,OAAO,sCAAsC,EAAE,iBAAiB;0CAChE,OAAO,sCAAsC,EAAE,2BAA2B;iCAC1E,OAAO,sCAAsC,EAAE,kBAAkB;wBAajE,OAAO,wBAAwB,EAAE,SAAS;gCAC1C,OAAO,wBAAwB,EAAE,iBAAiB;4BAClD,OAAO,wBAAwB,EAAE,aAAa;8BAC9C,OAAO,wBAAwB,EAAE,eAAe;6BAChD,OAAO,wBAAwB,EAAE,cAAc;gCAC/C,OAAO,wBAAwB,EAAE,iBAAiB;6BAIlD,OAAO,yBAAyB,EAAE,cAAc;4BAChD,OAAO,yBAAyB,EAAE,aAAa;+BAG/C,OAAO,kBAAkB,EAAE,gBAAgB;0BAC3C,OAAO,kBAAkB,EAAE,WAAW;gCAGtC,OAAO,0BAA0B,EAAE,iBAAiB;8BACpD,OAAO,0BAA0B,EAAE,eAAe;6BAClD,OAAO,0BAA0B,EAAE,cAAc;yBAMjD,OAAO,yBAAyB,EAAE,UAAU;8BAC5C,OAAO,yBAAyB,EAAE,eAAe;+BACjD,OAAO,yBAAyB,EAAE,gBAAgB;2BAGlD,OAAO,6BAA6B,EAAE,YAAY;+BAClD,OAAO,6BAA6B,EAAE,gBAAgB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses and validates the wire shape of a `node_status` claim: the closed `state`/`reason`
|
|
3
|
+
* sets, their combination rules with `expected_back_ms`, the non-negative integer fields,
|
|
4
|
+
* the `sig_scheme`/`sig` presence, and the 384-byte wire-size cap — everything the Rust
|
|
5
|
+
* producer enforces before it signs one, except the signature itself.
|
|
6
|
+
*
|
|
7
|
+
* Returns `null` unless `value.node_id` equals the pinned `homeNodeId` — a status naming a
|
|
8
|
+
* different node must never be attributed to this node's home — and unless every other rule
|
|
9
|
+
* holds.
|
|
10
|
+
*
|
|
11
|
+
* @param {unknown} value
|
|
12
|
+
* @param {string} homeNodeId
|
|
13
|
+
* @returns {NodeStatus | null}
|
|
14
|
+
*/
|
|
15
|
+
export function parseNodeStatus(value: unknown, homeNodeId: string): NodeStatus | null;
|
|
16
|
+
/**
|
|
17
|
+
* The wire's domain-separation prefix a `node_status` signature covers. Shared with
|
|
18
|
+
* `verifyLnSignedObject` at the call site — this module never verifies signatures itself.
|
|
19
|
+
*/
|
|
20
|
+
export const NODE_STATUS_SIGNING_DOMAIN: "node-status-v1:";
|
|
21
|
+
export type NodeStatusState = "normal" | "maintenance" | "degraded";
|
|
22
|
+
export type NodeStatusReason = "ota" | "low_memory" | "storage_full" | "service_down" | "update_failed";
|
|
23
|
+
export type NodeStatus = {
|
|
24
|
+
readonly state: NodeStatusState;
|
|
25
|
+
readonly reason?: NodeStatusReason;
|
|
26
|
+
readonly sinceMs: number;
|
|
27
|
+
readonly expectedBackMs?: number;
|
|
28
|
+
readonly seq: number;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=node-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-status.d.ts","sourceRoot":"","sources":["../../src/models/node-status.js"],"names":[],"mappings":"AAmEA;;;;;;;;;;;;;GAaG;AACH,uCAJW,OAAO,cACP,MAAM,GACJ,UAAU,GAAG,IAAI,CAmD7B;AAtGD;;;GAGG;AACH,yCAA0C,iBAAiB,CAAC;8BAd9C,QAAQ,GAAG,aAAa,GAAG,UAAU;+BACrC,KAAK,GAAG,YAAY,GAAG,cAAc,GAAG,cAAc,GAAG,eAAe;yBACxE;IAAE,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projects the owner-facing explanation for why the home node is unreachable, from the
|
|
3
|
+
* locally cached `NodeStatus` and (if a gossip-relay lookup completed) a status another
|
|
4
|
+
* member answered with. Pure: no I/O, no clock reads — `nowMs` is supplied by the caller.
|
|
5
|
+
*
|
|
6
|
+
* ## `kind: "none"`
|
|
7
|
+
* Means no lookup has completed yet AND there is nothing locally cached either — nothing
|
|
8
|
+
* is known either way, not even "silent". Expressed as `asked === 0 && fetched === null &&
|
|
9
|
+
* !fetchedCardNewer && local === null`: the caller hasn't asked anyone, hasn't been handed
|
|
10
|
+
* a fetched status, hasn't observed a newer card, and has no cached local status to fall
|
|
11
|
+
* back on. When `asked === 0` but a `local` status IS cached (e.g. a pre-OTA maintenance
|
|
12
|
+
* announce already in the mirror), evaluation falls through to that `local` status exactly
|
|
13
|
+
* as the no-newer-card branch below does — `asked: 0` only means the lookup hasn't asked
|
|
14
|
+
* anyone yet, not that the locally known status should be hidden.
|
|
15
|
+
*
|
|
16
|
+
* ## Which status is "effective"
|
|
17
|
+
* - `fetched` counts only when `fetchedCardNewer` is true, `fetched` is non-null, and
|
|
18
|
+
* (`local` is `null` or `fetched.seq > local.seq`). A fetched status at or below the
|
|
19
|
+
* local seq is a stale/replayed read and is ignored outright — evaluation falls back to
|
|
20
|
+
* `local`, exactly as if nothing had been fetched at all.
|
|
21
|
+
* - A newer card that carries no status at all (`fetchedCardNewer` true, `fetched` `null`,
|
|
22
|
+
* e.g. a member still running pre-node_status gossip) is never treated as `"normal"` and
|
|
23
|
+
* never falls back to evaluating `local`'s timing — it is reported `"silent"` directly.
|
|
24
|
+
* `lastState` still reflects `local`'s last known state (`"updating"` when
|
|
25
|
+
* `local.state === "maintenance"`, else `"normal"`), since that is the last thing
|
|
26
|
+
* actually known before this newer, status-less card arrived.
|
|
27
|
+
* - Otherwise (no newer card at all) evaluation falls back to `local`.
|
|
28
|
+
*
|
|
29
|
+
* ## Timing (applied to whichever status is effective)
|
|
30
|
+
* - `state: "normal"` (or no effective status at all) → `"silent"` with
|
|
31
|
+
* `lastState: "normal"`.
|
|
32
|
+
* - `state: "degraded"` → `"degraded"`, carrying `reason` and `sinceMs` through untouched.
|
|
33
|
+
* - `state: "maintenance"` with no `expectedBackMs` → `"updating"` forever; no overdue or
|
|
34
|
+
* silent timer ever fires.
|
|
35
|
+
* - `state: "maintenance"` with `expectedBackMs` → `"updating"` until
|
|
36
|
+
* `nowMs > expectedBackMs + 2 minutes`, then `"overdue"`, then — once
|
|
37
|
+
* `nowMs > expectedBackMs + 60 minutes` — `"silent"` with `lastState: "updating"`.
|
|
38
|
+
*
|
|
39
|
+
* Provenance: `member` is carried through to the result only when `fetched` was the
|
|
40
|
+
* effective status — only then can the reading be attributed to whoever answered. In every
|
|
41
|
+
* other branch `member` is dropped even if supplied, leaving the result to report `asked`
|
|
42
|
+
* alone ("asked N nodes, none heard anything newer"). `lastHeardMs` and `asked` are always
|
|
43
|
+
* passed through untouched.
|
|
44
|
+
*
|
|
45
|
+
* @param {{
|
|
46
|
+
* local: NodeStatus | null,
|
|
47
|
+
* fetched: NodeStatus | null,
|
|
48
|
+
* fetchedCardNewer: boolean,
|
|
49
|
+
* lastHeardMs: number | undefined,
|
|
50
|
+
* nowMs: number,
|
|
51
|
+
* member?: string,
|
|
52
|
+
* asked: number,
|
|
53
|
+
* }} input
|
|
54
|
+
* @returns {RemoteStatus}
|
|
55
|
+
*/
|
|
56
|
+
export function projectRemoteStatus({ local, fetched, fetchedCardNewer, lastHeardMs, nowMs, member, asked }: {
|
|
57
|
+
local: NodeStatus | null;
|
|
58
|
+
fetched: NodeStatus | null;
|
|
59
|
+
fetchedCardNewer: boolean;
|
|
60
|
+
lastHeardMs: number | undefined;
|
|
61
|
+
nowMs: number;
|
|
62
|
+
member?: string;
|
|
63
|
+
asked: number;
|
|
64
|
+
}): RemoteStatus;
|
|
65
|
+
export type NodeStatus = import("../models/node-status.js").NodeStatus;
|
|
66
|
+
export type NodeStatusReason = import("../models/node-status.js").NodeStatusReason;
|
|
67
|
+
export type RemoteStatusKind = "none" | "updating" | "overdue" | "degraded" | "silent";
|
|
68
|
+
export type RemoteStatus = {
|
|
69
|
+
readonly kind: RemoteStatusKind;
|
|
70
|
+
readonly reason?: NodeStatusReason;
|
|
71
|
+
readonly sinceMs?: number;
|
|
72
|
+
readonly expectedBackMs?: number;
|
|
73
|
+
readonly lastHeardMs?: number;
|
|
74
|
+
readonly lastState?: "normal" | "updating";
|
|
75
|
+
readonly member?: string;
|
|
76
|
+
readonly asked: number;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=remote-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-status.d.ts","sourceRoot":"","sources":["../../src/services/remote-status.js"],"names":[],"mappings":"AAoCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,6GAXW;IACN,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,GACS,YAAY,CAkBxB;yBAxGY,OAAO,0BAA0B,EAAE,UAAU;+BAG7C,OAAO,0BAA0B,EAAE,gBAAgB;+BAGlD,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ;2BAGxD;IACZ,QAAY,CAAC,IAAI,EAAE,gBAAgB,CAAC;IACpC,QAAY,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IACvC,QAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAY,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACrC,QAAY,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAClC,QAAY,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC/C,QAAY,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAY,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@econ-v1/domain",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.162",
|
|
4
4
|
"description": "Platform-neutral domain contracts and errors for Node clients",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"author": "Node contributors",
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@econ-v1/ports": "7.6.
|
|
60
|
+
"@econ-v1/ports": "7.6.162"
|
|
61
61
|
}
|
|
62
62
|
}
|
package/src/events/index.js
CHANGED
|
@@ -40,7 +40,7 @@ function parseAppEventType(value) {
|
|
|
40
40
|
return { instance, resource };
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/** @type {readonly ["transport.request-loop-suspected", "transport.request-budget-exceeded", "transport.state-changed", "stage.catalog-invalidated", "stage.registry-changed", "query.invalidated", "outbox.state-changed", "domain.entity-changed", "sync.delta-applied", "client-storage.state-changed", "offline.stage-progress-changed", "offline.stage-readiness-changed", "offline.identity-invalidated", "app.data.changed", "app.data.committed", "onboarding.flow-changed", "device-cleanup.changed", "room.turn-stream", "room.job-stream", "connectivity.changed", "ip-pool.health-changed", "shell.stage.app-changed", "client-presence.changed"]} */
|
|
43
|
+
/** @type {readonly ["transport.request-loop-suspected", "transport.request-budget-exceeded", "transport.state-changed", "stage.catalog-invalidated", "stage.registry-changed", "query.invalidated", "outbox.state-changed", "domain.entity-changed", "sync.delta-applied", "client-storage.state-changed", "offline.stage-progress-changed", "offline.stage-readiness-changed", "offline.identity-invalidated", "app.data.changed", "app.data.committed", "onboarding.flow-changed", "device-cleanup.changed", "room.turn-stream", "room.job-stream", "connectivity.changed", "node.remote-status.changed", "ip-pool.health-changed", "shell.stage.app-changed", "client-presence.changed"]} */
|
|
44
44
|
export const KERNEL_EVENT_TYPES = [
|
|
45
45
|
"transport.request-loop-suspected",
|
|
46
46
|
"transport.request-budget-exceeded",
|
|
@@ -62,6 +62,7 @@ export const KERNEL_EVENT_TYPES = [
|
|
|
62
62
|
"room.turn-stream",
|
|
63
63
|
"room.job-stream",
|
|
64
64
|
"connectivity.changed",
|
|
65
|
+
"node.remote-status.changed",
|
|
65
66
|
"ip-pool.health-changed",
|
|
66
67
|
"shell.stage.app-changed",
|
|
67
68
|
"client-presence.changed",
|
|
@@ -78,7 +79,7 @@ export const KERNEL_EVENT_TYPES = [
|
|
|
78
79
|
* shape a de-duplication would take — declared in `@econ-v1/ports` and re-exported outward — and
|
|
79
80
|
* is the follow-up if this union ever grows a fifth state.
|
|
80
81
|
*/
|
|
81
|
-
/** @typedef {{ readonly "client-presence.changed": { readonly deviceId: string }, readonly "client-storage.state-changed": { readonly code?: string, readonly message?: string, readonly status: "ready" | "recovery-required" | "starting" }, readonly "offline.stage-progress-changed": {}, readonly "offline.stage-readiness-changed": { readonly readiness: OfflineStageReadiness }, readonly "offline.identity-invalidated": { readonly scope: OfflineIdentityScope }, readonly "app.data.changed": { readonly appName: string, readonly cursor: string, readonly revision: string, readonly stream: string }, readonly "app.data.committed": { readonly appName: string, readonly cursor: string, readonly revision: string, readonly stream: string }, readonly "device-cleanup.changed": { readonly state?: string }, readonly "domain.entity-changed": { readonly entity?: "push" | string, readonly action: "created" | "deleted" | "updated", readonly entityId: string, readonly entityType: string }, readonly "onboarding.flow-changed": { readonly stepId: string }, readonly "outbox.state-changed": { readonly intent: OutboxIntent }, readonly "room.job-stream": RoomJobStreamPayload, readonly "room.turn-stream": RoomTurnStreamPayload, readonly "stage.catalog-invalidated": { readonly reason: string }, readonly "query.invalidated": { readonly name: QueryName }, readonly "stage.registry-changed": { readonly appNames: readonly string[] }, readonly "shell.stage.app-changed": { readonly app: string | null }, readonly "sync.delta-applied": { readonly domain: string, readonly cursor: string }, readonly "transport.request-loop-suspected": { readonly caller: string, readonly operation: string, readonly action: "suspected" | "cleared", readonly enforced: false }, readonly "transport.request-budget-exceeded": { readonly scope?: "caller" | "total", readonly operation?: string, readonly enforced?: boolean, readonly caller: string, readonly observedRate: number, readonly action: "delayed" | "refused" | "suspended" | "cleared", readonly retryAfterMs: number }, readonly "transport.state-changed": { readonly state: TransportState }, readonly "connectivity.changed": { readonly reachability: "online" | "unreachable" | "session-required" | "unknown" }, readonly "ip-pool.health-changed": { readonly connectionState: "closed" | "filtered" | "open" | "unknown", readonly consecutiveFailures: number, readonly ipEntryId: string, readonly isHealthy: boolean, readonly latencyMs?: number } }} KernelEventPayloads */
|
|
82
|
+
/** @typedef {{ readonly "client-presence.changed": { readonly deviceId: string }, readonly "client-storage.state-changed": { readonly code?: string, readonly message?: string, readonly status: "ready" | "recovery-required" | "starting" }, readonly "offline.stage-progress-changed": {}, readonly "offline.stage-readiness-changed": { readonly readiness: OfflineStageReadiness }, readonly "offline.identity-invalidated": { readonly scope: OfflineIdentityScope }, readonly "app.data.changed": { readonly appName: string, readonly cursor: string, readonly revision: string, readonly stream: string }, readonly "app.data.committed": { readonly appName: string, readonly cursor: string, readonly revision: string, readonly stream: string }, readonly "device-cleanup.changed": { readonly state?: string }, readonly "domain.entity-changed": { readonly entity?: "push" | string, readonly action: "created" | "deleted" | "updated", readonly entityId: string, readonly entityType: string }, readonly "onboarding.flow-changed": { readonly stepId: string }, readonly "outbox.state-changed": { readonly intent: OutboxIntent }, readonly "room.job-stream": RoomJobStreamPayload, readonly "room.turn-stream": RoomTurnStreamPayload, readonly "stage.catalog-invalidated": { readonly reason: string }, readonly "query.invalidated": { readonly name: QueryName }, readonly "stage.registry-changed": { readonly appNames: readonly string[] }, readonly "shell.stage.app-changed": { readonly app: string | null }, readonly "sync.delta-applied": { readonly domain: string, readonly cursor: string }, readonly "transport.request-loop-suspected": { readonly caller: string, readonly operation: string, readonly action: "suspected" | "cleared", readonly enforced: false }, readonly "transport.request-budget-exceeded": { readonly scope?: "caller" | "total", readonly operation?: string, readonly enforced?: boolean, readonly caller: string, readonly observedRate: number, readonly action: "delayed" | "refused" | "suspended" | "cleared", readonly retryAfterMs: number }, readonly "transport.state-changed": { readonly state: TransportState }, readonly "connectivity.changed": { readonly reachability: "online" | "unreachable" | "session-required" | "unknown" }, readonly "node.remote-status.changed": {}, readonly "ip-pool.health-changed": { readonly connectionState: "closed" | "filtered" | "open" | "unknown", readonly consecutiveFailures: number, readonly ipEntryId: string, readonly isHealthy: boolean, readonly latencyMs?: number } }} KernelEventPayloads */
|
|
82
83
|
/** @template {KernelEventType} T @typedef {T extends CoreKernelEventType ? KernelEventPayloads[T] : AppEventPayload} KernelEventPayload */
|
|
83
84
|
/** @template {KernelEventType} T @typedef {{ readonly occurredAt: string, readonly payload: KernelEventPayload<T>, readonly type: T }} KernelEventByType */
|
|
84
85
|
/** @typedef {{ readonly occurredAt: string, readonly payload: AppEventPayload, readonly type: AppEventType }} AppDomainEvent */
|
package/src/index.js
CHANGED
|
@@ -596,4 +596,13 @@ export { ROUTE_SPEED_TIERS, speedTier } from "./network/route-speed.js";
|
|
|
596
596
|
|
|
597
597
|
export { formatNodeLabel, shortNodeId } from "./services/node-label.js";
|
|
598
598
|
|
|
599
|
+
/** @typedef {import("./models/node-status.js").NodeStatus} NodeStatus */
|
|
600
|
+
/** @typedef {import("./models/node-status.js").NodeStatusState} NodeStatusState */
|
|
601
|
+
/** @typedef {import("./models/node-status.js").NodeStatusReason} NodeStatusReason */
|
|
602
|
+
export { NODE_STATUS_SIGNING_DOMAIN, parseNodeStatus } from "./models/node-status.js";
|
|
603
|
+
|
|
604
|
+
/** @typedef {import("./services/remote-status.js").RemoteStatus} RemoteStatus */
|
|
605
|
+
/** @typedef {import("./services/remote-status.js").RemoteStatusKind} RemoteStatusKind */
|
|
606
|
+
export { projectRemoteStatus } from "./services/remote-status.js";
|
|
607
|
+
|
|
599
608
|
export { DEFAULT_ROUTE_SELECTION_POLICY, ROUTE_SELECTION_DEFAULTS } from "./network/route-selection.js";
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { encodeUtf8 } from "../services/runtime-globals.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The node's own signed operational status (`node_status`), carried on the gossip card.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors `node-app-gossip-node-status`'s Rust `node_status.rs` exactly: the same closed
|
|
9
|
+
* sets for `state`/`reason`, the same state/reason/ETA combination rules, the same
|
|
10
|
+
* non-negative-integer requirement on the time fields, and the same 384-byte cap on the
|
|
11
|
+
* full signed wire object. A status the Rust producer would refuse to sign must never parse
|
|
12
|
+
* here either.
|
|
13
|
+
*
|
|
14
|
+
* This module only parses and validates shape — it does not verify the signature. Pair
|
|
15
|
+
* `parseNodeStatus` with `verifyLnSignedObject` (`@econ-v1/adapters-web`), using
|
|
16
|
+
* `NODE_STATUS_SIGNING_DOMAIN`, against the same `node_id` this function pinned.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** @typedef {"normal" | "maintenance" | "degraded"} NodeStatusState */
|
|
20
|
+
/** @typedef {"ota" | "low_memory" | "storage_full" | "service_down" | "update_failed"} NodeStatusReason */
|
|
21
|
+
/** @typedef {{ readonly state: NodeStatusState, readonly reason?: NodeStatusReason, readonly sinceMs: number, readonly expectedBackMs?: number, readonly seq: number }} NodeStatus */
|
|
22
|
+
|
|
23
|
+
/** The closed set of valid `state` values. */
|
|
24
|
+
const STATES = new Set(["normal", "maintenance", "degraded"]);
|
|
25
|
+
|
|
26
|
+
/** The closed set of valid `reason` values. */
|
|
27
|
+
const REASONS = new Set(["ota", "low_memory", "storage_full", "service_down", "update_failed"]);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The wire's domain-separation prefix a `node_status` signature covers. Shared with
|
|
31
|
+
* `verifyLnSignedObject` at the call site — this module never verifies signatures itself.
|
|
32
|
+
*/
|
|
33
|
+
export const NODE_STATUS_SIGNING_DOMAIN = "node-status-v1:";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A status object larger than this, serialized as the full wire object (`sig_scheme` and
|
|
37
|
+
* `sig` included), is refused outright — the gossip card has no room for an unbounded
|
|
38
|
+
* claim. Mirrors `node_status::MAX_SERIALIZED_BYTES`.
|
|
39
|
+
*/
|
|
40
|
+
const MAX_SERIALIZED_BYTES = 384;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Does `state`/`reason`/`expectedBackMs` pair validly? `reason` is absent iff
|
|
44
|
+
* `state === "normal"`; `"ota"` only pairs with `"maintenance"`; every other reason only
|
|
45
|
+
* pairs with `"degraded"`. `expectedBackMs` only pairs with `"maintenance"`.
|
|
46
|
+
*
|
|
47
|
+
* @param {NodeStatusState} state
|
|
48
|
+
* @param {NodeStatusReason | undefined} reason
|
|
49
|
+
* @param {number | undefined} expectedBackMs
|
|
50
|
+
* @returns {boolean}
|
|
51
|
+
*/
|
|
52
|
+
function combinationIsValid(state, reason, expectedBackMs) {
|
|
53
|
+
const reasonMatchesState =
|
|
54
|
+
(state === "normal" && reason === undefined) ||
|
|
55
|
+
(state === "maintenance" && reason === "ota") ||
|
|
56
|
+
(state === "degraded" && reason !== undefined && reason !== "ota");
|
|
57
|
+
return reasonMatchesState && !(expectedBackMs !== undefined && state !== "maintenance");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @param {unknown} value
|
|
62
|
+
* @returns {value is number}
|
|
63
|
+
*/
|
|
64
|
+
function isSafeNonNegativeInteger(value) {
|
|
65
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Parses and validates the wire shape of a `node_status` claim: the closed `state`/`reason`
|
|
70
|
+
* sets, their combination rules with `expected_back_ms`, the non-negative integer fields,
|
|
71
|
+
* the `sig_scheme`/`sig` presence, and the 384-byte wire-size cap — everything the Rust
|
|
72
|
+
* producer enforces before it signs one, except the signature itself.
|
|
73
|
+
*
|
|
74
|
+
* Returns `null` unless `value.node_id` equals the pinned `homeNodeId` — a status naming a
|
|
75
|
+
* different node must never be attributed to this node's home — and unless every other rule
|
|
76
|
+
* holds.
|
|
77
|
+
*
|
|
78
|
+
* @param {unknown} value
|
|
79
|
+
* @param {string} homeNodeId
|
|
80
|
+
* @returns {NodeStatus | null}
|
|
81
|
+
*/
|
|
82
|
+
export function parseNodeStatus(value, homeNodeId) {
|
|
83
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
84
|
+
const record = /** @type {Record<string, unknown>} */ (value);
|
|
85
|
+
|
|
86
|
+
if (record.v !== 1) return null;
|
|
87
|
+
|
|
88
|
+
if (typeof record.node_id !== "string" || record.node_id.length === 0) return null;
|
|
89
|
+
if (record.node_id !== homeNodeId) return null;
|
|
90
|
+
|
|
91
|
+
if (typeof record.state !== "string" || !STATES.has(record.state)) return null;
|
|
92
|
+
const state = /** @type {NodeStatusState} */ (record.state);
|
|
93
|
+
|
|
94
|
+
/** @type {NodeStatusReason | undefined} */
|
|
95
|
+
let reason;
|
|
96
|
+
if (record.reason !== undefined && record.reason !== null) {
|
|
97
|
+
if (typeof record.reason !== "string" || !REASONS.has(record.reason)) return null;
|
|
98
|
+
reason = /** @type {NodeStatusReason} */ (record.reason);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (!isSafeNonNegativeInteger(record.since_ms)) return null;
|
|
102
|
+
const sinceMs = record.since_ms;
|
|
103
|
+
|
|
104
|
+
/** @type {number | undefined} */
|
|
105
|
+
let expectedBackMs;
|
|
106
|
+
if (record.expected_back_ms !== undefined && record.expected_back_ms !== null) {
|
|
107
|
+
if (!isSafeNonNegativeInteger(record.expected_back_ms)) return null;
|
|
108
|
+
expectedBackMs = record.expected_back_ms;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!isSafeNonNegativeInteger(record.seq)) return null;
|
|
112
|
+
const seq = record.seq;
|
|
113
|
+
|
|
114
|
+
if (record.sig_scheme !== "ln-v1") return null;
|
|
115
|
+
if (typeof record.sig !== "string" || record.sig.length === 0) return null;
|
|
116
|
+
|
|
117
|
+
if (!combinationIsValid(state, reason, expectedBackMs)) return null;
|
|
118
|
+
|
|
119
|
+
// The size cap applies to the full wire object as received, sig_scheme/sig included —
|
|
120
|
+
// that is what actually has to fit on the gossip card.
|
|
121
|
+
const serialized = JSON.stringify(value);
|
|
122
|
+
if (serialized === undefined || encodeUtf8(serialized).length > MAX_SERIALIZED_BYTES) return null;
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
state,
|
|
126
|
+
...(reason === undefined ? {} : { reason }),
|
|
127
|
+
sinceMs,
|
|
128
|
+
...(expectedBackMs === undefined ? {} : { expectedBackMs }),
|
|
129
|
+
seq,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import("../models/node-status.js").NodeStatus} NodeStatus
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import("../models/node-status.js").NodeStatusReason} NodeStatusReason
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** @typedef {"none" | "updating" | "overdue" | "degraded" | "silent"} RemoteStatusKind */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {{
|
|
14
|
+
* readonly kind: RemoteStatusKind,
|
|
15
|
+
* readonly reason?: NodeStatusReason,
|
|
16
|
+
* readonly sinceMs?: number,
|
|
17
|
+
* readonly expectedBackMs?: number,
|
|
18
|
+
* readonly lastHeardMs?: number,
|
|
19
|
+
* readonly lastState?: "normal" | "updating",
|
|
20
|
+
* readonly member?: string,
|
|
21
|
+
* readonly asked: number,
|
|
22
|
+
* }} RemoteStatus
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* `overdue` starts once the node is this far past its own `expectedBackMs` — tolerant of a
|
|
27
|
+
* phone clock running ahead of the node's. Mirrors the plan's global constraints.
|
|
28
|
+
*/
|
|
29
|
+
const OVERDUE_GRACE_MS = 2 * 60 * 1000;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* `updating`/`overdue` escalates to `silent` (with `lastState: "updating"`) once the node
|
|
33
|
+
* is this far past its own `expectedBackMs`.
|
|
34
|
+
*/
|
|
35
|
+
const SILENT_GRACE_MS = 60 * 60 * 1000;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Projects the owner-facing explanation for why the home node is unreachable, from the
|
|
39
|
+
* locally cached `NodeStatus` and (if a gossip-relay lookup completed) a status another
|
|
40
|
+
* member answered with. Pure: no I/O, no clock reads — `nowMs` is supplied by the caller.
|
|
41
|
+
*
|
|
42
|
+
* ## `kind: "none"`
|
|
43
|
+
* Means no lookup has completed yet AND there is nothing locally cached either — nothing
|
|
44
|
+
* is known either way, not even "silent". Expressed as `asked === 0 && fetched === null &&
|
|
45
|
+
* !fetchedCardNewer && local === null`: the caller hasn't asked anyone, hasn't been handed
|
|
46
|
+
* a fetched status, hasn't observed a newer card, and has no cached local status to fall
|
|
47
|
+
* back on. When `asked === 0` but a `local` status IS cached (e.g. a pre-OTA maintenance
|
|
48
|
+
* announce already in the mirror), evaluation falls through to that `local` status exactly
|
|
49
|
+
* as the no-newer-card branch below does — `asked: 0` only means the lookup hasn't asked
|
|
50
|
+
* anyone yet, not that the locally known status should be hidden.
|
|
51
|
+
*
|
|
52
|
+
* ## Which status is "effective"
|
|
53
|
+
* - `fetched` counts only when `fetchedCardNewer` is true, `fetched` is non-null, and
|
|
54
|
+
* (`local` is `null` or `fetched.seq > local.seq`). A fetched status at or below the
|
|
55
|
+
* local seq is a stale/replayed read and is ignored outright — evaluation falls back to
|
|
56
|
+
* `local`, exactly as if nothing had been fetched at all.
|
|
57
|
+
* - A newer card that carries no status at all (`fetchedCardNewer` true, `fetched` `null`,
|
|
58
|
+
* e.g. a member still running pre-node_status gossip) is never treated as `"normal"` and
|
|
59
|
+
* never falls back to evaluating `local`'s timing — it is reported `"silent"` directly.
|
|
60
|
+
* `lastState` still reflects `local`'s last known state (`"updating"` when
|
|
61
|
+
* `local.state === "maintenance"`, else `"normal"`), since that is the last thing
|
|
62
|
+
* actually known before this newer, status-less card arrived.
|
|
63
|
+
* - Otherwise (no newer card at all) evaluation falls back to `local`.
|
|
64
|
+
*
|
|
65
|
+
* ## Timing (applied to whichever status is effective)
|
|
66
|
+
* - `state: "normal"` (or no effective status at all) → `"silent"` with
|
|
67
|
+
* `lastState: "normal"`.
|
|
68
|
+
* - `state: "degraded"` → `"degraded"`, carrying `reason` and `sinceMs` through untouched.
|
|
69
|
+
* - `state: "maintenance"` with no `expectedBackMs` → `"updating"` forever; no overdue or
|
|
70
|
+
* silent timer ever fires.
|
|
71
|
+
* - `state: "maintenance"` with `expectedBackMs` → `"updating"` until
|
|
72
|
+
* `nowMs > expectedBackMs + 2 minutes`, then `"overdue"`, then — once
|
|
73
|
+
* `nowMs > expectedBackMs + 60 minutes` — `"silent"` with `lastState: "updating"`.
|
|
74
|
+
*
|
|
75
|
+
* Provenance: `member` is carried through to the result only when `fetched` was the
|
|
76
|
+
* effective status — only then can the reading be attributed to whoever answered. In every
|
|
77
|
+
* other branch `member` is dropped even if supplied, leaving the result to report `asked`
|
|
78
|
+
* alone ("asked N nodes, none heard anything newer"). `lastHeardMs` and `asked` are always
|
|
79
|
+
* passed through untouched.
|
|
80
|
+
*
|
|
81
|
+
* @param {{
|
|
82
|
+
* local: NodeStatus | null,
|
|
83
|
+
* fetched: NodeStatus | null,
|
|
84
|
+
* fetchedCardNewer: boolean,
|
|
85
|
+
* lastHeardMs: number | undefined,
|
|
86
|
+
* nowMs: number,
|
|
87
|
+
* member?: string,
|
|
88
|
+
* asked: number,
|
|
89
|
+
* }} input
|
|
90
|
+
* @returns {RemoteStatus}
|
|
91
|
+
*/
|
|
92
|
+
export function projectRemoteStatus({ local, fetched, fetchedCardNewer, lastHeardMs, nowMs, member, asked }) {
|
|
93
|
+
if (asked === 0 && fetched === null && !fetchedCardNewer && local === null) {
|
|
94
|
+
return { kind: "none", asked };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const fetchedCounts = fetchedCardNewer && fetched !== null && (local === null || fetched.seq > local.seq);
|
|
98
|
+
|
|
99
|
+
if (fetchedCounts) {
|
|
100
|
+
return finalize(evaluateStatus(fetched, nowMs), { lastHeardMs, asked, ...(member === undefined ? {} : { member }) });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (fetchedCardNewer && fetched === null) {
|
|
104
|
+
return finalize({ kind: "silent", lastState: lastKnownState(local) }, { lastHeardMs, asked });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return finalize(evaluateStatus(local, nowMs), { lastHeardMs, asked });
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {NodeStatus | null} status
|
|
112
|
+
* @returns {"normal" | "updating"}
|
|
113
|
+
*/
|
|
114
|
+
function lastKnownState(status) {
|
|
115
|
+
return status !== null && status.state === "maintenance" ? "updating" : "normal";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Maps one `NodeStatus` (whichever is effective — local or fetched) onto the timed outcome
|
|
120
|
+
* the plan's global constraints describe, independent of provenance.
|
|
121
|
+
*
|
|
122
|
+
* @param {NodeStatus | null} status
|
|
123
|
+
* @param {number} nowMs
|
|
124
|
+
* @returns {Omit<RemoteStatus, "asked" | "lastHeardMs" | "member">}
|
|
125
|
+
*/
|
|
126
|
+
function evaluateStatus(status, nowMs) {
|
|
127
|
+
if (status === null || status.state === "normal") {
|
|
128
|
+
return { kind: "silent", lastState: "normal" };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (status.state === "degraded") {
|
|
132
|
+
return { kind: "degraded", sinceMs: status.sinceMs, ...(status.reason === undefined ? {} : { reason: status.reason }) };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// status.state === "maintenance"
|
|
136
|
+
if (status.expectedBackMs === undefined) {
|
|
137
|
+
return { kind: "updating", sinceMs: status.sinceMs };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (nowMs > status.expectedBackMs + SILENT_GRACE_MS) {
|
|
141
|
+
return { kind: "silent", lastState: "updating" };
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (nowMs > status.expectedBackMs + OVERDUE_GRACE_MS) {
|
|
145
|
+
return { kind: "overdue", expectedBackMs: status.expectedBackMs };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return { kind: "updating", sinceMs: status.sinceMs, expectedBackMs: status.expectedBackMs };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @param {Omit<RemoteStatus, "asked" | "lastHeardMs" | "member">} partial
|
|
153
|
+
* @param {{ lastHeardMs: number | undefined, member?: string, asked: number }} provenance
|
|
154
|
+
* @returns {RemoteStatus}
|
|
155
|
+
*/
|
|
156
|
+
function finalize(partial, { lastHeardMs, member, asked }) {
|
|
157
|
+
return {
|
|
158
|
+
...partial,
|
|
159
|
+
...(lastHeardMs === undefined ? {} : { lastHeardMs }),
|
|
160
|
+
...(member === undefined ? {} : { member }),
|
|
161
|
+
asked,
|
|
162
|
+
};
|
|
163
|
+
}
|