@onlyworlds/sdk 4.126.0 → 4.127.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 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.102** (canonical 00.33.00).
3
+ **Current as of**: SDK **4.x** · schema-dist **v0.34.0-dist.103** (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,21 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.127.0] - 2026-11-02
9
+
10
+ ### Added
11
+
12
+ - **`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`.
13
+ - **`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`.
14
+
15
+ ### Changed
16
+
17
+ - **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).
18
+ - **`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.
19
+ - **`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.
20
+ - **`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.
21
+ - **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.
22
+
8
23
  ## [4.126.0] - 2026-11-01
9
24
 
10
25
  ### 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.33.0-dist.102** — canonical schema **00.33.00**, published 2026-11-01.
3
+ **Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.34.0-dist.103** — 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.33.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.33.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";
@@ -5658,6 +5662,55 @@ declare function degreeOf(graph: OwWorldGraph): Record<string, number>;
5658
5662
  */
5659
5663
  declare function outDegreeOf(graph: OwWorldGraph): Record<string, number>;
5660
5664
 
5665
+ /** Which part a door draws first: `gaps` under the size, `graph` at it and above. */
5666
+ type OwLandingMode = 'gaps' | 'graph';
5667
+ /** `heads` (default 5), `hops` (default 1) and `size` (default 24), each a whole number, 1 or more; null is the default. */
5668
+ interface OwLandingOptions {
5669
+ heads?: number | null;
5670
+ hops?: number | null;
5671
+ size?: number | null;
5672
+ }
5673
+ interface OwLandingMember {
5674
+ id: string;
5675
+ /** Steps from the head: 0 for the head itself. */
5676
+ hops: number;
5677
+ degree: number;
5678
+ }
5679
+ interface OwLandingCluster {
5680
+ head: string;
5681
+ /** The head first, then by hops, then by degree (highest first), then by id in code point order. */
5682
+ members: OwLandingMember[];
5683
+ }
5684
+ type OwLandingGapKind = 'orphan' | 'near_orphan' | 'no_place' | 'nobody_here';
5685
+ interface OwLandingGap {
5686
+ kind: OwLandingGapKind;
5687
+ id: string;
5688
+ }
5689
+ interface OwLanding {
5690
+ mode: OwLandingMode;
5691
+ /** The size the mode was read at. */
5692
+ size: number;
5693
+ clusters: OwLandingCluster[];
5694
+ /** Every node no head reaches within `hops`, by degree (highest first), then by id. */
5695
+ unclustered: {
5696
+ id: string;
5697
+ degree: number;
5698
+ }[];
5699
+ /** In the kinds' order (orphan, near_orphan, no_place, nobody_here), then by id; a node can carry several. */
5700
+ gaps: OwLandingGap[];
5701
+ }
5702
+ /**
5703
+ * A world's first picture at a door, from the graph `worldGraph` answered for the visitor, so it holds exactly what
5704
+ * that reader may see. The mode is `gaps` when the graph has fewer nodes than `size`, else `graph`; both parts are
5705
+ * always read. Heads: the Characters with an edge, most linked first (`degreeOf`'s count), ties by id in code point
5706
+ * order, at most `heads`, never a known-of node. A node within `hops` steps of a head (either way along an edge)
5707
+ * joins the nearest head, a tie going to the higher-ranked one. Gaps: the links report's orphans (degree 0) and
5708
+ * near-orphans (degree 1), a Character whose `location` names no Location node (`no_place`), a Location no
5709
+ * Character's `location` names (`nobody_here`); a known-of node is never a gap. The same graph and options give the
5710
+ * same answer, byte for byte. An unknown option, or one that is not a whole number of 1 or more, is refused by name.
5711
+ */
5712
+ declare function landingOf(graph: OwWorldGraph, options?: OwLandingOptions | null): OwLanding;
5713
+
5661
5714
  /** One word pair of a names map: `one` for a single thing, `many` for a plural (absent: `one`). */
5662
5715
  interface OwWordPair {
5663
5716
  one: string;
@@ -7007,4 +7060,4 @@ declare class TokenResource {
7007
7060
  getEncryptionInfo(): Promise<EncryptionInfo>;
7008
7061
  }
7009
7062
 
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 };
7063
+ 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-EVHGSTUB.js";
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
- this.inView = /* @__PURE__ */ new Map();
2906
- this.inFull = /* @__PURE__ */ new Map();
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 (!this.inFull.has(t)) this.inFull.set(t, []);
2963
- this.inFull.get(t).push(id);
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 (!this.inView.has(t)) this.inView.set(t, []);
2968
- this.inView.get(t).push(id);
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.inView.get(f) ?? []]) if (!excluded(t)) landed.add(t);
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.inFull.get(f) ?? []) consider(t);
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.x_review_proposed !== void 0 && el.x_review_proposed !== null;
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));
@@ -3746,6 +3755,94 @@ function outDegreeOf(graph) {
3746
3755
  return Object.fromEntries([...targets].map(([id, t]) => [id, t.size]));
3747
3756
  }
3748
3757
 
3758
+ // src/landing.ts
3759
+ var OPTION_KEYS = ["heads", "hops", "size"];
3760
+ var GAP_ORDER = ["orphan", "near_orphan", "no_place", "nobody_here"];
3761
+ function whole2(opts, key, fallback) {
3762
+ const v = valueOf(opts, key);
3763
+ if (v === null) return fallback;
3764
+ if (typeof v !== "number" || !Number.isInteger(v) || v < 1) {
3765
+ throw new RangeError(`landingOf: ${key} is a whole number, 1 or more; got ${JSON.stringify(v) ?? typeof v}.`);
3766
+ }
3767
+ return v;
3768
+ }
3769
+ function landingOf(graph, options) {
3770
+ if (!isBody2(graph) || !Array.isArray(graph.nodes) || !Array.isArray(graph.edges)) {
3771
+ throw new TypeError("landingOf: graph is what worldGraph answers, an object with nodes and edges lists.");
3772
+ }
3773
+ if (options !== void 0 && options !== null && !isBody2(options)) {
3774
+ throw new TypeError(`landingOf: options is an object, such as { heads: 5 }; got ${JSON.stringify(options) ?? typeof options}.`);
3775
+ }
3776
+ refuseUnknownOptions("landingOf", options, OPTION_KEYS);
3777
+ const opts = isBody2(options) ? options : {};
3778
+ const k = whole2(opts, "heads", 5);
3779
+ const reach = whole2(opts, "hops", 1);
3780
+ const size = whole2(opts, "size", 24);
3781
+ const degree = new Map(graph.nodes.map((n) => [n.id, 0]));
3782
+ const near = new Map(graph.nodes.map((n) => [n.id, /* @__PURE__ */ new Set()]));
3783
+ const type = new Map(graph.nodes.map((n) => [n.id, n.type]));
3784
+ const add = (id) => {
3785
+ const d = degree.get(id);
3786
+ if (d !== void 0) degree.set(id, d + 1);
3787
+ };
3788
+ const placed = /* @__PURE__ */ new Set();
3789
+ const inhabited = /* @__PURE__ */ new Set();
3790
+ for (const e of graph.edges) {
3791
+ add(e.source);
3792
+ if (e.target !== e.source) add(e.target);
3793
+ if (e.target !== e.source && near.has(e.source) && near.has(e.target)) {
3794
+ near.get(e.source).add(e.target);
3795
+ near.get(e.target).add(e.source);
3796
+ }
3797
+ if (e.field === "location" && type.get(e.source) === "character" && type.get(e.target) === "location") {
3798
+ placed.add(e.source);
3799
+ inhabited.add(e.target);
3800
+ }
3801
+ }
3802
+ const deg = (id) => degree.get(id) ?? 0;
3803
+ 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);
3804
+ const best = /* @__PURE__ */ new Map();
3805
+ heads.forEach((head, rank) => {
3806
+ const seen = /* @__PURE__ */ new Map([[head, 0]]);
3807
+ let frontier = [head];
3808
+ for (let step = 0; step < reach && frontier.length; step++) {
3809
+ const next = [];
3810
+ for (const id of frontier) {
3811
+ for (const nb of near.get(id) ?? []) {
3812
+ if (seen.has(nb)) continue;
3813
+ seen.set(nb, step + 1);
3814
+ next.push(nb);
3815
+ }
3816
+ }
3817
+ frontier = next;
3818
+ }
3819
+ for (const [id, hops] of seen) {
3820
+ const b = best.get(id);
3821
+ if (!b || hops < b.hops || hops === b.hops && rank < b.rank) best.set(id, { hops, rank });
3822
+ }
3823
+ });
3824
+ const clusters = heads.map((head) => ({ head, members: [] }));
3825
+ const unclustered = [];
3826
+ for (const n of graph.nodes) {
3827
+ const b = best.get(n.id);
3828
+ if (b) clusters[b.rank].members.push({ id: n.id, hops: b.hops, degree: deg(n.id) });
3829
+ else unclustered.push({ id: n.id, degree: deg(n.id) });
3830
+ }
3831
+ for (const c of clusters) c.members.sort((a, b) => a.hops - b.hops || b.degree - a.degree || byCodePoint(a.id, b.id));
3832
+ unclustered.sort((a, b) => b.degree - a.degree || byCodePoint(a.id, b.id));
3833
+ const gaps = [];
3834
+ for (const n of graph.nodes) {
3835
+ if (n.known_of === true) continue;
3836
+ const d = deg(n.id);
3837
+ if (d === 0) gaps.push({ kind: "orphan", id: n.id });
3838
+ if (d === 1) gaps.push({ kind: "near_orphan", id: n.id });
3839
+ if (n.type === "character" && !placed.has(n.id)) gaps.push({ kind: "no_place", id: n.id });
3840
+ if (n.type === "location" && !inhabited.has(n.id)) gaps.push({ kind: "nobody_here", id: n.id });
3841
+ }
3842
+ gaps.sort((a, b) => GAP_ORDER.indexOf(a.kind) - GAP_ORDER.indexOf(b.kind) || byCodePoint(a.id, b.id));
3843
+ return { mode: graph.nodes.length < size ? "gaps" : "graph", size, clusters, unclustered, gaps };
3844
+ }
3845
+
3749
3846
  // src/drag.ts
3750
3847
  var TYPES = new Set(ELEMENT_TYPES);
3751
3848
  function dragField(a, b) {
@@ -5534,8 +5631,8 @@ var DEFAULT_FORMAT_PLAIN = "{year} {era}";
5534
5631
  var DEFAULT_FORMAT_INTERCALARY = "{intercalary}, {year} {era}";
5535
5632
  var EMPTY_KNOWN = "\uE000";
5536
5633
  function renderTemplate(template, values) {
5537
- let out = template.replace(/\{([a-z_]+)\}/g, (whole2, token) => {
5538
- if (!KNOWN_TOKENS.includes(token)) return whole2;
5634
+ let out = template.replace(/\{([a-z_]+)\}/g, (whole3, token) => {
5635
+ if (!KNOWN_TOKENS.includes(token)) return whole3;
5539
5636
  const v = values[token];
5540
5637
  return v == null || v === "" ? EMPTY_KNOWN : v;
5541
5638
  });
@@ -6048,6 +6145,7 @@ export {
6048
6145
  isTemplate,
6049
6146
  isToEveryone,
6050
6147
  kindCanWrite,
6148
+ landingOf,
6051
6149
  lensesInUse,
6052
6150
  lookupWorld,
6053
6151
  monthStartSteps,
package/dist/waymark.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  openersFor,
7
7
  refuseUnknownOptions,
8
8
  typeWord
9
- } from "./chunk-EVHGSTUB.js";
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.126.0",
3
+ "version": "4.127.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {