@econ-v1/domain 7.6.159 → 7.6.160

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/index.d.ts CHANGED
@@ -273,7 +273,7 @@ export { OutboxIdempotencyConflictError, OutboxRevalidationRequiredError, Outbox
273
273
  export { ExpiredInvoiceError, InsufficientWalletBalanceError, OfflineWalletCommandError, WalletCommandRejectedError, WalletFreshStateRequiredError, WalletMirrorService } from "./services/wallet-mirror-service.js";
274
274
  export { canonicalHttpCandidateOrigin, isPotentiallyTrustworthyOrigin, transportStateChanged, TransportManager } from "./services/transport-manager.js";
275
275
  export { normalizeAdvertisement, nodeMetadataCandidates, PeerDirectoryService, uniqueAddresses } from "./services/peer-directory-service.js";
276
- export { addressMoveTargets, isPublicIpOrigin } from "./network/address-move.js";
276
+ export { addressMoveTargets, isPublicIpOrigin, signalFromRtt } from "./network/address-move.js";
277
277
  export { DiscoveryProbeService, secureLanOrigin } from "./services/discovery-probe-service.js";
278
278
  export { createDiscoveryCandidatesQuery, DISCOVERY_CANDIDATES_QUERY } from "./queries/discovery.js";
279
279
  export { createOnboardingStatusQuery, ONBOARDING_STATUS_QUERY } from "./queries/onboarding-status.js";
@@ -20,4 +20,11 @@ export function addressMoveTargets({ pageOrigin, wanOrigins, wanOrigin, onDirect
20
20
  wanOrigin?: string;
21
21
  onDirectToPage: boolean;
22
22
  }): readonly string[];
23
+ /** Signal bars for an address-move option, derived purely from the measured
24
+ * direct-check round-trip time. Kept here, not in the kernel or UI, so both the
25
+ * offer-building service and the presentation layer share one threshold table.
26
+ * @param {number} rttMs
27
+ * @returns {1 | 2 | 3 | 4}
28
+ */
29
+ export function signalFromRtt(rttMs: number): 1 | 2 | 3 | 4;
23
30
  //# sourceMappingURL=address-move.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"address-move.d.ts","sourceRoot":"","sources":["../../src/network/address-move.js"],"names":[],"mappings":"AAuDA;;;;;GAKG;AACH,yCAHW,MAAM,GACJ,OAAO,CAUnB;AAED;;;;;;;;GAQG;AACH,0FAHW;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAAE,GACjG,SAAS,MAAM,EAAE,CAU7B"}
1
+ {"version":3,"file":"address-move.d.ts","sourceRoot":"","sources":["../../src/network/address-move.js"],"names":[],"mappings":"AAuDA;;;;;GAKG;AACH,yCAHW,MAAM,GACJ,OAAO,CAUnB;AAED;;;;;;;;GAQG;AACH,0FAHW;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAAE,GACjG,SAAS,MAAM,EAAE,CAU7B;AAED;;;;;GAKG;AACH,qCAHW,MAAM,GACJ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAOzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"device-boot-state-service.d.ts","sourceRoot":"","sources":["../../src/services/device-boot-state-service.js"],"names":[],"mappings":"AACA,wEAAwE;AACxE,wEAAwE;AACxE,wLAAwL;AACxL;IAKI,qDAAqD;IACrD,qBADY,6BAA6B,EAIxC;IACD,0CAA0C;IAC1C,SADc,OAAO,CAAC,eAAe,CAAC,CAiDrC;;CACJ;4CA7Dc;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,gBAAgB,GAAG,eAAe,GAAG,0BAA0B,CAAC,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;CAAE;qCADjH,gCAAgC;kCADhB,gBAAgB"}
1
+ {"version":3,"file":"device-boot-state-service.d.ts","sourceRoot":"","sources":["../../src/services/device-boot-state-service.js"],"names":[],"mappings":"AACA,wEAAwE;AACxE,wEAAwE;AACxE,wLAAwL;AACxL;IAKI,qDAAqD;IACrD,qBADY,6BAA6B,EAIxC;IACD,0CAA0C;IAC1C,SADc,OAAO,CAAC,eAAe,CAAC,CAsDrC;;CACJ;4CAlEc;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,gBAAgB,GAAG,eAAe,GAAG,0BAA0B,CAAC,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;CAAE;qCADjH,gCAAgC;kCADhB,gBAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@econ-v1/domain",
3
- "version": "7.6.159",
3
+ "version": "7.6.160",
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.159"
60
+ "@econ-v1/ports": "7.6.160"
61
61
  }
62
62
  }
package/src/index.js CHANGED
@@ -543,7 +543,7 @@ export { OwnerViewService } from "./services/owner-view-service.js";
543
543
  export { OwnerViewRefreshService } from "./services/owner-view-refresh-service.js";
544
544
  export { OWNER_VIEW_SYNC_STRATEGIES } from "./models/owner-views.js";
545
545
  export { LanCandidateRefreshService } from "./services/lan-candidate-refresh-service.js";
546
- export { addressMoveTargets, isPublicIpOrigin } from "./network/address-move.js";
546
+ export { addressMoveTargets, isPublicIpOrigin, signalFromRtt } from "./network/address-move.js";
547
547
  export { DiscoveryProbeService, secureLanOrigin } from "./services/discovery-probe-service.js";
548
548
  export { DeviceBootStateService } from "./services/device-boot-state-service.js";
549
549
  export { createDiscoveryCandidatesQuery, DISCOVERY_CANDIDATES_QUERY } from "./queries/discovery.js";
@@ -88,6 +88,19 @@ export function addressMoveTargets({ pageOrigin, wanOrigins, wanOrigin, onDirect
88
88
  return origins.sort((a, b) => Number(b.startsWith("https://[")) - Number(a.startsWith("https://[")));
89
89
  }
90
90
 
91
+ /** Signal bars for an address-move option, derived purely from the measured
92
+ * direct-check round-trip time. Kept here, not in the kernel or UI, so both the
93
+ * offer-building service and the presentation layer share one threshold table.
94
+ * @param {number} rttMs
95
+ * @returns {1 | 2 | 3 | 4}
96
+ */
97
+ export function signalFromRtt(rttMs) {
98
+ if (rttMs <= 80) return 4;
99
+ if (rttMs <= 200) return 3;
100
+ if (rttMs <= 500) return 2;
101
+ return 1;
102
+ }
103
+
91
104
  /** @param {string} origin @returns {string} */
92
105
  function normalizeOrigin(origin) {
93
106
  return origin.toLowerCase().replace(/\/$/u, "").replace(/:443$/u, "");
@@ -21,17 +21,20 @@ export class DeviceBootStateService {
21
21
  }
22
22
  catch {
23
23
  // A store we cannot read must fail toward pairing, never toward a crash or
24
- // toward rendering cached data on an unverified device (spec §5).
24
+ // toward rendering cached data on an unverified device (spec §5). "unpaired" is
25
+ // not a verdict either (ADR-258): the pairing gate first tries a signed session
26
+ // with the stored key and shows pairing only on the node's own answer.
25
27
  return { kind: "unpaired" };
26
28
  }
27
29
  if (lifecycle === "revoked")
28
30
  return { kind: "revoked" };
29
31
  if (lifecycle === "unusable") {
30
- // The key was quarantined (kept, never purged) on a failed inspection — see
31
- // docs/superpowers/plans/2026-10-08-no-silent-device-key-purge.md. Best-effort read
32
- // of WHY, mirroring the fail-toward-unpaired discipline above: a diagnostic read
33
- // failure must never escalate past "no reason/time to show", since the lifecycle
34
- // verdict itself already came back clean.
32
+ // ADR-258: only a key that is genuinely MISSING (still absent after a re-read, see
33
+ // `WebCryptoIdentity#generate`) gates the UI. A lifecycle an older release left
34
+ // `"unusable"` after a failed key CHECK is not a verdict on this device: the key is
35
+ // kept and re-verified (and self-healed to `"active"`) on every `generate()`, so it
36
+ // falls through to the delegation below like any active identity. A diagnostic read
37
+ // that fails, or carries no reason, falls through too — never toward a lockout.
35
38
  /** @type {Awaited<ReturnType<NonNullable<DeviceBootStateServiceOptions["identity"]["loadKeyInspectionFailure"]>>>} */
36
39
  let diagnostic;
37
40
  try {
@@ -40,11 +43,13 @@ export class DeviceBootStateService {
40
43
  catch {
41
44
  diagnostic = undefined;
42
45
  }
43
- return {
44
- kind: "key-unusable",
45
- ...(diagnostic?.reason === undefined ? {} : { reason: diagnostic.reason }),
46
- ...(diagnostic?.detectedAt === undefined ? {} : { detectedAt: diagnostic.detectedAt }),
47
- };
46
+ if (diagnostic?.reason === "key-material-missing") {
47
+ return {
48
+ kind: "key-unusable",
49
+ reason: diagnostic.reason,
50
+ ...(diagnostic.detectedAt === undefined ? {} : { detectedAt: diagnostic.detectedAt }),
51
+ };
52
+ }
48
53
  }
49
54
  /** @type {Awaited<ReturnType<IdentityPort["loadDelegation"]>>} */
50
55
  let delegation;