@onlyworlds/sdk 4.126.0 → 4.128.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 +1 -1
- package/CHANGELOG.md +26 -0
- package/SCHEMA.md +2 -1
- package/dist/{chunk-EVHGSTUB.js → chunk-K7SQUXMR.js} +11 -2
- package/dist/index.d.ts +63 -7
- package/dist/index.js +118 -19
- package/dist/waymark.js +1 -1
- 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.
|
|
3
|
+
**Current as of**: SDK **4.x** · schema-dist **v0.34.0-dist.104** (canonical 00.34.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
|
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,32 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.128.0] - 2026-11-02
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`worldGraph(world, reader, { readingAids: true })` brings the reading aids back into an unlensed graph** (schema-dist `profiles/lens.md`, serial 104). The reading aids are a world's charter, its guide and its domains, each recognised by its pair and the mark `x_charter_of` (the pair without the mark is lore and a node like any other). They are out of an unlensed graph by default and counted `reading_aid`; with the flag they are nodes, each marked `reading_aid` (last in `marks`), and a link to one is an edge. The flag is a boolean, false by default (null reads as false). Any signed reader may ask it; a public reader asking it is refused by name before anything is read, and of several refused flags `readingAids` is named last, after `hidden`, `proposed`, `rooms` and `mapSpace`. A flag never widens a lens: with a lens the flag adds nothing, and a lens that names the pair (`law/charter`) keeps the charter whatever the flag says. `OwGraphMark` gains `'reading_aid'`.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **A reading aid a lens keeps carries the mark `reading_aid`**, as a room element a lens keeps carries `room`; before, it carried no mark.
|
|
17
|
+
- **Schema repinned to schema-dist `v0.34.0-dist.104`** (from dist.103); the standard stays canonical **00.34.00** and no schema field moved. Serial 104 adds the graph's `reading_aids` flag to the lens profile, with five graph cases in the lens fixture (201 cases in all), and two readings to the landing profile, with three cases (33 in all): `orphan` and `near_orphan` are degree 0 and degree 1 by the landing page's own degree, so a node whose only link is to itself is a near-orphan and a list naming one target twice counts degree 2; and a `heads` too large for the reader reads as the largest it holds, so `heads: 1e30` is taken, never refused, and every linked Character is a head. `landingOf` answers all three as it stood.
|
|
18
|
+
|
|
19
|
+
## [4.127.0] - 2026-11-02
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- **`landingOf(graph, options)`: the landing profile** (schema-dist `profiles/landing.md`, serial 103). A world's first picture at a door, read from the graph `worldGraph` answers for the visitor, so it holds only what that reader may see. The answer is `{ mode, size, clusters, unclustered, gaps }`, all five keys always present: `mode` is `gaps` when the graph has fewer nodes than `size` (default 24), else `graph`; `clusters` are the most-linked Characters (at most `heads`, default 5), each with the nodes within `hops` steps of it (default 1), a node joining its nearest head; `unclustered` is every node no head reaches; `gaps` are the orphans, the near-orphans, a Character whose `location` names no Location in the graph (`no_place`) and a Location no Character's `location` names (`nobody_here`). Counted in integers, ids in code point order, so the same graph and options give the same bytes. An unknown option, or one that is not a whole number of 1 or more, is refused by name. The fixture `profiles/landing.fixture.json` (30 cases) is the test. Types: `OwLanding`, `OwLandingCluster`, `OwLandingMember`, `OwLandingGap`, `OwLandingGapKind`, `OwLandingMode`, `OwLandingOptions`.
|
|
24
|
+
- **`LocationV2.vehicle`**, from canonical 00.34.00: a single link to the Object a place is the inside of (a ship, a train, a walking city), for a place that moves with the thing; a place inside another place still uses `parent_location`. It is in `FIELD_SCHEMA`, `SINGLE_LINK_FIELDS`, the Location's Setting section (after `parent_location`) and `SCHEMA.md`.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **Schema repinned to schema-dist `v0.34.0-dist.103`** (from dist.102), canonical **00.34.00**, so `ONLYWORLDS_VERSION` is now `'00.34.00'`. Serial 103 adds `vehicle` to Location, the landing profile, the lens profile graph section's degree and out-degree with the lens fixture's `degree` cases (196 cases in all; `degreeOf` and `outDegreeOf` answer the five new ones as they stood), and seven readings in the record profile (its fixture from 32 cases to 40).
|
|
29
|
+
- **`recordsOf` reads a run or a story as proposed exactly when `proposedMarkOf` does.** An empty mark (`{}`, `""` or `[]`) is settled, so a run or story carrying one is now read; before, any value but null left it out.
|
|
30
|
+
- **`recordsOf` never reads an Event or a Narrative whose `id` is not a string**: no entry without an id, and no error. Before, a run with a numeric id was returned with that number as its id. The record profile's other new cases (`played_at`'s upper-case `T` and `Z` and ASCII digits, a name that is not a string, ties by code point) pass as the reader stood.
|
|
31
|
+
- **`TOOLS` repinned at the tools list's `f10afdc`**: Tactical Tangle is a listed row (`tangle`). It has no open door, so `openersFor` offers it nowhere, and a record whose `tool` is `tangle` finds its row by id.
|
|
32
|
+
- **A reading builds its reverse link index only when a lens hop asks for it.** `worldGraph` without a lens, and every other reading that walks no hop, no longer pays for it; no answer changes. On a 20,573-element world, `worldGraph` for the owner went from a median 434 ms to 324 ms, both builds interleaved in one process.
|
|
33
|
+
|
|
8
34
|
## [4.126.0] - 2026-11-01
|
|
9
35
|
|
|
10
36
|
### Added
|
package/SCHEMA.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OnlyWorlds Schema Reference
|
|
2
2
|
|
|
3
|
-
**Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.
|
|
3
|
+
**Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.34.0-dist.104** — canonical schema **00.34.00**, published 2026-11-02.
|
|
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.
|
|
@@ -320,6 +320,7 @@ the group, the icon carries the type): blue · green · pink · amber.
|
|
|
320
320
|
- `function` (text) — Main use, role, or purpose of the location within the world
|
|
321
321
|
- `founding_date` (integer) — Date on which the location was founded, established, or designated
|
|
322
322
|
- `parent_location` (single link → location) — Wider location that this location is part of
|
|
323
|
+
- `vehicle` (single link → object) — The Object this place is the inside of: a ship, a train, an airship, a walking city, a station that moves. Set it when the place moves with the thing; a place inside another place uses parent_location instead
|
|
323
324
|
- `populations` (multi link → collective) — Distinct collective groups or communities residing within the location
|
|
324
325
|
|
|
325
326
|
### Politics
|
|
@@ -13,7 +13,7 @@ function refuseUnknownOptions(fn, opts, keys, after = "") {
|
|
|
13
13
|
|
|
14
14
|
// src/v2/types.generated.ts
|
|
15
15
|
var ELEMENT_TYPES = ["ability", "character", "collective", "construct", "creature", "event", "family", "institution", "language", "law", "location", "map", "marker", "narrative", "object", "phenomenon", "pin", "relation", "species", "title", "trait", "zone"];
|
|
16
|
-
var ONLYWORLDS_VERSION = "00.
|
|
16
|
+
var ONLYWORLDS_VERSION = "00.34.00";
|
|
17
17
|
var ELEMENT_GROUPS = {
|
|
18
18
|
ability: "amber",
|
|
19
19
|
character: "blue",
|
|
@@ -143,7 +143,7 @@ var ELEMENT_SECTIONS = {
|
|
|
143
143
|
{ name: "World", order: 2, fields: ["author", "locations", "zones", "prohibitions", "adjudicators", "enforcers"] }
|
|
144
144
|
],
|
|
145
145
|
location: [
|
|
146
|
-
{ name: "Setting", order: 1, fields: ["form", "function", "founding_date", "parent_location", "populations"] },
|
|
146
|
+
{ name: "Setting", order: 1, fields: ["form", "function", "founding_date", "parent_location", "vehicle", "populations"] },
|
|
147
147
|
{ name: "Politics", order: 2, fields: ["political_climate", "primary_power", "governing_title", "secondary_powers", "zone", "rival", "partner"] },
|
|
148
148
|
{ name: "World", order: 3, fields: ["customs", "founders", "cults", "delicacies"] },
|
|
149
149
|
{ name: "Production", order: 4, fields: ["extraction_methods", "extraction_goods", "industry_methods", "industry_goods"] },
|
|
@@ -632,6 +632,7 @@ var FIELD_SCHEMA = {
|
|
|
632
632
|
function: { type: "text" },
|
|
633
633
|
founding_date: { type: "integer" },
|
|
634
634
|
parent_location: { type: "single_link", target: "location" },
|
|
635
|
+
vehicle: { type: "single_link", target: "object" },
|
|
635
636
|
populations: { type: "multi_link", target: "collective" },
|
|
636
637
|
// Politics
|
|
637
638
|
political_climate: { type: "text" },
|
|
@@ -1419,6 +1420,14 @@ var TOOLS = [
|
|
|
1419
1420
|
"map_space"
|
|
1420
1421
|
]
|
|
1421
1422
|
}
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
"id": "tangle",
|
|
1426
|
+
"name": "Tactical Tangle",
|
|
1427
|
+
"url": "https://tangle.onlyworlds.com",
|
|
1428
|
+
"client": "tangle",
|
|
1429
|
+
"rung": "listed",
|
|
1430
|
+
"open": null
|
|
1422
1431
|
}
|
|
1423
1432
|
];
|
|
1424
1433
|
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ type ElementType = 'ability' | 'character' | 'collective' | 'construct' | 'creat
|
|
|
48
48
|
declare const ELEMENT_TYPES: ElementType[];
|
|
49
49
|
/** Canonical OnlyWorlds schema version. Source: the `canonical:` value of the pinned
|
|
50
50
|
* distribution's VERSION file (see the provenance block at the top of this file). */
|
|
51
|
-
declare const ONLYWORLDS_VERSION: "00.
|
|
51
|
+
declare const ONLYWORLDS_VERSION: "00.34.00";
|
|
52
52
|
/** The four colour groups, named by their colour. A visual aid for drawing the 22 types,
|
|
53
53
|
* not part of the standard: colour carries the group, ELEMENT_ICONS carries the type. */
|
|
54
54
|
type ElementGroup = 'blue' | 'green' | 'pink' | 'amber';
|
|
@@ -1030,6 +1030,10 @@ declare const FIELD_SCHEMA: {
|
|
|
1030
1030
|
readonly type: "single_link";
|
|
1031
1031
|
readonly target: "location";
|
|
1032
1032
|
};
|
|
1033
|
+
readonly vehicle: {
|
|
1034
|
+
readonly type: "single_link";
|
|
1035
|
+
readonly target: "object";
|
|
1036
|
+
};
|
|
1033
1037
|
readonly populations: {
|
|
1034
1038
|
readonly type: "multi_link";
|
|
1035
1039
|
readonly target: "collective";
|
|
@@ -5566,9 +5570,11 @@ interface OwGraphOptions {
|
|
|
5566
5570
|
proposed?: boolean | null;
|
|
5567
5571
|
/** Bring back map space: Maps, Pins and Markers (a Zone is a node by default). Refused for a public reader. */
|
|
5568
5572
|
mapSpace?: boolean | null;
|
|
5573
|
+
/** Bring back the reading aids: the charter, its guide and its domains, each by its pair and the mark `x_charter_of`. Refused for a public reader. */
|
|
5574
|
+
readingAids?: boolean | null;
|
|
5569
5575
|
}
|
|
5570
5576
|
/** Why a node that is out by default is in. */
|
|
5571
|
-
type OwGraphMark = 'room' | 'hidden' | 'proposed';
|
|
5577
|
+
type OwGraphMark = 'room' | 'hidden' | 'proposed' | 'reading_aid';
|
|
5572
5578
|
/**
|
|
5573
5579
|
* Why an element is not a node, or an edge was left out: the lens's closed list, then the graph's own, in
|
|
5574
5580
|
* this order: `room`, `hidden`, `proposed`, `map_space`, `reading_aid`, `outside_lens`. `outside_lens` (a link
|
|
@@ -5588,7 +5594,7 @@ interface OwGraphNode {
|
|
|
5588
5594
|
family: ElementGroup;
|
|
5589
5595
|
/** The type's icon name, from the distribution's presentation defaults. */
|
|
5590
5596
|
icon: string;
|
|
5591
|
-
/** The out-by-default kinds the element belongs to, in this order: `room`, `hidden`, `proposed`; absent when none. */
|
|
5597
|
+
/** The out-by-default kinds the element belongs to, in this order: `room`, `hidden`, `proposed`, `reading_aid`; absent when none. */
|
|
5592
5598
|
marks?: OwGraphMark[];
|
|
5593
5599
|
/** True on a guest's known-of element, a stub that has no edges out; absent otherwise. */
|
|
5594
5600
|
known_of?: true;
|
|
@@ -5620,8 +5626,8 @@ interface OwWorldGraph {
|
|
|
5620
5626
|
*
|
|
5621
5627
|
* `world` and `reader` are what `resolveLens` takes. Without `options.lens` the nodes are every element
|
|
5622
5628
|
* the reader sees less what is out by default: room elements, hidden ones, proposed ones and map space
|
|
5623
|
-
* (Map, Pin, Marker; a Zone is content and a node like any other)
|
|
5624
|
-
* its
|
|
5629
|
+
* (Map, Pin, Marker; a Zone is content and a node like any other) and the reading aids (the charter, its guide,
|
|
5630
|
+
* its domains: `isCharterElement`), each brought back by its flag and then marked (map space carries no mark). With a lens the nodes are
|
|
5625
5631
|
* exactly the lens's `kept`, its cut rides along unchanged, and a flag adds nothing. A lens whose `x_lens`
|
|
5626
5632
|
* cannot be read gives an empty graph with `unreadable` naming the key, as `resolveLens` does.
|
|
5627
5633
|
*
|
|
@@ -5637,7 +5643,8 @@ interface OwWorldGraph {
|
|
|
5637
5643
|
* reader does not see. A link to an id that is not in the world is left out and not counted.
|
|
5638
5644
|
*
|
|
5639
5645
|
* `hidden` or `proposed` from a reader that is not the owner, or any flag from a public reader, is refused
|
|
5640
|
-
* by name before anything is read
|
|
5646
|
+
* by name before anything is read; of several, the first in the order `hidden`, `proposed`, `rooms`, `mapSpace`,
|
|
5647
|
+
* `readingAids`. An owner reading `as` another reader is judged by that reader's rung.
|
|
5641
5648
|
*/
|
|
5642
5649
|
declare function worldGraph(world: OwLensWorld, reader: OwLensReader, options?: OwGraphOptions): OwWorldGraph;
|
|
5643
5650
|
/**
|
|
@@ -5658,6 +5665,55 @@ declare function degreeOf(graph: OwWorldGraph): Record<string, number>;
|
|
|
5658
5665
|
*/
|
|
5659
5666
|
declare function outDegreeOf(graph: OwWorldGraph): Record<string, number>;
|
|
5660
5667
|
|
|
5668
|
+
/** Which part a door draws first: `gaps` under the size, `graph` at it and above. */
|
|
5669
|
+
type OwLandingMode = 'gaps' | 'graph';
|
|
5670
|
+
/** `heads` (default 5), `hops` (default 1) and `size` (default 24), each a whole number, 1 or more; null is the default. */
|
|
5671
|
+
interface OwLandingOptions {
|
|
5672
|
+
heads?: number | null;
|
|
5673
|
+
hops?: number | null;
|
|
5674
|
+
size?: number | null;
|
|
5675
|
+
}
|
|
5676
|
+
interface OwLandingMember {
|
|
5677
|
+
id: string;
|
|
5678
|
+
/** Steps from the head: 0 for the head itself. */
|
|
5679
|
+
hops: number;
|
|
5680
|
+
degree: number;
|
|
5681
|
+
}
|
|
5682
|
+
interface OwLandingCluster {
|
|
5683
|
+
head: string;
|
|
5684
|
+
/** The head first, then by hops, then by degree (highest first), then by id in code point order. */
|
|
5685
|
+
members: OwLandingMember[];
|
|
5686
|
+
}
|
|
5687
|
+
type OwLandingGapKind = 'orphan' | 'near_orphan' | 'no_place' | 'nobody_here';
|
|
5688
|
+
interface OwLandingGap {
|
|
5689
|
+
kind: OwLandingGapKind;
|
|
5690
|
+
id: string;
|
|
5691
|
+
}
|
|
5692
|
+
interface OwLanding {
|
|
5693
|
+
mode: OwLandingMode;
|
|
5694
|
+
/** The size the mode was read at. */
|
|
5695
|
+
size: number;
|
|
5696
|
+
clusters: OwLandingCluster[];
|
|
5697
|
+
/** Every node no head reaches within `hops`, by degree (highest first), then by id. */
|
|
5698
|
+
unclustered: {
|
|
5699
|
+
id: string;
|
|
5700
|
+
degree: number;
|
|
5701
|
+
}[];
|
|
5702
|
+
/** In the kinds' order (orphan, near_orphan, no_place, nobody_here), then by id; a node can carry several. */
|
|
5703
|
+
gaps: OwLandingGap[];
|
|
5704
|
+
}
|
|
5705
|
+
/**
|
|
5706
|
+
* A world's first picture at a door, from the graph `worldGraph` answered for the visitor, so it holds exactly what
|
|
5707
|
+
* that reader may see. The mode is `gaps` when the graph has fewer nodes than `size`, else `graph`; both parts are
|
|
5708
|
+
* always read. Heads: the Characters with an edge, most linked first (`degreeOf`'s count), ties by id in code point
|
|
5709
|
+
* order, at most `heads`, never a known-of node. A node within `hops` steps of a head (either way along an edge)
|
|
5710
|
+
* joins the nearest head, a tie going to the higher-ranked one. Gaps: the links report's orphans (degree 0) and
|
|
5711
|
+
* near-orphans (degree 1), a Character whose `location` names no Location node (`no_place`), a Location no
|
|
5712
|
+
* Character's `location` names (`nobody_here`); a known-of node is never a gap. The same graph and options give the
|
|
5713
|
+
* same answer, byte for byte. An unknown option, or one that is not a whole number of 1 or more, is refused by name.
|
|
5714
|
+
*/
|
|
5715
|
+
declare function landingOf(graph: OwWorldGraph, options?: OwLandingOptions | null): OwLanding;
|
|
5716
|
+
|
|
5661
5717
|
/** One word pair of a names map: `one` for a single thing, `many` for a plural (absent: `one`). */
|
|
5662
5718
|
interface OwWordPair {
|
|
5663
5719
|
one: string;
|
|
@@ -7007,4 +7063,4 @@ declare class TokenResource {
|
|
|
7007
7063
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
7008
7064
|
}
|
|
7009
7065
|
|
|
7010
|
-
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_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementGroup, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GROUP_COLORS, GROUP_ORDER, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountToken, 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 OwDoor, type OwDragField, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwElementMark, 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 OwOpener, type OwOpenerKind, type OwOpenerState, type OwOpenerSurface, type OwOpenersOptions, 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 OwRecord, type OwRecordMark, type OwRecordStory, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwServedReadingAids, 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 OwStrand, type OwStrandSlot, type OwStrandWorld, type OwTool, type OwToolNeeds, type OwToolOpen, 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, RECORD_FIELD, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, STRAND_FIELD, type SectionInfo, type StepBreakdown, TOOLS, 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, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, readingAidOf, recipientsOf, recordMarkOf, recordsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, strandOf, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
|
|
7066
|
+
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_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementGroup, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GROUP_COLORS, GROUP_ORDER, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountToken, 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 OwDoor, type OwDragField, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwElementMark, 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 OwLanding, type OwLandingCluster, type OwLandingGap, type OwLandingGapKind, type OwLandingMember, type OwLandingMode, type OwLandingOptions, 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 OwOpener, type OwOpenerKind, type OwOpenerState, type OwOpenerSurface, type OwOpenersOptions, 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 OwRecord, type OwRecordMark, type OwRecordStory, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwServedReadingAids, 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 OwStrand, type OwStrandSlot, type OwStrandWorld, type OwTool, type OwToolNeeds, type OwToolOpen, 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, RECORD_FIELD, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, STRAND_FIELD, type SectionInfo, type StepBreakdown, TOOLS, 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, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, landingOf, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, readingAidOf, recipientsOf, recordMarkOf, recordsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, strandOf, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
|
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
trimWhiteSpace,
|
|
43
43
|
typeWord,
|
|
44
44
|
unknownKey
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-K7SQUXMR.js";
|
|
46
46
|
|
|
47
47
|
// src/v2/keyed-id.ts
|
|
48
48
|
var KEYED_IDS = "0199b6a0-6f0e-7c2a-9d1e-3b5c7a8e4f21";
|
|
@@ -2902,8 +2902,9 @@ var Reading = class {
|
|
|
2902
2902
|
/** The ids a body this reader is served may link to: the view, and the proposed elements its rung sees (keel's `scoped` leaves them out for the public rung alone). */
|
|
2903
2903
|
this.linkable = /* @__PURE__ */ new Set();
|
|
2904
2904
|
this.served = /* @__PURE__ */ new Map();
|
|
2905
|
-
|
|
2906
|
-
|
|
2905
|
+
/** Who links to each element, in the reader's view and in the owner's world: built on the first hop that asks,
|
|
2906
|
+
* since a reading with no lens (a graph, a menu's marks) never reads it. Everything it reads is set by the constructor. */
|
|
2907
|
+
this.incoming = null;
|
|
2907
2908
|
const hidden = this.hidden;
|
|
2908
2909
|
if (Array.isArray(world.hidden)) {
|
|
2909
2910
|
for (const id of world.hidden) if (typeof id === "string") hidden.add(id);
|
|
@@ -2956,18 +2957,26 @@ var Reading = class {
|
|
|
2956
2957
|
}
|
|
2957
2958
|
this.members = Array.isArray(world.members) ? world.members : null;
|
|
2958
2959
|
this.asOf = asOf;
|
|
2960
|
+
}
|
|
2961
|
+
/** The reverse links, built once on first ask. */
|
|
2962
|
+
linkedFrom() {
|
|
2963
|
+
if (this.incoming !== null) return this.incoming;
|
|
2964
|
+
const view = /* @__PURE__ */ new Map();
|
|
2965
|
+
const full = /* @__PURE__ */ new Map();
|
|
2959
2966
|
for (const id of this.order) {
|
|
2960
2967
|
for (const t of this.fullLinks(id)) {
|
|
2961
2968
|
if (!this.byId.has(t)) continue;
|
|
2962
|
-
if (!
|
|
2963
|
-
|
|
2969
|
+
if (!full.has(t)) full.set(t, []);
|
|
2970
|
+
full.get(t).push(id);
|
|
2964
2971
|
}
|
|
2965
2972
|
if (!this.view.has(id)) continue;
|
|
2966
2973
|
for (const t of this.links(id)) {
|
|
2967
|
-
if (!
|
|
2968
|
-
|
|
2974
|
+
if (!view.has(t)) view.set(t, []);
|
|
2975
|
+
view.get(t).push(id);
|
|
2969
2976
|
}
|
|
2970
2977
|
}
|
|
2978
|
+
this.incoming = { view, full };
|
|
2979
|
+
return this.incoming;
|
|
2971
2980
|
}
|
|
2972
2981
|
/**
|
|
2973
2982
|
* The ids the element's owner-served body links to, in the schema's field order. A link reaches only an
|
|
@@ -3082,7 +3091,7 @@ var Reading = class {
|
|
|
3082
3091
|
const landed = /* @__PURE__ */ new Set();
|
|
3083
3092
|
for (const f of from) {
|
|
3084
3093
|
if (this.stubs.has(f) || this.room.has(f) || stops !== void 0 && stops(f)) continue;
|
|
3085
|
-
for (const t of [...this.links(f), ...this.
|
|
3094
|
+
for (const t of [...this.links(f), ...this.linkedFrom().view.get(f) ?? []]) if (!excluded(t)) landed.add(t);
|
|
3086
3095
|
}
|
|
3087
3096
|
const reached = new Set(landed);
|
|
3088
3097
|
const edges = [];
|
|
@@ -3102,7 +3111,7 @@ var Reading = class {
|
|
|
3102
3111
|
for (const f of from) {
|
|
3103
3112
|
if (this.stubs.has(f) || this.room.has(f)) continue;
|
|
3104
3113
|
for (const t of this.fullLinks(f)) consider(t);
|
|
3105
|
-
for (const t of this.
|
|
3114
|
+
for (const t of this.linkedFrom().full.get(f) ?? []) consider(t);
|
|
3106
3115
|
}
|
|
3107
3116
|
for (const r of landedRelations) for (const t of this.fullLinks(r)) consider(t);
|
|
3108
3117
|
return out;
|
|
@@ -3527,7 +3536,7 @@ function isInstant(s) {
|
|
|
3527
3536
|
const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][mo - 1];
|
|
3528
3537
|
return days !== void 0 && d >= 1 && d <= days && h <= 23 && mi <= 59 && se <= 59 && y >= 1;
|
|
3529
3538
|
}
|
|
3530
|
-
var proposed = (el) => el
|
|
3539
|
+
var proposed = (el) => proposedMarkOf(el) !== null;
|
|
3531
3540
|
function recordMarkOf(element) {
|
|
3532
3541
|
if (!isObject(element) || element.type !== "event") return null;
|
|
3533
3542
|
const m = element[RECORD_FIELD];
|
|
@@ -3552,7 +3561,7 @@ function recordsOf(characterId, elements) {
|
|
|
3552
3561
|
if (!Array.isArray(elements)) throw new TypeError("recordsOf: elements must be an array");
|
|
3553
3562
|
const storiesOf = /* @__PURE__ */ new Map();
|
|
3554
3563
|
for (const n of elements) {
|
|
3555
|
-
if (!isObject(n) || n.type !== "narrative" || proposed(n)) continue;
|
|
3564
|
+
if (!isObject(n) || n.type !== "narrative" || !isString(n.id) || proposed(n)) continue;
|
|
3556
3565
|
const p = n.protagonist === characterId;
|
|
3557
3566
|
const r = n.narrator === characterId;
|
|
3558
3567
|
if (!p && !r) continue;
|
|
@@ -3566,7 +3575,7 @@ function recordsOf(characterId, elements) {
|
|
|
3566
3575
|
const out = [];
|
|
3567
3576
|
for (const ev of elements) {
|
|
3568
3577
|
const mark = recordMarkOf(ev);
|
|
3569
|
-
if (!mark || proposed(ev) || !list(ev.characters).includes(characterId)) continue;
|
|
3578
|
+
if (!mark || !isString(ev.id) || proposed(ev) || !list(ev.characters).includes(characterId)) continue;
|
|
3570
3579
|
const id = ev.id;
|
|
3571
3580
|
const stories = (storiesOf.get(id) ?? []).map((s) => ({ ...s }));
|
|
3572
3581
|
stories.sort((a, b) => cp(a.id, b.id));
|
|
@@ -3587,7 +3596,7 @@ function recordsOf(characterId, elements) {
|
|
|
3587
3596
|
}
|
|
3588
3597
|
|
|
3589
3598
|
// src/graph.ts
|
|
3590
|
-
var GRAPH_OPTION_KEYS = ["lens", "asOf", "clock", "rooms", "hidden", "proposed", "mapSpace"];
|
|
3599
|
+
var GRAPH_OPTION_KEYS = ["lens", "asOf", "clock", "rooms", "hidden", "proposed", "mapSpace", "readingAids"];
|
|
3591
3600
|
var DECLARED_LINKS = ["x_lens_leads_to", "x_spine_depends_on"];
|
|
3592
3601
|
var GRAPH_REASONS = [...CUT_REASONS, "room", "hidden", "proposed", "map_space", "reading_aid", "outside_lens"];
|
|
3593
3602
|
var GRAPH_OWNER_ONLY = /* @__PURE__ */ new Set([...OWNER_ONLY, "hidden", "proposed"]);
|
|
@@ -3610,14 +3619,15 @@ function worldGraph(world, reader, options) {
|
|
|
3610
3619
|
room: flag(opts, "rooms"),
|
|
3611
3620
|
hidden: flag(opts, "hidden"),
|
|
3612
3621
|
proposed: flag(opts, "proposed"),
|
|
3613
|
-
map_space: flag(opts, "mapSpace")
|
|
3622
|
+
map_space: flag(opts, "mapSpace"),
|
|
3623
|
+
reading_aid: flag(opts, "readingAids")
|
|
3614
3624
|
};
|
|
3615
3625
|
const seenRung = reader.rung === "owner" && reader.as != null ? reader.as.rung : reader.rung;
|
|
3616
3626
|
for (const [kind, key] of [["hidden", "hidden"], ["proposed", "proposed"]]) {
|
|
3617
3627
|
if (flags[kind] && seenRung !== "owner") throw new TypeError(`worldGraph: ${key} is the owner's alone; a ${seenRung} reader may not ask it.`);
|
|
3618
3628
|
}
|
|
3619
3629
|
if (seenRung === "public") {
|
|
3620
|
-
for (const [kind, key] of [["room", "rooms"], ["map_space", "mapSpace"]]) {
|
|
3630
|
+
for (const [kind, key] of [["room", "rooms"], ["map_space", "mapSpace"], ["reading_aid", "readingAids"]]) {
|
|
3621
3631
|
if (flags[kind]) throw new TypeError(`worldGraph: a public reader takes no flag; it asked ${key}.`);
|
|
3622
3632
|
}
|
|
3623
3633
|
}
|
|
@@ -3635,7 +3645,7 @@ function worldGraph(world, reader, options) {
|
|
|
3635
3645
|
if (r.aid.has(id)) out.push("reading_aid");
|
|
3636
3646
|
return out;
|
|
3637
3647
|
};
|
|
3638
|
-
const brought = (k) =>
|
|
3648
|
+
const brought = (k) => flags[k];
|
|
3639
3649
|
const candidate = (id) => r.view.has(id) || seenOwner && r.proposed.has(id);
|
|
3640
3650
|
const nodeIds = /* @__PURE__ */ new Set();
|
|
3641
3651
|
let cut2;
|
|
@@ -3670,7 +3680,7 @@ function worldGraph(world, reader, options) {
|
|
|
3670
3680
|
family: ELEMENT_GROUPS[type],
|
|
3671
3681
|
icon: ELEMENT_ICONS[type]
|
|
3672
3682
|
};
|
|
3673
|
-
const marks2 = kinds(id).filter((k) => k !== "map_space"
|
|
3683
|
+
const marks2 = kinds(id).filter((k) => k !== "map_space");
|
|
3674
3684
|
if (marks2.length > 0) node.marks = marks2;
|
|
3675
3685
|
if (r.stubs.has(id)) node.known_of = true;
|
|
3676
3686
|
return node;
|
|
@@ -3746,6 +3756,94 @@ function outDegreeOf(graph) {
|
|
|
3746
3756
|
return Object.fromEntries([...targets].map(([id, t]) => [id, t.size]));
|
|
3747
3757
|
}
|
|
3748
3758
|
|
|
3759
|
+
// src/landing.ts
|
|
3760
|
+
var OPTION_KEYS = ["heads", "hops", "size"];
|
|
3761
|
+
var GAP_ORDER = ["orphan", "near_orphan", "no_place", "nobody_here"];
|
|
3762
|
+
function whole2(opts, key, fallback) {
|
|
3763
|
+
const v = valueOf(opts, key);
|
|
3764
|
+
if (v === null) return fallback;
|
|
3765
|
+
if (typeof v !== "number" || !Number.isInteger(v) || v < 1) {
|
|
3766
|
+
throw new RangeError(`landingOf: ${key} is a whole number, 1 or more; got ${JSON.stringify(v) ?? typeof v}.`);
|
|
3767
|
+
}
|
|
3768
|
+
return v;
|
|
3769
|
+
}
|
|
3770
|
+
function landingOf(graph, options) {
|
|
3771
|
+
if (!isBody2(graph) || !Array.isArray(graph.nodes) || !Array.isArray(graph.edges)) {
|
|
3772
|
+
throw new TypeError("landingOf: graph is what worldGraph answers, an object with nodes and edges lists.");
|
|
3773
|
+
}
|
|
3774
|
+
if (options !== void 0 && options !== null && !isBody2(options)) {
|
|
3775
|
+
throw new TypeError(`landingOf: options is an object, such as { heads: 5 }; got ${JSON.stringify(options) ?? typeof options}.`);
|
|
3776
|
+
}
|
|
3777
|
+
refuseUnknownOptions("landingOf", options, OPTION_KEYS);
|
|
3778
|
+
const opts = isBody2(options) ? options : {};
|
|
3779
|
+
const k = whole2(opts, "heads", 5);
|
|
3780
|
+
const reach = whole2(opts, "hops", 1);
|
|
3781
|
+
const size = whole2(opts, "size", 24);
|
|
3782
|
+
const degree = new Map(graph.nodes.map((n) => [n.id, 0]));
|
|
3783
|
+
const near = new Map(graph.nodes.map((n) => [n.id, /* @__PURE__ */ new Set()]));
|
|
3784
|
+
const type = new Map(graph.nodes.map((n) => [n.id, n.type]));
|
|
3785
|
+
const add = (id) => {
|
|
3786
|
+
const d = degree.get(id);
|
|
3787
|
+
if (d !== void 0) degree.set(id, d + 1);
|
|
3788
|
+
};
|
|
3789
|
+
const placed = /* @__PURE__ */ new Set();
|
|
3790
|
+
const inhabited = /* @__PURE__ */ new Set();
|
|
3791
|
+
for (const e of graph.edges) {
|
|
3792
|
+
add(e.source);
|
|
3793
|
+
if (e.target !== e.source) add(e.target);
|
|
3794
|
+
if (e.target !== e.source && near.has(e.source) && near.has(e.target)) {
|
|
3795
|
+
near.get(e.source).add(e.target);
|
|
3796
|
+
near.get(e.target).add(e.source);
|
|
3797
|
+
}
|
|
3798
|
+
if (e.field === "location" && type.get(e.source) === "character" && type.get(e.target) === "location") {
|
|
3799
|
+
placed.add(e.source);
|
|
3800
|
+
inhabited.add(e.target);
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
const deg = (id) => degree.get(id) ?? 0;
|
|
3804
|
+
const heads = graph.nodes.filter((n) => n.type === "character" && n.known_of !== true && deg(n.id) > 0).map((n) => n.id).sort((a, b) => deg(b) - deg(a) || byCodePoint(a, b)).slice(0, k);
|
|
3805
|
+
const best = /* @__PURE__ */ new Map();
|
|
3806
|
+
heads.forEach((head, rank) => {
|
|
3807
|
+
const seen = /* @__PURE__ */ new Map([[head, 0]]);
|
|
3808
|
+
let frontier = [head];
|
|
3809
|
+
for (let step = 0; step < reach && frontier.length; step++) {
|
|
3810
|
+
const next = [];
|
|
3811
|
+
for (const id of frontier) {
|
|
3812
|
+
for (const nb of near.get(id) ?? []) {
|
|
3813
|
+
if (seen.has(nb)) continue;
|
|
3814
|
+
seen.set(nb, step + 1);
|
|
3815
|
+
next.push(nb);
|
|
3816
|
+
}
|
|
3817
|
+
}
|
|
3818
|
+
frontier = next;
|
|
3819
|
+
}
|
|
3820
|
+
for (const [id, hops] of seen) {
|
|
3821
|
+
const b = best.get(id);
|
|
3822
|
+
if (!b || hops < b.hops || hops === b.hops && rank < b.rank) best.set(id, { hops, rank });
|
|
3823
|
+
}
|
|
3824
|
+
});
|
|
3825
|
+
const clusters = heads.map((head) => ({ head, members: [] }));
|
|
3826
|
+
const unclustered = [];
|
|
3827
|
+
for (const n of graph.nodes) {
|
|
3828
|
+
const b = best.get(n.id);
|
|
3829
|
+
if (b) clusters[b.rank].members.push({ id: n.id, hops: b.hops, degree: deg(n.id) });
|
|
3830
|
+
else unclustered.push({ id: n.id, degree: deg(n.id) });
|
|
3831
|
+
}
|
|
3832
|
+
for (const c of clusters) c.members.sort((a, b) => a.hops - b.hops || b.degree - a.degree || byCodePoint(a.id, b.id));
|
|
3833
|
+
unclustered.sort((a, b) => b.degree - a.degree || byCodePoint(a.id, b.id));
|
|
3834
|
+
const gaps = [];
|
|
3835
|
+
for (const n of graph.nodes) {
|
|
3836
|
+
if (n.known_of === true) continue;
|
|
3837
|
+
const d = deg(n.id);
|
|
3838
|
+
if (d === 0) gaps.push({ kind: "orphan", id: n.id });
|
|
3839
|
+
if (d === 1) gaps.push({ kind: "near_orphan", id: n.id });
|
|
3840
|
+
if (n.type === "character" && !placed.has(n.id)) gaps.push({ kind: "no_place", id: n.id });
|
|
3841
|
+
if (n.type === "location" && !inhabited.has(n.id)) gaps.push({ kind: "nobody_here", id: n.id });
|
|
3842
|
+
}
|
|
3843
|
+
gaps.sort((a, b) => GAP_ORDER.indexOf(a.kind) - GAP_ORDER.indexOf(b.kind) || byCodePoint(a.id, b.id));
|
|
3844
|
+
return { mode: graph.nodes.length < size ? "gaps" : "graph", size, clusters, unclustered, gaps };
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3749
3847
|
// src/drag.ts
|
|
3750
3848
|
var TYPES = new Set(ELEMENT_TYPES);
|
|
3751
3849
|
function dragField(a, b) {
|
|
@@ -5534,8 +5632,8 @@ var DEFAULT_FORMAT_PLAIN = "{year} {era}";
|
|
|
5534
5632
|
var DEFAULT_FORMAT_INTERCALARY = "{intercalary}, {year} {era}";
|
|
5535
5633
|
var EMPTY_KNOWN = "\uE000";
|
|
5536
5634
|
function renderTemplate(template, values) {
|
|
5537
|
-
let out = template.replace(/\{([a-z_]+)\}/g, (
|
|
5538
|
-
if (!KNOWN_TOKENS.includes(token)) return
|
|
5635
|
+
let out = template.replace(/\{([a-z_]+)\}/g, (whole3, token) => {
|
|
5636
|
+
if (!KNOWN_TOKENS.includes(token)) return whole3;
|
|
5539
5637
|
const v = values[token];
|
|
5540
5638
|
return v == null || v === "" ? EMPTY_KNOWN : v;
|
|
5541
5639
|
});
|
|
@@ -6048,6 +6146,7 @@ export {
|
|
|
6048
6146
|
isTemplate,
|
|
6049
6147
|
isToEveryone,
|
|
6050
6148
|
kindCanWrite,
|
|
6149
|
+
landingOf,
|
|
6051
6150
|
lensesInUse,
|
|
6052
6151
|
lookupWorld,
|
|
6053
6152
|
monthStartSteps,
|
package/dist/waymark.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
openersFor,
|
|
7
7
|
refuseUnknownOptions,
|
|
8
8
|
typeWord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-K7SQUXMR.js";
|
|
10
10
|
|
|
11
11
|
// src/waymark/glyphs.ts
|
|
12
12
|
var MARK_PATH = "M48.8 0.0 43.8 0.4 39.0 1.2 36.0 2.0 33.2 2.9 29.3 4.5 24.8 6.8 20.6 9.5 17.0 12.4 13.6 15.7 10.4 19.4 7.8 23.1 5.8 26.6 4.5 29.3 3.3 32.1 1.8 36.8 0.8 41.2 0.1 46.3 0.0 51.1 0.4 56.2 1.2 61.0 2.0 63.9 2.9 66.8 4.5 70.7 6.8 75.2 9.5 79.4 12.4 82.9 15.7 86.3 19.4 89.5 23.1 92.1 26.6 94.2 29.3 95.5 32.1 96.7 36.8 98.2 41.2 99.2 46.3 99.8 51.1 100.0 56.2 99.6 61.0 98.8 63.9 98.0 66.8 97.1 70.7 95.5 75.2 93.2 79.4 90.4 82.9 87.6 86.3 84.3 89.5 80.5 92.1 76.9 94.2 73.4 95.5 70.7 96.7 67.9 98.2 63.2 99.2 58.7 99.8 53.7 100.0 48.8 99.6 43.8 98.6 38.4 97.1 33.2 95.5 29.3 93.2 24.8 90.4 20.6 87.6 17.0 84.3 13.6 80.5 10.4 76.9 7.8 73.4 5.8 70.7 4.5 67.9 3.3 63.2 1.8 58.7 0.8 53.7 0.1ZM77.5 80.7 74.1 83.4 70.7 85.7 67.0 87.5 64.5 88.6 64.1 88.7 65.7 86.3 67.1 83.9 68.7 80.7 69.9 77.6 72.7 78.5 73.0 78.4ZM22.5 80.7 25.6 79.0 27.3 78.3 30.0 77.6 31.3 80.7 32.8 83.9 34.2 86.3 35.9 88.7 32.9 87.5 29.3 85.7 25.8 83.4ZM51.2 74.5 55.1 74.7 59.9 75.2 64.2 76.0 67.5 76.9 66.0 80.5 64.2 84.0 62.0 87.4 59.6 90.1 55.1 90.9 52.2 91.2 51.2 91.1ZM48.7 74.5 48.8 91.1 47.7 91.2 44.9 90.9 40.3 90.1 38.2 87.8 36.3 85.0 34.2 81.2 32.5 77.0 35.8 76.0 40.5 75.2 44.5 74.7ZM91.1 51.2 91.1 52.9 90.8 56.3 90.1 59.7 89.3 62.5 88.5 64.8 87.2 67.7 85.7 70.7 83.9 73.4 82.0 75.9 79.4 78.9 76.3 77.2 73.8 76.1 76.2 68.8 77.8 62.7 78.7 56.8 79.0 51.2ZM55.8 51.2 67.7 51.2 67.6 55.1 67.2 59.0 66.7 61.5 65.7 65.0 61.0 64.2 55.7 63.6ZM32.5 51.2 44.5 51.2 44.4 63.6 39.7 64.1 34.5 65.0 33.5 61.3 32.9 58.1 32.5 54.2ZM8.8 51.2 21.0 51.2 21.0 53.3 21.4 56.6 22.7 64.0 23.8 68.4 25.0 72.1 26.6 75.9 23.7 77.2 20.6 78.9 18.5 76.7 16.5 74.1 14.8 71.5 13.4 69.1 12.1 66.3 11.0 63.6 10.1 60.5 9.4 57.3 8.9 53.5 8.8 51.3ZM36.2 27.0 39.5 27.5 44.5 28.2 44.4 48.8 32.4 48.7 32.8 44.5 33.6 39.1 35.0 32.0ZM63.9 26.9 65.2 32.1 66.6 39.2 67.4 44.8 67.7 48.7 55.8 48.8 55.7 28.1 60.5 27.5ZM74.8 23.4 76.9 22.5 79.4 21.1 82.0 24.0 84.8 27.8 86.2 30.3 87.5 32.9 88.6 35.4 89.5 38.1 90.3 41.2 90.8 44.0 91.1 47.0 91.1 48.8 79.0 48.7 78.7 44.6 78.0 39.3 76.5 31.2 74.7 23.5ZM25.5 23.5 25.5 23.7 24.5 26.8 23.7 30.2 22.4 36.6 21.5 42.5 21.1 48.7 8.8 48.8 8.8 47.0 9.2 43.7 9.8 40.8 10.5 38.1 11.5 35.2 12.4 32.9 13.8 30.2 15.2 27.8 17.9 24.0 20.6 21.1 23.1 22.5ZM64.1 11.3 67.0 12.4 70.7 14.3 74.1 16.5 77.5 19.3 75.6 20.3 73.2 21.5 70.0 22.6 68.7 19.2 67.1 16.1 65.7 13.6ZM35.9 11.3 34.2 13.6 32.8 16.1 31.3 19.2 30.0 22.5 27.9 21.9 26.4 21.3 22.5 19.3 25.8 16.5 29.3 14.3 32.9 12.4 35.4 11.4ZM51.2 8.8 52.2 8.8 55.1 9.0 59.6 9.9 61.7 12.2 64.2 16.0 66.0 19.5 67.6 23.3 64.3 24.3 59.4 25.2 56.2 25.6 51.2 25.5ZM48.8 8.8 48.7 25.5 44.2 25.6 40.6 25.2 36.4 24.5 32.4 23.2 33.9 19.5 35.7 16.0 38.2 12.2 40.3 9.9 44.9 9.0 47.7 8.8Z";
|