@witbitz/sdk 4.6.0 → 4.7.0

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/manifest.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "4.6.0",
3
- "commit": "020ab80d8b6f2c5808065c2ec462123e7bb37e23",
2
+ "version": "4.7.0",
3
+ "commit": "a98d5ae3b3fceb654ceed8264e49babac09f8d62",
4
4
  "released": "2026-11-29",
5
5
  "files": {
6
6
  "a2aCore.js": "sha384-rnS5krIO4jMP44Rk55sMqVXUqQ+AOrYvMeLJ+lcaCr9uIEia1X6Yl39mmHOKt1/6",
@@ -17,8 +17,8 @@
17
17
  "acctV2Client.js": "sha384-/1HW620EUxJMrdInzNeknjn6fC1NUPFBCGtFoYV6nRR5sSGvwXvra/Q5gVA1c45w",
18
18
  "acctV2Keys.js": "sha384-xlfDiwkXSQWjiKBcceDCfsoCVcuLRxxC/p8jss/K9M2gMn4x62ZE5UlFkm9eTpIV",
19
19
  "acctV2Legacy.js": "sha384-QlBzwihqxBMe+eejAzEVYV4vnbJxj/3PNrtkovy+g1CMrIqQmDxeWkyLlcwPS2lG",
20
- "acctV2Switch.js": "sha384-6D7U3ahlQQnrEcSVC40x1+AQgrWaV4jaY0gt/Qty52OsFJ51F6kh8n0mw0CfdDsB",
21
- "acctV2UiCore.js": "sha384-f9sAgPjclrzHrIfLQuFletmdE17XwRkZYWOUNZC7ooVnTklGn64gc5+dlPHK/yX9",
20
+ "acctV2Switch.js": "sha384-kFTFjxcIn9nKkpUUMEOdl7ZoQupXWBt5w7tZrcuZVx4xUsfryE3aPzEg4+KJm29W",
21
+ "acctV2UiCore.js": "sha384-sFx9BatgYWF0mYYN//KYbFIfIuF1xZOFnKmS11CMhVHC18Jye+6uxFP79Ds1qQoR",
22
22
  "acctV2WebAuthn.js": "sha384-tfWRaxzO6+mKfyXTbNDssa3VxQLTQeFTTA6WhXmq5dtL3SSog1QPd7v/0r9T/Z39",
23
23
  "acctV2Wire.js": "sha384-umBkf5pazE80LpOByLC7mdcrLiWUHzB4+OpdvUybpJ2KgpOsQ5ftgr0IInNmqKKT",
24
24
  "addPreferred.js": "sha384-npT8Hea1UtImEiC7CMvZ3t9CQRVHqbjxEEQeoCWFJaDt2lTrdjL+4ipvek2NX8NQ",
@@ -40,9 +40,9 @@
40
40
  "cloudDevicePins.js": "sha384-PzhTc/N+uLjCcNc+b4BnDVagpSy90cvurEmFOx3mGBoFxJr9sGyyurSYuFYfvJOy",
41
41
  "cloudDeviceSeal.js": "sha384-1pc+0oFx924IQVeSAAH5LzOp/l7p79fH6MhROKnS0Q9wnU2Y0oJYs2carCVxLdqe",
42
42
  "codeAttachments.js": "sha384-ufp2O+y/clLkfUq9cOKGKA0tFATGI8BByGkHwzcabxAfY2f+ON+Po6Bl0+VdGL8H",
43
- "codeBrowse.js": "sha384-bxBdHgqYBbtxm3q0mAAR4/eJFR0DirfhpiXIgOwfHx1HlDc6waExBFIq+6OS9fv2",
44
- "codeCache.js": "sha384-AG00pgEvlGEQc74OjEqC8ttdGe2LW5w3N4JvEsHnnDp4yBvWgOLAeVDc0FAeSdES",
45
- "codeCloud.js": "sha384-1gO3/+apMktXlQFeqHL7u7j/3jZW3sGY4LjSb0ORgjILxer2gTNruMMsK9yc+A9u",
43
+ "codeBrowse.js": "sha384-4zwyAaZvPTdvt5fqmfoVJlOVlWw66NHp6W52FcxUJrXnOabNmMG2BNkgUNeIDd68",
44
+ "codeCache.js": "sha384-v+VTvCPVyaiHcAwecYOnhqvzcWJqNe8Et/peRiU07epMSpRPZnmdMFxGhwo74aaz",
45
+ "codeCloud.js": "sha384-yW3qX8IId2B5QyQiUGSRfeBey5kuSAwOoKiyTFeMkECn29DIj8RuO9dBsqRY0rl4",
46
46
  "codeCloudKeys.js": "sha384-SGf8gNR3NQaDKlwIMB0MWinfAatj202hjJrRtHR6rC82qpI000J7q4BGpBkC9cbb",
47
47
  "codeCommands.js": "sha384-vDl7wobjRwSKgcmhhOVu2pM1ZMYzoiZKwgBjeLFE1ZC0+Oinm8L2dautSvM4yDY/",
48
48
  "codeComputers.js": "sha384-RkOIVwwOwyZRzDWJoqoLAUVxXhsC9xTC0tHHWRuaruZG+dGo1hLXXmZJPt1kkfe4",
@@ -78,8 +78,9 @@
78
78
  "deviceKeyCore.js": "sha384-dA+UIUgvUsJNHY8s3vufUNb84MVTjf+7ITQK+nmpFx0NiYHoNBy++Lc3mys+wnt5",
79
79
  "deviceSeal.js": "sha384-mBad+znurqKyoHJJbSDsAYvmVF9aSamidPZsFyw5xAxEzA2gaAil1ThTDsXFjFbV",
80
80
  "e2ee.js": "sha384-uMzRbdRSuG+Aj3RfMMsguXP4sYGSWPLp8aBIRpMHJ9vKAjtzhAg8FGpfCVpI5xmH",
81
+ "earlierHistory.js": "sha384-EfwAu7IEQX0psiS1aWasJwhFFOqGNtZnCtOSim+Q7x8XxTJE1kG7E539DuYsS0GI",
81
82
  "eat.js": "sha384-MJ4WfNn+0X0WLfa8DEuCss+2HBY7TXuXmC+RWIVvB+kAcSXX6rw9q/g5EH6bbgBM",
82
- "emailFork.js": "sha384-GVraOqmfj/t2zn8upXWBKq6OtgW3P/2Yg7S+B0X47G2p9gnqpkWkTOOGsFDrFGuK",
83
+ "emailFork.js": "sha384-t8LdmJjGUo3nypJ3Z4HNou991UOoO2BHSTvmHmy06A1jFmZIyZeOlqL8ZKtCPreH",
83
84
  "emailSignIn.js": "sha384-boc9bHIdZmie1BaOJfGOnBDvrufTqPPO+6YeGFQVoKOaMoR7Z/pbFFmGJnjKA10M",
84
85
  "emptySpaces.js": "sha384-BPOMXq0mpGts+YvHzGBfK9wT1xtyZvZqvxWcSBYrvOlH7XamiXjTmnJ5K7VGMnFH",
85
86
  "encSource.js": "sha384-ofgX5C8aGQ5UfBJeygQigJ7uU5O+h01xVW6LvNHEfQRFnhsYoA45Wum5utj7dZk2",
@@ -107,7 +108,7 @@
107
108
  "laneLinkCore.js": "sha384-bdUhU+o0amycFRuRZCAeo+E2zWtHQiYgW9ffY0CqotDCmldBD8RG9CGL3Z6IwXga",
108
109
  "ledgerView.js": "sha384-fL++ZXJfO54k1harJd+GHPFyCJQcMpg5A7yAblbFhjq/XUvJEteIV7sHbK+4p9uF",
109
110
  "mcpRecommended.js": "sha384-Gk+4KPSHrmRhVVkA3Wlrk1WoGSqRNVHLfrhBFIPWQhYhDkqSACFh/qrHp1H1atCS",
110
- "memberChange.js": "sha384-5Yg8dTdp4t3A2YrTzeR4j7xsclMcORFZs+629VEvsYbnwVskvBAMNOhh+lT2HdLl",
111
+ "memberChange.js": "sha384-vmnmUgHq6pPk15R3LDQA5HMSN+0hBi4SgbVBJXRBTD9uYiLEpT8qtePSFNdi1bL7",
111
112
  "mirrorBatch.js": "sha384-ji6KmcfgJPcTuucsW9a5SXGlTocLmTD6fW+nOIhZutMTiBh1AEgXa/fOZlcEoDdI",
112
113
  "mkseal.js": "sha384-O5n50dLqnJyHJDK5nmP//KePkkSz9ZnSsrSFeTQW1njCzzvtH4kov0tKbOdwq+IU",
113
114
  "nativePush.js": "sha384-UwfPqJvxuLSc+4cz+2ImNpwjhF4olPUVgh8ViuqPNJTQbouEH8OljaT8Fq5QceNV",
@@ -143,7 +144,8 @@
143
144
  "roomIntake.js": "sha384-PC4d2NNUMbaCaxgC5H+NDfX18yca+Zo06EAOwBd5s9BJJOW8SXnp8NGxO50AG6Kl",
144
145
  "roomName.js": "sha384-GT7/NXN+OJIvGNVsliPY+O/+RC1Xapg+TCAZxMSqDpzTdJ1EUpPZalKXN4RivT4+",
145
146
  "roomPass.js": "sha384-l47V/HhjQWFxJOxWm9SLP+ECDDmwc0KoiIBS+2c98AIqGEw5iOU8xE6Oaw31RSaQ",
146
- "roomRoster.js": "sha384-DYwtBN59P58L2JsDS1U1Cs0Ze8NaLveUHeXGwlEic41r/ee0/3rJCih7W1l3Y8dD",
147
+ "roomRoles.js": "sha384-9n6jWPlyYDhDfQijorjcxx/vZXX5pI7cForT0xbmkATUSo7nalWr9xNaSlgk7dm6",
148
+ "roomRoster.js": "sha384-RUkuezzheIEvZQKrlT/eAgMhqOrVWh2R7epfDOQOSkfADw9iIg/57Mi53b6ne/Po",
147
149
  "roomSettings.js": "sha384-OV2g5ae1e2JmyQl2FOEBZk/0qKCT/BNRULRLT0RapvEvshfFY2HOiyaoT0U/DzFB",
148
150
  "roomState.js": "sha384-SFWOMqdRoZeowpZ+uUltsnRPnkVQKZmEsA1k1GvACo6KSiVeqe+5GX6fDL+63g8Y",
149
151
  "roomStreamClient.js": "sha384-OZ2Xt4EqRTnhRNnDD3OWPLi0zmXpPTgU7dYtpGx/2M2S4p0cd91r76Ue3H1R89af",
@@ -154,21 +156,21 @@
154
156
  "safeMediaPins.js": "sha384-ck3rBAvVaHZ+K1xwF3iNEfQwVx35NtZNFIYtB+0PmINTieOaXTw2ID+OZABcBLSo",
155
157
  "scheduleNext.js": "sha384-7Xu8xaDNV473aZLJub6/fdX52zUgGhUDke0CGMOCD7l6+HpsdkI3S/UK8DVuppdx",
156
158
  "schedulesDoc.js": "sha384-goD3ZkheAxrSYDxMz+oylHXUUhdfvJya+oF+whxrZ3YTtVmuDO1IGR4PrhajA0n5",
157
- "sdkA2A.js": "sha384-yryQH4nBOGY1SPqk6hH5vWfLtc92qqMCI8LyvBGvQdiSlYaW1iGmi07y7XHp1Y4x",
159
+ "sdkA2A.js": "sha384-WPgDGsvaJBStXw4Zhcs1G4FlM+aElih5qP2JHtspAnMT8Tr+8BSrOj2dNfFBTDP1",
158
160
  "sdkAccount.js": "sha384-BY/WJI8NkUqu/VXoEX7fr1cFp/xT6fT1Z2/DQByrp5qxXB0V/KuPmq1CK1ZHF6Gs",
159
161
  "sdkAccountDoc.js": "sha384-uM2b2+6neFTLnX70SVKXHvXcvKjecGRxU5wXoxafiysCHnZjAtR9d1xQQEXErE4x",
160
162
  "sdkAccountSections.js": "sha384-5CmYkh5fIZOOc/SdmR+Ix32TAJdQc7tqzIusuAZnNzu6lahUDjPaAxToBKZvO3fL",
161
163
  "sdkAgui.js": "sha384-oVwPKHW53+SHofOzZicxnHC5QP6qMbJCJLLF7MHYUuD+nC7vewH2hqOKV3vc0aJs",
162
164
  "sdkAttest.js": "sha384-s4vq547Vhg2dGVm53XaHgzuC9xSyXvU9WlG8t63s/fiyiAtiGM0uSOxfpzO7HQlW",
163
- "sdkBackup.js": "sha384-iDuzHM5egV2bRj033gbrLZyi5/+mAtU3Z73leXonl7WDbmNGkMVZQPC0bHmcLdwL",
165
+ "sdkBackup.js": "sha384-bgokIMBjFsb4/Syd1dRyHofABe/ELw/1ROvb8zmBZ8NbXCAw+wBDT1Ad7m0lMjQ6",
164
166
  "sdkBackupV2.js": "sha384-yNWjU8Cr/fh2DSTA6I2nfQB1nHRD0jENrAqe3Azy6Dhsu4tskaX310DB+hlRHKr4",
165
167
  "sdkBrowserPrivate.js": "sha384-LmbHgfSSFbTz6P1uBm0kHfIV8an1nnyepvnpX6/ELMrDDHlWlzuspLOstOCvMW4f",
166
168
  "sdkBuilds.js": "sha384-98mac3jp5DARBMNVJSwqiI4kXCs4LlSnNmDOtbxsEF4IdrHetse2p+njQZoXqVEG",
167
169
  "sdkCloudDevice.js": "sha384-Nk18FVoWqlN3XyYhKqnaLlTNZzVHia0F6ChQFzdTAMTZhICvRIB75wKawtrWjocd",
168
- "sdkComputers.js": "sha384-/aIxSVqn0Mu8z7HVEymO5991RAfzfpBg5BK2yT170Z4ICnLymYkP8IDtENdVQDJE",
170
+ "sdkComputers.js": "sha384-ekOsMRO4cFdo9tbookA8rh76xJGNaRn3Y2O/fkIiDdkR7nyMFPoEkdBUv9kZwegj",
169
171
  "sdkDictation.js": "sha384-eK4MjyycSp+i/0jg90DzHXe//QuFGKW+F3uXMvSNkotHhamiX6wN3Sal5P6D7NXw",
170
172
  "sdkErase.js": "sha384-kJDYZZ4pCwu24rqy21bdUnNzgjuXkS4FvwjMNwHs/kUf0w4Vo5HOP3sj7LEE0KVr",
171
- "sdkExports.js": "sha384-n/Nkwcbwf6oHi4//wA6dEiCaWQXPua0LNhGjVoEwhLhvZxjgyDqOKb4B5ca2pnrl",
173
+ "sdkExports.js": "sha384-O4WVEc+Ecyke2lIs0bd0uyqOmP1a433nAuozvfzabu1HFZDVrxmi0MqfZ8iCdzAt",
172
174
  "sdkInvitations.js": "sha384-ZWK1d055LRmMLLx+frvrAWxPaJT+h5N/QWlmRLg+3gsDEpyi3aj1XlZHAjQAzm7j",
173
175
  "sdkKeptAgent.js": "sha384-OS+VP2GPpjSXfSoel3C0Pw4MWxZH7HZm+jO/ZJwyPiQcvnhZja7TGmJhoxx7Va0P",
174
176
  "sdkKeptIntake.js": "sha384-K02pjf9CW6cC7yifCpFWwVIBnDTCQ2c/eGfyAbPDMprArJorbddtnzNi4FyMws5Z",
@@ -176,7 +178,7 @@
176
178
  "sdkPlan.js": "sha384-YzaZ4s9SHCNDOP/Avn6w+rxlONsl7ZzfWIbyY6RCVX0DAbA2fLB9eRzQRAwloggw",
177
179
  "sdkProtect.js": "sha384-iAeAAC1Xvjcv1odagezcsgMQPZEpy6PExEMc91LrajM6yTxftWiWRFHGbXWMjF+i",
178
180
  "sdkRedact.js": "sha384-wrk7y+RYN33bDy9WjgjKWO56qOYwJdzTeAJU1cf/+QAPTz6cBW9wY4uqGlMarMva",
179
- "sdkRekey.js": "sha384-HsFnbekQH6HqPPeZ5RGPATcWIHfYt1stz0tS0wjjuOizwqkD324L+gmosDVM2RTe",
181
+ "sdkRekey.js": "sha384-0b/b2OleYGx7Qreiop7zKZcKRtRYMH2ZzNdYlcmGHbjv+1sq7hcR1gFFEsvoIuAR",
180
182
  "sdkReport.js": "sha384-kEnWCgXzYc/SoS57F9oLUa5egSOszjGV75upnbgfJOZdu3BrnHzhBcsswg8+e00o",
181
183
  "sdkSafeMedia.js": "sha384-0s5Zcq1gO+XXyxJbHGOmIeXuFtpY7d2HMdsj4R4oAaCkIV+X1W9SuEIwPSmCMAmE",
182
184
  "sdkSchedules.js": "sha384-qy+Q8mhbaKYZNSNwwYRNQKS+oxtimwld8mxAG6g5vR2vo4lkzDPl3k1Q0+J+uZx7",
@@ -192,7 +194,7 @@
192
194
  "sharedViews.js": "sha384-+tw2Oj/1X1XXM+5PW4rVSyZOHXJ9yocOqbPc2NZ6245otJxaI5yKVZYnepHndBwL",
193
195
  "sheetChrome.js": "sha384-2nTqz57klkEZhvjhwM03b/ISOaFy9Qh6L2uDlk/QwdD+Ua86ao7ostLaI1eTaRoq",
194
196
  "siri.js": "sha384-WYAr+BM+JaTQlWfQ7eHylDgmhyK427uaJ8IvocIrX73B4qgQp1L2zrOGmFvMQEpK",
195
- "spaceClient.js": "sha384-sywwa6sVEE9gjHwHW6eN9V78jppd0RFqBnkOAsuIz2RBLq2hoXqPLYiqUq6no9NZ",
197
+ "spaceClient.js": "sha384-LDxYWVhUk6blkV0EH2f5cMPYtHAW73Fz5N6kWHWDr7hX9lo+2Fd0jtzHEHW3MWBz",
196
198
  "spaceConfig.js": "sha384-Pb3W47eQ8xQSGkL9yD521UFnn+tp4vV3+F5Y3Qf92d5jLPmEeZqo3Zbj1idGb4Wd",
197
199
  "spaceEmailGate.js": "sha384-iynfCnft76GXEDC9p7K+mWkYpH+k1zHSSuuKi1JoSHCrHjcojoLB39WviO359U4K",
198
200
  "spaceExport.js": "sha384-j9nsGBzycJ7w9YFYaMkufu4zOIs87GYW4LfHvW9fCZ4Ms57ptn7yw4BY6rI80nQG",
@@ -218,8 +220,8 @@
218
220
  "usageReceipts.js": "sha384-2jq24tFKYlEdmmG2wB1IGeS65eY1vmJTx+HbZgcE8WauyQMA5RyCZwC1nqnd7GBO",
219
221
  "usageSummary.js": "sha384-Ox1QVGMJ9QwuddinJ0lCCqzzTH2gQlVh8d8Ozd0v6Vp6esApiWkdfbM5vgW0VT6C",
220
222
  "util.js": "sha384-wYUVRuJQGeY7x+4ckFhal5xSNqJy5p3KsF1Dw8yWUW9354XrYtAX2cn+h53faZdo",
221
- "vault-core.js": "sha384-XCgOgvpUY20o0DhIrcc/vOd2032fCKHWjx2HtvsZT418NYD0WgJteRblEIELraA0",
222
- "vault-kit.mjs": "sha384-k2N5PfrDMhkwbL6aye0CBOb6QC2ZErCAx3YiWEKK2uvrXC94H1uHimEgRTZhspZd",
223
+ "vault-core.js": "sha384-gIGxcrArSkVsP3ab4tvsuxj85oi9JeRK68J/Oc2uY4I7pd4b1ydDs5B9ui7Lm5XX",
224
+ "vault-kit.mjs": "sha384-fezooQ+NhxZWC13pdCu0ncU9EVV64rCcH5if0yAAj5eui5zIsDleQzRPhOwgLheg",
223
225
  "vault-screens.js": "sha384-URf4/cjWLnzLt/dryA3odAUeJCe6lKmWxbDAl67nVpWIJerK/6tHf1DrS2SJj+KS",
224
226
  "vaultAtRest.js": "sha384-1zrXlwg5pMed4Yl60eAAFFaCh8rMKryoHxX9v802PXFfDiV4piavKybVYVD5RBTL",
225
227
  "vaultCoreLock.js": "sha384-2RdHJjbgp/Qr1JzXX21I71vbiVmWl1Uv7JpBKnU/+InBaa0vC1B19EAMhYZ1LZ0/",
@@ -233,14 +235,14 @@
233
235
  "voiceAttest.js": "sha384-H+Uxa7jFO7kaLjxhZnSwgZ/GrgQLjCFV3o6hhQE4l0yw1mI1Nx6HKZVKSkhVJ9sW",
234
236
  "voiceCert.js": "sha384-lYIUZhCjHZUqJOqIaV0JrMVJXl4u5O32+kofC6kSVAmwOUbpme9mMh0ZhNcrYYEj",
235
237
  "witbitz-admin.js": "sha384-/e0V5Q5jYfuJVnomnQaXiI2hszGueuX5W2PbYApdFAowZXHW24m+mpxW+KHfSywE",
236
- "witbitz-sdk.js": "sha384-hjmDbHINufSMTfekvRG9hZ6rH2HEY+GGqZ0oAoqlweVdc6if+96kKScsNLhT3cHO",
238
+ "witbitz-sdk.js": "sha384-m9FHdABtrnhMpo1T9zWzkInymNBMEZ/5QiO9uNwyRklXEBD6wLEH3QJugqmPtnvj",
237
239
  "workerClient.js": "sha384-f/z7EfUCWakRS00R8UfWGnVIZDtWBA3WPXl2B5orVAkeyvaTUXVqC+hDqb4hkAB6",
238
240
  "workerLiveness.js": "sha384-BSL4mziJ9HE+b2ILIHccsIxSloOr0NKm6pGrRrPN77cRLcwzaJHEEtrjrQcIgVZH",
239
241
  "x509.js": "sha384-YAuy3/aSUomw0Ne+aDTto3HTb9yzdgA+1h44DimiEMjkMYOq/O6MhuRZKsbXmSSp",
240
- "witbitz-sdk.d.ts": "sha384-Jg2SVUAt5q48TQ5kXjlQlbSxtaPP4r9sWDc7ApgQlAlQ2lvUCd/Z+g5A1wd5UFxF",
242
+ "witbitz-sdk.d.ts": "sha384-bO138VoQVdsIwAdn2I60//aDOic8cBGkpZb4cPOFw7b2zwczd18QE2UQX0twzcJu",
241
243
  "witbitz-admin.d.ts": "sha384-ikmN7qyKXg/WdVWmRORgw9LNt/n+M0zJaKcKbLlY0W+nEIH9b4uCCUbket/jWbwX",
242
244
  "decrypt.html": "sha384-3xRvQ++CfE5Fdxf+zHU51M4wxGNthg4NZqrgfaO0vaHiKTKNplmgWBotsf1o8vTS",
243
- "witbitz-admin.mjs": "sha384-jhD1aapG9ESaewlEdnBQWbPXVVvmIm7ZX1ORRO99O02JzPauolPYqWRepYyUmwWr",
244
- "l1-worker-src.js": "sha384-Xf4IJbY/5O+Jf0CsQTYwJWjCIngAGrheEpyjgdjoaF8mlnBvHA9BBVuHLAecwgWN"
245
+ "witbitz-admin.mjs": "sha384-LIJMOhifpwvM43LDyOVO14iSibNv+uXY0uHOUxwWHOTIDD85isj6QBkGottphkxa",
246
+ "l1-worker-src.js": "sha384-7pLejzbh49u67tyvYU3Pcw/lvfDHmllFsfXNwBJjFxQc3Xz424cxzch+S3yf7tof"
245
247
  }
246
248
  }
package/memberChange.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // the config's own shape, and each remaining member's grant address and invite key. Nothing here holds a key.
4
4
  import { memberHash } from './rosterHash.js'
5
5
  import { govOf } from './emailFork.js'
6
+ import { roleTags } from './roomRoles.js' // owners and admins by @username tag (docs/spaces-usernames.md § 13.1)
6
7
  import { resolveHandle } from './inviteEnroll.js'
7
8
  import { findInvitee } from './inviteSend.js'
8
9
 
@@ -79,8 +80,14 @@ export async function membersAfter (cfg, want, room) {
79
80
  if (Array.isArray(al.users) && dropUsers.size) allow.users = al.users.filter((u) => !(u && typeof u === 'object' && dropUsers.has(lc(u.username))))
80
81
  if (Array.isArray(want.domains)) allow.domains = normalizeDomains(want.domains)
81
82
  for (const k of Object.keys(allow)) if (allow[k] === undefined || (Array.isArray(allow[k]) && !allow[k].length && k !== 'emails')) delete allow[k]
82
- const set = (xs) => ({ emails: [...new Set((xs || []).map(lc))] })
83
- return { allow, owners: set(want.owners), admins: set((want.admins || []).filter((e) => !(want.owners || []).map(lc).includes(lc(e)))), removed }
83
+ // ROLES BY TAG (docs/spaces-usernames.md § 13.1): `want.ownerTags` / `want.adminTags` state them; unstated, the room's are kept — a
84
+ // change that does not touch a role held by a tag must not drop it (an older change knew only emails) — less those it removes
85
+ const TK = { owners: 'ownerTags', admins: 'adminTags' }
86
+ const keptTags = (k) => (Array.isArray(want[TK[k]]) ? want[TK[k]] : roleTags(cfg && cfg[k])).filter((t) => typeof t === 'string' && t && !removedMh.has(t))
87
+ const oTags = [...new Set(keptTags('owners'))], aTags = [...new Set(keptTags('admins'))].filter((t) => !oTags.includes(t))
88
+ const had = (k) => Array.isArray(want[TK[k]]) || roleTags(cfg && cfg[k]).length > 0 // `tags: []` says "none now" (spaceClient.setConfig keeps an unstated one)
89
+ const set = (k, xs, tags) => ({ emails: [...new Set((xs || []).map(lc))], ...(tags.length || had(k) ? { tags } : {}) })
90
+ return { allow, owners: set('owners', want.owners, oTags), admins: set('admins', (want.admins || []).filter((e) => !(want.owners || []).map(lc).includes(lc(e))), aTags), removed }
84
91
  }
85
92
 
86
93
  // HIDDEN MEMBERS NOBODY HAS SEEN: an address the list keeps only as its hash (allow.mh — a private invite not opened yet) has no
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@witbitz/sdk",
3
- "version": "4.6.0",
4
- "description": "The Witbitz SDK: Spaces — end-to-end encrypted rooms with an AI assistant — in your own app. The same bytes as https://witbitz.chat/sdk/4.6.0/",
3
+ "version": "4.7.0",
4
+ "description": "The Witbitz SDK: Spaces — end-to-end encrypted rooms with an AI assistant — in your own app. The same bytes as https://witbitz.chat/sdk/4.7.0/",
5
5
  "type": "module",
6
6
  "main": "./witbitz-sdk.js",
7
7
  "types": "./witbitz-sdk.d.ts",
@@ -97,6 +97,7 @@
97
97
  "deviceKeyCore.js",
98
98
  "deviceSeal.js",
99
99
  "e2ee.js",
100
+ "earlierHistory.js",
100
101
  "eat.js",
101
102
  "emailFork.js",
102
103
  "emailSignIn.js",
@@ -164,6 +165,7 @@
164
165
  "roomIntake.js",
165
166
  "roomName.js",
166
167
  "roomPass.js",
168
+ "roomRoles.js",
167
169
  "roomRoster.js",
168
170
  "roomSettings.js",
169
171
  "roomState.js",
package/roomRoles.js ADDED
@@ -0,0 +1,116 @@
1
+ // roomRoles.js — OWNERS AND ADMINS BY EMAIL OR BY THEIR @USERNAME TAG (docs/spaces-usernames.md § 13.1; the owner, 2026-11-29:
2
+ // "Change it."). A verified room's roles are `owners: { emails, tags }` and `admins: { emails, tags }`: an owner or admin who prefers
3
+ // their @username ("Add me to Spaces as @username", § 13) is named by the room's TAG for them (§ 12) — the value that also admits them
4
+ // from `allow.mh` — so their email is nowhere in the sealed config the members read. One rule for the Spaces apps and the SDK:
5
+ // • a tag goes into a role only when the server says it may (`op:'user' mode:'tag'` answers `roles: true` — the Lambda's
6
+ // ROLE_TAGS switch, set once the Lambda and the turn enclave check tag roles); otherwise the role names the email, as before;
7
+ // • a role never admits anyone: whoever holds a role by tag is put on the list by it too;
8
+ // • who holds a role tag is read from the guest book (roster_seen records the entries each person signed in by: 'mh:<tag>').
9
+ // Pure of the DOM; the client is injected.
10
+ import { validUsername } from './address.js'
11
+
12
+ const lc = (s) => String(s || '').trim().toLowerCase()
13
+ const TAG = /^[A-Za-z0-9_-]{16,128}$/
14
+
15
+ /** A role's emails (lowercased, unique). */
16
+ export const roleEmails = (o) => [...new Set((o && Array.isArray(o.emails) ? o.emails : []).map(lc).filter(Boolean))]
17
+ /** A role's tags (valid, unique — base64url, case kept). */
18
+ export const roleTags = (o) => [...new Set((o && Array.isArray(o.tags) ? o.tags : []).filter((t) => typeof t === 'string' && TAG.test(t)))]
19
+ /** A role in the config's shape: emails always, tags only when there are any (a room with none is sealed exactly as before). */
20
+ export const roleOf = (emails, tags) => { const t = [...new Set((tags || []).filter((x) => typeof x === 'string' && TAG.test(x)))]; return { emails: [...new Set((emails || []).map(lc).filter(Boolean))], ...(t.length ? { tags: t } : {}) } }
21
+
22
+ /** The room's roles: owners and admins (admins without the owners — an owner is an admin), by email and by tag. */
23
+ export function rolesOf (cfg) {
24
+ const owners = roleEmails(cfg && cfg.owners), ownerTags = roleTags(cfg && cfg.owners)
25
+ return { owners, admins: roleEmails(cfg && cfg.admins).filter((e) => !owners.includes(e)), ownerTags, adminTags: roleTags(cfg && cfg.admins).filter((t) => !ownerTags.includes(t)) }
26
+ }
27
+ /** Does the room name any owner or admin (by email or by tag)? */
28
+ export const hasRoles = (cfg) => { const r = rolesOf(cfg); return !!(r.owners.length || r.admins.length || r.ownerTags.length || r.adminTags.length) }
29
+ /** The role a person holds here: 'owner' | 'admin' | ''. `who` = { email, tags: [their tag(s) for this room] }. */
30
+ export function roleFor (cfg, who = {}) {
31
+ const r = rolesOf(cfg), e = lc(who.email), tags = Array.isArray(who.tags) ? who.tags : []
32
+ if ((e && r.owners.includes(e)) || tags.some((t) => r.ownerTags.includes(t))) return 'owner'
33
+ if ((e && r.admins.includes(e)) || tags.some((t) => r.adminTags.includes(t))) return 'admin'
34
+ return ''
35
+ }
36
+
37
+ /** The tag a name may hold a role by in this room — only when the server says tag roles are on (`roles: true`). → tag | ''. */
38
+ export async function roleTagFor (client, username, room) {
39
+ const u = validUsername(String(username || '').replace(/^@/, ''))
40
+ if (!u || !client || typeof client.userTag !== 'function') return ''
41
+ try { const t = await client.userTag(u, room); return t && t.status === 200 && t.roles === true && typeof t.tag === 'string' && TAG.test(t.tag) ? t.tag : '' } catch { return '' }
42
+ }
43
+
44
+ /** The @username a signed-in person prefers to be named by in a role (whoami: a username, and the preference not switched off). → name | ''. */
45
+ export async function ownRoleName (client, idToken) {
46
+ try {
47
+ if (!idToken || !client || typeof client.userWhoami !== 'function') return ''
48
+ const w = await client.userWhoami(idToken)
49
+ return w && w.status === 200 && w.username && w.asUser !== false ? (validUsername(String(w.username)) || '') : ''
50
+ } catch { return '' }
51
+ }
52
+
53
+ /** THE ROLES OF A NEW SPACE, as each person prefers. `people` = [{ role: 'owners'|'admins', email, username }] — the creator, and anyone
54
+ * made owner or admin who prefers their @username. Each whose name may hold a role here (roleTagFor) is named by the tag in that role
55
+ * and goes on the list by the name (`allow.tagUsers` — the create stores it as the same tag), and their email leaves the role and the
56
+ * list; anyone else keeps their email. `allow`: the create's list ({ emails, hidden?, tagUsers?, … }). → { owners, admins, allow, placed } */
57
+ export async function placeRoles ({ room, owners, admins, allow }, people, { client } = {}) {
58
+ const roles = { owners: { emails: roleEmails(owners), tags: roleTags(owners) }, admins: { emails: roleEmails(admins), tags: roleTags(admins) } }
59
+ const al = { ...(allow || {}) }
60
+ const placed = []
61
+ for (const p of (Array.isArray(people) ? people : [])) {
62
+ if (!p || (p.role !== 'owners' && p.role !== 'admins')) continue
63
+ const email = lc(p.email), name = validUsername(String(p.username || '').replace(/^@/, ''))
64
+ if (!name) continue
65
+ const tag = await roleTagFor(client, name, room)
66
+ if (!tag) continue // the server cannot take a tag role yet (or the name did not tag): the email stays
67
+ const r = roles[p.role]
68
+ if (!r.tags.includes(tag)) r.tags.push(tag)
69
+ if (email) { r.emails = r.emails.filter((e) => e !== email); if (p.role === 'owners') roles.admins.emails = roles.admins.emails.filter((e) => e !== email) }
70
+ for (const k of ['emails', 'hidden']) if (Array.isArray(al[k]) && email) al[k] = al[k].filter((e) => lc(e) !== email)
71
+ al.tagUsers = [...new Set([...(Array.isArray(al.tagUsers) ? al.tagUsers : []), name])]
72
+ placed.push({ role: p.role, email, username: name, tag })
73
+ }
74
+ return { owners: roleOf(roles.owners.emails, roles.owners.tags), admins: roleOf(roles.admins.emails, roles.admins.tags), allow: al, placed }
75
+ }
76
+
77
+ /** WHO HOLDS EACH ROLE TAG, from the guest book (`roster_seen` people: { email?, user?, entries: ['mh:<tag>', …] }). → Map tag → { email, user }. */
78
+ export function tagHolders (people, tags) {
79
+ const want = new Set((tags || []).filter((t) => typeof t === 'string' && t))
80
+ const out = new Map()
81
+ for (const p of (Array.isArray(people) ? people : Object.values(people || {}))) {
82
+ if (!p || p.left || !Array.isArray(p.entries)) continue
83
+ for (const x of p.entries) if (typeof x === 'string' && x.startsWith('mh:') && want.has(x.slice(3)) && !out.has(x.slice(3))) out.set(x.slice(3), { email: lc(p.email), user: lc(p.user).replace(/^@/, '') })
84
+ }
85
+ return out
86
+ }
87
+
88
+ /** WHO HOLDS EACH ROLE TAG — the guest book's entries first, then each member's @username asked for its tag here (`userTag(name, room)`):
89
+ * a role granted in place to someone on the list by email is not among the entries they signed in by, and every tag-role holder has a
90
+ * username (the tag is their name's). Only tags still unmatched are asked for, each name once. → Map tag → { email, user }. */
91
+ export async function roleTagHolders (people, tags, { room, userTag } = {}) {
92
+ const list = Array.isArray(people) ? people : Object.values(people || {})
93
+ const out = tagHolders(list, tags)
94
+ const left = new Set((tags || []).filter((t) => typeof t === 'string' && t && !out.has(t)))
95
+ if (!left.size || typeof userTag !== 'function') return out
96
+ const asked = new Set([...out.values()].map((h) => h.user).filter(Boolean)) // a person holds one tag in a room: one already matched is not asked
97
+ for (const p of list) {
98
+ if (!left.size) break
99
+ if (!p || p.left || !p.user) continue
100
+ const u = lc(p.user).replace(/^@/, '')
101
+ if (!u || asked.has(u)) continue
102
+ asked.add(u)
103
+ const t = await Promise.resolve().then(() => userTag(u, room)).catch(() => null)
104
+ const tag = t && t.status === 200 && typeof t.tag === 'string' ? t.tag : ''
105
+ if (tag && left.has(tag)) { out.set(tag, { email: lc(p.email), user: u }); left.delete(tag) }
106
+ }
107
+ return out
108
+ }
109
+
110
+ /** The role tags a guest-book person (by email or @username) holds them by — what a demotion or removal drops. */
111
+ export async function tagsOfPerson (people, cfg, { email = '', user = '' } = {}, { room, userTag } = {}) {
112
+ const r = rolesOf(cfg), all = [...r.ownerTags, ...r.adminTags], e = lc(email), u = lc(user).replace(/^@/, '')
113
+ if (!all.length) return []
114
+ const held = await roleTagHolders(people, all, { room, userTag })
115
+ return all.filter((t) => { const h = held.get(t); return !!h && ((e && h.email === e) || (u && h.user === u)) })
116
+ }
package/roomRoster.js CHANGED
@@ -19,7 +19,10 @@ export function verifiedPosters(entries, seen, { withId = false } = {}) {
19
19
  const person = Object.prototype.hasOwnProperty.call(seen, id) ? seen[id] : null
20
20
  if (person?.left) continue
21
21
  const owner = person?.swapped ? null : person
22
- const stampedEmail = (e.kind === 'data' || e.kind === 'title') && typeof e.email === 'string' ? e.email.trim().toLowerCase() : ''
22
+ // A person the roster serves by @username alone (no email in their record) never gets one back from an edit's stamp — rows and
23
+ // renames made before the server stopped stamping it still carry it (sync sweep 2026-11-29 #5).
24
+ const servedByUser = !!(owner && owner.user && !owner.email)
25
+ const stampedEmail = !servedByUser && (e.kind === 'data' || e.kind === 'title') && typeof e.email === 'string' ? e.email.trim().toLowerCase() : ''
23
26
  const email = owner?.email || stampedEmail || (e.emailNameVerified === true ? String(e.name || '').trim().toLowerCase() : '')
24
27
  const user = owner?.user || e.user || ''
25
28
  if (email || user) posters.push({ email, user, ...(withId && !person?.swapped ? { id } : {}) })
package/sdkA2A.js CHANGED
@@ -454,7 +454,7 @@ export class LaneA2A {
454
454
  async reply(taskId, text, { ask = false, reject = false } = {}) {
455
455
  const a = this._acct()
456
456
  let r
457
- try { r = await a._sealed('a2areply', { account: await a._account(), taskId: String(taskId), text: String(text || ''), ask: !!ask, reject: !!reject }) } catch (e) {
457
+ try { r = await a._sealed('a2areply', { account: await a._account(), taskId: String(taskId), text: reject ? '' : String(text || ''), ask: !!ask, reject: !!reject }) } catch (e) { // a decline carries no text (the app's replyA2A)
458
458
  // a task already answered (a resumed 'auto' task taken mid-send was re-sent on every resume, an error each time —
459
459
  // sync sweep backlog): it is done, not failed — dropped, never offered again
460
460
  if (!finishedTask(e)) throw e
@@ -599,7 +599,7 @@ export class VaultLaneA2A extends LaneA2A {
599
599
  }
600
600
  async reply(taskId, text, { ask = false, reject = false, autoPeerId } = {}) {
601
601
  let r
602
- try { r = await this._call('reply', String(taskId), String(text || ''), { ask: !!ask, reject: !!reject, ...(autoPeerId ? { autoPeerId } : {}) }) } catch (e) { if (!finishedTask(e)) throw e; r = { state: 'completed' } } // already answered: done (see above)
602
+ try { r = await this._call('reply', String(taskId), reject ? '' : String(text || ''), { ask: !!ask, reject: !!reject, ...(autoPeerId ? { autoPeerId } : {}) }) } catch (e) { if (!finishedTask(e)) throw e; r = { state: 'completed' } } // already answered: done (see above)
603
603
  if (r?.held) return r
604
604
  this._pending = this._pending.filter((p) => p.taskId !== taskId)
605
605
  return { state: r && r.state }
package/sdkBackup.js CHANGED
@@ -245,6 +245,7 @@ export class AccountBackup {
245
245
  * (wb.account) — opening the room again later brings it back. */
246
246
  remove(room) {
247
247
  if (!this._s) return this
248
+ for (const child of this._s.rooms.slice()) if (child.kind === 'lane' && child.shared === room) this._detachLane(child.room, room) // a lane of it stays as a room of its own, never one pointing at a removed Space (as account.forget)
248
249
  const n = this._s.rooms.length
249
250
  this._s.rooms = this._s.rooms.filter((x) => x.room !== room)
250
251
  if (this._s.rooms.length !== n) { this._s.tomb = [...(this._s.tomb || []).filter((t) => t.room !== room), { room, at: Date.now() }].slice(-500); this._schedule() }
package/sdkComputers.js CHANGED
@@ -200,6 +200,7 @@ export class Computers {
200
200
  }
201
201
  const store = {
202
202
  get: async key => { const blob = await idb.get(key); return blob ? open(key, blob) : null },
203
+ getStrict: async key => { const blob = await idb.getStrict(key); return blob ? open(key, blob) : null }, // a failed read throws (codeCache removeCachedSession)
203
204
  set: async (key, value) => { const box = await sealDoc(loc.key, { key, value }); check(); return idb.set(key, { accountBox: box }) },
204
205
  entries: async prefix => Promise.all((await idb.entries(prefix)).map(async ([k, v]) => [k, await open(k, v)])),
205
206
  del: key => idb.del(key),
package/sdkExports.js CHANGED
@@ -1,4 +1,6 @@
1
- import { exportSpace, recreateSpace, missingAttachments, messageCount } from './spaceExport.js'
1
+ import { exportSpace, recreateSpace, missingAttachments, messageCount, inlineEarlier } from './spaceExport.js'
2
+ import { earlierForExport } from './earlierHistory.js'
3
+ import { readEpochChain } from './spaceFork.js'
2
4
  import { makeBundle, sealSpaceMeta, keysFileText, OFFLINE_ATTACHMENTS_MAX_BYTES, addAttachmentStats } from './offlineBundle.js'
3
5
 
4
6
  // Downloads stay in the document doing the export. A vault never returns the
@@ -17,20 +19,26 @@ export async function saveOfflineReader() {
17
19
  saveExport('witbitz-offline-decryptor.html', await response.text(), 'text/html;charset=utf-8')
18
20
  }
19
21
 
20
- export async function saveRoomExport(sp, tier, current = () => true, title = sp.title) {
22
+ // `earlierKeys` ({ room: key } — the account's rooms this client can open): a LINKED CONTINUATION's earlier versions ride along, read
23
+ // as the Spaces app reads them (offlineExport.js, earlierHistory.js); when they cannot be, the result says so (`historyIncomplete`)
24
+ export async function saveRoomExport(sp, tier, current = () => true, title = sp.title, earlierKeys = null) {
21
25
  const reader = Object.fromEntries(['poll', 'getConfig', 'blob', 'state'].map((op) => [
22
26
  op, (room, ...args) => sp._client[op](room, sp._mk, ...args),
23
27
  ]))
24
28
  const bundle = await exportSpace(sp.room, reader, { title })
25
29
  if (!current()) throw new Error('account_changed')
26
30
  bundle.tier = tier
31
+ const keys = earlierKeys && typeof earlierKeys === 'object' ? earlierKeys : {}
32
+ const { earlier, note } = await earlierForExport({ parent: bundle.config?.parent?.room, epochKeys: keys, readChain: (p, mk, ek) => readEpochChain(sp._client, p, mk, ek, 0, { whole: true }) })
33
+ if (earlier) { earlier.entries = await inlineEarlier(earlier.entries, (room, ref) => (room && keys[room] ? sp._client.blob(room, keys[room], ref) : null)); bundle.earlier = earlier }
34
+ if (!current()) throw new Error('account_changed')
27
35
  // A readable file carries no credential (a connection's callKey, the room's earlier keys): exportSpace leaves them out for
28
36
  // every caller — spaceExport.js portableConfig (side sweep: portable-export-includes-room-credentials).
29
37
  saveExport('witbitz-space-' + sp.room + '.json', JSON.stringify(bundle), 'application/json')
30
38
  // the attachments the file still carries only as a pointer to this room (their read failed): said, as the app says it — a
31
39
  // recreated room cannot open them (side sweep: portable-export-silent-attachment-read-failure)
32
40
  const missing = missingAttachments(bundle)
33
- return { count: messageCount(bundle.entries), ...(missing ? { attachmentsMissing: missing } : {}) } // the MESSAGE count: a photo's Safe media copy is not one (side sweep: room-export-counts-hidden-records-as-messages)
41
+ return { count: messageCount(bundle.entries), ...(missing ? { attachmentsMissing: missing } : {}), ...(earlier ? { earlierCount: messageCount(earlier.entries) } : note ? { historyIncomplete: note.trim() } : {}) } // the MESSAGE count: a photo's Safe media copy is not one (side sweep: room-export-counts-hidden-records-as-messages)
34
42
  }
35
43
 
36
44
  export async function recreateExport(wb, bundle, { tier = bundle?.tier || (bundle?.device?.confidential === false ? 'standard' : 'enclave') } = {}) {
package/sdkRekey.js CHANGED
@@ -21,6 +21,7 @@ import { assertNotKept } from './sdkCloudDevice.js'
21
21
  import { memberHash } from './rosterHash.js'
22
22
  import { preferredAddresses } from './addPreferred.js' // "Add me to Spaces as @username" (docs/spaces-usernames.md § 13)
23
23
  import { findInvitee } from './inviteSend.js'
24
+ import { rolesOf, roleFor, hasRoles, roleTagFor, roleTagHolders } from './roomRoles.js' // owners and admins by @username tag (docs/spaces-usernames.md § 13.1)
24
25
 
25
26
  const sdkError = (message, code) => Object.assign(new Error(message), { code })
26
27
 
@@ -119,6 +120,9 @@ export class InviteAccount {
119
120
  const client = wb && wb._client
120
121
  if (!client || typeof client.inboxFetch !== 'function') throw sdkError('witbitz: this client cannot read an invite inbox', 'unsupported')
121
122
  const out = []
123
+ // THE ACCOUNT THAT ASKED (sync sweep 11-29 #2): a sign-out or switch during the read must not hand the previous account's links on
124
+ const whoNow = () => { const s = wb._session; return s && s.email ? lc(s.email) + '|' + inviteScope(s.idToken) : '' }
125
+ const asked = whoNow()
122
126
  // a fetch that rejects before any answer is `unreachable` too, as the types say (side sweep: sdk-invite-collection-network-error)
123
127
  const n = await checkInbox({ client, inviteKey: k, onInvite: (inv) => {
124
128
  if (inv.kind || !inv.room) return false // an attested room's: its native app takes it
@@ -129,6 +133,7 @@ export class InviteAccount {
129
133
  out.push({ room: String(inv.room), link, title: typeof inv.title === 'string' ? inv.title.slice(0, 200) : '', from: typeof inv.from === 'string' ? inv.from.slice(0, 320) : '', at: Math.min(Number(inv.at) || 0, Date.now()) })
130
134
  return true
131
135
  } }).catch(() => -1)
136
+ if (whoNow() !== asked || this._key() !== k) throw sdkError('witbitz: the account changed while collecting invitations', 'account_changed')
132
137
  if (n < 0) throw sdkError('witbitz: the invite inbox could not be read', 'unreachable')
133
138
  const seen = new Set()
134
139
  return out.sort((a, b) => b.at - a.at).filter((x) => !seen.has(x.room) && seen.add(x.room)) // the newest invitation per room
@@ -239,7 +244,18 @@ async function currentMembers (space, cfg) {
239
244
  const onList = await stillOnList(cfg, space.room, Object.values(book.seen || {}).filter((x) => x && x.email && !x.left)).catch(() => null) // the records: a person in by @username is on by the entry they came in by (sync sweep 11-23 #2)
240
245
  const seen = onList ? seen0.filter((e) => onList(e, '')) : seen0
241
246
  const emails = [...new Set([...(Array.isArray(al.emails) ? al.emails : []), ...seen].map(lc))]
242
- return { book, emails, owners: ((cfg.owners && cfg.owners.emails) || []).map(lc), admins: ((cfg.admins && cfg.admins.emails) || []).map(lc) }
247
+ const rt = rolesOf(cfg) // ownerTags/adminTags: the roles held by @username tag (§ 13.1) — a change that does not touch them carries them
248
+ return { book, emails, owners: ((cfg.owners && cfg.owners.emails) || []).map(lc), admins: ((cfg.admins && cfg.admins.emails) || []).map(lc), ownerTags: rt.ownerTags, adminTags: rt.adminTags }
249
+ }
250
+
251
+ /** This session's tag for the Space (its @username's, op user mode tag) — a role it holds by its tag (§ 13.1). → [tag] | [] */
252
+ async function ownTags (space) {
253
+ const wb = space._wb
254
+ const w = wb && wb.usernames ? await wb.usernames.mine().catch(() => null) : null
255
+ if (!w || !w.username) return []
256
+ const c = (wb && wb._client) || space._client
257
+ const t = typeof c.userTag === 'function' ? await c.userTag(w.username, space.room).catch(() => null) : null
258
+ return t && t.status === 200 && typeof t.tag === 'string' && t.tag ? [t.tag] : []
243
259
  }
244
260
 
245
261
  const epochOf = (cfg) => (Array.isArray(cfg && cfg.keyChain) ? cfg.keyChain.length : 0) // the epoch a config was read at (= the app's rekeyToWant)
@@ -284,9 +300,11 @@ export async function changeable (space, what) {
284
300
  if (!cfg) throw sdkError(`witbitz: couldn’t read this Space’s members — try ${what} again shortly`, 'config_unavailable')
285
301
  if (cfg.admission !== 'email') throw sdkError(`witbitz: only an email-gated Space changes ${what === 'rotateKey' ? 'its key' : 'its members'}`, 'invalid_argument')
286
302
  const me = lc(wb._session.email)
287
- const owners = ((cfg.owners && cfg.owners.emails) || []).map(lc), admins = ((cfg.admins && cfg.admins.emails) || []).map(lc)
288
- if (!owners.length && !admins.length) throw sdkError('witbitz: this Space has no owners or admins — only the Spaces app can change it (its creator)', 'not_admin')
289
- if (!owners.includes(me) && !admins.includes(me)) throw sdkError('witbitz: only an owner or an admin changes this Space', 'not_admin')
303
+ if (!hasRoles(cfg)) throw sdkError('witbitz: this Space has no owners or admins — only the Spaces app can change it (its creator)', 'not_admin')
304
+ // a role held by this account's @username tag (§ 13.1) counts as one held by its email
305
+ const rt = rolesOf(cfg)
306
+ const tags = !roleFor(cfg, { email: me }) && (rt.ownerTags.length || rt.adminTags.length) ? await ownTags(space) : []
307
+ if (!roleFor(cfg, { email: me, tags })) throw sdkError('witbitz: only an owner or an admin changes this Space', 'not_admin')
290
308
  return { cfg, me }
291
309
  }
292
310
 
@@ -356,6 +374,33 @@ export async function planMembers (space, admission = {}, cfg = null) {
356
374
  want[role] = retained
357
375
  }
358
376
  }
377
+ // ROLES BY @USERNAME TAG (docs/spaces-usernames.md § 13.1; the owner, 2026-11-29). `admission.ownerTags` / `adminTags` (members()'s) state
378
+ // them in full; unstated, the room's are kept — but where `owners` / `admins` are stated, a tag whose holder the guest book names by an
379
+ // email left out of that list is dropped (lowered), and an email stated for someone who holds the role by tag stays their tag.
380
+ const held = (cur.ownerTags.length || cur.adminTags.length) ? await roleTagHolders(Object.values((cur.book && cur.book.seen) || {}), [...cur.ownerTags, ...cur.adminTags], { room: space.room, userTag: typeof c.userTag === 'function' ? (n, r) => c.userTag(n, r) : null }) : new Map()
381
+ const holderEmail = (t) => (held.get(t) && held.get(t).email) || ''
382
+ const tagWant = {}
383
+ for (const [role, key] of [['owners', 'ownerTags'], ['admins', 'adminTags']]) {
384
+ if (admission[key] !== undefined) {
385
+ if (!Array.isArray(admission[key]) || admission[key].some((t) => typeof t !== 'string' || !t)) throw sdkError(`witbitz: admission.${key} is a list of the tags members() reports`, 'invalid_argument')
386
+ tagWant[key] = [...new Set(admission[key])]
387
+ } else if (Array.isArray(admission[role])) { const stated = new Set(want[role]); tagWant[key] = cur[key].filter((t) => { const e = holderEmail(t); return !e || stated.has(e) }) } else tagWant[key] = [...cur[key]]
388
+ const byTag = new Set(tagWant[key].map(holderEmail).filter(Boolean))
389
+ want[role] = want[role].filter((e) => !byTag.has(e))
390
+ }
391
+ // SOMEONE MADE AN OWNER OR ADMIN NOW, as they prefer: by the room's tag for their @username (the email door names it, only where "find
392
+ // me by email" is on), once the server takes tag roles (roleTagFor: `roles: true`); otherwise by the email, as before.
393
+ {
394
+ const granted = [...want.owners.filter((e) => !cur.owners.includes(e)).map((e) => ['owners', e]), ...want.admins.filter((e) => !cur.admins.includes(e) && !cur.owners.includes(e) && !want.owners.includes(e)).map((e) => ['admins', e])]
395
+ const pref = granted.length ? await preferredAddresses([...new Set(granted.map(([, e]) => e))], { client: c }).catch(() => null) : null
396
+ for (const { email, username } of (pref && pref.learned) || []) {
397
+ const t = await roleTagFor(c, username, space.room)
398
+ if (!t) continue
399
+ for (const [role, e] of granted) if (e === email) { want[role] = want[role].filter((x) => x !== email); tagWant[role === 'owners' ? 'ownerTags' : 'adminTags'].push(t) }
400
+ }
401
+ }
402
+ want.ownerTags = [...new Set(tagWant.ownerTags)]
403
+ want.adminTags = [...new Set(tagWant.adminTags)].filter((t) => !want.ownerTags.includes(t))
359
404
  // HOW A NEW MEMBER IS ADDED IS THEIR PREFERENCE (docs/spaces-usernames.md § 13; owner, 2026-11-29): an address NEW to the list
360
405
  // (not shown, not a manager, not yours) whose person prefers their @username — the email door names it, only where "find me by
361
406
  // email" is on — goes on the list as the room's TAG for that name: the other members never get the email. Its grant is sealed at
@@ -380,6 +425,8 @@ export async function planMembers (space, admission = {}, cfg = null) {
380
425
  }
381
426
  const m0 = await listAfter(cfg, space.room, { ...want, known: cur.emails }, { book: () => cur.book, tagOf })
382
427
  const m = asUsers.length ? { ...m0, allow: { ...m0.allow, mh: [...new Set([...(Array.isArray(m0.allow.mh) ? m0.allow.mh : []), ...asUsers.map((x) => x.tag)])] } } : m0
428
+ // a STATED role tag is one admission() reported (a role held now) or a tag on the new list — anything else names nobody, refused, never written
429
+ { const known = new Set([...(Array.isArray(m.allow.mh) ? m.allow.mh : []), ...cur.ownerTags, ...cur.adminTags]); const stray = [...(Array.isArray(admission.ownerTags) ? admission.ownerTags : []), ...(Array.isArray(admission.adminTags) ? admission.adminTags : [])].find((t) => !known.has(t)); if (stray) throw sdkError('witbitz: a role tag must be one admission() reports, or name someone on the list (' + String(stray).slice(0, 8) + '…)', 'invalid_argument') }
383
430
  // ⛔ NOT YOURSELF, SILENTLY (second review, 2026-11-27): a manager the new list does not admit is dropped (545f3a97f, so a role cannot
384
431
  // admit anyone) — a manager who leaves THEIR OWN address off the whole list would lose the Space with no word. Refused by name
385
432
  // instead: they add it, or leave the Space. Asked of the change itself (`m.removed`), so a manager who stays by a domain, a
package/spaceClient.js CHANGED
@@ -31,6 +31,7 @@ import { verifyRoomGovernance } from './ownerPolicy.js'
31
31
  import { staysDirect } from './roomName.js' // a direct chat that gains a third member is a group (rekey)
32
32
  import { stageMirrorAttachments } from './mirrorBatch.js'
33
33
  import { memberHash } from './rosterHash.js' // hash the email allow-list (room-bound) before sealing → co-members can't read addresses
34
+ import { roleOf } from './roomRoles.js' // owners and admins by email or @username tag (docs/spaces-usernames.md § 13.1)
34
35
 
35
36
  async function directRoster(allow, room) {
36
37
  if (!Array.isArray(allow?.emails) || !Array.isArray(allow?.mh) || !allow.mh.length) return allow
@@ -106,8 +107,8 @@ const sealConfig = async (config, mk) =>
106
107
  // (spaceService hasAdmins/isRoomAdmin/cardNeedsAdmin) — and were MISSING from this list, so an SDK room declared them
107
108
  // and sealed without them: no admins, approvals by any member (a builder measured it on production). `forkedFrom` is
108
109
  // where a fork came from; `connections` are the grants a fork carries. Undefined ⇒ dropped ⇒ sealed exactly as before.
109
- admins: config.admins && Array.isArray(config.admins.emails) ? { emails: config.admins.emails.map((x) => String(x).toLowerCase()) } : undefined,
110
- owners: config.owners && Array.isArray(config.owners.emails) ? { emails: config.owners.emails.map((x) => String(x).toLowerCase()) } : undefined, // OWNERS (2026-10-03): above admins, enforced by the room
110
+ admins: config.admins && Array.isArray(config.admins.emails) ? roleOf(config.admins.emails, config.admins.tags) : undefined, // tags: an admin by @username tag (docs/spaces-usernames.md § 13.1)
111
+ owners: config.owners && Array.isArray(config.owners.emails) ? roleOf(config.owners.emails, config.owners.tags) : undefined, // OWNERS (2026-10-03): above admins, enforced by the room
111
112
  forkedFrom: typeof config.forkedFrom === 'string' && config.forkedFrom ? config.forkedFrom.slice(0, 120) : undefined,
112
113
  connections: Array.isArray(config.connections) && config.connections.length ? config.connections : undefined,
113
114
  direct: config.direct === true ? true : undefined, // a DIRECT chat (directChat.js): the server refuses its rename, the other side files it by this
@@ -1448,7 +1449,9 @@ export function makeSpaceClient({ endpoint = DEFAULT_ENDPOINT, fetch: fetchImpl,
1448
1449
  if ('platformTools' in p) next.platformTools = p.platformTools === false || Array.isArray(p.platformTools) ? p.platformTools : undefined // which platform tools the assistant gets; null/true = all again
1449
1450
  if ('framing' in p) next.framing = p.framing === 'builder' ? 'builder' : undefined // builder mode: the app's prompt only; null = the Spaces framing again
1450
1451
  // WHO RUNS IT (a role change in place — no new key; the server checks who may: agent/roomRekey.mayChangeRoles)
1451
- for (const k of ['admins', 'owners']) if (k in p) next[k] = { emails: [...new Set(((p[k] && p[k].emails) || []).map((e) => String(e).trim().toLowerCase()).filter(Boolean))] }
1452
+ // a role names emails and @username tags (docs/spaces-usernames.md § 13.1): `tags` stated → those; unstated → the room's kept (a caller
1453
+ // that knows only emails never drops a role held by a tag)
1454
+ for (const k of ['admins', 'owners']) if (k in p) { const tags = p[k] && Array.isArray(p[k].tags) ? p[k].tags : (cur[k] && Array.isArray(cur[k].tags) ? cur[k].tags : []); next[k] = roleOf((p[k] && p[k].emails) || [], tags) }
1452
1455
  if ('lanes' in p) next.lanes = p.lanes === true // "Private assistants" off (or on) in place (docs/always-on-agent-plan.md Phase 0b)
1453
1456
  if ('dataWrites' in p) next.dataWrites = p.dataWrites === false ? false : undefined // false = data_query only; null/true = writes offered again
1454
1457
  if ('safeMedia' in p) next.safeMedia = p.safeMedia === true ? true : undefined // SAFE MEDIA on/off (docs/safe-media.md): the admins', any member's where there are none