@onlyworlds/sdk 4.98.0 → 4.100.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/AGENTS.md +8 -5
- package/CHANGELOG.md +26 -0
- package/README.md +5 -3
- package/SCHEMA.md +1 -1
- package/dist/index.d.ts +141 -46
- package/dist/index.js +206 -58
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# For AI agents using @onlyworlds/sdk
|
|
2
2
|
|
|
3
|
-
**Current as of**: SDK **4.x** · schema-dist **v0.33.0-dist.
|
|
3
|
+
**Current as of**: SDK **4.x** · schema-dist **v0.33.0-dist.83** (canonical 00.33.00).
|
|
4
4
|
This line is asserted by `codegen:check` in CI — if the pin moves and this file is not
|
|
5
5
|
re-read against it, the check fails rather than letting this document rot quietly.
|
|
6
6
|
|
|
@@ -69,11 +69,14 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
|
|
|
69
69
|
- Allowance (since 4.21.0, account token): `account.allowance()` reads the daily AI allowance
|
|
70
70
|
without spending: `{ token_rating, tokens_used_today, tokens_remaining, resets_at }`.
|
|
71
71
|
- Who am I (since 4.22.0, a world key): `client.me()` is `{ world, scope, kind, role,
|
|
72
|
-
membership, character, front_door }` (`membership` is what `created_by` holds for what you
|
|
72
|
+
membership, character, front_door, reading_aids }` (`membership` is what `created_by` holds for what you
|
|
73
73
|
create; null for the owner); `front_door` (since 4.60.0) names who answers for your
|
|
74
74
|
seat (`sponsor`, `sponsor_character`), your Character, the AI and player seats you answer
|
|
75
75
|
for (`my_seats`, since 4.82.0: `{ id, kind, name, character }`, agent seats first), and the
|
|
76
|
-
world's Charter with up to five skill Objects: an agent reads `charter` first. `
|
|
76
|
+
world's Charter with up to five skill Objects: an agent reads `charter` first. `reading_aids`
|
|
77
|
+
(since 4.100.0, also on an agent's join) is the world's three things to read first:
|
|
78
|
+
`charter` (`{ id, name, rules, skill }`), `guide` and `domains` (`{ id, name, sentence, hubs }`);
|
|
79
|
+
`charterOf(world, reader)` reads the same packet from a snapshot or a folder. `client.members()` is the roster's rows. An
|
|
77
80
|
account token is a TypeError.
|
|
78
81
|
- Lenses chosen (a world key, or an account token): `worldLenses(worldId, { resolve })` lists the
|
|
79
82
|
world's lenses; `setMyLenses(lensIds)` sets the ones you start with (an account token needs the
|
|
@@ -169,8 +172,8 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
|
|
|
169
172
|
- A world with a parlor holds its room as ordinary elements: `isRoomElement(el)` is true when the
|
|
170
173
|
type and supertype, trimmed and case-blind, match one of `ROOM_PAIRS` (narrative/Message,
|
|
171
174
|
narrative/Board, relation/Work item, construct/Spec, relation/Heart, relation/Take,
|
|
172
|
-
relation/Vote, event/Sitting, character/Member) AND the element carries `x_room_of`, a
|
|
173
|
-
|
|
175
|
+
relation/Vote, event/Sitting, character/Member) AND the element carries `x_room_of`, any value but null (a string only when something
|
|
176
|
+
is left after trimming). A Take also carries `x_room_item`, the work item's id. A pair
|
|
174
177
|
without the mark is lore (a novel's letters). The world's charter (a Law with supertype
|
|
175
178
|
`Charter`), its guide and its domains (Constructs with supertype `Guide` or `Domain`) are reading
|
|
176
179
|
aids when they carry `x_charter_of` (`isCharterElement(el)`): show them first, leave them out of a
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,32 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.100.0] - 2026-10-28
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`charterOf(world, reader)` and `domainsOf(world, reader)`**: the charter profile's reader, the world's three reading aids as one reader sees a world snapshot. `charter` is the newest marked Charter it sees (newest by `created_at` compared as instants, none sorting as the oldest, then the higher id), `{ id, name, rules, skill }`: `rules` its `x_checks_rules` as stored (`[]` when none), `skill` the ids its description names by any `ow://` form, a site address or a bare id, lowercase, each once in the order written, kept when it is an Object of this world the reader sees, the first five of those kept, as the API's `charter_skill` reads it. `guide` is the newest marked Guide the same way, `{ id, name }`. `domains` is every marked Domain the reader sees, `{ id, name, sentence, hubs }`, in the order the Guide's `constructs` names them as the reader is served the Guide (a Domain named twice keeps its first place), then by folded name and id; `sentence` is the description to its first line break, trimmed, and `hubs` the distinct `{ type, id }` its links name that the reader sees, in the schema's field order, never itself, none for a Domain known only as a stub. The reader is a lens reader; the public rung reads nothing of a world that is not `open`. `domainsOf` is the list alone. Every case of the distribution's charter fixture is its own test.
|
|
13
|
+
- **`CHARTER_PAIRS`**: the charter profile's three pairs (`law`/`Charter`, `construct`/`Guide`, `construct`/`Domain`), each with the aid it is, generated from the distribution's charter fixture and checked against the page and the lens fixture's pairs.
|
|
14
|
+
- **`reading_aids` on `OwMe` and `OwAgentJoined`**: `me()` and an agent's `redeemJoin` answer carry the same packet beside `front_door`, typed `OwReadingAids` (`OwReadingAidsCharter`, `OwReadingAidsGuide`, `OwReadingAidsDomain`, `OwReadingAidsHub`), as the API's document declares it.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **Schema repinned to schema-dist `v0.33.0-dist.83`** (from dist.82; the same canonical 00.33.00, so `ONLYWORLDS_VERSION` stays `'00.33.00'` and no element field moved). Serial 83 adds the charter profile and its fixture, writes the room and charter marks' presence rule, and adds fifteen lens cases; the lens fixture holds 147 cases (71 resolve, 37 graph), the room fixture 32, every one passing.
|
|
19
|
+
- **`isRoomElement` reads `x_room_of` by presence**: the mark counts when its value is not null, a string only when something is left after trimming White_Space, any other value (a number, an object) as present, the value never compared. It wanted a non-empty string before, so a number read as no mark and a mark of spaces as one. `isCharterElement` already read `x_charter_of` this way.
|
|
20
|
+
- **An umbrella lens's children keep their own budget and mail rule**: each child keeps at most its own `budget` (the rest counted `budget`) and its own mail rule takes its messages out of the child's kept, uncounted, before the union takes the umbrella's mail rule and budget. The rows are made once, from the union, by the umbrella's `show`, and a child's `notes` never reach a row. The union drops an element only by its id, so a sibling lens a child's hop reaches stays kept.
|
|
21
|
+
- **Nothing is hopped out of what the fence cuts**: an element cut `after_as_of`, an anchor among them, is not hopped out of. The second hop's `hops_not_served` count leaves out a room element or a reading aid whose pair `types` does not name.
|
|
22
|
+
- **Lens rows below the owner come as the API serves that reader.** A link to an element the reader cannot see was already left out, and still is. What moves: `x_served_trimmed` is no longer added for the public rung, and on a Message it names only `characters` and `narrator`, in that order (it named every trimmed link field, `objects` and `locations` too). A Pin aimed at an element the reader cannot see reads `element_type` `""` and `element_id` null (the type stayed), and so does one whose `element_type` is not its element's type; an id of the wrong type for its link field is left out. The owner reading as itself gets the bodies as stored (an id outside its view, a missing or proposed one, was dropped). A public reader has no mail part.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **4.99.0 handed hidden elements' ids to a reader below the owner, in the notes of a lens kept as an element.** A lens a hop reaches is kept as an element, and its row carried `x_lens.notes` whole, so a contributor, a guest or the public got the ids of hidden anchors and other hidden elements as note keys, with the notes' text. The row now keeps a note only for an anchor it is served or another element the reader sees; for a contributor or a guest, `notes` joins `x_served_trimmed` when an anchor's note went with its anchor. Twenty row cases hold these readings, the same file as the Python package's.
|
|
27
|
+
|
|
28
|
+
## [4.99.0] - 2026-10-28
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **`setMyLenses(null)` and `setMemberLenses(world, member, null)`**: `null` puts a lens list back to never chosen, so a seat playing a Character starts with its Titles' lenses again, while an empty list now keeps a seat off them (the API tells the two apart from this release on). On the owner's own list `null` is the empty list. Anything that is neither a list nor `null` is still refused before sending.
|
|
33
|
+
|
|
8
34
|
## [4.98.0] - 2026-10-28
|
|
9
35
|
|
|
10
36
|
### Added
|
package/README.md
CHANGED
|
@@ -173,7 +173,7 @@ await account.revokeWorldLink(worldId, made.id);
|
|
|
173
173
|
Once in, a world key can ask who it is and who else is there (since 4.22.0):
|
|
174
174
|
|
|
175
175
|
```typescript
|
|
176
|
-
const me = await client.me(); // { world, scope, kind, role, membership, character, front_door }:
|
|
176
|
+
const me = await client.me(); // { world, scope, kind, role, membership, character, front_door, reading_aids }: reading_aids.charter is the house rules, read first
|
|
177
177
|
const roster = await client.members(); // [{ id, kind, role, character, status }], the owner's id is null
|
|
178
178
|
```
|
|
179
179
|
|
|
@@ -362,7 +362,7 @@ The four colour families (agents, world, abstract, temporal) are checked for col
|
|
|
362
362
|
|
|
363
363
|
### The room
|
|
364
364
|
|
|
365
|
-
A parlor (a chat room on a world) keeps its lines, board entries, work items, specs, hearts, votes, sittings and member cards in the world as ordinary elements, told apart by type and supertype and marked with `x_room_of` (the id of the world or sitting the room belongs to). `ROOM_PAIRS` is the room profile's list of those pairs, and `isRoomElement(el)` is true when an element matches one (type and supertype trimmed, case-blind, the whole word) and carries the mark. A pair without the mark is lore: a novel's letters are Narratives with supertype Message.
|
|
365
|
+
A parlor (a chat room on a world) keeps its lines, board entries, work items, specs, hearts, votes, sittings and member cards in the world as ordinary elements, told apart by type and supertype and marked with `x_room_of` (the id of the world or sitting the room belongs to). `ROOM_PAIRS` is the room profile's list of those pairs, and `isRoomElement(el)` is true when an element matches one (type and supertype trimmed, case-blind, the whole word) and carries the mark (read by presence since 4.100.0: any value but null, a string only when something is left after trimming). A pair without the mark is lore: a novel's letters are Narratives with supertype Message.
|
|
366
366
|
|
|
367
367
|
```typescript
|
|
368
368
|
import { isRoomElement } from '@onlyworlds/sdk';
|
|
@@ -372,6 +372,8 @@ const lore = elements.filter(el => !isRoomElement(el)); // a lore view, unless t
|
|
|
372
372
|
|
|
373
373
|
The world's charter (a Law with supertype `Charter`), its guide and its domains (Constructs with supertype `Guide` or `Domain`) are reading aids when they carry the mark `x_charter_of`, the id of the world they belong to: `isCharterElement(el)` is true for one (pair and mark, matched as `isRoomElement` matches). A tool's front door shows them first and a lore view leaves them out; the pair without the mark is lore (a kingdom's Charter in a novel's world). A reading aid is not a room element.
|
|
374
374
|
|
|
375
|
+
`charterOf(world, reader)` (since 4.100.0) reads the three as one reader sees a world snapshot, the packet keel serves as `reading_aids` beside `front_door` on `me()` and an agent's join: `charter` (`{ id, name, rules, skill }`, the newest marked Charter; `skill` the Objects its text names, at most five), `guide` (`{ id, name }`), and `domains` (`{ id, name, sentence, hubs }`, in the Guide's order, then by name). `domainsOf(world, reader)` is the list alone, and `CHARTER_PAIRS` the three pairs. The reader is a lens reader (below); the public reads nothing of a world unless it carries `open: true`. The profile: [`profiles/charter.md`](https://github.com/OnlyWorlds/schema-dist/blob/main/profiles/charter.md).
|
|
376
|
+
|
|
375
377
|
A lore view (a list, a count, search, a graph, a link picker, a story's context) leaves room elements out unless the person asks to see them; the room's own views show them whole, and a tool that writes the world writes them like any element. A Law with supertype `Charter` is lore on purpose. The profile: [`profiles/room.md`](https://github.com/OnlyWorlds/schema-dist/blob/main/profiles/room.md) in the schema distribution.
|
|
376
378
|
|
|
377
379
|
### Messages
|
|
@@ -407,7 +409,7 @@ r.kept; r.rows; r.cut; // ids in order, rows as show makes them, e.g. { budget:
|
|
|
407
409
|
if (r.unreadable) console.warn(`x_lens.${r.unreadable} is outside the profile's table`);
|
|
408
410
|
```
|
|
409
411
|
|
|
410
|
-
The world holds the elements as the owner is served them; the reader's `rung` (`owner`, `contributor`, `guest` with its `whole` and `known_of` ids, `public`) decides what it sees, and an owner reading `as` another reader keeps the owner's two counts (`anchor_not_visible`, `not_visible`), which no other reader ever carries. The profile: [`profiles/lens.md`](https://github.com/OnlyWorlds/schema-dist/blob/main/profiles/lens.md).
|
|
412
|
+
The world holds the elements as the owner is served them; the reader's `rung` (`owner`, `contributor`, `guest` with its `whole` and `known_of` ids, `public`) decides what it sees, and an owner reading `as` another reader keeps the owner's two counts (`anchor_not_visible`, `not_visible`), which no other reader ever carries. A row is the body as the reader is served it: below the owner, every link holds only ids the reader sees (a Pin's pair aimed elsewhere reads `""` and null), and `x_served_trimmed` names a Message's trimmed `characters` or `narrator` and a lens's trimmed anchors, never for the public; the owner's rows are the bodies as stored. The profile: [`profiles/lens.md`](https://github.com/OnlyWorlds/schema-dist/blob/main/profiles/lens.md).
|
|
411
413
|
|
|
412
414
|
`DATE_FIELD` is the profile's date table (each dated type's date field; the ten timeless types are not in it), and `dateOf(el)` is an element's date as that table reads it: the whole number in its type's date field, else null. A timeline or a horizon dates elements exactly as the lens reader's fence does.
|
|
413
415
|
|
package/SCHEMA.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OnlyWorlds Schema Reference
|
|
2
2
|
|
|
3
|
-
**Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.33.0-dist.
|
|
3
|
+
**Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.33.0-dist.83** — canonical schema **00.33.00**, published 2026-10-28.
|
|
4
4
|
|
|
5
5
|
GENERATED from the canonical schema YAML — do not hand-edit (regenerate: `python codegen/generate_types.py`).
|
|
6
6
|
Written for both humans and AI agents reading this package locally.
|
package/dist/index.d.ts
CHANGED
|
@@ -104,6 +104,17 @@ declare const ROOM_PAIRS: ReadonlyArray<{
|
|
|
104
104
|
readonly type: ElementType;
|
|
105
105
|
readonly supertype: string;
|
|
106
106
|
}>;
|
|
107
|
+
/** The charter profile's three pairs (schema-dist `profiles/charter.md`): the Charter (the rules here), the
|
|
108
|
+
* Guide (start here) and the Domains (the places in the world), each with the aid it is. An element is a
|
|
109
|
+
* reading aid when its type and supertype, each trimmed and compared without regard to case, match one
|
|
110
|
+
* of these AND it carries the mark `x_charter_of`, read by presence: match with isCharterElement, read
|
|
111
|
+
* the packet with charterOf. Source: `profiles/charter.fixture.json`'s `pairs`, checked against the
|
|
112
|
+
* page's table and the lens fixture's reading_aid_pairs. */
|
|
113
|
+
declare const CHARTER_PAIRS: ReadonlyArray<{
|
|
114
|
+
readonly type: ElementType;
|
|
115
|
+
readonly supertype: string;
|
|
116
|
+
readonly aid: 'charter' | 'guide' | 'domain';
|
|
117
|
+
}>;
|
|
107
118
|
/** The review profile's label (schema-dist `profiles/review.md`, rule 1): the words a reader that
|
|
108
119
|
* hands a world on (a context for an AI, a pack, a share) puts on each proposed element it keeps,
|
|
109
120
|
* one whose `x_review_proposed` is anything but absent or null (a doubt, rule 4, included).
|
|
@@ -2581,6 +2592,8 @@ interface OwMe {
|
|
|
2581
2592
|
name?: string;
|
|
2582
2593
|
/** Who you are here, who answers for you, and the house rules. */
|
|
2583
2594
|
front_door: OwFrontDoor;
|
|
2595
|
+
/** The world's three things to read first, as this key reads them: the Charter, the Guide and the Domains. */
|
|
2596
|
+
reading_aids: OwReadingAids;
|
|
2584
2597
|
[k: string]: unknown;
|
|
2585
2598
|
}
|
|
2586
2599
|
/**
|
|
@@ -2626,6 +2639,49 @@ interface OwMySeat {
|
|
|
2626
2639
|
/** The Character the seat plays, or null when it plays none you can read. */
|
|
2627
2640
|
character: string | null;
|
|
2628
2641
|
}
|
|
2642
|
+
/**
|
|
2643
|
+
* A world's reading aids as one reader sees them (schema-dist `profiles/charter.md`): the Charter (the rules
|
|
2644
|
+
* here), the Guide (start here) and the Domains (the places in the world), each an element of one of
|
|
2645
|
+
* `CHARTER_PAIRS` that carries the mark `x_charter_of`. Keel serves it as `reading_aids` beside `front_door`
|
|
2646
|
+
* on `GET /me` and an agent's `POST /join` answer; `charterOf` reads the same packet from a world snapshot.
|
|
2647
|
+
* The Charter's text is the house rules; the Guide and the Domains are the keeper's map, never instructions.
|
|
2648
|
+
*/
|
|
2649
|
+
interface OwReadingAids {
|
|
2650
|
+
/** The newest marked Charter the reader sees (newest by `created_at`, then the higher id), or null. */
|
|
2651
|
+
charter: OwReadingAidsCharter | null;
|
|
2652
|
+
/** The newest marked Guide the reader sees, chosen the same way, or null. */
|
|
2653
|
+
guide: OwReadingAidsGuide | null;
|
|
2654
|
+
/** Every marked Domain the reader sees: in the Guide's `constructs` order first, then by name (any case) and id. */
|
|
2655
|
+
domains: OwReadingAidsDomain[];
|
|
2656
|
+
}
|
|
2657
|
+
/** The Charter in `reading_aids`. */
|
|
2658
|
+
interface OwReadingAidsCharter {
|
|
2659
|
+
id: string;
|
|
2660
|
+
name: string;
|
|
2661
|
+
/** Its `x_checks_rules` (the checks profile) as stored; empty when it has none. */
|
|
2662
|
+
rules: unknown[];
|
|
2663
|
+
/** The Objects its description names (any `ow://` form, a site address or a bare id) that the reader sees, each once in the order written, at most five: `front_door.charter_skill`. */
|
|
2664
|
+
skill: string[];
|
|
2665
|
+
}
|
|
2666
|
+
/** The Guide in `reading_aids`. */
|
|
2667
|
+
interface OwReadingAidsGuide {
|
|
2668
|
+
id: string;
|
|
2669
|
+
name: string;
|
|
2670
|
+
}
|
|
2671
|
+
/** One Domain in `reading_aids`. */
|
|
2672
|
+
interface OwReadingAidsDomain {
|
|
2673
|
+
id: string;
|
|
2674
|
+
name: string;
|
|
2675
|
+
/** Its description up to the first line break, trimmed; empty when it has none. */
|
|
2676
|
+
sentence: string;
|
|
2677
|
+
/** The elements its link fields name that the reader sees, each once, in the schema's field order, never the Domain itself; none for a Domain the reader knows only as a stub. */
|
|
2678
|
+
hubs: OwReadingAidsHub[];
|
|
2679
|
+
}
|
|
2680
|
+
/** One hub of a Domain: an element by its type and id. */
|
|
2681
|
+
interface OwReadingAidsHub {
|
|
2682
|
+
type: string;
|
|
2683
|
+
id: string;
|
|
2684
|
+
}
|
|
2629
2685
|
/** One row of GET /members, the world's roster. */
|
|
2630
2686
|
interface OwMember {
|
|
2631
2687
|
/** The membership id (what `created_by` holds), or null for the owner. */
|
|
@@ -2775,6 +2831,8 @@ interface OwAgentJoined {
|
|
|
2775
2831
|
members: Array<Record<string, unknown>>;
|
|
2776
2832
|
/** The world's front door for the new seat: its sponsor, its Character, the Charter to read first. */
|
|
2777
2833
|
front_door: OwFrontDoor;
|
|
2834
|
+
/** The world's three things to read first, as the new seat reads them: the Charter, the Guide and the Domains (the same packet as `GET /me`'s). */
|
|
2835
|
+
reading_aids: OwReadingAids;
|
|
2778
2836
|
[k: string]: unknown;
|
|
2779
2837
|
}
|
|
2780
2838
|
/** POST /join, a player's code: a read key for a friend with no account, reading as a guest. Shown once. */
|
|
@@ -3896,7 +3954,10 @@ declare class OwV2Client {
|
|
|
3896
3954
|
setMyCharacter(character: string | null): Promise<OwMe>;
|
|
3897
3955
|
/**
|
|
3898
3956
|
* PUT /me/lenses -- choose the lenses this key's holder starts with: lens ids in order, 0 to 20,
|
|
3899
|
-
* repeats dropped by keel; an empty list is a choice too (the draught then adds no frame)
|
|
3957
|
+
* repeats dropped by keel; an empty list is a choice too (the draught then adds no frame), and keeps
|
|
3958
|
+
* a seat off its Titles' lenses. `null` goes back to never chosen: a seat playing a Character then
|
|
3959
|
+
* starts with its Titles' lenses (`lenses_from` says where a list comes from); on the owner's own
|
|
3960
|
+
* keys `null` is the empty list. Any write
|
|
3900
3961
|
* key of the world, with its PIN, sets its own holder's list: a person member's, an agent seat's, or
|
|
3901
3962
|
* on the owner's keys the owner's own; answers GET /me's body. The draught reads the list whenever it
|
|
3902
3963
|
* is given no lens and no policy. 404 for a lens this key cannot see; 422 `not_a_lens`,
|
|
@@ -3905,7 +3966,7 @@ declare class OwV2Client {
|
|
|
3905
3966
|
* `world` names (`world=<id>`, the Bearer token, no PIN); without `world` set it is a TypeError
|
|
3906
3967
|
* before sending. A world key sends no `world`: the key names its world.
|
|
3907
3968
|
*/
|
|
3908
|
-
setMyLenses(lensIds: string[]): Promise<OwMe>;
|
|
3969
|
+
setMyLenses(lensIds: string[] | null): Promise<OwMe>;
|
|
3909
3970
|
/**
|
|
3910
3971
|
* GET /world/{worldId}/lenses -- every lens in the world this key can see, templates included and
|
|
3911
3972
|
* marked, each with its recipe echoed (`x_lens`, defaults filled in), the Titles it is the default
|
|
@@ -4453,7 +4514,9 @@ declare class OwV2Client {
|
|
|
4453
4514
|
removeSeat(worldId: string, seatId: string): Promise<void>;
|
|
4454
4515
|
/**
|
|
4455
4516
|
* PATCH /account/worlds/{worldId}/members/{memberId} with `lenses` alone -- set the lenses a row
|
|
4456
|
-
* starts with: lens ids in order, 0 to 20, repeats dropped by keel; an empty list is a choice too
|
|
4517
|
+
* starts with: lens ids in order, 0 to 20, repeats dropped by keel; an empty list is a choice too,
|
|
4518
|
+
* and keeps a seat off its Titles' lenses, while `null` puts the row back to never chosen (a seat
|
|
4519
|
+
* playing a Character then starts with its Titles' lenses; for `'owner'`, `null` is the empty list).
|
|
4457
4520
|
* A member sets its own row (any role), an agent's or a player's seat it answers for (its sponsor),
|
|
4458
4521
|
* or any seat as a co-builder; the owner sets any seat, and its own list with `'owner'` as
|
|
4459
4522
|
* `memberId`. Any other row is a 404; the owner naming a person's row is a 422 (a person sets its
|
|
@@ -4466,7 +4529,7 @@ declare class OwV2Client {
|
|
|
4466
4529
|
* (keel's `MemberLenses`), `id` null and `role` and `kind` `owner` for the owner's own list. The body is `{ lenses }` and
|
|
4467
4530
|
* nothing else: a role, Character or sponsor change is not sent here. Needs the client's `ow_a_` token.
|
|
4468
4531
|
*/
|
|
4469
|
-
setMemberLenses(worldId: string, memberId: string, lensIds: string[]): Promise<OwMemberLenses>;
|
|
4532
|
+
setMemberLenses(worldId: string, memberId: string, lensIds: string[] | null): Promise<OwMemberLenses>;
|
|
4470
4533
|
/**
|
|
4471
4534
|
* PUT /{type}/{id}/hidden -- hide an element. The owner's key or a co-builder's
|
|
4472
4535
|
* (a person's or a seat's) with its PIN; hiding a hidden element again changes nothing, and
|
|
@@ -4831,8 +4894,9 @@ declare function getElementLabel(elementType: ElementType): string;
|
|
|
4831
4894
|
|
|
4832
4895
|
/**
|
|
4833
4896
|
* True when the element is a room element: its type and supertype, each trimmed and compared
|
|
4834
|
-
* without regard to case, match one of ROOM_PAIRS, AND it carries the mark `x_room_of`
|
|
4835
|
-
*
|
|
4897
|
+
* without regard to case, match one of ROOM_PAIRS, AND it carries the mark `x_room_of` (the id of
|
|
4898
|
+
* the world or the sitting the room belongs to), read by presence: any value but null, a string only
|
|
4899
|
+
* when something is left after trimming, the value never compared. Both, always:
|
|
4836
4900
|
* a pair without the mark is lore (a novel's letters are Narratives with supertype Message),
|
|
4837
4901
|
* and a mark without a pair is not a room element (a malformed mark: report it, never hide it).
|
|
4838
4902
|
* The pair match is the whole word: a Narrative with supertype `Messages` is lore. The charter
|
|
@@ -4852,7 +4916,7 @@ declare function getElementLabel(elementType: ElementType): string;
|
|
|
4852
4916
|
declare function isRoomElement(el: {
|
|
4853
4917
|
type?: string;
|
|
4854
4918
|
supertype?: string | null;
|
|
4855
|
-
x_room_of?:
|
|
4919
|
+
x_room_of?: unknown;
|
|
4856
4920
|
}): boolean;
|
|
4857
4921
|
/**
|
|
4858
4922
|
* True when the element is a reading aid (schema-dist profiles/room.md, profiles/lens.md rule 4): the
|
|
@@ -5027,43 +5091,6 @@ declare function unreadFor<T extends object>(messages: readonly T[], characterId
|
|
|
5027
5091
|
declare function threadOf<T extends object>(messages: readonly T[], rootId: string): T[];
|
|
5028
5092
|
declare function noteOf(narratives: readonly object[], characterId: string, members: Members): string | null;
|
|
5029
5093
|
|
|
5030
|
-
/**
|
|
5031
|
-
* The review profile's proposed mark (schema-dist profiles/review.md): an element whose
|
|
5032
|
-
* `x_review_proposed` is an object was written as proposed (an AI seat's new element on a world
|
|
5033
|
-
* whose keeper reviews them) and is not canon until a keeper settles it: accept writes the mark
|
|
5034
|
-
* null, decline deletes the element.
|
|
5035
|
-
*
|
|
5036
|
-
* Two readings, as the profile's rule 1 and rule 4 give them. A reader that shows a world to its
|
|
5037
|
-
* people shows the mark when it is an object (`proposedMarkOf`); any other value is not a mark and
|
|
5038
|
-
* is reported by a lint, never repaired. A reader that hands a world on leaves out every element
|
|
5039
|
-
* whose `x_review_proposed` is anything but absent or null (`handsOnAsProposed`), so a doubt never
|
|
5040
|
-
* reaches an AI as canon.
|
|
5041
|
-
*/
|
|
5042
|
-
/** The review profile's proposed mark, an extension key. */
|
|
5043
|
-
declare const PROPOSED_MARK = "x_review_proposed";
|
|
5044
|
-
/** A proposed element's mark as a reader shows it. */
|
|
5045
|
-
interface OwProposedMark {
|
|
5046
|
-
/** The membership or seat that proposed it, trimmed of Unicode White_Space as the room profile trims, when the mark names one. */
|
|
5047
|
-
by: string | null;
|
|
5048
|
-
/** The day it lapses (YYYY-MM-DD), trimmed, when the mark gives one in that shape. */
|
|
5049
|
-
expires: string | null;
|
|
5050
|
-
/** `expires` has come (on or before `today`): shown as lapsed, never deleted on its own (rule 2). */
|
|
5051
|
-
lapsed: boolean;
|
|
5052
|
-
}
|
|
5053
|
-
/**
|
|
5054
|
-
* The proposed mark of an element as a reader that shows a world shows it, or null for a settled
|
|
5055
|
-
* element: `x_review_proposed` absent, null, or a value that is not an object (an array included).
|
|
5056
|
-
* `today` is a day as the profile writes one (YYYY-MM-DD), by default today in UTC; anything else
|
|
5057
|
-
* is a TypeError.
|
|
5058
|
-
*/
|
|
5059
|
-
declare function proposedMarkOf(element: unknown, today?: string): OwProposedMark | null;
|
|
5060
|
-
/**
|
|
5061
|
-
* Whether a reader that hands a world on (a pack, a context packet, an AI's context) leaves this
|
|
5062
|
-
* element out as proposed: `x_review_proposed` with any value but absent or null, a value that is
|
|
5063
|
-
* not a proper mark included (a doubt, counted with the proposed).
|
|
5064
|
-
*/
|
|
5065
|
-
declare function handsOnAsProposed(element: unknown): boolean;
|
|
5066
|
-
|
|
5067
5094
|
/** A reader of a lens: the rung decides what of the world it sees. */
|
|
5068
5095
|
interface OwLensReader {
|
|
5069
5096
|
/**
|
|
@@ -5182,7 +5209,7 @@ declare function lensesInUse(membership: readonly string[] | null | undefined, x
|
|
|
5182
5209
|
*
|
|
5183
5210
|
* The rules, in short: visibility first (a hidden or proposed element is not there to hop through; a
|
|
5184
5211
|
* known-of stub is kept as served and nothing hops out of it); a hop reaches both ways, and on through
|
|
5185
|
-
* a Relation to its parties; an umbrella enters each child lens once
|
|
5212
|
+
* a Relation to its parties; an umbrella enters each child lens once, each child keeping its own budget and mail rule, the rows made by the umbrella's `show`; a hop never crosses a room
|
|
5186
5213
|
* element; a reading aid (the charter, its guide, a domain: `isCharterElement`) a hop reaches is kept, and
|
|
5187
5214
|
* hopped on from, only when `types` names its pair, while one the lens names as an anchor is kept and
|
|
5188
5215
|
* followed; anchors first in link order, then by type in the schema's order, newest first, then by id;
|
|
@@ -5193,6 +5220,74 @@ declare function lensesInUse(membership: readonly string[] | null | undefined, x
|
|
|
5193
5220
|
*/
|
|
5194
5221
|
declare function resolveLens(world: OwLensWorld, lens: object | string, reader: OwLensReader, options?: OwLensOptions): OwLensReading;
|
|
5195
5222
|
|
|
5223
|
+
/** The world snapshot the reading aids are read from: the lens reader's world, and whether it is open to anyone. */
|
|
5224
|
+
interface OwCharterWorld extends OwLensWorld {
|
|
5225
|
+
/** True for a world open to anyone: only then does the public rung read anything of it. */
|
|
5226
|
+
open?: boolean | null;
|
|
5227
|
+
}
|
|
5228
|
+
/**
|
|
5229
|
+
* A world's reading aids as `reader` sees it (schema-dist profiles/charter.md): `{charter, guide, domains}`,
|
|
5230
|
+
* the packet every front door shows first, in that order.
|
|
5231
|
+
*
|
|
5232
|
+
* `charter` is the newest marked Charter the reader sees (newest by `created_at`, compared as instants, none
|
|
5233
|
+
* sorting as the oldest; then the higher id by code point), as `{id, name, rules, skill}`: `rules` its
|
|
5234
|
+
* `x_checks_rules` as stored (`[]` when it has none), `skill` the ids its description names (any `ow://`
|
|
5235
|
+
* form, a site address or a bare id), lowercase, each once in the order written, kept when it is an Object
|
|
5236
|
+
* of this world the reader sees, the first five of those kept (keel's `charter_skill`). `guide` is the
|
|
5237
|
+
* newest marked Guide the same way, `{id, name}`. `domains` is every marked Domain the reader sees, each
|
|
5238
|
+
* `{id, name, sentence, hubs}`: in the order the Guide's `constructs` names them as the reader is served the
|
|
5239
|
+
* Guide (a Domain named twice keeps its first place; an entry that is no marked Domain it sees is skipped),
|
|
5240
|
+
* then the rest by folded name and id; with no Guide seen, by folded name and id alone. `sentence` is the
|
|
5241
|
+
* description up to its first line break, trimmed; `hubs` the distinct `{type, id}` its link fields name that
|
|
5242
|
+
* the reader sees, in the schema's field order, never itself, and none for a Domain it knows only as a stub.
|
|
5243
|
+
*
|
|
5244
|
+
* `world` holds the elements as the owner is served them (the hidden in `hidden` or each element's own
|
|
5245
|
+
* `hidden`), and `open: true` for a world open to anyone; `reader` is a lens reader (`OwLensReader`): the
|
|
5246
|
+
* owner, a contributor, a guest (its `whole` and `known_of` ids) or the public, which reads nothing of a
|
|
5247
|
+
* world that is not open. Whether an element is an aid is read from the element as the owner is served it,
|
|
5248
|
+
* since a stub serves no extension field; what the packet shows of it is what the reader is served. Pure.
|
|
5249
|
+
*/
|
|
5250
|
+
declare function charterOf(world: OwCharterWorld, reader: OwLensReader): OwReadingAids;
|
|
5251
|
+
/** The marked Domains alone, as `charterOf` lists them for the same reader. */
|
|
5252
|
+
declare function domainsOf(world: OwCharterWorld, reader: OwLensReader): OwReadingAidsDomain[];
|
|
5253
|
+
|
|
5254
|
+
/**
|
|
5255
|
+
* The review profile's proposed mark (schema-dist profiles/review.md): an element whose
|
|
5256
|
+
* `x_review_proposed` is an object was written as proposed (an AI seat's new element on a world
|
|
5257
|
+
* whose keeper reviews them) and is not canon until a keeper settles it: accept writes the mark
|
|
5258
|
+
* null, decline deletes the element.
|
|
5259
|
+
*
|
|
5260
|
+
* Two readings, as the profile's rule 1 and rule 4 give them. A reader that shows a world to its
|
|
5261
|
+
* people shows the mark when it is an object (`proposedMarkOf`); any other value is not a mark and
|
|
5262
|
+
* is reported by a lint, never repaired. A reader that hands a world on leaves out every element
|
|
5263
|
+
* whose `x_review_proposed` is anything but absent or null (`handsOnAsProposed`), so a doubt never
|
|
5264
|
+
* reaches an AI as canon.
|
|
5265
|
+
*/
|
|
5266
|
+
/** The review profile's proposed mark, an extension key. */
|
|
5267
|
+
declare const PROPOSED_MARK = "x_review_proposed";
|
|
5268
|
+
/** A proposed element's mark as a reader shows it. */
|
|
5269
|
+
interface OwProposedMark {
|
|
5270
|
+
/** The membership or seat that proposed it, trimmed of Unicode White_Space as the room profile trims, when the mark names one. */
|
|
5271
|
+
by: string | null;
|
|
5272
|
+
/** The day it lapses (YYYY-MM-DD), trimmed, when the mark gives one in that shape. */
|
|
5273
|
+
expires: string | null;
|
|
5274
|
+
/** `expires` has come (on or before `today`): shown as lapsed, never deleted on its own (rule 2). */
|
|
5275
|
+
lapsed: boolean;
|
|
5276
|
+
}
|
|
5277
|
+
/**
|
|
5278
|
+
* The proposed mark of an element as a reader that shows a world shows it, or null for a settled
|
|
5279
|
+
* element: `x_review_proposed` absent, null, or a value that is not an object (an array included).
|
|
5280
|
+
* `today` is a day as the profile writes one (YYYY-MM-DD), by default today in UTC; anything else
|
|
5281
|
+
* is a TypeError.
|
|
5282
|
+
*/
|
|
5283
|
+
declare function proposedMarkOf(element: unknown, today?: string): OwProposedMark | null;
|
|
5284
|
+
/**
|
|
5285
|
+
* Whether a reader that hands a world on (a pack, a context packet, an AI's context) leaves this
|
|
5286
|
+
* element out as proposed: `x_review_proposed` with any value but absent or null, a value that is
|
|
5287
|
+
* not a proper mark included (a doubt, counted with the proposed).
|
|
5288
|
+
*/
|
|
5289
|
+
declare function handsOnAsProposed(element: unknown): boolean;
|
|
5290
|
+
|
|
5196
5291
|
/** `worldGraph`'s options. Each flag is a boolean, false by default, and brings back one kind of element that is out by default. */
|
|
5197
5292
|
interface OwGraphOptions {
|
|
5198
5293
|
/** A lens body, or the id of a lens in the world the reader can see: the nodes are then exactly what it kept, and no flag adds to them. */
|
|
@@ -6430,4 +6525,4 @@ declare class TokenResource {
|
|
|
6430
6525
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
6431
6526
|
}
|
|
6432
6527
|
|
|
6433
|
-
export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAddress, OwAddressError, type OwAddressForm, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwGraphCutReason, type OwGraphEdge, type OwGraphMark, type OwGraphNode, type OwGraphOptions, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLensCutReason, type OwLensMail, type OwLensOptions, type OwLensReader, type OwLensReading, type OwLensWorld, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberLenses, type OwMemberRole, type OwMessageMember, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldGraph, type OwWorldIndex, type OwWorldLens, type OwWorldLensReading, type OwWorldLenses, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, dateOf, degreeOf, detectKeyKind, displayYear, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
|
|
6528
|
+
export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, CHARTER_PAIRS, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAddress, OwAddressError, type OwAddressForm, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwCharterWorld, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwGraphCutReason, type OwGraphEdge, type OwGraphMark, type OwGraphNode, type OwGraphOptions, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLensCutReason, type OwLensMail, type OwLensOptions, type OwLensReader, type OwLensReading, type OwLensWorld, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberLenses, type OwMemberRole, type OwMessageMember, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwReadingAids, type OwReadingAidsCharter, type OwReadingAidsDomain, type OwReadingAidsGuide, type OwReadingAidsHub, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldGraph, type OwWorldIndex, type OwWorldLens, type OwWorldLensReading, type OwWorldLenses, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, charterOf, dateOf, degreeOf, detectKeyKind, displayYear, domainsOf, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
|
package/dist/index.js
CHANGED
|
@@ -691,7 +691,10 @@ var OwV2Client = class {
|
|
|
691
691
|
}
|
|
692
692
|
/**
|
|
693
693
|
* PUT /me/lenses -- choose the lenses this key's holder starts with: lens ids in order, 0 to 20,
|
|
694
|
-
* repeats dropped by keel; an empty list is a choice too (the draught then adds no frame)
|
|
694
|
+
* repeats dropped by keel; an empty list is a choice too (the draught then adds no frame), and keeps
|
|
695
|
+
* a seat off its Titles' lenses. `null` goes back to never chosen: a seat playing a Character then
|
|
696
|
+
* starts with its Titles' lenses (`lenses_from` says where a list comes from); on the owner's own
|
|
697
|
+
* keys `null` is the empty list. Any write
|
|
695
698
|
* key of the world, with its PIN, sets its own holder's list: a person member's, an agent seat's, or
|
|
696
699
|
* on the owner's keys the owner's own; answers GET /me's body. The draught reads the list whenever it
|
|
697
700
|
* is given no lens and no policy. 404 for a lens this key cannot see; 422 `not_a_lens`,
|
|
@@ -701,8 +704,8 @@ var OwV2Client = class {
|
|
|
701
704
|
* before sending. A world key sends no `world`: the key names its world.
|
|
702
705
|
*/
|
|
703
706
|
async setMyLenses(lensIds) {
|
|
704
|
-
if (!Array.isArray(lensIds)) {
|
|
705
|
-
throw new TypeError("setMyLenses: lensIds is a list of lens ids ([] for none). Nothing was sent.");
|
|
707
|
+
if (lensIds !== null && !Array.isArray(lensIds)) {
|
|
708
|
+
throw new TypeError("setMyLenses: lensIds is a list of lens ids ([] for none, null for never chosen). Nothing was sent.");
|
|
706
709
|
}
|
|
707
710
|
return this.request("PUT", "/me/lenses", { accountToken: "world", body: { lenses: lensIds } });
|
|
708
711
|
}
|
|
@@ -1586,7 +1589,9 @@ var OwV2Client = class {
|
|
|
1586
1589
|
}
|
|
1587
1590
|
/**
|
|
1588
1591
|
* PATCH /account/worlds/{worldId}/members/{memberId} with `lenses` alone -- set the lenses a row
|
|
1589
|
-
* starts with: lens ids in order, 0 to 20, repeats dropped by keel; an empty list is a choice too
|
|
1592
|
+
* starts with: lens ids in order, 0 to 20, repeats dropped by keel; an empty list is a choice too,
|
|
1593
|
+
* and keeps a seat off its Titles' lenses, while `null` puts the row back to never chosen (a seat
|
|
1594
|
+
* playing a Character then starts with its Titles' lenses; for `'owner'`, `null` is the empty list).
|
|
1590
1595
|
* A member sets its own row (any role), an agent's or a player's seat it answers for (its sponsor),
|
|
1591
1596
|
* or any seat as a co-builder; the owner sets any seat, and its own list with `'owner'` as
|
|
1592
1597
|
* `memberId`. Any other row is a 404; the owner naming a person's row is a 422 (a person sets its
|
|
@@ -1603,8 +1608,8 @@ var OwV2Client = class {
|
|
|
1603
1608
|
if (this.keyKind !== "account") {
|
|
1604
1609
|
throw new TypeError("setMemberLenses needs an account token (ow_a_): a world key sets its own holder's list with setMyLenses");
|
|
1605
1610
|
}
|
|
1606
|
-
if (!Array.isArray(lensIds)) {
|
|
1607
|
-
throw new TypeError("setMemberLenses: lensIds is a list of lens ids ([] for none). Nothing was sent.");
|
|
1611
|
+
if (lensIds !== null && !Array.isArray(lensIds)) {
|
|
1612
|
+
throw new TypeError("setMemberLenses: lensIds is a list of lens ids ([] for none, null for never chosen). Nothing was sent.");
|
|
1608
1613
|
}
|
|
1609
1614
|
return this.request(
|
|
1610
1615
|
"PATCH",
|
|
@@ -2436,6 +2441,11 @@ var READING_AID_PAIRS = [
|
|
|
2436
2441
|
{ type: "construct", supertype: "domain" }
|
|
2437
2442
|
];
|
|
2438
2443
|
var READING_AID_MARK = "x_charter_of";
|
|
2444
|
+
var CHARTER_PAIRS = [
|
|
2445
|
+
{ type: "law", supertype: "Charter", aid: "charter" },
|
|
2446
|
+
{ type: "construct", supertype: "Guide", aid: "guide" },
|
|
2447
|
+
{ type: "construct", supertype: "Domain", aid: "domain" }
|
|
2448
|
+
];
|
|
2439
2449
|
var REVIEW_PROPOSED_LABEL = "proposed, not yet reviewed";
|
|
2440
2450
|
var MESSAGE_PAIR = { type: "narrative", supertype: "Message" };
|
|
2441
2451
|
var MESSAGE_READ_MARK = {
|
|
@@ -3818,10 +3828,14 @@ function trimWhiteSpace(text2) {
|
|
|
3818
3828
|
return text2.slice(start, end);
|
|
3819
3829
|
}
|
|
3820
3830
|
var fold = (text2) => simpleCaseFold(trimWhiteSpace(text2));
|
|
3831
|
+
function hasMark(el, field) {
|
|
3832
|
+
const mark = Object.prototype.hasOwnProperty.call(el, field) ? el[field] : void 0;
|
|
3833
|
+
if (mark === void 0 || mark === null) return false;
|
|
3834
|
+
return typeof mark !== "string" || trimWhiteSpace(mark) !== "";
|
|
3835
|
+
}
|
|
3821
3836
|
function isRoomElement(el) {
|
|
3822
|
-
if (el == null || typeof el.type !== "string" || typeof el.supertype !== "string") return false;
|
|
3823
|
-
|
|
3824
|
-
if (typeof mark !== "string" || mark === "") return false;
|
|
3837
|
+
if (el == null || typeof el !== "object" || typeof el.type !== "string" || typeof el.supertype !== "string") return false;
|
|
3838
|
+
if (!hasMark(el, ROOM_MARK)) return false;
|
|
3825
3839
|
const type = fold(el.type);
|
|
3826
3840
|
const supertype = fold(el.supertype);
|
|
3827
3841
|
return ROOM_PAIRS.some((p) => fold(p.type) === type && fold(p.supertype) === supertype);
|
|
@@ -3833,9 +3847,7 @@ function readingAidKey(element) {
|
|
|
3833
3847
|
if (typeof el.type !== "string" || typeof el.supertype !== "string") return null;
|
|
3834
3848
|
const key = `${fold(el.type)}/${fold(el.supertype)}`;
|
|
3835
3849
|
if (!READING_AID_KEYS.has(key)) return null;
|
|
3836
|
-
|
|
3837
|
-
if (mark === void 0 || mark === null || typeof mark === "string" && trimWhiteSpace(mark) === "") return null;
|
|
3838
|
-
return key;
|
|
3850
|
+
return hasMark(el, READING_AID_MARK) ? key : null;
|
|
3839
3851
|
}
|
|
3840
3852
|
function isCharterElement(element) {
|
|
3841
3853
|
return readingAidKey(element) !== null;
|
|
@@ -4124,6 +4136,7 @@ var CUT_REASONS = [
|
|
|
4124
4136
|
var OWNER_ONLY = /* @__PURE__ */ new Set(["anchor_not_visible", "not_visible"]);
|
|
4125
4137
|
var ROOM_KEYS = new Set(ROOM_PAIRS.map((p) => `${fold(p.type)}/${fold(p.supertype)}`));
|
|
4126
4138
|
var MAIL_SECONDS = 30 * 86400;
|
|
4139
|
+
var MESSAGE_ADDRESSING = ["characters", "narrator"];
|
|
4127
4140
|
var STUB_FIELDS = ["id", "type", "name", "description", "supertype", "subtype", "image_url", "created_at", "updated_at"];
|
|
4128
4141
|
var LINK_FIELDS = new Map(
|
|
4129
4142
|
Object.entries(FIELD_SCHEMA).map(([type, fields]) => [
|
|
@@ -4274,6 +4287,7 @@ var Reading = class {
|
|
|
4274
4287
|
this.owner = reader.rung === "owner";
|
|
4275
4288
|
const seen = this.owner && reader.as != null ? reader.as : reader;
|
|
4276
4289
|
this.seenRung = seen.rung;
|
|
4290
|
+
this.stored = seen.rung === "owner";
|
|
4277
4291
|
this.character = typeof seen.character === "string" && seen.character !== "" ? seen.character : null;
|
|
4278
4292
|
const listed = (v) => new Set(Array.isArray(v) ? v.filter((i) => typeof i === "string") : []);
|
|
4279
4293
|
const wholeIds = listed(seen.whole);
|
|
@@ -4333,7 +4347,7 @@ var Reading = class {
|
|
|
4333
4347
|
if (this.stubs.has(id)) return [];
|
|
4334
4348
|
return this.fullLinks(id).filter((t) => this.view.has(t));
|
|
4335
4349
|
}
|
|
4336
|
-
/** The body this reader is served: a stub for a known-of element
|
|
4350
|
+
/** The body this reader is served: a stub for a known-of element; the owner's own view the body as stored; any other reader's with the links it cannot see left out (`trim`). */
|
|
4337
4351
|
body(id) {
|
|
4338
4352
|
let b = this.served.get(id);
|
|
4339
4353
|
if (b !== void 0) return b;
|
|
@@ -4347,29 +4361,64 @@ var Reading = class {
|
|
|
4347
4361
|
b.known_of = true;
|
|
4348
4362
|
} else {
|
|
4349
4363
|
b = copy(el);
|
|
4350
|
-
|
|
4351
|
-
for (const [field, many] of LINK_FIELDS.get(type) ?? []) {
|
|
4352
|
-
if (!own(b, field)) continue;
|
|
4353
|
-
const v = b[field];
|
|
4354
|
-
if (many) {
|
|
4355
|
-
if (!Array.isArray(v)) continue;
|
|
4356
|
-
const kept = v.filter((t) => typeof t === "string" && this.view.has(t));
|
|
4357
|
-
if (v.some((t) => typeof t === "string" && !this.view.has(t))) trimmed.push(field);
|
|
4358
|
-
b[field] = kept;
|
|
4359
|
-
} else if (typeof v === "string" && !this.view.has(v)) {
|
|
4360
|
-
b[field] = null;
|
|
4361
|
-
trimmed.push(field);
|
|
4362
|
-
}
|
|
4363
|
-
}
|
|
4364
|
-
if (trimmed.length > 0 && (isMessage(b) || isLens(b))) {
|
|
4365
|
-
const mark = Array.isArray(b.x_served_trimmed) ? b.x_served_trimmed.slice() : [];
|
|
4366
|
-
for (const f of trimmed) if (!mark.includes(f)) mark.push(f);
|
|
4367
|
-
b.x_served_trimmed = mark;
|
|
4368
|
-
}
|
|
4364
|
+
if (!this.stored) this.trim(type, b);
|
|
4369
4365
|
}
|
|
4370
4366
|
this.served.set(id, b);
|
|
4371
4367
|
return b;
|
|
4372
4368
|
}
|
|
4369
|
+
/**
|
|
4370
|
+
* A whole body as a reader below the owner is served it, as keel's `redact` and `serialize` serve it: every
|
|
4371
|
+
* link id the reader cannot see (or that names an element of another type than the field's) left out, a
|
|
4372
|
+
* single link to null, a generic pair (a Pin's `element_type` and `element_id`) to the empty pair, `""` and
|
|
4373
|
+
* null; a lens's `x_lens.notes` keeps the entries keyed to an anchor it is served or another element it
|
|
4374
|
+
* sees. `x_served_trimmed` names what was trimmed only where keel adds it: a Message's `characters` and
|
|
4375
|
+
* `narrator`, a lens's anchor fields and `notes` (when an anchor's note went with it), for a contributor
|
|
4376
|
+
* or a guest, never the public rung.
|
|
4377
|
+
*/
|
|
4378
|
+
trim(type, b) {
|
|
4379
|
+
const sees = (t, target) => typeof t === "string" && this.view.has(t) && (target === "any" || this.typeOf.get(t) === target);
|
|
4380
|
+
const schema = FIELD_SCHEMA[type] ?? {};
|
|
4381
|
+
const isLensBody = isLens(b);
|
|
4382
|
+
const anchorsBefore = isLensBody ? new Set(ANCHOR_FIELDS.flatMap((f) => Array.isArray(b[f]) ? b[f] : [])) : null;
|
|
4383
|
+
const trimmed = [];
|
|
4384
|
+
for (const [field, many] of LINK_FIELDS.get(type) ?? []) {
|
|
4385
|
+
if (!own(b, field)) continue;
|
|
4386
|
+
const v = b[field];
|
|
4387
|
+
const target = schema[field]?.target ?? "any";
|
|
4388
|
+
if (many) {
|
|
4389
|
+
if (!Array.isArray(v) || v.length === 0) continue;
|
|
4390
|
+
const kept = v.filter((t) => sees(t, target));
|
|
4391
|
+
if (kept.length !== v.length) trimmed.push(field);
|
|
4392
|
+
b[field] = kept;
|
|
4393
|
+
} else if (target === "any" && field.endsWith("_id")) {
|
|
4394
|
+
const typeField = `${field.slice(0, -3)}_type`;
|
|
4395
|
+
if (typeof v !== "string" || v === "" || sees(v, typeof b[typeField] === "string" ? b[typeField] : "")) continue;
|
|
4396
|
+
if (own(b, typeField)) b[typeField] = "";
|
|
4397
|
+
b[field] = null;
|
|
4398
|
+
trimmed.push(field);
|
|
4399
|
+
} else if (typeof v === "string" && v !== "" && !sees(v, target)) {
|
|
4400
|
+
b[field] = null;
|
|
4401
|
+
trimmed.push(field);
|
|
4402
|
+
}
|
|
4403
|
+
}
|
|
4404
|
+
let notesGone = false;
|
|
4405
|
+
if (anchorsBefore !== null && isBody2(b.x_lens) && isBody2(b.x_lens.notes)) {
|
|
4406
|
+
const notes = b.x_lens.notes;
|
|
4407
|
+
const served = new Set(ANCHOR_FIELDS.flatMap((f) => Array.isArray(b[f]) ? b[f] : []));
|
|
4408
|
+
const kept = {};
|
|
4409
|
+
for (const k of Object.keys(notes)) {
|
|
4410
|
+
if (served.has(k) || !anchorsBefore.has(k) && this.view.has(k)) kept[k] = notes[k];
|
|
4411
|
+
else if (anchorsBefore.has(k)) notesGone = true;
|
|
4412
|
+
}
|
|
4413
|
+
if (Object.keys(kept).length !== Object.keys(notes).length) b.x_lens = { ...b.x_lens, notes: kept };
|
|
4414
|
+
}
|
|
4415
|
+
if (this.seenRung === "public") return;
|
|
4416
|
+
const named = isMessage(b) ? MESSAGE_ADDRESSING.filter((f) => trimmed.includes(f)) : isLensBody ? [...ANCHOR_FIELDS.filter((f) => trimmed.includes(f)), ...notesGone ? ["notes"] : []] : [];
|
|
4417
|
+
if (named.length === 0) return;
|
|
4418
|
+
const mark = Array.isArray(b.x_served_trimmed) ? b.x_served_trimmed.slice() : [];
|
|
4419
|
+
for (const f of named) if (!mark.includes(f)) mark.push(f);
|
|
4420
|
+
b.x_served_trimmed = mark;
|
|
4421
|
+
}
|
|
4373
4422
|
/**
|
|
4374
4423
|
* One hop from each element of `from`, both ways, and on through each Relation it lands on to that Relation's
|
|
4375
4424
|
* parties. Nothing hops out of a stub or a room element, nor out of an element `stops` names.
|
|
@@ -4515,8 +4564,7 @@ function resolveOne(lens, recipe, r, visited, wall) {
|
|
|
4515
4564
|
};
|
|
4516
4565
|
const { anchors, children, unseen, anchored } = anchorsOf(lens, r);
|
|
4517
4566
|
const anchorSet = new Set(anchors);
|
|
4518
|
-
|
|
4519
|
-
const list = [];
|
|
4567
|
+
let list = [];
|
|
4520
4568
|
const frontier = [];
|
|
4521
4569
|
for (const id of anchors) {
|
|
4522
4570
|
if (visited.has(id) || !r.byId.has(id)) continue;
|
|
@@ -4524,8 +4572,8 @@ function resolveOne(lens, recipe, r, visited, wall) {
|
|
|
4524
4572
|
addCut(id, "anchor_not_visible");
|
|
4525
4573
|
continue;
|
|
4526
4574
|
}
|
|
4527
|
-
frontier.push(id);
|
|
4528
4575
|
const why = r.fenceCut(id, recipe);
|
|
4576
|
+
if (why !== "after_as_of") frontier.push(id);
|
|
4529
4577
|
if (why !== null) addCut(id, why);
|
|
4530
4578
|
else list.push(id);
|
|
4531
4579
|
}
|
|
@@ -4538,16 +4586,18 @@ function resolveOne(lens, recipe, r, visited, wall) {
|
|
|
4538
4586
|
const selected = r.order.filter((id) => r.view.has(id) && !visited.has(id) && r.kept(id, recipe));
|
|
4539
4587
|
list.push(...r.sort(selected.filter(passes)));
|
|
4540
4588
|
} else if (recipe.depth >= 1) {
|
|
4541
|
-
const excluded = (id) => anchorSet.has(id) ||
|
|
4589
|
+
const excluded = (id) => anchorSet.has(id) || visited.has(id);
|
|
4542
4590
|
const { reached: hop, edges } = r.reach(frontier, excluded);
|
|
4543
4591
|
list.push(...r.sort([...hop].filter(passes)));
|
|
4544
4592
|
if (r.owner) for (const id of r.unseen(frontier, edges, excluded)) addCut(id, "not_visible");
|
|
4545
4593
|
if (recipe.depth === 2) {
|
|
4546
|
-
const stops = (id) => r.stopsAt(id, recipe);
|
|
4547
|
-
for (const id of r.reach(hop, (id2) => excluded(id2) || hop.has(id2), stops).reached)
|
|
4594
|
+
const stops = (id) => r.stopsAt(id, recipe) || r.fenceCut(id, recipe) === "after_as_of";
|
|
4595
|
+
for (const id of r.reach(hop, (id2) => excluded(id2) || hop.has(id2), stops).reached) {
|
|
4596
|
+
if ((r.room.has(id) || r.aid.has(id)) && !r.kept(id, recipe)) continue;
|
|
4597
|
+
addCut(id, "hops_not_served");
|
|
4598
|
+
}
|
|
4548
4599
|
}
|
|
4549
4600
|
}
|
|
4550
|
-
const out = list.map((id) => ({ id, row: r.row(id, recipe.show, anchorSet.has(id) ? recipe.notes : null) }));
|
|
4551
4601
|
for (const child of children) {
|
|
4552
4602
|
if (visited.has(child)) continue;
|
|
4553
4603
|
visited.add(child);
|
|
@@ -4555,14 +4605,23 @@ function resolveOne(lens, recipe, r, visited, wall) {
|
|
|
4555
4605
|
const read = readRecipe(body.x_lens);
|
|
4556
4606
|
if (!("recipe" in read) || isTemplate(body)) continue;
|
|
4557
4607
|
const sub = resolveOne(body, read.recipe, r, visited, wall);
|
|
4558
|
-
|
|
4608
|
+
const have = new Set(list);
|
|
4609
|
+
list.push(...sub.list.filter((id) => !have.has(id)));
|
|
4559
4610
|
for (const [id, why] of sub.cut) addCut(id, why);
|
|
4560
4611
|
}
|
|
4561
|
-
|
|
4612
|
+
const mail = recipe.mail === "none" ? null : mailPart(r, recipe.mail, recipe.budget, wall);
|
|
4613
|
+
if (mail !== null) {
|
|
4614
|
+
const inMail = /* @__PURE__ */ new Set([...mail.unread, ...mail.read]);
|
|
4615
|
+
list = list.filter((id) => !inMail.has(id));
|
|
4616
|
+
}
|
|
4617
|
+
for (const id of list.slice(recipe.budget)) cut2.set(id, "budget");
|
|
4618
|
+
list = list.slice(0, recipe.budget);
|
|
4619
|
+
for (const id of list) cut2.delete(id);
|
|
4620
|
+
return { list, cut: cut2, mail };
|
|
4562
4621
|
}
|
|
4563
4622
|
function mailPart(r, mode, budget, clock) {
|
|
4564
4623
|
const empty = { unread: [], read: [], rows: [], cut: {}, totals: { unread: 0, read: 0 } };
|
|
4565
|
-
if (r.character === null) return empty;
|
|
4624
|
+
if (r.character === null || r.seenRung === "public") return empty;
|
|
4566
4625
|
const inView = r.order.filter((id) => r.view.has(id));
|
|
4567
4626
|
const messages = inView.filter((id) => !r.stubs.has(id)).map((id) => r.body(id)).filter((b) => isMessage(b));
|
|
4568
4627
|
const relations = inView.filter((id) => r.typeOf.get(id) === "relation").map((id) => r.body(id));
|
|
@@ -4628,20 +4687,9 @@ function lensReading(r, lens, clockV) {
|
|
|
4628
4687
|
const wall = timeKey(clockV ?? (/* @__PURE__ */ new Date()).toISOString());
|
|
4629
4688
|
const visited = /* @__PURE__ */ new Set();
|
|
4630
4689
|
if (typeof body.id === "string") visited.add(body.id);
|
|
4631
|
-
const
|
|
4632
|
-
const
|
|
4633
|
-
const
|
|
4634
|
-
const seen = /* @__PURE__ */ new Set();
|
|
4635
|
-
const union = resolved.list.filter((e) => {
|
|
4636
|
-
if (seen.has(e.id) || visited.has(e.id) || inMail.has(e.id)) return false;
|
|
4637
|
-
seen.add(e.id);
|
|
4638
|
-
return true;
|
|
4639
|
-
});
|
|
4640
|
-
const keep = union.slice(0, recipe.budget);
|
|
4641
|
-
const cut2 = resolved.cut;
|
|
4642
|
-
for (const e of union.slice(recipe.budget)) cut2.set(e.id, "budget");
|
|
4643
|
-
for (const e of keep) cut2.delete(e.id);
|
|
4644
|
-
for (const id of visited) cut2.delete(id);
|
|
4690
|
+
const { list: keep, cut: cut2, mail } = resolveOne(body, recipe, r, visited, wall);
|
|
4691
|
+
const { anchors } = anchorsOf(body, r);
|
|
4692
|
+
const rows = keep.map((id) => r.row(id, recipe.show, anchors.includes(id) ? recipe.notes : null));
|
|
4645
4693
|
const counts = {};
|
|
4646
4694
|
for (const why of CUT_REASONS) {
|
|
4647
4695
|
if (OWNER_ONLY.has(why) && !r.owner) continue;
|
|
@@ -4649,9 +4697,106 @@ function lensReading(r, lens, clockV) {
|
|
|
4649
4697
|
for (const w of cut2.values()) if (w === why) n++;
|
|
4650
4698
|
if (n > 0) counts[why] = n;
|
|
4651
4699
|
}
|
|
4652
|
-
const { anchors } = anchorsOf(body, r);
|
|
4653
4700
|
const notesIgnored = Object.keys(recipe.notes).filter((k) => !anchors.includes(k) && r.view.has(k)).length;
|
|
4654
|
-
return { reading: { kept: keep
|
|
4701
|
+
return { reading: { kept: keep, rows, cut: counts, notesIgnored, mail, unreadable: null }, cutById: cut2 };
|
|
4702
|
+
}
|
|
4703
|
+
|
|
4704
|
+
// src/charter.ts
|
|
4705
|
+
var SKILL_MAX = 5;
|
|
4706
|
+
var ID = /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/g;
|
|
4707
|
+
var BREAK = /\r\n|\r|\n/;
|
|
4708
|
+
function firstLine(text2) {
|
|
4709
|
+
if (typeof text2 !== "string") return "";
|
|
4710
|
+
return trimWhiteSpace(trimWhiteSpace(text2).split(BREAK, 1)[0]);
|
|
4711
|
+
}
|
|
4712
|
+
function newest(ids, r) {
|
|
4713
|
+
let best = null;
|
|
4714
|
+
let bestAt = null;
|
|
4715
|
+
for (const id of ids) {
|
|
4716
|
+
const at = timeKey(r.byId.get(id).created_at);
|
|
4717
|
+
if (best !== null) {
|
|
4718
|
+
const c = at && bestAt ? compareKeys(at, bestAt) : at ? 1 : bestAt ? -1 : 0;
|
|
4719
|
+
if (c < 0 || c === 0 && byCodePoint2(id, best) < 0) continue;
|
|
4720
|
+
}
|
|
4721
|
+
best = id;
|
|
4722
|
+
bestAt = at;
|
|
4723
|
+
}
|
|
4724
|
+
return best;
|
|
4725
|
+
}
|
|
4726
|
+
function idsIn(text2) {
|
|
4727
|
+
const out = [];
|
|
4728
|
+
if (typeof text2 !== "string") return out;
|
|
4729
|
+
for (const m of text2.matchAll(ID)) {
|
|
4730
|
+
const id = m[0].toLowerCase();
|
|
4731
|
+
if (!out.includes(id)) out.push(id);
|
|
4732
|
+
}
|
|
4733
|
+
return out;
|
|
4734
|
+
}
|
|
4735
|
+
function hubsOf(id, r) {
|
|
4736
|
+
const body = r.body(id);
|
|
4737
|
+
if (body.known_of === true) return [];
|
|
4738
|
+
const schema = FIELD_SCHEMA.construct;
|
|
4739
|
+
const out = [];
|
|
4740
|
+
const seen = /* @__PURE__ */ new Set([`construct/${id}`]);
|
|
4741
|
+
for (const [field, many] of LINK_FIELDS.get("construct") ?? []) {
|
|
4742
|
+
const v = body[field];
|
|
4743
|
+
const target = schema[field]?.target ?? "";
|
|
4744
|
+
for (const t of many ? Array.isArray(v) ? v : [] : [v]) {
|
|
4745
|
+
if (typeof t !== "string" || t === "" || seen.has(`${target}/${t}`)) continue;
|
|
4746
|
+
seen.add(`${target}/${t}`);
|
|
4747
|
+
out.push({ type: target, id: t });
|
|
4748
|
+
}
|
|
4749
|
+
}
|
|
4750
|
+
return out;
|
|
4751
|
+
}
|
|
4752
|
+
var NONE = () => ({ charter: null, guide: null, domains: [] });
|
|
4753
|
+
function charterOf(world, reader) {
|
|
4754
|
+
if (!isBody2(world) || !Array.isArray(world.elements)) {
|
|
4755
|
+
throw new TypeError("charterOf: world is an object with an elements list.");
|
|
4756
|
+
}
|
|
4757
|
+
checkReader(reader, "charterOf: reader");
|
|
4758
|
+
const r = new Reading(world, reader, null);
|
|
4759
|
+
if (r.seenRung === "public" && world.open !== true) return NONE();
|
|
4760
|
+
const seen = (pair) => r.order.filter((id) => r.view.has(id) && r.aid.get(id) === pair);
|
|
4761
|
+
const out = NONE();
|
|
4762
|
+
const law = newest(seen("law/charter"), r);
|
|
4763
|
+
if (law !== null) {
|
|
4764
|
+
const el = r.byId.get(law);
|
|
4765
|
+
const rules = el.x_checks_rules;
|
|
4766
|
+
const skill = idsIn(el.description).filter((id) => r.view.has(id) && r.typeOf.get(id) === "object").slice(0, SKILL_MAX);
|
|
4767
|
+
out.charter = {
|
|
4768
|
+
id: law,
|
|
4769
|
+
name: typeof el.name === "string" ? el.name : "",
|
|
4770
|
+
rules: Array.isArray(rules) ? JSON.parse(JSON.stringify(rules)) : [],
|
|
4771
|
+
skill
|
|
4772
|
+
};
|
|
4773
|
+
}
|
|
4774
|
+
const guide = newest(seen("construct/guide"), r);
|
|
4775
|
+
if (guide !== null) {
|
|
4776
|
+
const el = r.byId.get(guide);
|
|
4777
|
+
out.guide = { id: guide, name: typeof el.name === "string" ? el.name : "" };
|
|
4778
|
+
}
|
|
4779
|
+
const domains = new Set(seen("construct/domain"));
|
|
4780
|
+
const order = [];
|
|
4781
|
+
const named = guide === null ? void 0 : r.body(guide).constructs;
|
|
4782
|
+
for (const id of Array.isArray(named) ? named : []) {
|
|
4783
|
+
if (typeof id === "string" && domains.has(id) && !order.includes(id)) order.push(id);
|
|
4784
|
+
}
|
|
4785
|
+
const nameOf = (id) => {
|
|
4786
|
+
const name = r.body(id).name;
|
|
4787
|
+
return typeof name === "string" ? name : "";
|
|
4788
|
+
};
|
|
4789
|
+
const rest = [...domains].filter((id) => !order.includes(id)).sort((a, b) => byCodePoint2(fold(nameOf(a)), fold(nameOf(b))) || byCodePoint2(a, b));
|
|
4790
|
+
out.domains = [...order, ...rest].map((id) => ({
|
|
4791
|
+
id,
|
|
4792
|
+
name: nameOf(id),
|
|
4793
|
+
sentence: firstLine(r.body(id).description),
|
|
4794
|
+
hubs: hubsOf(id, r)
|
|
4795
|
+
}));
|
|
4796
|
+
return out;
|
|
4797
|
+
}
|
|
4798
|
+
function domainsOf(world, reader) {
|
|
4799
|
+
return charterOf(world, reader).domains;
|
|
4655
4800
|
}
|
|
4656
4801
|
|
|
4657
4802
|
// src/graph.ts
|
|
@@ -6566,6 +6711,7 @@ export {
|
|
|
6566
6711
|
ASK_LIMITS,
|
|
6567
6712
|
CALENDAR_FIELD,
|
|
6568
6713
|
CALENDAR_SUPERTYPE,
|
|
6714
|
+
CHARTER_PAIRS,
|
|
6569
6715
|
DATE_FIELD,
|
|
6570
6716
|
ELEMENT_FAMILIES,
|
|
6571
6717
|
ELEMENT_ICONS,
|
|
@@ -6608,10 +6754,12 @@ export {
|
|
|
6608
6754
|
breakdownStep,
|
|
6609
6755
|
buildAskContext,
|
|
6610
6756
|
buildWorldIndex,
|
|
6757
|
+
charterOf,
|
|
6611
6758
|
dateOf,
|
|
6612
6759
|
degreeOf,
|
|
6613
6760
|
detectKeyKind,
|
|
6614
6761
|
displayYear,
|
|
6762
|
+
domainsOf,
|
|
6615
6763
|
draughtText,
|
|
6616
6764
|
editedBy,
|
|
6617
6765
|
elementAddress,
|