@econ-v1/domain 7.6.182 → 7.6.185

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.
@@ -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 "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 */
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 "session.state.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", "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"];
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", "session.state.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", "session.state.changed"];
30
30
  export type CoreKernelEventType = (typeof KERNEL_EVENT_TYPES)[number];
31
31
  export type KernelEventType = AppEventType | CoreKernelEventType;
32
32
  export type KernelEventPayloads = {
@@ -112,6 +112,7 @@ export type KernelEventPayloads = {
112
112
  readonly reachability: "online" | "unreachable" | "session-required" | "unknown";
113
113
  };
114
114
  readonly "node.remote-status.changed": {};
115
+ readonly "session.state.changed": {};
115
116
  readonly "ip-pool.health-changed": {
116
117
  readonly connectionState: "closed" | "filtered" | "open" | "unknown";
117
118
  readonly consecutiveFailures: number;
@@ -1 +1 @@
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,KA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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"}
@@ -15,9 +15,15 @@ export function isPotentiallyTrustworthyOrigin(url: RuntimeUrl): boolean;
15
15
  /** @typedef {{ readonly abort: AbortControllerPort, readonly promise: Promise<HomeNodeClient> }} SharedRun */
16
16
  /** @typedef {{ readonly attempt: DialAttempt, readonly client: HomeNodeClient, readonly success: true }} DialSuccess */
17
17
  /** @typedef {{ readonly attempt: DialAttempt, readonly success: false }} DialFailure */
18
+ /** One candidate dial that settled inside a run nobody cancelled: `connected` when it produced
19
+ * a client, `failed` when it threw or hit its candidate deadline (`error` is what it threw).
20
+ * @typedef {{ readonly candidate: DirectHomeNodeCandidate, readonly outcome: "connected" } | { readonly candidate: DirectHomeNodeCandidate, readonly outcome: "failed", readonly error: unknown }} DialOutcome */
18
21
  export class TransportManager {
19
22
  /** @param {TransportManagerOptions} options */
20
23
  constructor(options: TransportManagerOptions);
24
+ /** Refresh one failed candidate before its final outcome is counted.
25
+ * @param {((candidate: DirectHomeNodeCandidate, error: unknown, signal: AbortSignalPort) => Promise<DirectHomeNodeCandidate | undefined>) | undefined} retry */
26
+ setDialRetry(retry: ((candidate: DirectHomeNodeCandidate, error: unknown, signal: AbortSignalPort) => Promise<DirectHomeNodeCandidate | undefined>) | undefined): void;
21
27
  /** @returns {TransportState} */
22
28
  get state(): TransportState;
23
29
  /** @returns {DirectHomeNodeCandidate | undefined} */
@@ -31,6 +37,15 @@ export class TransportManager {
31
37
  * @returns {() => void}
32
38
  */
33
39
  subscribe(listener: (state: TransportState) => void): () => void;
40
+ /**
41
+ * Observe every candidate dial that settles in a run that was not cancelled, whatever the
42
+ * caller asked for (a full ladder, a priority bound or one path). A run decides between
43
+ * tiers on its own, so this is the only place a caller can learn that a higher tier was
44
+ * tried and failed before a lower one won. Report-only: an observer that throws is ignored.
45
+ * @param {(outcome: DialOutcome) => void} observer
46
+ * @returns {() => void}
47
+ */
48
+ observeDials(observer: (outcome: DialOutcome) => void): () => void;
34
49
  /**
35
50
  * The normalized ladder as the manager will actually dial it. Read-only: callers
36
51
  * that need to notice a ladder CHANGE (rather than re-derive their own shadow copy,
@@ -141,4 +156,16 @@ export type DialFailure = {
141
156
  readonly attempt: DialAttempt;
142
157
  readonly success: false;
143
158
  };
159
+ /**
160
+ * One candidate dial that settled inside a run nobody cancelled: `connected` when it produced
161
+ * a client, `failed` when it threw or hit its candidate deadline (`error` is what it threw).
162
+ */
163
+ export type DialOutcome = {
164
+ readonly candidate: DirectHomeNodeCandidate;
165
+ readonly outcome: "connected";
166
+ } | {
167
+ readonly candidate: DirectHomeNodeCandidate;
168
+ readonly outcome: "failed";
169
+ readonly error: unknown;
170
+ };
144
171
  //# sourceMappingURL=transport-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport-manager.d.ts","sourceRoot":"","sources":["../../src/services/transport-manager.js"],"names":[],"mappings":"AA8cA,sFAAsF;AACtF,+CADY,cAAc,QAAkB,cAAc,GAAiB,OAAO,CAqBjF;AA6ED;;;GAGG;AACH,oDAHW,MAAM,GACJ,MAAM,CAoBlB;AAKD,iDAAiD;AACjD,oDADY,UAAU,GAAgB,OAAO,CAW5C;AAjkBD,oYAAoY;AACpY,qKAAqK;AACrK,gGAAgG;AAChG,yFAAyF;AACzF,kKAAkK;AAClK,8GAA8G;AAC9G,wHAAwH;AACxH,wFAAwF;AAExF;IAoDE,+CAA+C;IAC/C,qBADY,uBAAuB,EAWlC;IAED,gCA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E,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAA;CAAE;0BAC1F;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAA;CAAE"}
1
+ {"version":3,"file":"transport-manager.d.ts","sourceRoot":"","sources":["../../src/services/transport-manager.js"],"names":[],"mappings":"AA8fA,sFAAsF;AACtF,+CADY,cAAc,QAAkB,cAAc,GAAiB,OAAO,CAqBjF;AA6ED;;;GAGG;AACH,oDAHW,MAAM,GACJ,MAAM,CAoBlB;AAKD,iDAAiD;AACjD,oDADY,UAAU,GAAgB,OAAO,CAW5C;AA1mBD,oYAAoY;AACpY,qKAAqK;AACrK,gGAAgG;AAChG,yFAAyF;AACzF,kKAAkK;AAClK,8GAA8G;AAC9G,wHAAwH;AACxH,wFAAwF;AACxF;;kNAEkN;AAElN;IA4DE,+CAA+C;IAC/C,qBADY,uBAAuB,EAWlC;IA9BD;oKACgK;IAChK,oBADW,CAAC,CAAC,SAAS,EAAE,uBAAuB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,QACtG;IA8BhD,gCAAgC;IAChC,aADc,cAAc,CAG3B;IAED,qDAAqD;IACrD,yBADc,uBAAuB,GAAG,SAAS,CAKhD;IAED,oFAAoF;IACpF,qBADY,cAAc,GAAmB,uBAAuB,GAAG,SAAS,CAI/E;IAED,4EAA4E;IAC5E,0BADY,OAAO,GAAkB,uBAAuB,GAAG,SAAS,CAIvE;IAED;;;OAGG;IACH,oBAHW,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GAC7B,MAAM,IAAI,CAKtB;IAED;;;;;;;OAOG;IACH,uBAHW,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,G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E,uBAAuB,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@econ-v1/domain",
3
- "version": "7.6.182",
3
+ "version": "7.6.185",
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.182"
60
+ "@econ-v1/ports": "7.6.185"
61
61
  }
62
62
  }
@@ -46,7 +46,7 @@ export const DOMAIN_ERROR_CODES = [
46
46
  // one unloaded optional app then tore down the shared WebSocket, re-minted the session and
47
47
  // re-dialed on every refresh of the affected query (`observability.snapshot.v1`, and earlier
48
48
  // `core.system.info`). Mapped by `client/adapters-web/src/network/envelope-error-mapping.js`
49
- // (HTTP) and `client-rpc/response-error.js` (WebTransport/WebRTC).
49
+ // for every carrier (each carries HTTP, directly or through the stream tunnel).
50
50
  "capability_unavailable",
51
51
  // A composed stage resolved a child app to one of the 13 non-"ready" child states (see
52
52
  // `client/rpc/src/child-state-contract.js`'s `CHILD_STATE_CODES`) and could not proceed.
@@ -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", "node.remote-status.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", "session.state.changed"]} */
44
44
  export const KERNEL_EVENT_TYPES = [
45
45
  "transport.request-loop-suspected",
46
46
  "transport.request-budget-exceeded",
@@ -66,6 +66,7 @@ export const KERNEL_EVENT_TYPES = [
66
66
  "ip-pool.health-changed",
67
67
  "shell.stage.app-changed",
68
68
  "client-presence.changed",
69
+ "session.state.changed",
69
70
  ];
70
71
 
71
72
  /** @typedef {(typeof KERNEL_EVENT_TYPES)[number]} CoreKernelEventType */
@@ -79,7 +80,7 @@ export const KERNEL_EVENT_TYPES = [
79
80
  * shape a de-duplication would take — declared in `@econ-v1/ports` and re-exported outward — and
80
81
  * is the follow-up if this union ever grows a fifth state.
81
82
  */
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 */
83
+ /** @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 "session.state.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 */
83
84
  /** @template {KernelEventType} T @typedef {T extends CoreKernelEventType ? KernelEventPayloads[T] : AppEventPayload} KernelEventPayload */
84
85
  /** @template {KernelEventType} T @typedef {{ readonly occurredAt: string, readonly payload: KernelEventPayload<T>, readonly type: T }} KernelEventByType */
85
86
  /** @typedef {{ readonly occurredAt: string, readonly payload: AppEventPayload, readonly type: AppEventType }} AppDomainEvent */
@@ -9,15 +9,22 @@
9
9
  /** @typedef {import("./abort-signal.js").AbortSignalPort} AbortSignalPort */
10
10
  /** @typedef {import("./runtime-globals.js").RuntimeUrl} RuntimeUrl */
11
11
 
12
+ import { carrierForPath } from "@econ-v1/ports";
12
13
  import { TransportError } from "../errors/index.js";
13
14
  import {
14
15
  createRuntimeAbortController,
15
16
  parseRuntimeUrl,
16
17
  } from "./runtime-globals.js";
17
18
 
18
- /** @type {readonly DirectTransportPath[]} */
19
- /** @type {readonly DirectTransportPath[]} */
20
- const DIRECT_TIER_ORDER = ["lan-direct", "lan-webtransport", "wan-direct"];
19
+ /**
20
+ * The direct ladder, best first (ADR-277). QUIC (`lan-webtransport`) leads the LAN rung: a
21
+ * full-ladder connect tries it before HTTPS on the same network. Tiers are dialled one after
22
+ * another, so a QUIC dial that fails or times out costs at most one candidate deadline before
23
+ * `lan-direct` is tried; the browser composition withholds a QUIC candidate that recently
24
+ * failed, so that cost is paid once, not on every reconnect.
25
+ * @type {readonly DirectTransportPath[]}
26
+ */
27
+ const DIRECT_TIER_ORDER = ["lan-webtransport", "lan-direct", "wan-webtransport", "wan-direct"];
21
28
 
22
29
  /** @typedef {{ readonly candidates: readonly DirectHomeNodeCandidate[], readonly dial: (candidate: DirectHomeNodeCandidate, signal: AbortSignalPort) => Promise<HomeNodeClient>, readonly delay?: DelayPort, readonly priorityGraceMs?: number, readonly candidateTimeoutMs?: number, readonly now?: () => string, readonly onState?: (state: TransportState) => void }} TransportManagerOptions */
23
30
  /** @typedef {{ readonly higherPriorityThan?: DirectTransportPath, readonly path?: DirectTransportPath, readonly publishState?: boolean }} TransportConnectOptions */
@@ -27,6 +34,9 @@ const DIRECT_TIER_ORDER = ["lan-direct", "lan-webtransport", "wan-direct"];
27
34
  /** @typedef {{ readonly abort: AbortControllerPort, readonly promise: Promise<HomeNodeClient> }} SharedRun */
28
35
  /** @typedef {{ readonly attempt: DialAttempt, readonly client: HomeNodeClient, readonly success: true }} DialSuccess */
29
36
  /** @typedef {{ readonly attempt: DialAttempt, readonly success: false }} DialFailure */
37
+ /** One candidate dial that settled inside a run nobody cancelled: `connected` when it produced
38
+ * a client, `failed` when it threw or hit its candidate deadline (`error` is what it threw).
39
+ * @typedef {{ readonly candidate: DirectHomeNodeCandidate, readonly outcome: "connected" } | { readonly candidate: DirectHomeNodeCandidate, readonly outcome: "failed", readonly error: unknown }} DialOutcome */
30
40
 
31
41
  export class TransportManager {
32
42
  /** @type {readonly DirectHomeNodeCandidate[]} */
@@ -65,6 +75,14 @@ export class TransportManager {
65
75
  #closedClients = new WeakSet();
66
76
  /** @readonly @type {Set<(state: TransportState) => void>} */
67
77
  #listeners = new Set();
78
+ /** @readonly @type {Set<(outcome: DialOutcome) => void>} */
79
+ #dialObservers = new Set();
80
+ /** @type {((candidate: DirectHomeNodeCandidate, error: unknown, signal: AbortSignalPort) => Promise<DirectHomeNodeCandidate | undefined>) | undefined} */
81
+ #dialRetry;
82
+ /** Refresh one failed candidate before its final outcome is counted.
83
+ * @param {((candidate: DirectHomeNodeCandidate, error: unknown, signal: AbortSignalPort) => Promise<DirectHomeNodeCandidate | undefined>) | undefined} retry */
84
+ setDialRetry(retry) { this.#dialRetry = retry; }
85
+
68
86
  /** @type {TransportState} */
69
87
  #state = {
70
88
  changedAt: "1970-01-01T00:00:00.000Z",
@@ -126,6 +144,27 @@ export class TransportManager {
126
144
  return () => this.#listeners.delete(listener);
127
145
  }
128
146
 
147
+ /**
148
+ * Observe every candidate dial that settles in a run that was not cancelled, whatever the
149
+ * caller asked for (a full ladder, a priority bound or one path). A run decides between
150
+ * tiers on its own, so this is the only place a caller can learn that a higher tier was
151
+ * tried and failed before a lower one won. Report-only: an observer that throws is ignored.
152
+ * @param {(outcome: DialOutcome) => void} observer
153
+ * @returns {() => void}
154
+ */
155
+ observeDials(observer) {
156
+ this.#dialObservers.add(observer);
157
+ return () => this.#dialObservers.delete(observer);
158
+ }
159
+
160
+ /** @param {DialOutcome} outcome @returns {void} */
161
+ #reportDial(outcome) {
162
+ for (const observer of [...this.#dialObservers]) {
163
+ try { observer(outcome); }
164
+ catch { /* Report-only. */ }
165
+ }
166
+ }
167
+
129
168
  /**
130
169
  * The normalized ladder as the manager will actually dial it. Read-only: callers
131
170
  * that need to notice a ladder CHANGE (rather than re-derive their own shadow copy,
@@ -182,7 +221,7 @@ export class TransportManager {
182
221
  */
183
222
  markConnected(path) {
184
223
  this.#setState(typeof path === "string"
185
- ? { changedAt: this.#now(), path, status: "connected" }
224
+ ? { changedAt: this.#now(), path, carrier: carrierForPath(path), status: "connected" }
186
225
  : path);
187
226
  }
188
227
 
@@ -338,9 +377,12 @@ export class TransportManager {
338
377
  const outcomes = await Promise.all(
339
378
  attempts.map(async (attempt) => {
340
379
  try {
341
- return { attempt, client: await attempt.promise, success: true };
380
+ const dialed = await attempt.promise;
381
+ if (!signal.aborted) this.#reportDial({ candidate: { ...attempt.candidate }, outcome: "connected" });
382
+ return { attempt, client: dialed, success: true };
342
383
  } catch (error) {
343
384
  failures.push(`${attempt.candidate.path}:${messageFor(error)}`);
385
+ if (!signal.aborted) this.#reportDial({ candidate: { ...attempt.candidate }, error, outcome: "failed" });
344
386
  return { attempt, success: false };
345
387
  } finally {
346
388
  this.#controllers.delete(attempt.controller);
@@ -413,7 +455,13 @@ export class TransportManager {
413
455
  * @returns {Promise<HomeNodeClient>}
414
456
  */
415
457
  async #dialWithTimeout(candidate, controller, runSignal) {
416
- const dial = this.#dial(candidate, controller.signal);
458
+ const dial = this.#dial(candidate, controller.signal).catch(async error => {
459
+ if (controller.signal.aborted || runSignal.aborted || !this.#dialRetry) throw error;
460
+ const refreshed = await this.#dialRetry(candidate, error, controller.signal);
461
+ if (!refreshed || controller.signal.aborted || runSignal.aborted) throw error;
462
+ Object.assign(candidate, refreshed);
463
+ return this.#dial(candidate, controller.signal);
464
+ });
417
465
  void dial
418
466
  .then(async (client) => {
419
467
  if (controller.signal.aborted || runSignal.aborted)
@@ -517,11 +565,11 @@ function candidateSetKey(candidates) {
517
565
  * @returns {readonly DirectHomeNodeCandidate[]}
518
566
  */
519
567
  function normalizeDirectCandidates(candidates) {
520
- /** @type {Record<DirectTransportPath, DirectHomeNodeCandidate[]>} */
521
568
  /** @type {Record<DirectTransportPath, DirectHomeNodeCandidate[]>} */
522
569
  const tiers = {
523
- "lan-direct": [],
524
570
  "lan-webtransport": [],
571
+ "lan-direct": [],
572
+ "wan-webtransport": [],
525
573
  "wan-direct": [],
526
574
  };
527
575
  const seen = new Set();
@@ -538,9 +586,9 @@ function normalizeDirectCandidates(candidates) {
538
586
  }
539
587
  const address = canonicalHttpCandidateOrigin(candidate.address);
540
588
  const identityBinding =
541
- candidate.path === "lan-webtransport"
589
+ (candidate.path === "lan-webtransport" || candidate.path === "wan-webtransport")
542
590
  ? undefined
543
- : candidate.identityBinding;
591
+ : "identityBinding" in candidate ? candidate.identityBinding : undefined;
544
592
  if (identityBinding !== "bootstrap") trustedNodeIds.add(candidate.id);
545
593
  const key = JSON.stringify([candidate.path, address, candidate.id]);
546
594
  if (seen.has(key)) continue;
@@ -605,7 +653,7 @@ export function isPotentiallyTrustworthyOrigin(url) {
605
653
  function isDirectCandidate(candidate) {
606
654
  return (
607
655
  candidate.path === "lan-direct" ||
608
- candidate.path === "lan-webtransport" ||
656
+ (candidate.path === "lan-webtransport" || candidate.path === "wan-webtransport") ||
609
657
  candidate.path === "wan-direct"
610
658
  );
611
659
  }