@estiva-app/interop 0.46.0 → 0.48.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.
@@ -719,7 +719,7 @@ function webTemplate(event, entity) {
719
719
  /**
720
720
  * The bare file — `kind:30840`, SPEC §6.7, decided in RFC 0.5 §10.7.
721
721
  *
722
- * A file **no app owns**: a `d`, a `title`, the `h` of the team it lives in, at
722
+ * A file **no app owns**: a `d`, a `title`, the `h` of the Folder it lives in, at
723
723
  * most one `a` naming the file it sits under, and a §13.3 block document (or
724
724
  * nothing) for content. A Peek topic is one. Typed kinds — a project, an issue
725
725
  * — add properties on top of this; the bare file adds none, which is exactly
@@ -845,7 +845,7 @@ const BARE_FILE_MANIFEST = {
845
845
 
846
846
  `rename` is a `kind:1851` change to the `title` field, not a re-publish of
847
847
  the `30840`. The title slot already folds `title`, so a rename by anyone in
848
- the team lands for every reader the way a re-parent does; a re-publish
848
+ the Folder lands for every reader the way a re-parent does; a re-publish
849
849
  could only ever be the author's, because a `30840` from another pubkey is a
850
850
  different address and not a refusal. `delete` is NIP-09's `kind:5` naming
851
851
  the address — the relay decides who may (the author, or the owner of an
@@ -856,7 +856,7 @@ const BARE_FILE_MANIFEST = {
856
856
  {
857
857
  id: 'comment',
858
858
  label: 'Comment',
859
- description: 'Say something about this file. The comment lands in the team Folder the file lives in, ' +
859
+ description: 'Say something about this file. The comment lands in the Folder the file lives in, ' +
860
860
  'and is what every reader of the file sees under it.',
861
861
  effect: 'writes',
862
862
  appliesTo: [String(KIND_BARE_FILE)],
@@ -866,7 +866,7 @@ const BARE_FILE_MANIFEST = {
866
866
  {
867
867
  id: 'rename',
868
868
  label: 'Rename',
869
- description: 'Give this file a new title. A change event, so anyone in the team may, and every app ' +
869
+ description: 'Give this file a new title. A change event, so anyone in the Folder may, and every app ' +
870
870
  'reading the file folds it into the title.',
871
871
  effect: 'writes',
872
872
  appliesTo: [String(KIND_BARE_FILE)],
@@ -876,15 +876,15 @@ const BARE_FILE_MANIFEST = {
876
876
  /*
877
877
  `move` is the `parent` field SPEC §6.7 already defines, declared so a
878
878
  consumer draws the control from here as it draws Rename (FOL-4). The value
879
- is the new parent's address, or empty for the top of the team. A move
879
+ is the new parent's address, or empty for the top of the Folder. A move
880
880
  never changes `h`: nesting organises and never grants access, so a file
881
- moved under another stays readable by exactly the team it was.
881
+ moved under another stays readable by exactly the people it was.
882
882
  */
883
883
  {
884
884
  id: 'move',
885
885
  label: 'Move',
886
- description: "Put this file under another file in the same team, or back at the top. A change event, so anyone in " +
887
- 'the team may; who can read the file does not change.',
886
+ description: "Put this file under another file in the same Folder, or back at the top. A change event, so anyone in " +
887
+ 'the Folder may; who can read the file does not change.',
888
888
  effect: 'writes',
889
889
  appliesTo: [String(KIND_BARE_FILE)],
890
890
  emits: { kind: 1851, field: 'parent' },
@@ -893,7 +893,7 @@ const BARE_FILE_MANIFEST = {
893
893
  /*
894
894
  `archive` is the one field every file may carry (FOL-46): `true` hides the
895
895
  file and everything under it from every list, an empty value brings it
896
- back. A change, so anyone in the team may, and the archiving change's
896
+ back. A change, so anyone in the Folder may, and the archiving change's
897
897
  `content` is the resolution summary a person gave (`ActionEventArgs.note`).
898
898
  */
899
899
  {
@@ -1437,8 +1437,20 @@ export function isArchived(file) {
1437
1437
  * `changes` may hold any events; only this rule's change kind, naming this
1438
1438
  * address, setting this field, is read. Last write wins, by the same order as
1439
1439
  * every other field.
1440
+ *
1441
+ * **A Folder is the exception** (SPEC §3.2): on a `kind:39000` address only a
1442
+ * change in the Folder's own `h` by one of `folderAdmins` — the owners and
1443
+ * admins on its relay-signed `kind:39001` — counts. A caller that has not read
1444
+ * the admin list passes none, and then no change counts: a Folder shown live
1445
+ * when it is archived is recoverable, one any member could hide is not.
1440
1446
  */
1441
- function archiveOf(changes, address, rule) {
1447
+ function archiveOf(changes, address, rule, folderAdmins) {
1448
+ const [kind, , folderId] = address.split(':');
1449
+ if (Number(kind) === KIND_CHANNEL) {
1450
+ if (!folderAdmins?.size)
1451
+ return undefined;
1452
+ changes = changes.filter((change) => tagValue(change, 'h') === folderId && folderAdmins.has(change.pubkey));
1453
+ }
1442
1454
  let last;
1443
1455
  for (const change of changes) {
1444
1456
  // The target is the first target tag, as every other fold reads it: a
@@ -3671,6 +3683,17 @@ function buildCreationEvent(args) {
3671
3683
  return `"${held}" is not one of ${vocab.map((e) => e.value).join(', ')}.`;
3672
3684
  }
3673
3685
  }
3686
+ // A person property is checked as a person change is (SPEC §7.3, SHA-28).
3687
+ const people = [];
3688
+ for (const [name, held] of Object.entries(value)) {
3689
+ if (properties[name]?.type !== 'pubkey')
3690
+ continue;
3691
+ const problem = personKeyProblem(declared.label, held);
3692
+ if (problem)
3693
+ return problem;
3694
+ if (held !== '' && !people.includes(held))
3695
+ people.push(held);
3696
+ }
3674
3697
  if (isAddressableKind(declared.emits.kind) && !newId) {
3675
3698
  return `Creating a kind ${declared.emits.kind} needs an identifier, and none was supplied.`;
3676
3699
  }
@@ -3716,6 +3739,10 @@ function buildCreationEvent(args) {
3716
3739
  tags.push([declared.emits.setTag, address]);
3717
3740
  }
3718
3741
  tags.push([placement, folder], ...prose);
3742
+ // Each person the new root names, once, where the relay indexes them — the
3743
+ // property's own tag is not indexed (SPEC §11.8, decided 2026-10-05).
3744
+ for (const person of people)
3745
+ tags.push(['p', person]);
3719
3746
  return {
3720
3747
  pubkey: args.pubkey,
3721
3748
  created_at: Math.floor(args.createdAtMs / 1000),
@@ -3724,6 +3751,20 @@ function buildCreationEvent(args) {
3724
3751
  content: bodyField ? (value[bodyField] ?? '') : '',
3725
3752
  };
3726
3753
  }
3754
+ /**
3755
+ * A person's key as an input of `type: "pubkey"` takes it — SPEC §7.3, SHA-28.
3756
+ * The `p` a writer adds must be what `#p` matches, so an npub or upper-case hex
3757
+ * is refused rather than converted: the person picking it saw something else.
3758
+ */
3759
+ const PERSON_KEY = /^[0-9a-f]{64}$/;
3760
+ /** Why `value` is neither `''` nor a person's key, or undefined when it is one. */
3761
+ function personKeyProblem(label, value) {
3762
+ if (value === '' || PERSON_KEY.test(value))
3763
+ return undefined;
3764
+ // A consumer shows this to the person, whose picker went wrong upstream; the
3765
+ // rule for developers is SPEC §7.3's, not theirs to act on.
3766
+ return `"${label}" needs a person picked from the list, so nothing was changed.`;
3767
+ }
3727
3768
  /**
3728
3769
  * Build the event that performs a manifest-declared action — one event.
3729
3770
  *
@@ -3879,6 +3920,15 @@ function buildOneActionEvent(args) {
3879
3920
  return `"${value}" is not one of ${vocab.map((e) => e.value).join(', ')}.`;
3880
3921
  }
3881
3922
  }
3923
+ // A change whose input is a person names them (SPEC §7.3's `pubkey`, SHA-28).
3924
+ // `''` clears it and names nobody; anything else that is not a key would fold
3925
+ // as the field's value and make nobody a member, so it is refused here.
3926
+ const namesPerson = !!declared.emits.field && declared.input?.type === 'pubkey';
3927
+ if (namesPerson) {
3928
+ const problem = personKeyProblem(declared.label, value);
3929
+ if (problem)
3930
+ return problem;
3931
+ }
3882
3932
  // A prose value's `content-format` and `imeta` — a change only, per the
3883
3933
  // refusal above. Ship's order: the tag before `ts`, the files after it.
3884
3934
  const prose = declared.emits.field
@@ -3924,6 +3974,11 @@ function buildOneActionEvent(args) {
3924
3974
  if (records.order?.includes('ts'))
3925
3975
  tags.push(['ts', String(args.createdAtMs)]);
3926
3976
  tags.push(...files);
3977
+ // The person, where the relay indexes them: `value` is not indexed, so
3978
+ // without this `#p` never finds the change and §11.8 makes nobody a member.
3979
+ // After `ts`, where Ship's own builder has put it since FOL-30.
3980
+ if (namesPerson && value !== '')
3981
+ tags.push(['p', value]);
3927
3982
  // A move also names its new parent where a relay indexes it (SPEC §7.2, FOL-45):
3928
3983
  // `value` is not indexed, so without this no read by the new parent finds a
3929
3984
  // child moved in. Only for the field the kind declares as `movedBy`, and only
@@ -3977,13 +4032,39 @@ export const KIND_FOLDER_STATE = 30890;
3977
4032
  /**
3978
4033
  * NIP-29 group metadata — the Folder's channel.
3979
4034
  *
3980
- * Named here for two unrelated jobs: it carries the folder's `name` before any
3981
- * folder state exists, and its own address is what makes a Peek topic a file
3982
- * like any other (§5.2).
4035
+ * Named here for two unrelated jobs: it carries the Folder's title — its
4036
+ * `name`, and only that (SPEC §3.2) — and its own address is what makes a Peek
4037
+ * topic a file like any other (§5.2).
3983
4038
  */
3984
4039
  const KIND_CHANNEL = 39000;
4040
+ /** NIP-29 group admins — the relay's list of who holds which role in a channel. */
4041
+ const KIND_CHANNEL_ADMINS = 39001;
4042
+ /** The roles on a `kind:39001` that may rename a Folder, and so archive it (SPEC §3.2). */
4043
+ const FOLDER_ADMIN_ROLES = new Set(['owner', 'admin']);
3985
4044
  /** The `name` tag, when there is an event to read it off at all. */
3986
4045
  const nameOf = (event) => (event ? tagValue(event, 'name') : undefined);
4046
+ /**
4047
+ * The owners and admins a `kind:39001` lists — kept only when the channel's own
4048
+ * signer, the relay, signed it: anybody can publish an event of that shape.
4049
+ */
4050
+ function folderAdminsOf(admins, channel) {
4051
+ if (!admins || !channel || admins.pubkey !== channel.pubkey)
4052
+ return [];
4053
+ return [
4054
+ ...new Set(admins.tags
4055
+ .filter((tag) => tag[0] === 'p' && tag[1] && tag.slice(2).some((role) => FOLDER_ADMIN_ROLES.has(role)))
4056
+ .map((tag) => tag[1])),
4057
+ ];
4058
+ }
4059
+ /**
4060
+ * A Folder's own archive (SPEC §3.2): the `archived` changes on its channel's
4061
+ * address, counting only one carrying the Folder's own `h` whose author the
4062
+ * relay lists as its owner or admin. From anybody else the relay accepts the
4063
+ * change, and it means nothing.
4064
+ */
4065
+ function folderArchiveOf(changes, folder) {
4066
+ return folder.channel ? archiveOf(changes, folder.channel, ARCHIVE_RULE, new Set(folder.admins ?? [])) : undefined;
4067
+ }
3987
4068
  /**
3988
4069
  * The folders a person navigates by: the ones with state that no other folder
3989
4070
  * lists (FOL-5).
@@ -3996,7 +4077,7 @@ const nameOf = (event) => (event ? tagValue(event, 'name') : undefined);
3996
4077
  * never gets; and a folder another one lists (`listedIn`) is a row inside
3997
4078
  * that one, not a section beside it.
3998
4079
  *
3999
- * Not a list of ids: a new team is a folder somebody creates, not a code
4080
+ * Not a list of ids: a new Folder is a folder somebody creates, not a code
4000
4081
  * change. Moved here from Peek and Ship, which each held the same line.
4001
4082
  *
4002
4083
  * An archived Folder is not navigated by (FOL-46), and a listing that has not
@@ -4009,8 +4090,8 @@ export function topLevelFolders(folders) {
4009
4090
  * Every folder this identity can see, for a sidebar.
4010
4091
  *
4011
4092
  * Both shapes in one pass: folders the relay maintains state for, and bare
4012
- * channels that have none yet. A channel with state appears once, named by its
4013
- * state — the folder's name is the folder's to say.
4093
+ * channels that have none yet. A channel with state appears once, titled by its
4094
+ * `kind:39000` (SPEC §3.2), with the owners and admins its `kind:39001` lists.
4014
4095
  *
4015
4096
  * **A direct route, deliberately.** §4.2's post-mortem on REW-11 is that
4016
4097
  * discovering children only through their parent loses them when the parent
@@ -4021,30 +4102,44 @@ export async function listFolders(query) {
4021
4102
  const events = await query([
4022
4103
  { kinds: [KIND_FOLDER_STATE], limit: 500 },
4023
4104
  { kinds: [KIND_CHANNEL], limit: 500 },
4105
+ { kinds: [KIND_CHANNEL_ADMINS], limit: 500 },
4024
4106
  ]);
4025
4107
  const byId = new Map();
4108
+ const channelOf = new Map();
4109
+ const adminsOf = new Map();
4026
4110
  for (const event of events) {
4027
4111
  const id = tagValue(event, 'd');
4028
4112
  if (!id)
4029
4113
  continue;
4114
+ if (event.kind === KIND_CHANNEL)
4115
+ channelOf.set(id, event);
4116
+ if (event.kind === KIND_CHANNEL_ADMINS)
4117
+ adminsOf.set(id, event);
4118
+ if (event.kind !== KIND_FOLDER_STATE && event.kind !== KIND_CHANNEL)
4119
+ continue;
4030
4120
  const state = event.kind === KIND_FOLDER_STATE;
4031
4121
  const existing = byId.get(id);
4032
- // State wins over the channel for the name, whichever order they arrived.
4033
- if (existing && !state)
4034
- continue;
4035
- const addresses = state ? event.tags.filter((tag) => tag[0] === 'a' && tag[1]).map((tag) => tag[1]) : [];
4122
+ const addresses = state ? event.tags.filter((tag) => tag[0] === 'a' && tag[1]).map((tag) => tag[1]) : (existing?.addresses ?? []);
4036
4123
  byId.set(id, {
4037
4124
  id,
4038
- name: tagValue(event, 'name') ?? existing?.name,
4039
4125
  hasState: state || (existing?.hasState ?? false),
4040
4126
  ...(addresses.length ? { addresses } : {}),
4041
4127
  });
4042
4128
  }
4043
- for (const event of events) {
4044
- const id = tagValue(event, 'd');
4045
- const folder = id && event.kind === KIND_CHANNEL ? byId.get(id) : undefined;
4046
- if (folder)
4047
- folder.channel = pointerToAddress({ kind: KIND_CHANNEL, pubkey: event.pubkey, identifier: id, relays: [] });
4129
+ // The title, privacy and admins are the channel's (§3.2), whichever order the events arrived.
4130
+ for (const [id, folder] of byId) {
4131
+ const channel = channelOf.get(id);
4132
+ if (!channel)
4133
+ continue;
4134
+ const name = nameOf(channel);
4135
+ if (name !== undefined)
4136
+ folder.name = name;
4137
+ if (channel.tags.some((tag) => tag[0] === 'private'))
4138
+ folder.private = true;
4139
+ const admins = folderAdminsOf(adminsOf.get(id), channel);
4140
+ if (admins.length)
4141
+ folder.admins = admins;
4142
+ folder.channel = pointerToAddress({ kind: KIND_CHANNEL, pubkey: channel.pubkey, identifier: id, relays: [] });
4048
4143
  }
4049
4144
  /*
4050
4145
  A folder listed in another folder's state is a file there. Read off the
@@ -4086,18 +4181,18 @@ export async function listFolders(query) {
4086
4181
  *
4087
4182
  * A Folder is archived by a change naming its channel's address, the way any
4088
4183
  * file is. A record's channel — a Ship project's conversation — is archived
4089
- * with its record, so an archived project's channel stops lighting its team's
4184
+ * with its record, so an archived project's channel stops lighting its Folder's
4090
4185
  * dot the way the project stopped being listed — only when every record naming
4091
4186
  * the channel is archived, since two projects may share one. Its own archive
4092
4187
  * wins when it has one.
4093
4188
  *
4094
4189
  * A refused read throws before this, like the reads beside it: a listing that
4095
- * silently reported every Folder live would put archived teams back in
4190
+ * silently reported every Folder live would put archived Folders back in
4096
4191
  * everyone's sidebar.
4097
4192
  */
4098
4193
  function markArchivedFolders(byId, recordsOf, changes) {
4099
4194
  for (const folder of byId.values()) {
4100
- const own = folder.channel ? archiveOf(changes, folder.channel, ARCHIVE_RULE) : undefined;
4195
+ const own = folderArchiveOf(changes, folder);
4101
4196
  if (own) {
4102
4197
  folder.archived = own;
4103
4198
  continue;
@@ -4247,13 +4342,13 @@ async function countLiveChildren(parents, counted, query, cache) {
4247
4342
  * names the channel its conversation lives in with {@link folderOf}'s tags. No
4248
4343
  * state lists that channel, so without this `listFolders` reports it placed
4249
4344
  * nowhere, and a consumer folding an unread verdict into the containers of a
4250
- * channel (Peek's team dot) has nowhere to fold it: correct, and drawn
4345
+ * channel (Peek's Folder dot) has nowhere to fold it: correct, and drawn
4251
4346
  * nowhere. Measured on production 2026-09-22: of the 43 records the six
4252
4347
  * states list, 23 name a channel other than the state's own and no state lists
4253
4348
  * any of them. This places 21 channels and moves no top-level Folder.
4254
4349
  *
4255
4350
  * Derived rather than published, so it cannot drift: a `kind:1852` adding each
4256
- * channel to its team would have to be repeated by every app that places a
4351
+ * channel to its Folder would have to be repeated by every app that places a
4257
4352
  * record, and would stay wrong the first time one did not.
4258
4353
  *
4259
4354
  * Both of `folderOf`'s spellings, because production has both — about half of
@@ -4278,7 +4373,7 @@ async function countLiveChildren(parents, counted, query, cache) {
4278
4373
  * production that was the bug it was meant to prevent: Peek reads the listing
4279
4374
  * once per page load, the load is when the relay's budget is most contested,
4280
4375
  * and one refused read on 2026-09-22 left a project's channel unplaced for the
4281
- * whole session — the team's dot dark, and nothing anywhere saying why. A
4376
+ * whole session — the Folder's dot dark, and nothing anywhere saying why. A
4282
4377
  * listing missing placements looks exactly like a correct one, so only the
4283
4378
  * caller can recover, and only if it is told. Keeping the last good listing
4284
4379
  * and retrying is the caller's to do.
@@ -4359,7 +4454,7 @@ async function placeRecordChannels(events, byId, listedIn, query) {
4359
4454
  if (!channel || byId.get(channel)?.hasState)
4360
4455
  continue;
4361
4456
  // A file published into the Folder that lists it names that Folder, and
4362
- // does not own it: a topic's `h` is its team's.
4457
+ // does not own it: a topic's `h` is its Folder's.
4363
4458
  if (!containers.includes(channel))
4364
4459
  recordsOf.set(channel, [...(recordsOf.get(channel) ?? []), key]);
4365
4460
  for (const container of containers) {
@@ -4426,16 +4521,20 @@ cache, options = {}) {
4426
4521
  const identity = await query([
4427
4522
  { kinds: [KIND_FOLDER_STATE], '#d': [folder], limit: 1 },
4428
4523
  { kinds: [KIND_CHANNEL], '#d': [folder], limit: 1 },
4524
+ { kinds: [KIND_CHANNEL_ADMINS], '#d': [folder], limit: 1 },
4429
4525
  ]);
4430
4526
  const state = identity.find((e) => e.kind === KIND_FOLDER_STATE && tagValue(e, 'd') === folder);
4431
4527
  const channel = identity.find((e) => e.kind === KIND_CHANNEL && tagValue(e, 'd') === folder);
4528
+ const admins = folderAdminsOf(identity.find((e) => e.kind === KIND_CHANNEL_ADMINS && tagValue(e, 'd') === folder), channel);
4432
4529
  const channelAddress = channel
4433
4530
  ? pointerToAddress({ kind: KIND_CHANNEL, pubkey: channel.pubkey, identifier: folder, relays: [] })
4434
4531
  : undefined;
4435
4532
  const summary = {
4436
4533
  id: folder,
4437
- name: nameOf(state) ?? nameOf(channel),
4534
+ name: nameOf(channel),
4438
4535
  hasState: !!state,
4536
+ ...(channel?.tags.some((tag) => tag[0] === 'private') ? { private: true } : {}),
4537
+ ...(admins.length ? { admins } : {}),
4439
4538
  ...(channelAddress ? { channel: channelAddress } : {}),
4440
4539
  ...(state
4441
4540
  ? { address: pointerToAddress({ kind: state.kind, pubkey: state.pubkey, identifier: folder, relays: [] }) }
@@ -4452,9 +4551,7 @@ cache, options = {}) {
4452
4551
  if (addresses.length === 0) {
4453
4552
  // Nothing listed, so no change query to ride on: the Folder's own archive
4454
4553
  // is one small read of its own.
4455
- const archived = channelAddress
4456
- ? archiveOf(await readArchiveChanges([channelAddress], query), channelAddress, ARCHIVE_RULE)
4457
- : undefined;
4554
+ const archived = channelAddress ? folderArchiveOf(await readArchiveChanges([channelAddress], query), summary) : undefined;
4458
4555
  return { ...summary, ...(archived ? { archived } : {}), files: [], source: state ? 'state' : 'channel' };
4459
4556
  }
4460
4557
  // 2. Group by (kind, author): one manifest answers for every file an app owns
@@ -4504,6 +4601,7 @@ cache, options = {}) {
4504
4601
  ...[...manifests.values()].flatMap((r) => (r.manifest.records ? [r.manifest.records.changeKind] : [])),
4505
4602
  ]),
4506
4603
  ];
4604
+ const nestedFolderIds = pointers.filter(({ pointer }) => pointer.kind === KIND_CHANNEL).map(({ pointer }) => pointer.identifier);
4507
4605
  const events = await query([
4508
4606
  ...[...groups.values()].map(({ pointer, addresses: group }) => ({
4509
4607
  kinds: [pointer.kind],
@@ -4517,8 +4615,10 @@ cache, options = {}) {
4517
4615
  // changes for every file together, and one Folder has already had 688.
4518
4616
  // Same request.
4519
4617
  ...archiveFilters(channelAddress ? [...addresses, channelAddress] : addresses),
4618
+ // A Folder listed here counts its archive only from its own admins (§3.2). Same request.
4619
+ ...(nestedFolderIds.length ? [{ kinds: [KIND_CHANNEL_ADMINS], '#d': nestedFolderIds, limit: nestedFolderIds.length }] : []),
4520
4620
  ]);
4521
- const ownArchive = channelAddress ? archiveOf(events, channelAddress, ARCHIVE_RULE) : undefined;
4621
+ const ownArchive = folderArchiveOf(events, summary);
4522
4622
  if (ownArchive)
4523
4623
  summary.archived = ownArchive;
4524
4624
  // 4. Build each file, in the order the folder listed them. Archived files are
@@ -4542,7 +4642,10 @@ cache, options = {}) {
4542
4642
  continue;
4543
4643
  const records = foldRuleOf(resolved.manifest);
4544
4644
  const folded = foldChanges(events.filter((e) => e.kind === records.changeKind && hasTagValue(e, records.targetTag, address)), records);
4545
- const archive = archiveOf(events, address, archiveRuleOf(resolved.manifest));
4645
+ const nestedAdmins = pointer.kind === KIND_CHANNEL
4646
+ ? new Set(folderAdminsOf(events.find((e) => e.kind === KIND_CHANNEL_ADMINS && tagValue(e, 'd') === pointer.identifier), root))
4647
+ : undefined;
4648
+ const archive = archiveOf(events, address, archiveRuleOf(resolved.manifest), nestedAdmins);
4546
4649
  archiveByAddress.set(address, archive);
4547
4650
  const parent = parentRefOf(resolved.manifest, pointer.kind, root, folded);
4548
4651
  parentByAddress.set(address, parent);
@@ -4564,7 +4667,7 @@ cache, options = {}) {
4564
4667
  the file is here; if the fold has moved on, somebody has since placed it
4565
4668
  somewhere else and this folder is holding a statement that has been
4566
4669
  superseded, which an append-only stream cannot retract. Ship linking a
4567
- project to a second team is the case: the first team's Folder keeps the
4670
+ project to a second Folder is the case: the first Folder keeps the
4568
4671
  old statement for ever, and without this check would list the project
4569
4672
  for ever.
4570
4673
 
@@ -4662,17 +4765,17 @@ cache, options = {}) {
4662
4765
  *
4663
4766
  * A folder lists the files whose `h` it is **and** the files placed in it.
4664
4767
  * An event cannot change its own `h`, so a project filed in one Folder and
4665
- * later linked to a team keeps the `h` it was born with, and the only thing
4768
+ * later linked to a Folder keeps the `h` it was born with, and the only thing
4666
4769
  * that can say "it belongs over there now" is a change event. Ship publishes
4667
4770
  * that change twice — into the record's own Folder, and *into the Folder
4668
- * being linked*: a `kind:1851` carried by the team's `h`, targeting the
4669
- * project, whose value is the team Folder itself. The second copy is the
4771
+ * being linked*: a `kind:1851` carried by the Folder's `h`, targeting the
4772
+ * project, whose value is the Folder itself. The second copy is the
4670
4773
  * placement, and it is what this reads.
4671
4774
  *
4672
4775
  * {@link resolveFolderProject} has read the same statement since PEEK-24 to
4673
4776
  * answer "which project is this topic paired with". This is the listing's
4674
- * half of it, and it is the rule the tidy-up rests on: five team Folders,
4675
- * fourteen projects linked into them and none re-created, so a team Folder
4777
+ * half of it, and it is the rule the tidy-up rests on: five Folders,
4778
+ * fourteen projects linked into them and none re-created, so a Folder
4676
4779
  * whose `h` is on nothing lists its projects anyway.
4677
4780
  *
4678
4781
  * App-neutral by the same discipline as everything else here. The change