@uuaid/pillar 2.8.0 → 2.8.2

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/HOSTING-LIMITS.md CHANGED
@@ -457,11 +457,30 @@ like `/v1/` (40 s, `X-Forwarded-For` replaced, the same body size and CORS):
457
457
 
458
458
  The relay answers every `/e/*` request with `cache-control: no-store`; do not
459
459
  add a proxy cache in front of `/e/`, and do not log `x-pillar-*` headers.
460
- A seed served through a tunnel relay is not listed in any `directory.json` in
461
- 2.8.0; agents add its `<origin>/e/<id>` URL to their carriers by hand (README
462
- "Egress seed"). Proxy only an allow-file relay. A carrier started with `--accept-tunnels open`
463
- (loopback tests) admits any seed; its loopback bind does not stop a proxy on the
464
- same host from publishing it.
460
+ A 2.8.0 client never configures a seed served through a tunnel relay
461
+ automatically; agents add its `<origin>/e/<id>` URL to their carriers by hand
462
+ (README "Egress seed"). A 2.8.1 registry lists it in `directory.json` `seeds[]`
463
+ for reach only, with its `uuaid` and `relay`, once a round trip with inbox auth
464
+ v2 and the seed's served proof passed for its current URL, key and relay pin;
465
+ a 2.8.1 `pillar init --directory` takes at most 4 such entries (README
466
+ "Relayed seeds in the directory"). A carrier started with
467
+ `--accept-tunnels open` (2.8.1, README "Open relay") admits any seed that proves
468
+ its uuaid key; proxy it the same way. Its stdout has one meter line per stream
469
+ (route template, status, bytes, ms): that is the usage record, with no header.
470
+
471
+ **Inbox auth nonces (2.8.1).** A carrier that takes inbox auth v2 (a relayed
472
+ seed, or a carrier with `--public-url`) stores each v2 nonce until its
473
+ 5-minute window ends (at most ts + 5 min + 1 s), with an index on the expiry
474
+ time. It holds at most 100,000 at once, about 10 MiB (measured: 10.4 MiB of
475
+ database for 100,000 rows with both indexes). Behind a relay, one client
476
+ address at the relay's 600 reads a minute fills about 6,000 in 10 minutes, so
477
+ about 16 such addresses fill it. A direct carrier with `--public-url` has no
478
+ per-address limit on `wait=0` reads (below), so one address can fill it:
479
+ rate-limit `/v1/inbox/` in your proxy. When it is full, new v2 reads get 503 `inbox-auth-busy`
480
+ until stored nonces expire; no stored nonce is dropped early, so a replay is
481
+ still refused. v1 reads use no nonce. A full store also fails a registry's
482
+ round trips to that seed, so its listing and vetting lapse until space
483
+ returns. The bound is not a flag in 2.8.1.
465
484
 
466
485
  **Relayed seed memory (2.8.0).** Per tunnel, that is per `pillar-seed --relay`
467
486
  process: inbox pages held for clients are bounded by `--response-budget` (32
@@ -616,6 +635,13 @@ or an exception message. A parameterised reason such as
616
635
  | `bad-sig-encoding` | 401 | Send `x-pillar-sig` as 128 hex characters |
617
636
  | `clock-skew` | 401 | Fix your clock (NTP) to within 5 min of the carrier; retrying does not help |
618
637
  | `uuaid-pubkey-mismatch` | 401 | Read the inbox of the UUAID your key derives, or send that UUAID's delegation in `x-pillar-delegation` |
638
+ | `inbox-auth-v2-required` (2.8.1) | 401 | A relayed seed, and a 2.8.1 relay, take only inbox auth v2 (`x-pillar-auth: 2`, bound to the seed URL, single-use): update pillar to 2.8.1 or later |
639
+ | `inbox-auth-version` (2.8.1) | 401 | Send `x-pillar-auth: 2`, or no `x-pillar-auth` for v1 at a direct carrier |
640
+ | `inbox-audience-unknown` (2.8.1) | 401 | This carrier has no public URL to check a v2 audience against; send v1 |
641
+ | `bad-nonce` (2.8.1) | 401 | Send `x-pillar-nonce` as 32 random hex characters, new for each request |
642
+ | `nonce-used` (2.8.1) | 401 | Sign again with a new nonce; each v2 inbox auth is used once |
643
+ | `inbox-auth-query` (2.8.1) | 401 | A v2 read takes only `since` and `wait` (whole numbers) and `challenge` (64 hex), each at most once; v2 signs all three |
644
+ | `inbox-auth-busy` (2.8.1) | 503 | Retry in a few seconds: the carrier keeps every live v2 nonce until its 5-minute window ends, up to 100,000 at once |
619
645
  | `delegation-unparseable` | 401 | Send `x-pillar-delegation` as the JSON delegation document |
620
646
  | `delegation-too-large` | 401 | Send a delegation document under 8,192 bytes |
621
647
  | `delegation-principal-mismatch` | 401 | Use a delegation whose principal is the inbox UUAID |
@@ -646,6 +672,7 @@ or an exception message. A parameterised reason such as
646
672
  |---|---|---|
647
673
  | `carrier-unreachable` | every carrier failed without answering | Check the carrier URLs and your network, then retry |
648
674
  | `carrier-bad-response` | a carrier or its proxy answered without a reason | Retry, or use another carrier |
675
+ | `carrier-redirect-refused` | a carrier answered 3xx; the client never follows a redirect (2.8.1), so no `x-pillar-*` header reaches the target | Configure the carrier's final https URL |
649
676
  | `over-tier-limit`, `blob-too-large` | send preflight, before any network call (src/net/carrier-client.mjs:90) | Send the payload as a blob (`pillar-blob send`, or `Pillar.sendBlob`) |
650
677
  | `blob-key-unproven` | `pillar-blob`, before signing a broker request | Use a self-certifying agent UUAID (`foundation`, `pillar` or `agentnet`) derived from this key (`pillar init`), or get a registry badge that names this key |
651
678
  | `sender-key-not-active` | `pillar-blob get`, before redeeming | Ask the sender to send from a self-certifying agent UUAID (`foundation`, `pillar` or `agentnet`) derived from its own key, or to get a registry badge naming its key |
package/README.md CHANGED
@@ -441,6 +441,13 @@ exchange needed. For peers outside any directory, pass their key once with
441
441
  `pillar-ask <uuaid> "..." --to-pubkey HEX`. Point it at your own directory.json
442
442
  to build a private mesh.
443
443
 
444
+ An app that reads the directory itself can apply the same rule (2.8.2):
445
+ `import { directoryCarriers } from "@uuaid/pillar/discovery"`.
446
+ `directoryCarriers(doc)` returns `{ carriers, skippedRelayed }`: the bootstrap
447
+ carrier (never a relayed seed URL), then each seed URL in directory order. A
448
+ relayed seed is taken only when its entry names its relay and its URL is
449
+ `<relay>/e/<id>`, and at most `MAX_RELAYED_FROM_DIRECTORY` (4) are taken.
450
+
444
451
  ### The contacts file (`fleet.json`)
445
452
 
446
453
  ```json
@@ -528,10 +535,13 @@ and eviction do not currently prefer contacts or trusted senders.
528
535
  ### Group admin from code: `@uuaid/pillar/groups-v2`
529
536
 
530
537
  From 2.6.0 the signed pillar-group/2 admin API is a package export, so an app
531
- needs neither `pillar group` nor a deep import. It exports exactly these 11
538
+ needs neither `pillar group` nor a deep import. It exports exactly these 18
532
539
  names: `adminCreate`, `adminChange`, `adminManifestSends`, `parseMemberRef`,
533
540
  `adminOf`, `activeAdmins`, `isGroupIdV2`, `ACTIONS`, `MAX_MEMBERS`, `MAX_NAME`
534
- and `MAX_PURPOSE`.
541
+ and `MAX_PURPOSE`; and, read-only, for co-admins (`ext.admins`): `coAdminsOf`,
542
+ `adminsFault`, `parseRenameField`, `ADMINS_V`, `CO_ADMIN_POWERS`,
543
+ `MAX_CO_ADMINS` and `REFUSE_REASONS`. `adminCreate` and `adminChange` refuse to
544
+ sign a malformed `ext.admins` (error code `group-v2-admins-refused`).
535
545
 
536
546
  **No store and no receiver is exported** (one group store per home, design
537
547
  D5): there is no `RosterStore`, `MemoryRosterStore`, `GroupReceiver` or
@@ -969,17 +979,44 @@ other exits 2 after `--takeover-wait`, even if it was serving before. Mail that
969
979
  process had accepted stays in its database (the exit message names it): stop
970
980
  the other process and start that one again to serve it.
971
981
 
972
- **Clients name a relayed seed explicitly.** In 2.8.0 a relayed seed URL is never
973
- configured automatically: `directory.json` (and its `/` alias) never lists one,
974
- neither in `seeds[]` nor as the bootstrap carrier, and `pillar init --directory`
975
- and `--refresh` skip any it finds (by the `/e/<id>` shape or by `relay`
976
- metadata; a note on stderr says how many). An agent that trusts a fleet relay
977
- adds the seed itself: `pillar init --carriers https://relay.example.org/e/<id>`,
978
- or the `carriers` list in `config.json`. `--refresh` replaces `carriers` with
979
- what the directory offers, so it also removes a relayed URL an earlier
980
- directory added (and one you added by hand: add it again after a refresh).
981
- Automatic discovery of relayed seeds waits for inbox auth bound to its
982
- audience. `pillar-directory --carrier` refuses a relayed URL.
982
+ **Relayed seeds in the directory (2.8.1).** `directory.json` (and its `/`
983
+ alias) lists a relayed seed in `seeds[]` with its `uuaid`, its `url` and its
984
+ `relay`, once the registry fetched the seed's own signed `/v1/seed-info` over
985
+ that exact `<relay>/e/<id>` URL and then passed a round trip with inbox auth v2
986
+ and the seed's signed served proof for the seed's current URL, key and relay
987
+ pin, and while the seed is not demoted. Signed seed-info alone does not list a
988
+ seed: it does not show that clients can read it. A failed round trip, or a
989
+ changed URL, key or relay pin, takes the seed out until the next round trip
990
+ passes. A relayed row stored by 2.8.0 or earlier, and a 2.8.0 seed behind a
991
+ 2.8.1 relay (it cannot check v2), stay out until then. It is never
992
+ the bootstrap carrier (`pillar-directory --carrier` refuses a relayed URL).
993
+ `pillar init --directory` and `--refresh` take a relayed entry only when it
994
+ names its relay and its URL is `<relay>/e/<id>`, and take at most 4 of them,
995
+ in directory order (proven seeds first); they skip the rest and say how many
996
+ on stderr. A 2.8.0 client takes none. An agent can still name one itself:
997
+ `pillar init --carriers https://relay.example.org/e/<id>`, or the `carriers`
998
+ list in `config.json`. `--refresh` replaces `carriers` with what the directory
999
+ offers, so it also removes a relayed URL the directory no longer offers (and
1000
+ one you added by hand: add it again after a refresh).
1001
+
1002
+ **Inbox auth v2 (2.8.1).** A client reads a relayed seed only with inbox auth
1003
+ v2: `x-pillar-auth: 2` and a random `x-pillar-nonce`, signed with the seed URL
1004
+ as the audience, so the seed and its relay cannot replay it to another carrier,
1005
+ and the seed takes each nonce once (`nonce-used`). The signature covers the
1006
+ method, the audience, the inbox uuaid, the `since`, `wait` and `challenge`
1007
+ query values, the timestamp and the nonce, so nobody on the path can change
1008
+ the page asked for, the wait, or the challenge the seed signs its served proof
1009
+ for. A v2 query holds only `since` and `wait` (whole numbers in plain decimal;
1010
+ absent is 0) and `challenge` (64 lowercase hex), each at most once; any other
1011
+ query is refused before the signature is checked and before the nonce is used
1012
+ (`inbox-auth-query`). The carrier keeps each nonce until its 5-minute window
1013
+ ends, at most 100,000 at once (about 10 MiB). When the store is full it refuses
1014
+ new v2 reads with 503 `inbox-auth-busy` and keeps every stored nonce until it
1015
+ expires; v1 reads use no nonce. A 2.8.1 relay refuses v1
1016
+ inbox auth on `/e/*` (`inbox-auth-v2-required`), whatever the seed's version,
1017
+ and a relayed seed refuses it too. Direct carriers still get v1, as in 2.8.0; a
1018
+ carrier with `--public-url` also takes v2 for that URL. The slim client
1019
+ (`@uuaid/pillar-client`) sends v1 only, so it cannot read a relayed seed.
983
1020
 
984
1021
  **Relay operator.** `pillar-carrier --accept-tunnels <allow-file> --tunnel-origin
985
1022
  https://relay.example.org --tunnel-keychain <key>`. The allow-file holds one
@@ -1036,18 +1073,36 @@ are inside their minute, a new address gets 503 `tunnel-busy` until one ages
1036
1073
  out. Only the
1037
1074
  four carrier routes pass; seed headers never reach clients; every `/e/*` answer
1038
1075
  is `cache-control: no-store`; logs carry the route template, status and sizes
1039
- only. `--accept-tunnels open` admits any seed and is for tests on loopback
1040
- only: it refuses any other `--host` or `--tunnel-origin`. A loopback bind does
1041
- not stop a reverse proxy or port forward on the same host from publishing the
1042
- port, so never put one in front of a carrier in open mode; it prints a warning
1043
- saying so at start.
1076
+ only.
1077
+
1078
+ **Open relay (2.8.1).** `pillar-carrier --accept-tunnels open --tunnel-origin
1079
+ https://relay.example.org` admits any seed that proves its uuaid key: the seed
1080
+ signs the tunnel request with the key its uuaid derives from, bound to this
1081
+ origin and a one-use nonce. There is no allow-file and no approval. The carrier
1082
+ speaks plain http, so bind it to 127.0.0.1 and serve the https origin through a
1083
+ TLS proxy that passes WebSocket upgrades (it prints a note when it is bound
1084
+ elsewhere). All the caps above apply. The relay writes one meter line per
1085
+ stream to stdout: `relay: <id> <method> <route template> <status>
1086
+ <in>/<out>B <ms>ms`, with no header, query or body. A request refused before a
1087
+ stream opens (401, 404, 413, 503) writes none. With `--tunnel-keychain` an
1088
+ open relay attests too, with admission `open`: it says only that a seed-info
1089
+ answer came through that seed's live tunnel. A registry that pins the relay in
1090
+ `--fleet-relays` vets its seeds as it vets a fleet relay's; a registry that
1091
+ does not pin it ranks them `relayed-unvetted` (probation, no grant). Every cap
1092
+ is a flag: `--tunnel-max`, `--tunnels-per-ip` (default 2), `--tunnel-kbps`,
1093
+ `--tunnel-total-kbps` and `--tunnel-buffer-mib` (queued bytes, default 64). With
1094
+ `--tunnel-max 4 --tunnels-per-ip 2`, two seed addresses fill the relay.
1095
+ Measured on macOS (Node 22): the relay adds nothing to an idle carrier (about 76
1096
+ MiB) and about 0.2 to 0.5 MiB per active tunnel at 8 to 32 tunnels
1097
+ (`test/measure/open-relay-rss.mjs`); it runs inside the carrier process, a
1098
+ seed-mode carrier included.
1044
1099
 
1045
1100
  **Trust.** A tunnel relay is a carrier: it can delay or drop mail, but cannot
1046
1101
  read or forge sealed envelopes. It does see inbox auth headers, which a carrier
1047
1102
  accepts for 5 minutes, so it could re-read that inbox page (sealed envelopes and
1048
- their metadata) in that window. That is why relays are admitted per seed by an
1049
- allow-file, pinned per registry, and never published for automatic discovery
1050
- (above).
1103
+ their metadata) in that window. Inbox auth v2 (above) closes that for relayed
1104
+ seeds: each v2 auth names the seed URL and is used once. Only a relay pinned
1105
+ per registry earns a seed a grant.
1051
1106
 
1052
1107
  **Registry.** `pillar-directory --fleet-relays <file>`, one `<origin> <relay key
1053
1108
  hex>` per line. Every probe of a relayed seed is a one-use challenge: the seed
@@ -1058,10 +1113,11 @@ error fails the probe; nothing falls back to `/v1/health`.
1058
1113
  | Seed topology | Highest tier | Priority, grant | In `directory.json` |
1059
1114
  | --- | --- | --- | --- |
1060
1115
  | Direct (`--public-url`) | anchor | as before | yes |
1061
- | On a pinned fleet relay, attested within its lease | durable | yes; the grant ends with the lease | no |
1062
- | On a pinned fleet relay, lease lapsed or a probe failed | steady | none | no |
1063
- | On any other relay | probation | none | no |
1116
+ | On a pinned fleet relay, attested within its lease | durable | yes; the grant ends with the lease | for reach (2.8.1), with `relay`, after a v2 round trip |
1117
+ | On a pinned fleet relay, lease lapsed or a probe failed | steady | none | for reach (2.8.1), with `relay`, after a v2 round trip, until demoted |
1118
+ | On a relay this registry does not pin | probation | none | for reach (2.8.1), with `relay`, after a v2 round trip, until demoted |
1064
1119
  | Relayed row from a 2.7.x registry, before its first challenge | probation | none | no |
1120
+ | Any relayed row before a v2 round trip passes for its current URL, key and relay pin (rows from 2.8.0 and earlier included) | as above | as above | no |
1065
1121
 
1066
1122
  **Lease.** A passing challenge probe through a pinned fleet relay vets the seed
1067
1123
  for min(3 x the probe interval, 30 minutes): 30 minutes at the default
@@ -1074,8 +1130,8 @@ at its expiry, even when its decision is cached. A grant minted earlier, or by a
1074
1130
  2.6.1 or 2.7.x registry, stays valid until its own expiry, up to 14 days. A 2.6.1 or 2.7.x registry still enrolls a relayed seed, but checks its
1075
1131
  liveness through the relay without a challenge (relay-attested), and applies no
1076
1132
  cap; `pillar-seed --status` says so. Not in 2.8.0: moving a seed to another
1077
- relay (it needs a new seed key), and inbox auth bound to its audience, which
1078
- must exist before relays are opened to other operators.
1133
+ relay (it needs a new seed key), and inbox auth bound to its audience (2.8.1
1134
+ adds it for relayed seeds: inbox auth v2).
1079
1135
 
1080
1136
  ## Abuse resistance — consent at the edge, budgets at the carrier
1081
1137
 
@@ -1475,3 +1531,117 @@ its own.
1475
1531
  ## License
1476
1532
 
1477
1533
  Apache-2.0.
1534
+
1535
+ ## Spaces API (2.8.2)
1536
+
1537
+ The Spaces API (first cut as the 2.7.0-spaces.0 source candidate) adds application-owned manifest extensions and outbound
1538
+ permission gates. It does not join a Space, approve an agent, or grant authority
1539
+ from a remote charter. The host still owns those decisions.
1540
+
1541
+ `adminCreate({ ...existing, ext })` signs a detached, bounded plain JSON extension
1542
+ through the existing genesis verification and single-store path. Omitting `ext`
1543
+ keeps the ordinary empty extension. No store or receiver constructor is added to
1544
+ the public export map.
1545
+
1546
+ `pillar.syncGroupV2({ manifestPayload, permit, signal })` calls `manifestPayload`
1547
+ for **each queued manifest attempt**, including retries after a restart. The
1548
+ callback receives deeply frozen `{ groupId, recipient, op, manifest, chain,
1549
+ head: { version, hash } }`, all from the verified held record. Return a plain JSON
1550
+ object of extra payload fields, for example `{ _commons: heldCharter }`; the
1551
+ callback must verify its own charter/hash/key/head association. A throw or invalid
1552
+ return leaves the row queued and sends nothing. Extras are limited to 32 KiB of
1553
+ canonical UTF-8 JSON and 32 levels of nesting, plus existing envelope/carrier
1554
+ limits. `_group`, `text`, `thread`, `quote`, `blobRef`, `inReplyTo`, `type`, `upTo`
1555
+ and prototype-manipulation keys are forbidden. Missing `manifestPayload` keeps
1556
+ the ordinary group payload.
1557
+
1558
+ A queued row keeps one envelope (2.8.2), with or without `trustedCarriers`. Its
1559
+ id is saved on the row before the first send, by a claim: when two sync passes
1560
+ run at once, only one seals an attempt for a row. One pass owns a row from its
1561
+ first read to its last write, across every await: another pass in the same
1562
+ process skips it, and a pass records a result only while the row is still
1563
+ queued under its own attempt (2.8.2 r4). A retry runs every check
1564
+ again, including `manifestPayload` (a throw still keeps the row queued and sends
1565
+ nothing), then sends the stored envelope again: its extras are the first
1566
+ attempt's. An attempt that was delivered or acked, also during the retry, makes
1567
+ the row `sent`. A new envelope is sealed only when the route moved, when the
1568
+ stored outbox row was erased, or when the stored envelope is over 23 hours old
1569
+ (a carrier refuses an envelope over 24 hours old). Each such attempt is replaced
1570
+ once, after every check and gate, with a new group tag and new extras. The
1571
+ replaced outbox row, and the pending row of a dropped queue row, become
1572
+ `superseded`.
1573
+
1574
+ `new Pillar({ ...existing, outboundPolicy })` installs an instance-bound policy.
1575
+ `send`, `sendDirect`, `sendGroupV2` and `syncGroupV2` additionally accept `permit`
1576
+ and `signal`. Both callbacks must return exactly `true`; they may return a
1577
+ promise. Their frozen routing DTO contains only `{ phase, route, recipient,
1578
+ groupId, op, carrier? }`: phase is `seal` or `dispatch`, and route is `auto`,
1579
+ `direct`, `carrier` or `group`. A host's instance baseline should synchronously
1580
+ read current identity/admission/retirement state. An asynchronous per-call
1581
+ consent callback must recheck its captured operation after awaiting consent;
1582
+ abort the supplied lifecycle signal on revoke, close, restore or identity
1583
+ replacement. The SDK checks the signal after policy awaits and again immediately
1584
+ before sealing, direct `stream.send` (after the dial), and each parallel carrier
1585
+ fetch. It also rechecks the instance baseline after the per-call callback.
1586
+
1587
+ Refusal, callback exception or cancellation yields the stable error code
1588
+ `send-permit-denied` with a sanitized message. Group fanout stops future members,
1589
+ keeps preceding results, and returns `stopped: true`. Queued manifest attempts
1590
+ are terminally dropped on denial, including remaining attempts in that sync;
1591
+ ordinary network errors remain queued. The code is reserved for this SDK's own
1592
+ denials: a carrier refusal whose reason names it is reported as an ordinary
1593
+ `carrier-bad-response` failure (its text kept in the per-carrier `error`), and no
1594
+ other error that merely carries the code stops a fanout or drops queued sends.
1595
+ Already-attempted network operations
1596
+ cannot be recalled. Partial carrier acceptance/attempt metadata is retained in
1597
+ `error.partial` and group result `partial`; acceptance does not prove receipt by
1598
+ a recipient. No generic pending-outbox resender is introduced. Blob reservation
1599
+ and upload APIs retain their existing separate host authorization requirements;
1600
+ these gates cover the listed send transports, not a general-purpose sandbox.
1601
+
1602
+ After a public admin write, `pillar.reloadGroupV2(groupId)` verifies the stored
1603
+ record, invalidates only that existing receiver's cache, and returns its current
1604
+ state. It does not construct another receiver or expose private caches.
1605
+
1606
+ ## Trusted carriers (2.8.2, opt-in)
1607
+
1608
+ `new Pillar({ ...existing, trustedCarriers: ["https://pillar.uuaid.org", ...] })`
1609
+ names the carriers this agent trusts, by exact base URL (a trailing slash is
1610
+ ignored). Unset (`null`, the default), carrier trust is as in 2.8.1: v1 inbox
1611
+ auth to every direct carrier, and any acceptance counts. Two 2.8.2 changes apply
1612
+ either way: `syncGroupV2` sends one envelope per queued row (above), and a
1613
+ carrier acceptance before a send permit denial marks the row `delivered`. `[]` is set,
1614
+ with no carrier trusted. Any other value but an array of URL strings is a
1615
+ `TypeError`. `CarrierClient` takes the same option.
1616
+
1617
+ When it is set:
1618
+
1619
+ - Inbox auth v1 goes only to a trusted carrier that is not a relayed seed URL.
1620
+ Every other carrier, direct or relayed, gets inbox auth v2 (bound to that
1621
+ carrier's URL, used once). v1 names no carrier and stays valid for 5 minutes,
1622
+ so any carrier that receives it can replay it elsewhere. A carrier that
1623
+ refuses v2 is not read; v1 is never sent to it instead. Retired-key imports
1624
+ follow the same rule.
1625
+ - Only a trusted carrier's acceptance marks the outbox row `delivered`. When only
1626
+ other carriers (for example a relayed seed) accept, `send()` returns
1627
+ `confirmed: false` and the row stays `pending`; a trusted acceptance returns
1628
+ `confirmed: true`. `sendGroupV2` marks such a member result `confirmed: false`,
1629
+ and `syncGroupV2` keeps the queued send queued (reason `no trusted carrier
1630
+ accepted`) so a later sync sends the same envelope again.
1631
+ - A plain `send()` with `confirmed: false` is not sent again by the SDK. The app
1632
+ owns that retry: `pillar.resendOutbound(envelopeId, { recipientPublicKey,
1633
+ permit, signal })` sends the stored envelope again, byte for byte, through
1634
+ every `send()` gate and the continuity route, and returns `send()`'s result
1635
+ (a trusted acceptance marks the row `delivered`). It works the same without
1636
+ `trustedCarriers`. It sends nothing and returns `{ resent: false, reason }`
1637
+ when the row is `completed` (delivered or acked), `erased`, `superseded`,
1638
+ `rerouted` (the route no longer lands on its recipient), `expired` (over 23
1639
+ hours old; a carrier refuses an envelope over 24 hours old), `missing`, or a
1640
+ `group` row. `expired` is named before any key lookup, so it needs no
1641
+ `recipientPublicKey`. The row is read again after every dispatch gate, right
1642
+ before the bytes leave on each route: a row erased, completed or superseded
1643
+ while a permit was pending sends nothing more and returns that reason (an
1644
+ earlier carrier acceptance is still recorded, as for a denial). `syncGroupV2` retries only its own queued rows. Nothing in the SDK
1645
+ retries a `sendGroupV2` member result with `confirmed: false`, and this method
1646
+ refuses it too: a plain `send()` would carry no group context to the permit.
1647
+ On `rerouted` or `expired` the app decides whether to send anew.
package/bin/carrier.mjs CHANGED
@@ -44,20 +44,25 @@
44
44
  * <origin>/e/<id> (src/net/tunnel-relay.mjs). With --tunnel-keychain (an
45
45
  * existing key, never minted here, different from the receipt and seed keys;
46
46
  * passphrase CARRIER_TUNNEL_KEYCHAIN_PASSPHRASE) it attests those tunnels to
47
- * registries that pin it. --accept-tunnels open admits any seed and is for
48
- * tests only: it needs a loopback --host and a loopback --tunnel-origin, and
49
- * the carrier exits if it is not bound to loopback. Off by default: /v1/tunnel
50
- * and /e/* answer 404 as in 2.7.1.
51
- * A loopback bind does not stop a reverse proxy or port forward on the same
52
- * host from publishing the port: never put one in front of open mode (a warning
53
- * is printed at start; Lead review C-P3-2).
47
+ * registries that pin it. Off by default: /v1/tunnel and /e/* answer 404 as
48
+ * in 2.7.1.
49
+ *
50
+ * Open relay (2.8.1, owner order 2026-12-04): --accept-tunnels open admits any
51
+ * seed that proves its uuaid with the key it derives from (src/net/tunnel.mjs),
52
+ * on a public https --tunnel-origin behind the TLS proxy. There is no
53
+ * allow-file and no approval; the TUNNEL_LIMITS caps (and the --tunnel-*
54
+ * overrides) bound it. With --tunnel-keychain it attests to registries that pin it
55
+ * that a seed-info answer came through the seed's live tunnel (admission
56
+ * "open"), and nothing more. Usage is metered: one log line per stream
57
+ * (seed localId, method, route template, status, bytes in/out, ms), never a
58
+ * header, path or query value.
54
59
  */
55
60
  import "../src/node-check.mjs"; // must stay the first import: refuses Node < 22 before any dependency loads
56
61
  import { CarrierServer, parseSecureDelete, parseCommunityWaits, MAX_TTL_DAYS } from "../src/net/carrier-server.mjs";
57
62
  import { Keychain, keyDerivesUuaid } from "../src/identity/keychain.mjs";
58
63
  import { checkSeedUrl } from "../src/net/seed-registry.mjs";
59
64
  import { parseTrustedProxies } from "../src/net/client-ip.mjs";
60
- import { canonicalOrigin, isLoopbackOrigin } from "../src/net/tunnel.mjs";
65
+ import { canonicalOrigin } from "../src/net/tunnel.mjs";
61
66
  import { TunnelRelay } from "../src/net/tunnel-relay.mjs";
62
67
  import { exitWithHelp, wantsHelp } from "../src/cli-help.mjs";
63
68
 
@@ -104,7 +109,8 @@ default; put a TLS-terminating proxy in front of it.
104
109
  --seed-keychain <file> with --public-url: serve a signed /v1/seed-info (CARRIER_SEED_KEYCHAIN)
105
110
  --public-url <https://> the URL the proxy serves (CARRIER_PUBLIC_URL)
106
111
  --accept-tunnels <file> relay seeds whose uuaid is in this allow-file (CARRIER_ACCEPT_TUNNELS;
107
- default off). "open" admits any seed: loopback tests only
112
+ default off). "open" admits any seed that proves its uuaid key
113
+ (2.8.1: a public open relay; caps and per-stream meter apply)
108
114
  --tunnel-origin <https://> the public origin seeds are served at, as <origin>/e/<id>
109
115
  (CARRIER_TUNNEL_ORIGIN)
110
116
  --tunnel-keychain <file> attest tunnels to registries with this existing key
@@ -112,6 +118,9 @@ default; put a TLS-terminating proxy in front of it.
112
118
  --tunnel-max <n> most tunnels at once (CARRIER_TUNNEL_MAX, default 32)
113
119
  --tunnel-kbps <n> per-tunnel KiB/s each way (CARRIER_TUNNEL_KBPS, default 256)
114
120
  --tunnel-total-kbps <n> all tunnels, KiB/s each way (CARRIER_TUNNEL_TOTAL_KBPS, default 8192)
121
+ --tunnels-per-ip <n> most tunnels from one seed address (CARRIER_TUNNELS_PER_IP, default 2)
122
+ --tunnel-buffer-mib <n> request and answer bytes the relay queues for all streams, MiB
123
+ (CARRIER_TUNNEL_BUFFER_MIB, default 64)
115
124
  -h, --help print this help and exit
116
125
 
117
126
  The carrier never mints a key. See the header of bin/carrier.mjs for details.`;
@@ -208,7 +217,7 @@ if (wantSeedKey) {
208
217
  }
209
218
  }
210
219
 
211
- // Relay (2.8.0): off unless --accept-tunnels names an allow-file (or "open" on loopback).
220
+ // Relay (2.8.0): off unless --accept-tunnels names an allow-file, or "open" (2.8.1: any seed).
212
221
  const tunnelOpt = (flag, env) => { const v = args[flag] ?? process.env[env]; return v === "" ? null : (v ?? null); };
213
222
  const acceptTunnels = tunnelOpt("accept-tunnels", "CARRIER_ACCEPT_TUNNELS");
214
223
  const tunnelOriginText = tunnelOpt("tunnel-origin", "CARRIER_TUNNEL_ORIGIN");
@@ -220,6 +229,9 @@ for (const [flag, env, key, scale] of [
220
229
  ["tunnel-max", "CARRIER_TUNNEL_MAX", "maxTunnels", 1],
221
230
  ["tunnel-kbps", "CARRIER_TUNNEL_KBPS", "tunnelBytesPerSec", 1024],
222
231
  ["tunnel-total-kbps", "CARRIER_TUNNEL_TOTAL_KBPS", "totalBytesPerSec", 1024],
232
+ // 2.8.1: every relay cap is a runtime flag, so a small host runs lower caps.
233
+ ["tunnels-per-ip", "CARRIER_TUNNELS_PER_IP", "tunnelsPerIp", 1],
234
+ ["tunnel-buffer-mib", "CARRIER_TUNNEL_BUFFER_MIB", "totalBufferedBytes", 1024 * 1024],
223
235
  ]) {
224
236
  const v = tunnelOpt(flag, env);
225
237
  if (v === null) continue;
@@ -235,16 +247,16 @@ if (acceptTunnels === null) {
235
247
  refuse("--tunnel-origin, --tunnel-keychain and the --tunnel-* limits need --accept-tunnels");
236
248
  }
237
249
  } else {
238
- if (typeof acceptTunnels !== "string") refuse("--accept-tunnels needs an allow-file path (or open, for loopback tests)");
250
+ if (typeof acceptTunnels !== "string") refuse("--accept-tunnels needs an allow-file path, or open");
239
251
  if (typeof tunnelOriginText !== "string") refuse("--accept-tunnels needs --tunnel-origin <https://origin>: the public origin seeds are served at");
240
252
  const c = canonicalOrigin(tunnelOriginText);
241
253
  if (!c.ok) refuse(`--tunnel-origin is not a relay origin (${c.reason}); the value is not shown`);
242
254
  tunnelOrigin = c.origin;
243
255
  if (acceptTunnels === "open") {
244
- // RedTeam 085b71 C5: open admission only on a real loopback listener.
245
- if (!tunnelLoopback(host)) refuse(`--accept-tunnels open is for loopback tests: --host must be 127.0.0.1 or ::1, not ${JSON.stringify(host)}`);
246
- if (!isLoopbackOrigin(tunnelOrigin)) refuse("--accept-tunnels open is for loopback tests: --tunnel-origin must be a loopback origin");
247
- if (tunnelKeychainPath !== null) refuse("--tunnel-keychain attests allow-file admission; --accept-tunnels open attests nothing");
256
+ // 2.8.1 (owner order 2026-12-04): open admission on a public origin. The
257
+ // 2.8.0 loopback-only lock (RedTeam 085b71 C5) is lifted on purpose. With
258
+ // --tunnel-keychain an open relay attests "came through this live tunnel"
259
+ // (admission "open", V1 via Lead 3f4436), nothing more.
248
260
  }
249
261
  if (tunnelKeychainPath !== null) {
250
262
  if (typeof tunnelKeychainPath !== "string") refuse("--tunnel-keychain needs a path to a keychain file");
@@ -277,21 +289,16 @@ try {
277
289
  refuse(e.message);
278
290
  }
279
291
  const addr = await server.listen(port, host);
280
- if (acceptTunnels === "open" && !tunnelLoopback(addr.address)) {
281
- // The address the socket really holds, not the flag (RedTeam 085b71 C5).
282
- await server.close();
283
- refuse(`--accept-tunnels open is for loopback tests, but the carrier is bound to ${addr.address}`);
284
- }
285
292
  console.log(`carrier listening on ${addr.address}:${addr.port}`);
286
293
  console.log(` db: ${dbPath}`);
287
294
  console.log(` ttl: ${ttlDays} days`);
288
295
  console.log(` tiers: ${tierIssuers.length ? `${tierIssuers.length} trusted issuer(s)` : "disabled (community budgets for all)"}`);
289
296
  console.log(` secure-delete: ${secureDelete ? "on (expired envelopes are zeroed; WAL truncated after each expiry pass)" : "off (expired envelope bytes stay on disk until reused)"}`);
290
297
  console.log(` seed: ${seedKeychain ? `${seedKeychain._identity.uuaid} at ${publicUrl} (signed /v1/seed-info)` : "off (no seed keychain; /v1/seed-info is 404)"}`);
291
- if (acceptTunnels === "open") {
292
- console.error(`carrier: warning: --accept-tunnels open admits any seed. Never put a proxy or port forward in front of ${addr.address}:${addr.port}; a loopback bind does not stop a proxy on this host from publishing it.`);
298
+ if (acceptTunnels === "open" && !tunnelLoopback(addr.address)) {
299
+ console.error(`carrier: note: bound to ${addr.address}, not loopback. The carrier speaks plain http; serve ${tunnelOrigin} through a TLS proxy.`);
293
300
  }
294
- console.log(` tunnels: ${!tunnelRelay ? "off (/v1/tunnel and /e/* are 404)" : acceptTunnels === "open" ? `open, loopback tests only, serving ${tunnelOrigin}/e/<id>` : `allow-file ${acceptTunnels} (${tunnelRelay.allow.set.size} seed${tunnelRelay.allow.set.size === 1 ? "" : "s"}), serving ${tunnelOrigin}/e/<id>${tunnelKeychain ? `, attesting as ${tunnelKeychain._identity.publicKeyHex.slice(0, 16)}…` : ", not attesting"}`}`);
301
+ console.log(` tunnels: ${!tunnelRelay ? "off (/v1/tunnel and /e/* are 404)" : acceptTunnels === "open" ? `open (any seed that proves its uuaid key; caps on; one meter line per stream), serving ${tunnelOrigin}/e/<id>${tunnelKeychain ? `, attesting as ${tunnelKeychain._identity.publicKeyHex.slice(0, 16)}… (admission open)` : ", not attesting"}` : `allow-file ${acceptTunnels} (${tunnelRelay.allow.set.size} seed${tunnelRelay.allow.set.size === 1 ? "" : "s"}), serving ${tunnelOrigin}/e/<id>${tunnelKeychain ? `, attesting as ${tunnelKeychain._identity.publicKeyHex.slice(0, 16)}…` : ", not attesting"}`}`);
295
302
  console.log(` receipts: ${server.receiptCarrier ? `signed as ${server.receiptCarrier} (uuaid.carrier-receipt.v1)` : "off (no receipt keychain)"}`);
296
303
 
297
304
  // Vacuum expired envelopes hourly.
@@ -68,7 +68,8 @@ The first start mints the registry key in --home.
68
68
  --trusted-proxy <ips> whose X-Forwarded-For counts (DIRECTORY_TRUSTED_PROXIES)
69
69
  --probe-minutes <n> seed probe interval (DIRECTORY_PROBE_MINUTES, default 10)
70
70
  --fleet-relays <file> relay origins and keys this registry pins, one "<origin> <key hex>"
71
- per line; only seeds on these are listed while relayed
71
+ per line; only seeds on these are vetted and granted (2.8.1 lists
72
+ a relayed seed on any relay for reach, after a v2 round trip)
72
73
  (DIRECTORY_FLEET_RELAYS; default none)
73
74
  -h, --help print this help and exit
74
75
 
@@ -100,7 +101,7 @@ const carrier = opts.carrier ?? null;
100
101
  // 2.8.0 (RedTeam 22f6c3 Q2): directory.json never names a relayed seed URL
101
102
  // (<relay origin>/e/<id>) as its bootstrap carrier.
102
103
  if (typeof carrier === "string" && isRelayedSeedUrl(carrier)) {
103
- console.error("pillar-directory: --carrier/DIRECTORY_CARRIER is a relayed seed URL (<origin>/e/<id>); 2.8.0 keeps relayed seeds out of directory.json. Name a direct carrier; clients reach a relayed seed with pillar init --carriers <url>.");
104
+ console.error("pillar-directory: --carrier/DIRECTORY_CARRIER is a relayed seed URL (<origin>/e/<id>); the bootstrap carrier is never a relayed seed (2.8.1 lists relayed seeds in seeds[] with their relay, for reach only). Name a direct carrier; clients reach a relayed seed with pillar init --carriers <url>.");
104
105
  process.exit(2);
105
106
  }
106
107
  const agentsPath = opts.agents ?? null;
@@ -115,8 +116,9 @@ const probeIntervalMs = opts["probe-interval-ms"];
115
116
  const effectiveProbeMs = probeIntervalMs ?? probeMinutes * 60_000;
116
117
  const allowPrivateUrls = opts["allow-private-urls"];
117
118
  // Fleet relays (2.8.0): the relay origins and attestation keys this registry pins.
118
- // A relayed seed is listed, vetted and granted only on one of these. None by
119
- // default: without this flag the registry pins no relay and lists no relayed seed.
119
+ // A relayed seed is vetted and granted only on one of these. None by default.
120
+ // 2.8.1: a relayed seed on any relay is listed for reach (no vetting, no grant)
121
+ // once a round trip with inbox auth v2 passed for its current pin.
120
122
  const fleetRelaysPath = opts["fleet-relays"] ?? null;
121
123
  let fleetRelays = new Map();
122
124
  if (fleetRelaysPath !== null) {
@@ -46,7 +46,9 @@
46
46
  * A machine with outbound-only network (a cloud VM, a laptop behind NAT) runs
47
47
  * a seed with --relay <origin> instead: the seed stays on 127.0.0.1, opens one
48
48
  * outbound WebSocket to that relay carrier, and is served at
49
- * <origin>/e/<id>. The relay must list this seed's uuaid on its allow-file.
49
+ * <origin>/e/<id>. The relay must list this seed's uuaid on its allow-file
50
+ * (2.8.1: an open relay, --accept-tunnels open, admits any seed that proves
51
+ * its uuaid key).
50
52
  * See src/net/tunnel-client.mjs and the README "Egress seed" section.
51
53
  */
52
54
  import "../src/node-check.mjs"; // must stay the first import: refuses Node < 22 before any dependency loads
@@ -441,7 +443,7 @@ async function printStanding(registry, uuaid, publicKeyHex) {
441
443
  else if (!s.demoted) console.log(` next: top of the ladder`);
442
444
  // 2.8.0: the topology this registry has pinned for the seed.
443
445
  if (s.topology) {
444
- console.log(` topology: ${s.topology}${s.relay ? ` via ${s.relay}` : ""}${s.vettedUntil ? `, vetted until ${s.vettedUntil}` : ""}${s.listed === false ? (s.relay ? " (not in directory.json: clients reach a relayed seed only by explicit config, pillar init --carriers <url>)" : " (not listed in directory.json)") : ""}`);
446
+ console.log(` topology: ${s.topology}${s.relay ? ` via ${s.relay}` : ""}${s.vettedUntil ? `, vetted until ${s.vettedUntil}` : ""}${s.listed === false ? (s.relay ? " (not in directory.json yet: a relayed seed is listed once a round trip with inbox auth v2 passes through its relay; until then clients reach it only by pillar init --carriers <url>)" : " (not listed in directory.json)") : ""}`);
445
447
  } else {
446
448
  const via = relayShapeOrigin(s.url, publicKeyHex);
447
449
  if (via) console.log(` topology: relayed via ${via}; this registry predates 2.8.0, so its liveness checks are relay-attested`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uuaid/pillar",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Pillar (Protocol for Inter-agent Linked Ledger And Relay) — the secure delivery layer of UACP, the Universal Agent Communication Protocol. UACP = UUAID (identity) + Envelope (signed, encrypted container) + Pillar (relay, mailbox, routing, store-and-forward). Reference implementation of the UACP delivery layer; includes VDA-1 (IAASO-3901, in ballot) delivery attestation and a blind escrow for the Zilligon ZGN / EVM rails.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -28,6 +28,7 @@
28
28
  "./carrier-client": "./src/net/carrier-client.mjs",
29
29
  "./seed-tier": "./src/net/seed-tier.mjs",
30
30
  "./seed-registry": "./src/net/seed-registry.mjs",
31
+ "./discovery": "./src/net/discovery.mjs",
31
32
  "./blob": "./src/blob/blob.mjs",
32
33
  "./blob/http": "./src/blob/http.mjs",
33
34
  "./blob/store": "./src/blob/store.mjs",
@@ -13,4 +13,7 @@ export {
13
13
  adminCreate, adminChange, adminManifestSends, parseMemberRef,
14
14
  adminOf, activeAdmins, isGroupIdV2,
15
15
  ACTIONS, MAX_MEMBERS, MAX_NAME, MAX_PURPOSE,
16
+ // Family A (WIRE-family-A-v1): read-side only. The builder refusal runs inside adminCreate/adminChange.
17
+ coAdminsOf, adminsFault, parseRenameField,
18
+ ADMINS_V, CO_ADMIN_POWERS, MAX_CO_ADMINS, REFUSE_REASONS,
16
19
  } from "./groups-v2.mjs";