keri-ts 2.2.3 → 2.2.5

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.
Files changed (247) hide show
  1. package/esm/keri/npm/src/_dnt.polyfills.js +14 -14
  2. package/esm/keri/npm/src/acdc/registering.js +19 -0
  3. package/esm/keri/npm/src/acdc/salting.js +4 -0
  4. package/esm/keri/npm/src/app/bootstrap/authenticating.js +34 -12
  5. package/esm/keri/npm/src/app/bootstrap/oobiery.js +365 -32
  6. package/esm/keri/npm/src/app/credentials/credential-importing.js +33 -4
  7. package/esm/keri/npm/src/app/credentials/root-replicator.js +27 -15
  8. package/esm/keri/npm/src/app/credentials/schema-resolving.js +5 -1
  9. package/esm/keri/npm/src/app/credentials/tel-publishing.js +16 -7
  10. package/esm/keri/npm/src/app/delivery/forwarding.js +188 -47
  11. package/esm/keri/npm/src/app/delivery/relaying.js +232 -0
  12. package/esm/keri/npm/src/app/delivery/respondant.js +8 -5
  13. package/esm/keri/npm/src/app/exchanges/exchange-messaging.js +1 -1
  14. package/esm/keri/npm/src/app/exchanges/exchanging.js +65 -9
  15. package/esm/keri/npm/src/app/identity/delegating.js +66 -9
  16. package/esm/keri/npm/src/app/identity/habbing.js +190 -71
  17. package/esm/keri/npm/src/app/identity/keeping.js +111 -39
  18. package/esm/keri/npm/src/app/identity/retire-identifier.js +98 -0
  19. package/esm/keri/npm/src/app/ipex/disclosure-replaying.js +116 -0
  20. package/esm/keri/npm/src/app/ipex/group-ipex.js +122 -25
  21. package/esm/keri/npm/src/app/ipex/group-issuance.js +109 -23
  22. package/esm/keri/npm/src/app/ipex/ipex-discloser.js +36 -22
  23. package/esm/keri/npm/src/app/ipex/ipex-grouping.js +53 -3
  24. package/esm/keri/npm/src/app/ipex/ipex-v2.js +7 -2
  25. package/esm/keri/npm/src/app/ipex/issuance.js +131 -35
  26. package/esm/keri/npm/src/app/ipex/pending-presentations.js +4 -2
  27. package/esm/keri/npm/src/app/ipex/presenting.js +3 -18
  28. package/esm/keri/npm/src/app/ipex/receive-issuance.js +2 -1
  29. package/esm/keri/npm/src/app/ipex/unblinding-workflow.js +16 -3
  30. package/esm/keri/npm/src/app/mailbox/agent-inbox.js +292 -0
  31. package/esm/keri/npm/src/app/mailbox/forward-handler.js +298 -52
  32. package/esm/keri/npm/src/app/mailbox/kel-publisher.js +26 -31
  33. package/esm/keri/npm/src/app/mailbox/mailbox-poller.js +70 -62
  34. package/esm/keri/npm/src/app/mailbox/mailboxing.js +20 -4
  35. package/esm/keri/npm/src/app/multisig/counseling.js +75 -27
  36. package/esm/keri/npm/src/app/multisig/group-members.js +41 -5
  37. package/esm/keri/npm/src/app/multisig/grouping.js +50 -2
  38. package/esm/keri/npm/src/app/multisig/multisig-workflows.js +3 -18
  39. package/esm/keri/npm/src/app/multisig/proposing.js +1 -16
  40. package/esm/keri/npm/src/app/multisig/rejoin-group.js +99 -0
  41. package/esm/keri/npm/src/app/multisig/replace-member.js +29 -8
  42. package/esm/keri/npm/src/app/protocol/parsering.js +45 -17
  43. package/esm/keri/npm/src/app/protocol/protocol-processing.js +62 -27
  44. package/esm/keri/npm/src/app/queries/query-replies.js +0 -22
  45. package/esm/keri/npm/src/app/queries/relay-refresh.js +81 -0
  46. package/esm/keri/npm/src/app/queries/witness-inquisitor.js +190 -40
  47. package/esm/keri/npm/src/app/runtime/agent-runtime.js +46 -73
  48. package/esm/keri/npm/src/app/runtime/cue-runtime.js +45 -5
  49. package/esm/keri/npm/src/app/runtime/doing.js +25 -0
  50. package/esm/keri/npm/src/app/runtime/operation-owners.js +26 -56
  51. package/esm/keri/npm/src/app/runtime/workflow-contract.js +7 -4
  52. package/esm/keri/npm/src/app/transport/http-client.js +20 -2
  53. package/esm/keri/npm/src/app/transport/message-source.js +2 -1
  54. package/esm/keri/npm/src/app/transport/messengering.js +39 -8
  55. package/esm/keri/npm/src/app/witness/ingress.js +7 -0
  56. package/esm/keri/npm/src/app/witness/receipt-client.js +43 -16
  57. package/esm/keri/npm/src/app/witness/receipting.js +62 -20
  58. package/esm/keri/npm/src/cli/messaging/multisig.js +4 -3
  59. package/esm/keri/npm/src/core/errors.js +73 -0
  60. package/esm/keri/npm/src/core/kel/delegation-ancestry.js +11 -2
  61. package/esm/keri/npm/src/core/kel/eventing.js +25 -28
  62. package/esm/keri/npm/src/core/kel/kever.js +15 -9
  63. package/esm/keri/npm/src/core/mailbox/kram-policy.js +8 -0
  64. package/esm/keri/npm/src/core/mailbox/kram-pruning.js +25 -6
  65. package/esm/keri/npm/src/core/mailbox/kram-time.js +34 -6
  66. package/esm/keri/npm/src/core/mailbox/kraming.js +58 -2
  67. package/esm/keri/npm/src/core/routing.js +18 -25
  68. package/esm/keri/npm/src/core/scheming.js +12 -5
  69. package/esm/keri/npm/src/core/wire-fields.js +126 -0
  70. package/esm/keri/npm/src/db/basing.js +4 -13
  71. package/esm/keri/npm/src/db/core/indexeddb-persistence.js +3 -2
  72. package/esm/keri/npm/src/db/core/lmdber.js +25 -6
  73. package/esm/keri/npm/src/db/core/memstore.js +4 -0
  74. package/esm/keri/npm/src/db/core/store-owner.js +4 -0
  75. package/esm/keri/npm/src/db/core/webdber.js +85 -27
  76. package/esm/keri/npm/src/db/mailbox/mailboxing.js +13 -0
  77. package/esm/keri/npm/src/db/subing.js +4 -0
  78. package/esm/keri/npm/src/runtime/index.js +11 -5
  79. package/esm/keri/npm/src/time/mod.js +5 -0
  80. package/esm/keri/npm/src/vdr/credential-tsn-record.js +2 -7
  81. package/esm/keri/npm/src/vdr/eventing.js +28 -19
  82. package/esm/keri/npm/src/vdr/registry-tsn-record.js +3 -13
  83. package/esm/keri/npm/src/version.js +2 -2
  84. package/package.json +1 -1
  85. package/types/_dnt.polyfills.d.ts +9 -9
  86. package/types/_dnt.polyfills.d.ts.map +1 -1
  87. package/types/acdc/registering.d.ts +6 -0
  88. package/types/acdc/registering.d.ts.map +1 -1
  89. package/types/acdc/salting.d.ts.map +1 -1
  90. package/types/app/bootstrap/authenticating.d.ts +12 -2
  91. package/types/app/bootstrap/authenticating.d.ts.map +1 -1
  92. package/types/app/bootstrap/oobiery.d.ts +144 -7
  93. package/types/app/bootstrap/oobiery.d.ts.map +1 -1
  94. package/types/app/credentials/credential-importing.d.ts +8 -0
  95. package/types/app/credentials/credential-importing.d.ts.map +1 -1
  96. package/types/app/credentials/root-replicator.d.ts +19 -8
  97. package/types/app/credentials/root-replicator.d.ts.map +1 -1
  98. package/types/app/credentials/schema-resolving.d.ts.map +1 -1
  99. package/types/app/credentials/tel-publishing.d.ts +4 -2
  100. package/types/app/credentials/tel-publishing.d.ts.map +1 -1
  101. package/types/app/delivery/forwarding.d.ts +75 -7
  102. package/types/app/delivery/forwarding.d.ts.map +1 -1
  103. package/types/app/delivery/relaying.d.ts +144 -0
  104. package/types/app/delivery/relaying.d.ts.map +1 -0
  105. package/types/app/delivery/respondant.d.ts +9 -2
  106. package/types/app/delivery/respondant.d.ts.map +1 -1
  107. package/types/app/exchanges/exchanging.d.ts +36 -0
  108. package/types/app/exchanges/exchanging.d.ts.map +1 -1
  109. package/types/app/identity/delegating.d.ts +6 -0
  110. package/types/app/identity/delegating.d.ts.map +1 -1
  111. package/types/app/identity/habbing.d.ts +106 -19
  112. package/types/app/identity/habbing.d.ts.map +1 -1
  113. package/types/app/identity/keeping.d.ts +54 -19
  114. package/types/app/identity/keeping.d.ts.map +1 -1
  115. package/types/app/identity/retire-identifier.d.ts +24 -0
  116. package/types/app/identity/retire-identifier.d.ts.map +1 -0
  117. package/types/app/ipex/disclosure-replaying.d.ts +61 -0
  118. package/types/app/ipex/disclosure-replaying.d.ts.map +1 -0
  119. package/types/app/ipex/group-ipex.d.ts +60 -14
  120. package/types/app/ipex/group-ipex.d.ts.map +1 -1
  121. package/types/app/ipex/group-issuance.d.ts +48 -6
  122. package/types/app/ipex/group-issuance.d.ts.map +1 -1
  123. package/types/app/ipex/ipex-discloser.d.ts +14 -2
  124. package/types/app/ipex/ipex-discloser.d.ts.map +1 -1
  125. package/types/app/ipex/ipex-grouping.d.ts +23 -2
  126. package/types/app/ipex/ipex-grouping.d.ts.map +1 -1
  127. package/types/app/ipex/ipex-v2.d.ts +5 -2
  128. package/types/app/ipex/ipex-v2.d.ts.map +1 -1
  129. package/types/app/ipex/issuance.d.ts +35 -11
  130. package/types/app/ipex/issuance.d.ts.map +1 -1
  131. package/types/app/ipex/pending-presentations.d.ts +4 -2
  132. package/types/app/ipex/pending-presentations.d.ts.map +1 -1
  133. package/types/app/ipex/presenting.d.ts.map +1 -1
  134. package/types/app/ipex/receive-issuance.d.ts +2 -1
  135. package/types/app/ipex/receive-issuance.d.ts.map +1 -1
  136. package/types/app/ipex/unblinding-workflow.d.ts +4 -1
  137. package/types/app/ipex/unblinding-workflow.d.ts.map +1 -1
  138. package/types/app/mailbox/agent-inbox.d.ts +126 -0
  139. package/types/app/mailbox/agent-inbox.d.ts.map +1 -0
  140. package/types/app/mailbox/forward-handler.d.ts +114 -14
  141. package/types/app/mailbox/forward-handler.d.ts.map +1 -1
  142. package/types/app/mailbox/kel-publisher.d.ts +12 -22
  143. package/types/app/mailbox/kel-publisher.d.ts.map +1 -1
  144. package/types/app/mailbox/mailbox-poller.d.ts +40 -24
  145. package/types/app/mailbox/mailbox-poller.d.ts.map +1 -1
  146. package/types/app/mailbox/mailboxing.d.ts +19 -5
  147. package/types/app/mailbox/mailboxing.d.ts.map +1 -1
  148. package/types/app/multisig/counseling.d.ts +34 -11
  149. package/types/app/multisig/counseling.d.ts.map +1 -1
  150. package/types/app/multisig/group-members.d.ts +17 -1
  151. package/types/app/multisig/group-members.d.ts.map +1 -1
  152. package/types/app/multisig/grouping.d.ts +17 -1
  153. package/types/app/multisig/grouping.d.ts.map +1 -1
  154. package/types/app/multisig/multisig-workflows.d.ts +0 -8
  155. package/types/app/multisig/multisig-workflows.d.ts.map +1 -1
  156. package/types/app/multisig/proposing.d.ts +4 -19
  157. package/types/app/multisig/proposing.d.ts.map +1 -1
  158. package/types/app/multisig/rejoin-group.d.ts +119 -0
  159. package/types/app/multisig/rejoin-group.d.ts.map +1 -0
  160. package/types/app/multisig/replace-member.d.ts +15 -1
  161. package/types/app/multisig/replace-member.d.ts.map +1 -1
  162. package/types/app/protocol/parsering.d.ts +21 -2
  163. package/types/app/protocol/parsering.d.ts.map +1 -1
  164. package/types/app/protocol/protocol-processing.d.ts +31 -6
  165. package/types/app/protocol/protocol-processing.d.ts.map +1 -1
  166. package/types/app/queries/query-replies.d.ts +4 -8
  167. package/types/app/queries/query-replies.d.ts.map +1 -1
  168. package/types/app/queries/relay-refresh.d.ts +26 -0
  169. package/types/app/queries/relay-refresh.d.ts.map +1 -0
  170. package/types/app/queries/witness-inquisitor.d.ts +57 -6
  171. package/types/app/queries/witness-inquisitor.d.ts.map +1 -1
  172. package/types/app/runtime/agent-runtime.d.ts +34 -3
  173. package/types/app/runtime/agent-runtime.d.ts.map +1 -1
  174. package/types/app/runtime/cue-runtime.d.ts +15 -3
  175. package/types/app/runtime/cue-runtime.d.ts.map +1 -1
  176. package/types/app/runtime/doing.d.ts +17 -0
  177. package/types/app/runtime/doing.d.ts.map +1 -1
  178. package/types/app/runtime/operation-owners.d.ts +16 -26
  179. package/types/app/runtime/operation-owners.d.ts.map +1 -1
  180. package/types/app/runtime/workflow-contract.d.ts +21 -6
  181. package/types/app/runtime/workflow-contract.d.ts.map +1 -1
  182. package/types/app/transport/http-client.d.ts +9 -0
  183. package/types/app/transport/http-client.d.ts.map +1 -1
  184. package/types/app/transport/message-source.d.ts +6 -3
  185. package/types/app/transport/message-source.d.ts.map +1 -1
  186. package/types/app/transport/messengering.d.ts +10 -1
  187. package/types/app/transport/messengering.d.ts.map +1 -1
  188. package/types/app/witness/ingress.d.ts +1 -0
  189. package/types/app/witness/ingress.d.ts.map +1 -1
  190. package/types/app/witness/receipt-client.d.ts +19 -1
  191. package/types/app/witness/receipt-client.d.ts.map +1 -1
  192. package/types/app/witness/receipting.d.ts +24 -1
  193. package/types/app/witness/receipting.d.ts.map +1 -1
  194. package/types/cli/messaging/multisig.d.ts.map +1 -1
  195. package/types/core/cues.d.ts +53 -1
  196. package/types/core/cues.d.ts.map +1 -1
  197. package/types/core/errors.d.ts +32 -0
  198. package/types/core/errors.d.ts.map +1 -1
  199. package/types/core/kel/delegation-ancestry.d.ts.map +1 -1
  200. package/types/core/kel/eventing.d.ts.map +1 -1
  201. package/types/core/kel/kever-decisions.d.ts +3 -1
  202. package/types/core/kel/kever-decisions.d.ts.map +1 -1
  203. package/types/core/kel/kever.d.ts +7 -1
  204. package/types/core/kel/kever.d.ts.map +1 -1
  205. package/types/core/mailbox/kram-policy.d.ts +6 -0
  206. package/types/core/mailbox/kram-policy.d.ts.map +1 -1
  207. package/types/core/mailbox/kram-pruning.d.ts +5 -1
  208. package/types/core/mailbox/kram-pruning.d.ts.map +1 -1
  209. package/types/core/mailbox/kram-time.d.ts +26 -2
  210. package/types/core/mailbox/kram-time.d.ts.map +1 -1
  211. package/types/core/mailbox/kraming.d.ts +14 -1
  212. package/types/core/mailbox/kraming.d.ts.map +1 -1
  213. package/types/core/routing.d.ts +3 -7
  214. package/types/core/routing.d.ts.map +1 -1
  215. package/types/core/scheming.d.ts.map +1 -1
  216. package/types/core/wire-fields.d.ts +56 -0
  217. package/types/core/wire-fields.d.ts.map +1 -0
  218. package/types/db/basing.d.ts.map +1 -1
  219. package/types/db/core/dber.d.ts +5 -0
  220. package/types/db/core/dber.d.ts.map +1 -1
  221. package/types/db/core/indexeddb-persistence.d.ts +3 -2
  222. package/types/db/core/indexeddb-persistence.d.ts.map +1 -1
  223. package/types/db/core/lmdber.d.ts +6 -0
  224. package/types/db/core/lmdber.d.ts.map +1 -1
  225. package/types/db/core/memstore.d.ts +2 -0
  226. package/types/db/core/memstore.d.ts.map +1 -1
  227. package/types/db/core/store-owner.d.ts +2 -0
  228. package/types/db/core/store-owner.d.ts.map +1 -1
  229. package/types/db/core/webdber.d.ts +32 -6
  230. package/types/db/core/webdber.d.ts.map +1 -1
  231. package/types/db/exchange/exchange-records.d.ts +4 -0
  232. package/types/db/exchange/exchange-records.d.ts.map +1 -1
  233. package/types/db/mailbox/mailboxing.d.ts +10 -1
  234. package/types/db/mailbox/mailboxing.d.ts.map +1 -1
  235. package/types/db/subing.d.ts +2 -0
  236. package/types/db/subing.d.ts.map +1 -1
  237. package/types/runtime/index.d.ts +20 -14
  238. package/types/runtime/index.d.ts.map +1 -1
  239. package/types/time/mod.d.ts +2 -0
  240. package/types/time/mod.d.ts.map +1 -1
  241. package/types/vdr/credential-tsn-record.d.ts.map +1 -1
  242. package/types/vdr/eventing.d.ts.map +1 -1
  243. package/types/vdr/registry-tsn-record.d.ts.map +1 -1
  244. package/types/version.d.ts +2 -2
  245. package/esm/keri/npm/src/app/runtime/signer-conditions.js +0 -51
  246. package/types/app/runtime/signer-conditions.d.ts +0 -32
  247. package/types/app/runtime/signer-conditions.d.ts.map +0 -1
@@ -1,16 +1,44 @@
1
- /** Authenticated /fwd intake: validate provider authority before storing reconstructed child bytes. */
1
+ /** Authenticated /fwd intake: deliver locally or re-forward for senders this host serves, else store for recipients. */
2
2
  import { type CesrFrame, SerderKERI } from "cesr-ts";
3
3
  import { type Operation } from "effection";
4
+ import type { Poster } from "../delivery/forwarding.js";
4
5
  import type { ExchangeAttachment, ExchangeRouteHandler } from "../exchanges/exchanging.js";
6
+ import type { Habery } from "../identity/habbing.js";
7
+ import type { Reactor } from "../protocol/reactor.js";
5
8
  import type { MailboxDirector } from "./mailbox-director.js";
6
9
  /**
7
- * Accepted `/fwd` route handler that stores embedded payloads in mailbox topics.
10
+ * Accepted `/fwd` route handler that stores embedded payloads in mailbox topics and, on a relaying host, delivers
11
+ * a served sender's payloads onward.
8
12
  *
9
13
  * This is the `keri-ts` mailbox-storage analogue to KERIpy's `ForwardHandler`.
10
14
  *
11
- * Authorization rule:
12
- * - the request-scoped mailbox AID passed with this message must currently be
13
- * authorized for the addressed recipient
15
+ * Paths, in order; exactly one runs for one `/fwd`:
16
+ * - ingest: the recipient is a habitat of this Habery and either this host
17
+ * keeps the recipient's mail for pickup (`keepsForPickup`: a local group that
18
+ * authorized it as mailbox or agent), whoever the sender is and whether or
19
+ * not the host relays, or the host relays and the `/fwd` sender is served.
20
+ * The child goes through this runtime's own byte ingress as remote input
21
+ * addressed to that habitat's endpoint, so
22
+ * signature, KRAM and escrow rules apply as for any received message. This is
23
+ * how an edge's group co-member hosted on the agent receives every group
24
+ * message. When the host keeps mail for pickup and the child is not
25
+ * `ownTraffic` (its originator is a local habitat, an agent principal of the
26
+ * host, or a member of the group, i.e. the edge that would pick it up), it is
27
+ * also stored once in the group's mailbox topic for its remote members: one
28
+ * ingest, one stored copy. A third party's `/fwd` to the group is ingested and
29
+ * stored; the edge's own is ingested only. This ingest is the only local
30
+ * delivery of a pickup group's mail: the host's `MailboxPoller` never polls
31
+ * its own endpoint for that group, so the stored copy is for remote members.
32
+ * - store: the request-scoped mailbox AID passed with this message must
33
+ * currently be authorized for the addressed recipient (witness, mailbox or
34
+ * agent). A recipient this host stores for is never also relayed.
35
+ * - relay (relaying only): the `/fwd` sender is served and the recipient is
36
+ * remote. The host re-sends the child with its own Poster, as KERIA's agent
37
+ * re-sends a Signify client's exn.
38
+ *
39
+ * A served sender authorized this host as its `mailbox` or `agent`, directly or
40
+ * through a group it is an accepted member of. Witness membership never makes a
41
+ * sender served.
14
42
  */
15
43
  export declare class ForwardHandler implements ExchangeRouteHandler {
16
44
  /** Registered exchange route for store-forward messages. */
@@ -22,17 +50,27 @@ export declare class ForwardHandler implements ExchangeRouteHandler {
22
50
  /** Borrowed provider publication/correlation owner. */
23
51
  readonly mailboxDirector: MailboxDirector;
24
52
  /**
25
- * Bind mailbox publication without acquiring a store.
53
+ * Borrowed byte ingress of this host's runtime, through which a local recipient receives the child; null (a
54
+ * standalone Exchanger without a runtime) never ingests and only stores.
55
+ */
56
+ readonly reactor: Reactor | null;
57
+ /** Borrowed Poster that re-sends a served sender's child to a remote recipient; null means this host never relays. */
58
+ readonly relay: Poster | null;
59
+ /**
60
+ * Bind mailbox publication, local ingress and optional relaying without acquiring a store.
26
61
  *
27
62
  * @param mailboxDirector Borrowed provider owner that publishes accepted forwarded payloads.
63
+ * @param reactor Borrowed ingress for a local recipient's child; null only outside a runtime.
64
+ * @param relay Borrowed Poster of a relaying host; null keeps the host from relaying or serving senders.
28
65
  */
29
- constructor(mailboxDirector: MailboxDirector);
66
+ constructor(mailboxDirector: MailboxDirector, reactor: Reactor | null, relay: Poster | null);
30
67
  /**
31
- * Verify that the embedded exchange has the mailbox modifiers and one
32
- * extractable forwarded payload.
68
+ * Verify that the exchange names a {@link ForwardAddress} and carries one forwarded message: a legacy embed that
69
+ * rebuilds into exactly one complete message ({@link legacyForwardedMessage}), or one SAID-bound v2 child. Any
70
+ * other shape is refused here, so the Exchanger rejects the `/fwd` and nothing is stored, relayed or ingested.
33
71
  *
34
72
  * @param args Signed forwarding exchange, attachment evidence and optional nested frames; children retain their own authentication requirements.
35
- * @returns Whether required modifiers and one bound forwarded payload are structurally valid.
73
+ * @returns Whether the address and one bound forwarded message are structurally valid.
36
74
  */
37
75
  verify(args: {
38
76
  serder: SerderKERI;
@@ -40,10 +78,9 @@ export declare class ForwardHandler implements ExchangeRouteHandler {
40
78
  nests?: readonly CesrFrame[];
41
79
  }): boolean;
42
80
  /**
43
- * Store one forwarded payload when the receiving host is allowed to act as
44
- * the recipient's async correspondence store.
81
+ * Take the one {@link ForwardPath} this `/fwd` qualifies for, or drop it.
45
82
  *
46
- * Accepted host shapes:
83
+ * Accepted store host shapes:
47
84
  * - explicit mailbox provider authorized in `ends.`
48
85
  * - recipient witness host from the accepted KEL witness set
49
86
  * - recipient agent host authorized in `ends.`
@@ -51,8 +88,19 @@ export declare class ForwardHandler implements ExchangeRouteHandler {
51
88
  * Controller endpoints stay excluded here because they are direct
52
89
  * correspondence destinations, not store-and-forward hosts.
53
90
  *
91
+ * A relayed child is admitted to the Poster with this host as source and the
92
+ * `/fwd` topic unchanged; the Poster's own `transportMailboxTopic` is
93
+ * idempotent on that already-bare topic. Admission is the end of this
94
+ * handler's duty: a failed onward attempt is the Poster's logged failed
95
+ * outcome, with no outbox and no acknowledgement back to the sender.
96
+ *
97
+ * An ingested child is dispatched inside this handler's operation, after the
98
+ * Exchanger has committed the `/fwd`; it is one more input to the shared
99
+ * protocol owners, which hold no lock or input queue. A child the recipient
100
+ * cannot process yet escrows as any received message does.
101
+ *
54
102
  * @param args Accepted exchange with borrowed attachments/children and receiving mailboxAid provenance.
55
- * @returns An operation for v2 child serialization, or synchronous completion/no-op for legacy or unauthorized input.
103
+ * @returns An operation for v2 child serialization or local ingest, or synchronous completion/no-op otherwise.
56
104
  */
57
105
  handle(args: {
58
106
  serder: SerderKERI;
@@ -62,7 +110,59 @@ export declare class ForwardHandler implements ExchangeRouteHandler {
62
110
  /** Receiving hosted endpoint whose authority must cover the addressed recipient. */
63
111
  mailboxAid?: string | null;
64
112
  }): void | Operation<void>;
113
+ /**
114
+ * Decide the path from current accepted state; see the class rules for their order.
115
+ *
116
+ * @param source Authenticated `/fwd` signer and the forwarded message's own originator.
117
+ * @param recipient Final recipient AID named by the `/fwd` modifiers.
118
+ * @param mailboxAid Receiving hosted endpoint AID, or null when the request named none.
119
+ * @returns The one path to take, or null to drop the `/fwd`.
120
+ */
121
+ private forwardPath;
122
+ /**
123
+ * Select the local host that keeps `recipient`'s mail for pickup, or null; any local habitat without
124
+ * request-scoped provenance, as {@link servingHost} does.
125
+ *
126
+ * @param recipient Final recipient AID named by the `/fwd` modifiers.
127
+ * @param mailboxAid Receiving hosted endpoint AID, or null when the request named none.
128
+ * @returns The local AID that keeps the recipient's mail for pickup, or null.
129
+ */
130
+ private pickupHost;
131
+ /**
132
+ * Take one decided path for complete child wire.
133
+ *
134
+ * @param path Path decided in this turn.
135
+ * @param address Final recipient AID and `/fwd` mailbox topic.
136
+ * @param wire Exactly one complete child message, signed by its originator.
137
+ * @returns The ingest operation for a local recipient; storage (including an ingested child's pickup copy, written
138
+ * before ingest in the turn its authority was read) and Poster admission complete synchronously.
139
+ */
140
+ private deliver;
65
141
  /** Re-read accepted authority in the same synchronous turn as provider publication. */
66
142
  private canStoreRecipient;
67
143
  }
144
+ /**
145
+ * Who a relayed request speaks for. A group's `/fwd` wrapper is signed by its local member (Poster cannot meet a
146
+ * group threshold with one signature), so the signer and the forwarded message's originator can differ. A request
147
+ * the host consumes itself (an `/oobis` request) has no forwarded originator.
148
+ */
149
+ export interface ForwardSource {
150
+ /** Authenticated `/fwd` signer (its `i`), verified by the Exchanger before this handler runs. */
151
+ readonly sender: string | null;
152
+ /** The forwarded message's own `i` (an ACDC's issuer), or null when it carries none. */
153
+ readonly origin: string | null;
154
+ }
155
+ /**
156
+ * Select the local host that serves this source, or null. This is the one served-sender rule of a relaying host:
157
+ * `/fwd` intake relays only for it and the `/oobis` handler resolves only for it.
158
+ *
159
+ * Without request-scoped provenance any local habitat the source authorized serves it, as the store path
160
+ * accepts any local store host.
161
+ *
162
+ * @param hby Borrowed local habitat collection and accepted-state database.
163
+ * @param source Authenticated signer and, for a `/fwd`, the forwarded message's own originator.
164
+ * @param mailboxAid Receiving hosted endpoint AID, or null when the request named none.
165
+ * @returns The local AID the source authorized, or null.
166
+ */
167
+ export declare function servingHost(hby: Habery, source: ForwardSource, mailboxAid: string | null | undefined): string | null;
68
168
  //# sourceMappingURL=forward-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"forward-handler.d.ts","sourceRoot":"","sources":["../../../src/app/mailbox/forward-handler.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,OAAO,EACL,KAAK,SAAS,EAQd,UAAU,EAEX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAG3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;;;GAQG;AACH,qB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AOG;IACH,OAAO,CAAC,UAAU;IAMlB;;;;;;;;OAQG;IACH,OAAO,CAAC,OAAO;IAgBf,uFAAuF;IACvF,OAAO,CAAC,iBAAiB;CAO1B;AA0BD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,iGAAiG;IACjG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGpH"}
@@ -18,13 +18,14 @@
18
18
  * A failed post is retried with a doubling delay up to {@link KEL_PUBLISH_MAX_DELAY_MS}, in memory, and given
19
19
  * up when the next attempt would start more than {@link KEL_PUBLISH_BUDGET_MS} after the first. Giving up
20
20
  * writes `failed` to the record and a change to the sink. A timed-out entry is not retried on its own: a new
21
- * rotation, a successful poll of that mailbox (the mailbox is evidently back), a successful 403 repair, a
22
- * `prompt`, or the next runtime open (memory starts empty, so each owed entry gets a fresh budget) re-arms it.
21
+ * rotation, a successful poll of that mailbox (the mailbox is evidently back), a 403 from it, a `prompt`, or the
22
+ * next runtime open (memory starts empty, so each owed entry gets a fresh budget) re-arms it. The mailbox poller
23
+ * reports polls as {@link MailboxPollCue} records on the `polls` deck; the publisher acts on them on its own tock.
23
24
  * A host that cannot take a multi-message stream (KERIpy answers 400 or 406) is recorded as told: it does
24
25
  * not authenticate polls, so nothing is lost.
25
26
  */
26
27
  import { type Operation } from "effection";
27
- import type { RotatedCue } from "../../core/cues.js";
28
+ import type { MailboxPollCue, RotatedCue } from "../../core/cues.js";
28
29
  import { Deck } from "../../core/deck.js";
29
30
  import { type DoerPacing } from "../runtime/doing.js";
30
31
  import type { RetryPolicy } from "../runtime/retry-backoff.js";
@@ -78,34 +79,21 @@ export declare class KelPublisher {
78
79
  #private;
79
80
  /** Completion points push here; the next tock gives that identifier's entries a fresh budget. */
80
81
  readonly rotated: Deck<RotatedCue>;
81
- /** A failure that escapes a pass is counted and kept here; the fiber keeps running. */
82
- readonly health: {
83
- faults: number;
84
- last: {
85
- error: unknown;
86
- at: number;
87
- } | null;
88
- };
82
+ /** The mailbox poller pushes what each poll said here; the next tock re-arms or repairs that entry. */
83
+ readonly polls: Deck<MailboxPollCue>;
89
84
  constructor(deps: KelPublisherDeps);
90
85
  /**
91
86
  * Give `pre`'s entries a fresh budget and derive them on the next tock; with `mailbox`, re-arm only that mailbox's
92
- * entry, and only if it timed out (the poller calls this after a successful poll).
87
+ * entry, and only if it timed out (what a `polled` record on {@link KelPublisher.polls} does).
93
88
  */
94
89
  prompt(pre: string, mailbox?: string): void;
95
- /**
96
- * A mailbox refused the owner's poll with 403: whatever the record says it holds, it cannot authenticate
97
- * the owner (it lost its state, or accepted a post it then escrowed). Forget what it was given, so the next
98
- * pass posts the KEL again, and give the entry a fresh budget. The poller calls this at most once per backoff
99
- * period, which is also the most this posts; a mailbox that never recovers is given up on like any other.
100
- */
101
- repair(pre: string, mailbox: string): void;
102
90
  /**
103
91
  * The full check: forget records of mailboxes no longer authorized, and mark every identifier for derivation.
104
92
  * A walk of all identifiers, so a host runs it at open and every many tocks.
105
93
  */
106
94
  sweep(): void;
107
95
  /**
108
- * The fixed-tock pass: drain the cues, derive the marked identifiers and those still owed, then send up to
96
+ * The fixed-tock pass: drain the decks, derive the marked identifiers and those still owed, then send up to
109
97
  * {@link KelSendsPerPass} due posts, each within `timeoutMs` for the mailbox's answer. An idle pass reads no
110
98
  * store. A post is recorded when the mailbox answers 2xx; a failure is retried on the schedule until the budget
111
99
  * is used up. Never throws on a remote failure; every attempt is returned.
@@ -134,8 +122,10 @@ export declare class KelPublisher {
134
122
  /**
135
123
  * Run the publisher on its own fiber until halted, as a fixed-tock doer: a sweep on tock 0 and every
136
124
  * `pacing.sweepTocks`, a pass on every tock, then a wait of one tock. A mailbox that hangs holds up only this
137
- * fiber, never the operation owners. A failure that escapes a pass is counted in `publisher.health` and the
138
- * loop keeps running.
125
+ * fiber, never the operation owners. Nothing is caught: every outcome of a post (an HTTP error status, a transport
126
+ * failure, no answer in time) is a `failed` publication that the pass records and retries, so what escapes a pass is a
127
+ * real fault (a store that cannot be read or written, a local group whose member is missing) and it ends the loop and
128
+ * `runAgentRuntime`. Halting the loop returns from the pass and is not a fault.
139
129
  */
140
130
  export declare function kelPublisherDo(publisher: KelPublisher, clock: RuntimeClock, pacing?: Readonly<DoerPacing>): Operation<never>;
141
131
  //# sourceMappingURL=kel-publisher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kel-publisher.d.ts","sourceRoot":"","sources":["../../../src/app/mailbox/kel-publisher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,KAAK,UAAU,EAAW,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,KAAK,UAAU,EAAgB,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAGxB,MAAM,qBAAqB,CAAC;AAG7B,wGAAwG;AACxG,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,sGAAsG;AACtG,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,qFAA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AM,EACX,EAAE,SAAS,EAAE,MAAW,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GACjE,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;CAqG7C;AAED;;;;;;;GAOG;AACH,wBAAiB,cAAc,CAC7B,SAAS,EAAE,YAAY,EACvB,KAAK,EAAE,YAAY,EACnB,MAAM,GAAE,QAAQ,CAAC,UAAU,CAAwB,GAClD,SAAS,CAAC,KAAK,CAAC,CAKlB"}
@@ -1,9 +1,11 @@
1
1
  /** Recipient mailbox polling: signed queries, awaited SSE intake and persisted cursor progression. */
2
2
  import { type Operation } from "effection";
3
+ import type { MailboxPollCue } from "../../core/cues.js";
4
+ import type { Deck } from "../../core/deck.js";
5
+ import type { Relay } from "../delivery/relaying.js";
3
6
  import type { Habery } from "../identity/habbing.js";
4
7
  import { type DoerPacing } from "../runtime/doing.js";
5
8
  import type { RuntimeClock } from "../runtime/runtime-clock.js";
6
- import type { SignerConditions } from "../runtime/signer-conditions.js";
7
9
  import type { HttpClient } from "../transport/http-client.js";
8
10
  import type { MailboxDirector } from "./mailbox-director.js";
9
11
  /**
@@ -14,18 +16,11 @@ interface MailboxPollerOptions {
14
16
  * Optional millisecond header and poll-window overrides.
15
17
  */
16
18
  timeouts?: Partial<MailboxPollingTimeoutPolicy>;
17
- /** Told after each poll a mailbox served; the runtime re-arms a timed-out KEL publication with it. */
18
- onPolled?: (pre: string, mailbox: string) => void;
19
19
  /**
20
- * Told when a mailbox answers 403 (it cannot authenticate the requester against the KEL it holds); the runtime
21
- * has its KEL publisher post the KEL again. The worker then backs off.
20
+ * Where each served poll (`polled`) and each 403 (`unauthorized`) is pushed; the runtime wires the KEL publisher's
21
+ * `polls` deck here, which the publisher drains on its tock. Omitted, polls are reported nowhere.
22
22
  */
23
- onUnauthorized?: (pre: string, mailbox: string) => void;
24
- /**
25
- * Where a poll that cannot be signed (its signer released) is reported while its worker waits; the worker
26
- * resumes as soon as a signer is held again.
27
- */
28
- signerConditions?: SignerConditions;
23
+ polls?: Deck<MailboxPollCue>;
29
24
  }
30
25
  /** Tocks between the poller's full re-selection of workers: 160 tocks of 31.25 ms is five seconds. */
31
26
  export declare const MAILBOX_POLLER_SWEEP_TOCKS = 160;
@@ -42,7 +37,8 @@ export declare const MAILBOX_POLLER_PACING: Readonly<DoerPacing>;
42
37
  *
43
38
  * Each endpoint has an independent worker and durable progress in the director.
44
39
  * Retrieved records are lent to the awaited consumer; protocol intake stays outside.
45
- * A provider store in the same runtime is never scanned for local recipient input.
40
+ * A provider store in the same runtime is never scanned for local recipient input, and this runtime never polls its
41
+ * own endpoint for a local group whose mail it processes on arrival (see {@link MailboxPoller.deliveredOnArrival}).
46
42
  */
47
43
  export declare class MailboxPoller {
48
44
  #private;
@@ -71,12 +67,10 @@ export declare class MailboxPoller {
71
67
  readonly http: HttpClient;
72
68
  /** Borrowed clock for this owner's actual network deadlines. */
73
69
  readonly clock: RuntimeClock;
74
- /** Told after each poll a mailbox served. */
75
- readonly onPolled: ((pre: string, mailbox: string) => void) | undefined;
76
- /** Where unsignable polls are reported, when the host keeps such a record. */
77
- readonly signerConditions: SignerConditions | undefined;
78
- /** Told when a mailbox answers 403. */
79
- readonly onUnauthorized: ((pre: string, mailbox: string) => void) | undefined;
70
+ /** Where served polls and 403s are pushed, for the KEL publisher; null when nothing consumes them. */
71
+ readonly polls: Deck<MailboxPollCue> | null;
72
+ /** The agent this runtime polls through (an edge), its only provider; null polls mailboxes and witnesses. */
73
+ readonly relay: Relay | null;
80
74
  /**
81
75
  * Bind polling inputs and dependencies without starting workers or acquiring stores.
82
76
  *
@@ -84,9 +78,10 @@ export declare class MailboxPoller {
84
78
  * @param mailboxDirector Borrowed provider/topic/cursor owner.
85
79
  * @param http Borrowed HTTP implementation selected by composition.
86
80
  * @param clock Borrowed clock with epoch-millisecond now and millisecond timer delays.
87
- * @param options Optional timeout overrides; finite positive values are floored with a 1 ms minimum. Missing/nonpositive/nonfinite values use 5-second headers and 30-second poll windows.
81
+ * @param relay The agent every subject is polled through; null selects authorized mailboxes and witnesses.
82
+ * @param options Optional timeout overrides and poll-report deck; finite positive timeouts are floored with a 1 ms minimum. Missing/nonpositive/nonfinite values use 5-second headers and 30-second poll windows.
88
83
  */
89
- constructor(hby: Habery, mailboxDirector: MailboxDirector, http: HttpClient, clock: RuntimeClock, options?: MailboxPollerOptions);
84
+ constructor(hby: Habery, mailboxDirector: MailboxDirector, http: HttpClient, clock: RuntimeClock, relay: Relay | null, options?: MailboxPollerOptions);
90
85
  /**
91
86
  * Register one mailbox topic that this poller should retrieve.
92
87
  *
@@ -114,7 +109,7 @@ export declare class MailboxPoller {
114
109
  * @param target Mailbox subject habitat plus the actual local signer (a member for groups).
115
110
  * @param endpoint Selected remote endpoint AID and HTTP(S) URL.
116
111
  * @param onBatch Awaited consumer; successful completion precedes durable cursor advancement.
117
- * @returns How the poll ended; see {@link PollOutcome}. An `unsignable` poll carries the missing public key.
112
+ * @returns How the poll ended; see {@link PollOutcome}.
118
113
  */
119
114
  private pollRemoteEndpointOnce;
120
115
  /**
@@ -123,6 +118,7 @@ export declare class MailboxPoller {
123
118
  * @param remoteWorkers Owned worker map, mutated to match current endpoint selection.
124
119
  * @param onBatch Shared awaited consumer used independently by each endpoint worker.
125
120
  * @param topics Current registered topics; no topics means no remote workers.
121
+ * @param tockMs How long a worker whose signer cannot sign yet waits before it looks again.
126
122
  */
127
123
  private syncRemoteWorkers;
128
124
  /**
@@ -132,13 +128,34 @@ export declare class MailboxPoller {
132
128
  * `keri-ts`'s split between mailbox transport and runtime parser ownership. Each poll ends in a
133
129
  * {@link PollOutcome}; {@link nextPoll} maps it and the backoff state to the next action. A mailbox that is
134
130
  * unreachable or refuses is retried on {@link MailboxPoller.RefusalBackoff}, never in a tight loop and never
135
- * by failing the runtime. A 403 also prompts the KEL publisher, which owns posting the KEL.
131
+ * by failing the runtime. A served poll and a 403 are pushed onto `polls` for the KEL publisher, which owns posting
132
+ * the KEL.
133
+ *
134
+ * A signer that cannot sign yet (a store opened without it) is not a remote failure: the worker neither polls
135
+ * nor backs off, and looks again each tock, so it polls within one tock of `Manager.hold`. Because it never polls
136
+ * for such a subject, the consumer's protocol work never runs for it either.
136
137
  *
137
138
  * @param target Mailbox subject habitat plus the actual local signer (a member for groups).
138
139
  * @param endpoint Selected remote endpoint AID and HTTP(S) URL.
139
140
  * @param onBatch Awaited consumer; successful completion precedes durable cursor advancement.
141
+ * @param tockMs How long the worker waits before it looks again at a signer that cannot sign.
140
142
  */
141
143
  private remoteEndpointWorker;
144
+ /**
145
+ * Whether `subject`'s mail at `eid` already reached local processing when it arrived, so polling `eid` for it would
146
+ * process every stored message a second time. That holds when this runtime is the provider (it owns the mailbox
147
+ * store), `eid` is one of its own habitats and it keeps `subject`'s mail for pickup ({@link keepsForPickup}: for a
148
+ * local subject, a group that authorized `eid` as mailbox or agent). Such a host ingests every `/fwd` for the group
149
+ * on arrival (`ForwardHandler`) and dispatches every raw arrival before keeping it; the copy it stores is for the
150
+ * group's remote members, who poll it from here. Any other local subject at a local endpoint (a single-sig habitat
151
+ * whose mailbox is this host) is still polled over loopback HTTP, which is its only local delivery of stored mail.
152
+ * Without a mailbox store this runtime is not the provider, so it polls as any remote client would.
153
+ *
154
+ * @param subject Local mailbox subject AID.
155
+ * @param eid Selected provider AID.
156
+ * @returns True when the endpoint must not be polled for this subject.
157
+ */
158
+ private deliveredOnArrival;
142
159
  /**
143
160
  * Select locally pollable subjects without substituting the group for its member signer.
144
161
  *
@@ -210,10 +227,9 @@ export interface MailboxFetchTimeoutPolicy {
210
227
  * - `no-response`: no response headers within the open window.
211
228
  * - `unreachable`: the connection failed before or while the response was read (refused, DNS, reset).
212
229
  * - `unauthorized`: 403, the mailbox cannot authenticate the requester against the KEL it holds.
213
- * - `unsignable`: the poll could not be signed because the host released the signer (`Manager.release`).
214
230
  * - `refused`: any other non-success status.
215
231
  */
216
- export type PollOutcome = "served" | "no-response" | "unreachable" | "unauthorized" | "unsignable" | "refused";
232
+ export type PollOutcome = "served" | "no-response" | "unreachable" | "unauthorized" | "refused";
217
233
  /** What the worker carries between polls: the current backoff, zero after a served poll. */
218
234
  export interface PollState {
219
235
  readonly backoffMs: number;
@@ -1 +1 @@
1
- {"version":3,"file":"mailbox-poller.d.ts","sourceRoot":"","sources":["../../../src/app/mailbox/mailbox-poller.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAAQ,KAAK,SAAS,EAA4B,MAAM,WAAW,CAAC;AAC3E,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,KAAK,UAAU,EAA6B,MAAM,qBAAqB,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAQxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D;;GAEG;AACH,UAAU,oBAAoB;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAChD,sGAAsG;IACtG,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED,sGAAsG;AACtG,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,UAAU,CAGrD,CAAC;AAEH;;;;;;GAMG;AACH,qBAAa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gC,GACrE;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAa1C"}
@@ -18,6 +18,7 @@
18
18
  import type { Operation } from "effection";
19
19
  import type { Baser } from "../../db/basing.js";
20
20
  import { Mailboxer, type MailboxerOptions } from "../../db/mailbox/mailboxing.js";
21
+ import type { Relay } from "../delivery/relaying.js";
21
22
  import type { Hab, Habery } from "../identity/habbing.js";
22
23
  /**
23
24
  * Derive mailbox open options from one existing habery.
@@ -81,22 +82,35 @@ export declare function mailboxQueryTopics(hby: Habery, pre: string, witness: st
81
82
  export declare function updateMailboxRemoteCursor(hby: Habery, pre: string, witness: string, topic: string, idx: number): void;
82
83
  /** AIDs `pre` currently has an authorized mailbox role with, in stored order. */
83
84
  export declare function authorizedMailboxes(db: Baser, pre: string): string[];
85
+ /** One mailbox provider to poll: its AID, its HTTP(S) URL and the worker key that names the pair. */
86
+ export interface MailboxPollEndpoint {
87
+ /** Stable worker key, `eid:url`. */
88
+ readonly key: string;
89
+ /** Provider AID the poll query is addressed to. */
90
+ readonly eid: string;
91
+ /** Preferred HTTP(S) URL of the provider. */
92
+ readonly url: string;
93
+ }
84
94
  /**
85
95
  * Enumerate authorized mailbox providers and the subject's current KEL witnesses.
86
96
  *
87
97
  * Both sets are polled, as in KERIpy MailboxDirector. A provider in both roles
88
98
  * shares one history and cursor, so it gets one worker. Locally controlled AIDs
89
99
  * remain eligible for HTTP polling; provider storage is never scanned directly.
100
+ * This lists every provider; the poller itself drops a local provider that
101
+ * processes the subject's mail on arrival (`MailboxPoller.deliveredOnArrival`).
90
102
  * Missing HTTP(S) locations produce no poll target until a location is available.
91
103
  *
104
+ * With a relay (an edge runtime) the relay is the only provider: witnesses and other mailboxes are not polled, and
105
+ * the relay is polled once the subject has authorized it as mailbox (for a group, the group's own row, since the
106
+ * relay stores the group's messages under that authorization). Until then the subject has no poll target; the
107
+ * runtime prompts the poller when the role is accepted.
108
+ *
92
109
  * @param hab Mailbox subject habitat supplying accepted roles and current witnesses.
110
+ * @param relay The agent this runtime polls through; null polls authorized mailboxes and witnesses.
93
111
  * @returns One HTTPS-preferred HTTP target per provider AID, with stable worker keys.
94
112
  */
95
- export declare function mailboxPollEndpoints(hab: Hab): Array<{
96
- key: string;
97
- eid: string;
98
- url: string;
99
- }>;
113
+ export declare function mailboxPollEndpoints(hab: Hab, relay: Relay | null): MailboxPollEndpoint[];
100
114
  /**
101
115
  * Read one endpoint's currently stored URLs directly from shared DB state.
102
116
  *
@@ -1 +1 @@
1
- {"version":3,"file":"mailboxing.d.ts","sourceRoot":"","sources":["../../../src/app/mailbox/mailboxing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,OAAO,CAAC,gBAAgB,CAAM,GACtC,gBAAgB,CAKlB;AAED;;;;;;;;;;GAUG;AACH,wBAAiB,sBAAsB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,OAAO,CAAC,gBAAgB,CAAM,GACtC,SAAS,CAAC,SAAS,CAAC,CAGtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAElE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,QAAQ,CAAC,MAAM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,GACtB,cAAc,EAAE,CAqBlB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,cAAc,SAAK,EACnB,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,GACtB,cAAc,GAAG,IAAI,CAGvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,GACtB,uBAAuB,EAAE,CAsB3B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,cAAc,SAAK,EACnB,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,EACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAC1B,qBAAqB,CA0BvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAChD,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAarC;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAExE;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMpD"}
@@ -1,5 +1,6 @@
1
1
  import { type Operation } from "effection";
2
2
  import type { RotatedCue } from "../../core/cues.js";
3
+ import type { Deck } from "../../core/deck.js";
3
4
  import { type Anchorer, type AnchorQueryDeps } from "../identity/delegating.js";
4
5
  import type { Hab, Habery } from "../identity/habbing.js";
5
6
  import type { RetryPolicy } from "../runtime/retry-backoff.js";
@@ -79,20 +80,17 @@ export interface GroupReceipting {
79
80
  receipt(pre: string, options: {
80
81
  sn: number;
81
82
  auths: WitnessAuthMap;
83
+ allowTcp?: boolean;
82
84
  }): Operation<unknown>;
83
85
  get(pre: string, options: {
84
86
  sn: number;
85
87
  said: string;
86
88
  }): Operation<boolean>;
87
89
  }
88
- /** Told when a group rotation completes, so its mailboxes are told; the runtime's `kelPublisher.rotated` fits. */
89
- export interface GroupMailboxes {
90
- rotated(cue: RotatedCue): void;
91
- }
92
90
  /**
93
91
  * Sends a completed event to members that may never have seen the signatures that completed it (a member that signed
94
92
  * nothing, or one whose own signature was not needed). One outcome per member; a transport failure is the member's
95
- * `failed` outcome and not an error.
93
+ * `failed` outcome and not an error. What it throws is a fault, which ends the Counselor's loop.
96
94
  */
97
95
  export interface GroupForwarding {
98
96
  forward(event: GroupEventRef, members: readonly string[]): Operation<GroupDelivery[]>;
@@ -115,23 +113,30 @@ export declare class Counselor {
115
113
  private readonly clock;
116
114
  private readonly changes?;
117
115
  private readonly delegation?;
118
- private readonly mailboxes?;
116
+ private readonly rotated?;
117
+ private readonly groupChanges?;
119
118
  private readonly receiptRetry;
120
119
  private readonly forwarding?;
121
120
  private readonly runs;
122
121
  /** Completed events this member, as the elected one, still owes to other members; memory only. */
123
122
  private readonly forwards;
124
123
  private readonly forwarded;
124
+ /** Per local group, the latest establishment SAID its stored members were found to follow; memory only. */
125
+ private readonly aligned;
125
126
  /**
126
127
  * @param hby Borrowed identities and stores; the Counselor opens nothing.
127
128
  * @param receipting Submits or fetches witness receipts for accepted events.
128
129
  * @param clock Time source for fallback and retry; only `now` is used.
129
130
  * @param changes Optional sink told `{kind:"group", id:"<pre>:<sn>"}` after commits.
130
131
  * @param delegation Anchorer and query port for delegated events; omit for non-delegated hosts.
131
- * @param mailboxes Told when one of the group's rotations completes; the member runtime's publisher then tells
132
- * the group's mailboxes the new key state, and several members doing so is harmless.
132
+ * @param rotated Deck that gets a record of each completed group rotation (`rot` or `drt`); the member runtime
133
+ * passes its KEL publisher's, which then tells the group's mailboxes the new key state. Several members doing
134
+ * so is harmless.
135
+ * @param groupChanges Deck that gets the prefix of a group whose establishment event completed or whose stored
136
+ * members were aligned late; the member runtime shares it with its root replicator, which re-derives the
137
+ * copies the group owes on its next pass instead of at its next sweep.
133
138
  */
134
- constructor(hby: Habery, receipting: GroupReceipting, clock: Pick<RuntimeClock, "now">, changes?: ChangeSink | undefined, delegation?: GroupDelegation | undefined, mailboxes?: GroupMailboxes | undefined, receiptRetry?: Readonly<RetryPolicy>, forwarding?: GroupForwarding | undefined);
139
+ constructor(hby: Habery, receipting: GroupReceipting, clock: Pick<RuntimeClock, "now">, changes?: ChangeSink | undefined, delegation?: GroupDelegation | undefined, rotated?: Deck<RotatedCue> | undefined, groupChanges?: Deck<string> | undefined, receiptRetry?: Readonly<RetryPolicy>, forwarding?: GroupForwarding | undefined);
135
140
  private readonly anchorQuery;
136
141
  /**
137
142
  * Begin counseling an event. Idempotent and safe before local acceptance.
@@ -167,7 +172,12 @@ export declare class Counselor {
167
172
  * in-memory inputs. Accepted KEL state is untouched.
168
173
  */
169
174
  abandon(pre: string): void;
170
- /** One pass over all stages, as KERIpy `processEscrows`. */
175
+ /** Whether completed events are held in memory for forwarding, which a pass retries without any store write. */
176
+ get holdsForwards(): boolean;
177
+ /**
178
+ * One pass over all stages, as KERIpy `processEscrows`, after aligning stored group members with accepted state
179
+ * so that a completion in this pass forwards to the members of the event that completed.
180
+ */
171
181
  processOnce(): Operation<void>;
172
182
  /** What became of the completed `event` this member forwarded to the others, per member; empty before it did. */
173
183
  forwardOutcomes(event: GroupEventRef): readonly GroupDelivery[];
@@ -184,9 +194,22 @@ export declare class Counselor {
184
194
  private publishDelegation;
185
195
  /** Non-publishing duty: find the delegator's sealing event, pin it, and move on to receipts. */
186
196
  private watchAnchor;
197
+ /**
198
+ * Bring each local group's stored members in line with its latest accepted establishment event, whoever proposed
199
+ * it and however late its last signature arrived (`Habery.alignGroupMembers`). A group is re-read only when that
200
+ * event differs from the one its members were last found to follow; one that cannot be attributed yet (a member's
201
+ * KEL is missing) is left as it is and read again on a later pass, which the arriving KEL's write brings about.
202
+ *
203
+ * After a change, an elected member whose latest establishment event already completed owes it again to the
204
+ * members it now has, and the group goes on `groupChanges` so the root replicator re-derives its copies.
205
+ */
206
+ private alignMembers;
187
207
  /** The elected member owes the completed event to the members that did not sign it into existence. */
188
208
  private owe;
189
- /** Record completion of a counseled event and drop its row from `table`. */
209
+ /**
210
+ * Record completion of a counseled event and drop its row from `table`. A completed establishment event goes on
211
+ * `groupChanges`, and a completed rotation on `rotated` as well.
212
+ */
190
213
  private finish;
191
214
  /** Complete events whose own witness threshold is met; otherwise submit or fetch receipts. */
192
215
  private processWitnesses;