/** Every element carries these. The extension index signature admits namespaced * pass-through fields (atlas_* / shadow_* / x_*) returned verbatim by the server. * Derived from base_properties.yaml: `World` is dropped (the API rejects it in * bodies -- the key determines the world) and the eight server-managed fields are * added, since they ride every wire body and appear in no element YAML; `known_of` * rides only a stub, `x_served_trimmed` only a message or a lens whose ids were left out. */ interface OwElementBase { /** Element type slug (server-managed, read-only). */ type: string; /** Unique identifier for the element, a UUID. New ids are minted as uuidv7; ids minted earlier as uuidv4 remain valid. */ id: string; /** Name of the element. */ name: string; /** Any kind of details about the element. */ description?: string; /** The top level classification of the element within its type. */ supertype?: string; /** The sub level classification through which the element is further sorted within its type. */ subtype?: string; /** URL to an image representing the element. */ image_url?: string; /** Creation timestamp (server-managed, read-only). */ created_at?: string; /** Last-update timestamp (server-managed, read-only). */ updated_at?: string; /** Per-world change cursor, stamped on every write (server-managed, read-only). */ change_seq?: number; /** The membership that created this element (server-managed, read-only); null for the world's owner and for anything created before memberships existed. */ created_by?: string | null; /** The membership whose write last changed this element (server-managed, read-only; served to the world's members only, absent for the public reader); null for the world's owner and for anything last changed before writes recorded it. */ changed_by?: string | null; /** The door of the last write (server-managed, read-only; served to the world's members only, absent for the public reader): `seat` (an AI seat), `mcp`, `declared` (a client that sent X-OW-Agent), then `api`, `v1`, `sync`, `server` (keel's own writes) or `site` (the owner signed in on onlyworlds.com). The first three are the doors the platform marks as an AI's. Null for anything last changed before writes recorded it. */ changed_via?: 'seat' | 'mcp' | 'declared' | 'api' | 'v1' | 'sync' | 'server' | 'site' | null; /** The name the client gave in the X-OW-Client header on the last write (server-managed, read-only; served to the world's members only, absent for the public reader): lower case letters, digits and hyphens, 1 to 32 characters, such as `sdk` or `atlas`. It is the client's claim about itself, never proof, and says nothing about whether an agent drove the write (that is `changed_via`). Null when the last write sent no name or one outside the rule, for keel's own writes, and for anything last changed before names were recorded. Sent in a write it is ignored. This SDK sends its `client` option, `sdk` by default. */ changed_client?: string | null; /** Each tool that wrote this element, with the time of its last write there (server-managed, read-only): one key per tool, the name it gave in X-OW-Client or else the door word of that write (`site`, `api`, `mcp`, ...), each value the `updated_at` that write left; at most 16 keys, the one with the oldest time dropped past that. Stamped from 2026-10-29 on, so an element not written since carries none. Served to the world's members only: absent for the public reader, on a known-of stub, in the change feed's bodies and in a world file. */ doors?: Record; /** Present, and true, only when the world's owner or a co-builder hid this element and this reader still sees it (server-managed, read-only): the owner, a co-builder, a key the owner minted, or the member who made it; to every other reader the element does not exist. Absent otherwise, whatever `fields` asked; on the read, the list, the change feed's upserts and MCP, never in the download, world sync or v1. Sent on a create (a POST, a PUT of a new id, a bulk item that creates), `hidden: true` creates the element hidden, from the owner's keys or a co-builder's; any other key gets 403 `hidden_not_allowed` and nothing is created. On any other write it is ignored: hide and unhide with hide() and unhide(). */ hidden?: true; /** Present, and true, only on a stub (server-managed, read-only): an element a guest or player reaches only through its own Character's sheet. A stub keeps id, type, name, description, supertype, subtype, image_url, created_at, updated_at and change_seq, and the fields its type lists in PUBLIC_FIELDS with their values; every other field reads unset ("", null, []), created_by/changed_by/changed_via null, no extension fields, and its files are 404. Its empties are not values and not a deletion: never write a stub back. Absent: the element is whole. See isKnownOf(). */ known_of?: true; /** Served only, on a message or a lens, never which ids or how many. On a message (the message profile, schema-dist `profiles/message.md`): present when ids in `characters` or `narrator` were left out because this reader may not see them, naming those fields (`characters` before `narrator`). An empty `characters` with `characters` named here is to someone the reader cannot see, never to everyone; a null `narrator` with `narrator` named is a sender the reader cannot see. On a lens (a Construct with supertype Lens, schema-dist `profiles/lens.md`): present when anchor ids were left out because this reader may not see them, naming those anchor fields in the schema's order, then `notes` when an anchor's note was left out of `x_lens` with it. A lens whose anchor fields are empty and that carries the mark is anchored (it resolves to nothing for this reader), never a filter over the whole world. Absent when nothing was left out, and always for the keyless public reader; on a lens also always for the world's owner, its co-builders and keys the owner minted. A write that carries it is refused (422 `served_trimmed_not_writable`): never send it back. See hasUnseenRecipients(), senderStatus() and resolveLens(). */ x_served_trimmed?: string[]; /** Namespaced extension fields (atlas_* / shadow_* / x_*), returned verbatim. */ [ext: string]: unknown; } type ElementType = 'ability' | 'character' | 'collective' | 'construct' | 'creature' | 'event' | 'family' | 'institution' | 'language' | 'law' | 'location' | 'map' | 'marker' | 'narrative' | 'object' | 'phenomenon' | 'pin' | 'relation' | 'species' | 'title' | 'trait' | 'zone'; declare const ELEMENT_TYPES: ElementType[]; /** Canonical OnlyWorlds schema version. Source: the `canonical:` value of the pinned * distribution's VERSION file (see the provenance block at the top of this file). */ declare const ONLYWORLDS_VERSION: "00.34.01"; /** The four colour groups, named by their colour. A visual aid for drawing the 22 types, * not part of the standard: colour carries the group, ELEMENT_ICONS carries the type. */ type ElementGroup = 'blue' | 'green' | 'pink' | 'amber'; /** Per-type colour group. Source: the distribution's `presentation.json` sidecar * (`types..family`): first-party drawing DEFAULTS, NOT part of the council-governed * OnlyWorlds standard, and explicitly overridable by any consumer. */ declare const ELEMENT_GROUPS: Record; /** The four colour groups in the distribution's order (`colors.order`), the order the * palette was checked for colour-vision separation in. */ declare const GROUP_ORDER: readonly ElementGroup[]; /** Each colour group's hex per surface mode, from the sidecar's `colors`: `light` assumes * near-white surfaces, `dark` near-black (measured against #0a0a0a). Checked for * colour-vision separation; dark-mode pairs sit in the 6-8 deltaE floor band, so show * the icon and label with the colour, never the colour alone. */ declare const GROUP_COLORS: Record; /** Material Symbols icon name per type. Source: the distribution's `presentation.json` sidecar. */ declare const ELEMENT_ICONS: Record; /** The fields onlyworlds.com shows on a known-of element (`known_of: true`, see isKnownOf) * besides the base fields, with their values; every other field of a stub reads unset. * Platform behaviour, not a default to override. Source: the distribution's * `presentation.json` sidecar, `types..public`. */ declare const PUBLIC_FIELDS: { readonly ability: readonly []; readonly character: readonly ["physicality", "height", "weight", "species", "reputation"]; readonly collective: readonly []; readonly construct: readonly []; readonly creature: readonly []; readonly event: readonly []; readonly family: readonly []; readonly institution: readonly []; readonly language: readonly []; readonly law: readonly []; readonly location: readonly []; readonly map: readonly []; readonly marker: readonly []; readonly narrative: readonly []; readonly object: readonly []; readonly phenomenon: readonly []; readonly pin: readonly []; readonly relation: readonly []; readonly species: readonly []; readonly title: readonly []; readonly trait: readonly []; readonly zone: readonly []; }; /** Field grouping for display. DERIVED from the canonical schema's own document * structure (top-level property groups, document order = display order). */ interface SectionInfo { name: string; order: number; fields: string[]; } declare const ELEMENT_SECTIONS: Record; /** The room profile's pairs (schema-dist `profiles/room.md`, a convention on the 22 types, * never a change to the standard): a parlor's line, board entry, work item, spec, heart, * vote, sitting or member card. An element is a room element when its type and supertype, * each trimmed and compared without regard to case, match one of these AND it carries the * mark (ROOM_MARK, a non-empty string); a pair without the mark is lore (a novel's letters * are Narratives with supertype Message). A lore view leaves room elements out unless the * person asks; the room's own views show them whole. Match with isRoomElement. Source: * `profiles/room.fixture.json`'s `pairs`, checked against the page's table at codegen. */ declare const ROOM_PAIRS: ReadonlyArray<{ readonly type: ElementType; readonly supertype: string; }>; /** The charter profile's three pairs (schema-dist `profiles/charter.md`): the Charter (the rules here), the * Guide (start here) and the Domains (the places in the world), each with the aid it is. An element is a * reading aid when its type and supertype, each trimmed and compared without regard to case, match one * of these AND it carries the mark `x_charter_of`, read by presence: match with isCharterElement, read * the packet with charterOf. Source: `profiles/charter.fixture.json`'s `pairs`, checked against the * page's table and the lens fixture's reading_aid_pairs. */ declare const CHARTER_PAIRS: ReadonlyArray<{ readonly type: ElementType; readonly supertype: string; readonly aid: 'charter' | 'guide' | 'domain'; }>; /** A row of views.json: how elements of one kind are shown. */ interface OwViewRow { /** The row's own name, distinct in the table. */ readonly id: string; /** What the row matches: a type, a type with a supertype, or a profile's pair (`type/Supertype`), which * matches only with that profile's mark, by its own reader (room: isRoomElement; charter: isCharterElement). */ readonly kind: { readonly type: string; readonly supertype?: string; } | { readonly profile: string; readonly pair: string; }; /** The page that defines the kind. */ readonly from: string; /** The fields that give the one sentence, the first that holds something winning. */ readonly sentence?: readonly string[]; /** The fields shown open first, in order. */ readonly lead?: readonly string[]; /** The fields shown folded, each under its label. */ readonly fold?: readonly { readonly field: string; readonly label: string; }[]; /** The layout, one of the table's `layouts`; `by` the link a conversation follows. */ readonly layout: { readonly name: string; readonly by?: string; }; /** Marks this kind's page shows at its head after the table's own banners. */ readonly banner?: readonly string[]; } /** views.json without its `_meta`: the banners every page shows, the layouts, the rows. */ interface OwViewsTable { readonly version: 3; readonly banners: readonly { readonly mark: string; readonly defined_by: string; }[]; readonly layouts: { readonly [name: string]: string; }; readonly rows: readonly OwViewRow[]; } /** The review profile's label (schema-dist `profiles/review.md`, rule 1): the words a reader that * hands a world on (a context for an AI, a pack, a share) puts on each proposed element it keeps, * one whose `x_review_proposed` is present (a doubt, rule 4, included; an empty mark is settled). * buildAskContext writes it on the element's first line. Source: rule 1's own sentence, read at * codegen. */ declare const REVIEW_PROPOSED_LABEL: "proposed, not yet reviewed"; /** The message profile's pair (schema-dist `profiles/message.md`, a convention on the 22 types, * never a change to the standard): a message between a world's members is a Narrative with this * supertype, the type and supertype each trimmed and compared without regard to case. Match with * isMessage. Source: `profiles/message.fixture.json`'s `pair`, checked against the page and against * ROOM_PAIRS at codegen. */ declare const MESSAGE_PAIR: { readonly type: ElementType; readonly supertype: string; }; /** The message profile's Note: a member's own line in the world, never a message (addressed to * nobody, never unread, in no thread), a Narrative with this supertype, matched as MESSAGE_PAIR * is. Match with isNote. Source: `profiles/message.fixture.json`'s `note_pair`, checked against the * page at codegen. */ declare const NOTE_PAIR: { readonly type: ElementType; readonly supertype: string; }; /** Field type definitions for OnlyWorlds elements. */ type FieldType = 'text' | 'integer' /** * @deprecated Emitted by nothing, and scheduled for removal in 5.0.0. * * No `FIELD_SCHEMA` entry has ever carried this type, in the entire history of * this repository. It was meant to surface the schema's `maximum:` constraint, * and that constraint is **advisory**: keel declares no `MaxValueValidator` and * the wire stores `charisma: 9999` against a `maximum: 100` field (201, verbatim). * The walk's schema.json carries the bounds as display data (a slider's range), * never as a rule, so this type would promise what no field keeps. A public type * member meaning "hint the wire ignores" is one consumers read as validation. */ | 'integer_max' | 'single_link' | 'multi_link'; /** Field metadata structure. */ interface FieldInfo { type: FieldType; target?: string; /** @deprecated Never populated; removed in 5.0.0. See `FieldType.integer_max`. */ max?: number; required?: boolean; } declare const FIELD_SCHEMA: { readonly ability: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly activation: { readonly type: "text"; }; readonly duration: { readonly type: "integer"; }; readonly potency: { readonly type: "integer"; }; readonly range: { readonly type: "integer"; }; readonly effects: { readonly type: "multi_link"; readonly target: "phenomenon"; }; readonly challenges: { readonly type: "text"; }; readonly talents: { readonly type: "multi_link"; readonly target: "trait"; }; readonly requisites: { readonly type: "multi_link"; readonly target: "construct"; }; readonly prevalence: { readonly type: "text"; }; readonly tradition: { readonly type: "single_link"; readonly target: "construct"; }; readonly source: { readonly type: "single_link"; readonly target: "phenomenon"; }; readonly locus: { readonly type: "single_link"; readonly target: "location"; }; readonly instruments: { readonly type: "multi_link"; readonly target: "object"; }; readonly systems: { readonly type: "multi_link"; readonly target: "construct"; }; }; readonly character: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly physicality: { readonly type: "text"; }; readonly mentality: { readonly type: "text"; }; readonly height: { readonly type: "integer"; }; readonly weight: { readonly type: "integer"; }; readonly species: { readonly type: "multi_link"; readonly target: "species"; }; readonly traits: { readonly type: "multi_link"; readonly target: "trait"; }; readonly abilities: { readonly type: "multi_link"; readonly target: "ability"; }; readonly background: { readonly type: "text"; }; readonly motivations: { readonly type: "text"; }; readonly birth_date: { readonly type: "integer"; }; readonly birthplace: { readonly type: "single_link"; readonly target: "location"; }; readonly languages: { readonly type: "multi_link"; readonly target: "language"; }; readonly reputation: { readonly type: "text"; }; readonly location: { readonly type: "single_link"; readonly target: "location"; }; readonly objects: { readonly type: "multi_link"; readonly target: "object"; }; readonly institutions: { readonly type: "multi_link"; readonly target: "institution"; }; readonly charisma: { readonly type: "integer"; }; readonly coercion: { readonly type: "integer"; }; readonly competence: { readonly type: "integer"; }; readonly compassion: { readonly type: "integer"; }; readonly creativity: { readonly type: "integer"; }; readonly courage: { readonly type: "integer"; }; readonly family: { readonly type: "multi_link"; readonly target: "family"; }; readonly friends: { readonly type: "multi_link"; readonly target: "character"; }; readonly rivals: { readonly type: "multi_link"; readonly target: "character"; }; readonly level: { readonly type: "integer"; }; readonly hit_points: { readonly type: "integer"; }; readonly STR: { readonly type: "integer"; }; readonly DEX: { readonly type: "integer"; }; readonly CON: { readonly type: "integer"; }; readonly INT: { readonly type: "integer"; }; readonly WIS: { readonly type: "integer"; }; readonly CHA: { readonly type: "integer"; }; }; readonly collective: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly composition: { readonly type: "text"; }; readonly count: { readonly type: "integer"; }; readonly formation_date: { readonly type: "integer"; }; readonly operator: { readonly type: "single_link"; readonly target: "institution"; }; readonly equipment: { readonly type: "multi_link"; readonly target: "object"; }; readonly activity: { readonly type: "text"; }; readonly disposition: { readonly type: "text"; }; readonly state: { readonly type: "text"; }; readonly abilities: { readonly type: "multi_link"; readonly target: "ability"; }; readonly symbolism: { readonly type: "multi_link"; readonly target: "construct"; }; readonly species: { readonly type: "multi_link"; readonly target: "species"; }; readonly characters: { readonly type: "multi_link"; readonly target: "character"; }; readonly creatures: { readonly type: "multi_link"; readonly target: "creature"; }; readonly phenomena: { readonly type: "multi_link"; readonly target: "phenomenon"; }; }; readonly construct: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly rationale: { readonly type: "text"; }; readonly history: { readonly type: "text"; }; readonly status: { readonly type: "text"; }; readonly reach: { readonly type: "text"; }; readonly start_date: { readonly type: "integer"; }; readonly end_date: { readonly type: "integer"; }; readonly founder: { readonly type: "single_link"; readonly target: "character"; }; readonly custodian: { readonly type: "single_link"; readonly target: "institution"; }; readonly characters: { readonly type: "multi_link"; readonly target: "character"; }; readonly objects: { readonly type: "multi_link"; readonly target: "object"; }; readonly locations: { readonly type: "multi_link"; readonly target: "location"; }; readonly species: { readonly type: "multi_link"; readonly target: "species"; }; readonly creatures: { readonly type: "multi_link"; readonly target: "creature"; }; readonly institutions: { readonly type: "multi_link"; readonly target: "institution"; }; readonly traits: { readonly type: "multi_link"; readonly target: "trait"; }; readonly collectives: { readonly type: "multi_link"; readonly target: "collective"; }; readonly zones: { readonly type: "multi_link"; readonly target: "zone"; }; readonly abilities: { readonly type: "multi_link"; readonly target: "ability"; }; readonly phenomena: { readonly type: "multi_link"; readonly target: "phenomenon"; }; readonly languages: { readonly type: "multi_link"; readonly target: "language"; }; readonly families: { readonly type: "multi_link"; readonly target: "family"; }; readonly relations: { readonly type: "multi_link"; readonly target: "relation"; }; readonly titles: { readonly type: "multi_link"; readonly target: "title"; }; readonly constructs: { readonly type: "multi_link"; readonly target: "construct"; }; readonly events: { readonly type: "multi_link"; readonly target: "event"; }; readonly narratives: { readonly type: "multi_link"; readonly target: "narrative"; }; }; readonly creature: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly appearance: { readonly type: "text"; }; readonly weight: { readonly type: "integer"; }; readonly height: { readonly type: "integer"; }; readonly species: { readonly type: "multi_link"; readonly target: "species"; }; readonly habits: { readonly type: "text"; }; readonly demeanor: { readonly type: "text"; }; readonly traits: { readonly type: "multi_link"; readonly target: "trait"; }; readonly abilities: { readonly type: "multi_link"; readonly target: "ability"; }; readonly languages: { readonly type: "multi_link"; readonly target: "language"; }; readonly status: { readonly type: "text"; }; readonly birth_date: { readonly type: "integer"; }; readonly location: { readonly type: "single_link"; readonly target: "location"; }; readonly zone: { readonly type: "single_link"; readonly target: "zone"; }; readonly challenge_rating: { readonly type: "integer"; }; readonly hit_points: { readonly type: "integer"; }; readonly armor_class: { readonly type: "integer"; }; readonly speed: { readonly type: "integer"; }; readonly actions: { readonly type: "multi_link"; readonly target: "ability"; }; }; readonly event: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly history: { readonly type: "text"; }; readonly challenges: { readonly type: "text"; }; readonly consequences: { readonly type: "text"; }; readonly start_date: { readonly type: "integer"; }; readonly end_date: { readonly type: "integer"; }; readonly triggers: { readonly type: "multi_link"; readonly target: "event"; }; readonly characters: { readonly type: "multi_link"; readonly target: "character"; }; readonly objects: { readonly type: "multi_link"; readonly target: "object"; }; readonly locations: { readonly type: "multi_link"; readonly target: "location"; }; readonly species: { readonly type: "multi_link"; readonly target: "species"; }; readonly creatures: { readonly type: "multi_link"; readonly target: "creature"; }; readonly institutions: { readonly type: "multi_link"; readonly target: "institution"; }; readonly traits: { readonly type: "multi_link"; readonly target: "trait"; }; readonly collectives: { readonly type: "multi_link"; readonly target: "collective"; }; readonly zones: { readonly type: "multi_link"; readonly target: "zone"; }; readonly abilities: { readonly type: "multi_link"; readonly target: "ability"; }; readonly phenomena: { readonly type: "multi_link"; readonly target: "phenomenon"; }; readonly languages: { readonly type: "multi_link"; readonly target: "language"; }; readonly families: { readonly type: "multi_link"; readonly target: "family"; }; readonly relations: { readonly type: "multi_link"; readonly target: "relation"; }; readonly titles: { readonly type: "multi_link"; readonly target: "title"; }; readonly constructs: { readonly type: "multi_link"; readonly target: "construct"; }; }; readonly family: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly spirit: { readonly type: "text"; }; readonly history: { readonly type: "text"; }; readonly traditions: { readonly type: "multi_link"; readonly target: "construct"; }; readonly traits: { readonly type: "multi_link"; readonly target: "trait"; }; readonly abilities: { readonly type: "multi_link"; readonly target: "ability"; }; readonly languages: { readonly type: "multi_link"; readonly target: "language"; }; readonly ancestors: { readonly type: "multi_link"; readonly target: "character"; }; readonly reputation: { readonly type: "text"; }; readonly estates: { readonly type: "multi_link"; readonly target: "location"; }; readonly governs: { readonly type: "multi_link"; readonly target: "institution"; }; readonly heirlooms: { readonly type: "multi_link"; readonly target: "object"; }; readonly creatures: { readonly type: "multi_link"; readonly target: "creature"; }; }; readonly institution: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly doctrine: { readonly type: "text"; }; readonly founding_date: { readonly type: "integer"; }; readonly parent_institution: { readonly type: "single_link"; readonly target: "institution"; }; readonly zones: { readonly type: "multi_link"; readonly target: "zone"; }; readonly objects: { readonly type: "multi_link"; readonly target: "object"; }; readonly creatures: { readonly type: "multi_link"; readonly target: "creature"; }; readonly status: { readonly type: "text"; }; readonly allies: { readonly type: "multi_link"; readonly target: "institution"; }; readonly adversaries: { readonly type: "multi_link"; readonly target: "institution"; }; readonly constructs: { readonly type: "multi_link"; readonly target: "construct"; }; }; readonly language: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly phonology: { readonly type: "text"; }; readonly grammar: { readonly type: "text"; }; readonly lexicon: { readonly type: "text"; }; readonly writing: { readonly type: "text"; }; readonly classification: { readonly type: "single_link"; readonly target: "construct"; }; readonly status: { readonly type: "text"; }; readonly spread: { readonly type: "multi_link"; readonly target: "location"; }; readonly dialects: { readonly type: "multi_link"; readonly target: "language"; }; }; readonly law: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly declaration: { readonly type: "text"; }; readonly purpose: { readonly type: "text"; }; readonly date: { readonly type: "integer"; }; readonly parent_law: { readonly type: "single_link"; readonly target: "law"; }; readonly penalties: { readonly type: "multi_link"; readonly target: "construct"; }; readonly author: { readonly type: "single_link"; readonly target: "institution"; }; readonly locations: { readonly type: "multi_link"; readonly target: "location"; }; readonly zones: { readonly type: "multi_link"; readonly target: "zone"; }; readonly prohibitions: { readonly type: "multi_link"; readonly target: "construct"; }; readonly adjudicators: { readonly type: "multi_link"; readonly target: "title"; }; readonly enforcers: { readonly type: "multi_link"; readonly target: "title"; }; }; readonly location: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly form: { readonly type: "text"; }; readonly function: { readonly type: "text"; }; readonly founding_date: { readonly type: "integer"; }; readonly parent_location: { readonly type: "single_link"; readonly target: "location"; }; readonly vehicle: { readonly type: "single_link"; readonly target: "object"; }; readonly populations: { readonly type: "multi_link"; readonly target: "collective"; }; readonly political_climate: { readonly type: "text"; }; readonly primary_power: { readonly type: "single_link"; readonly target: "institution"; }; readonly governing_title: { readonly type: "single_link"; readonly target: "title"; }; readonly secondary_powers: { readonly type: "multi_link"; readonly target: "institution"; }; readonly zone: { readonly type: "single_link"; readonly target: "zone"; }; readonly rival: { readonly type: "single_link"; readonly target: "location"; }; readonly partner: { readonly type: "single_link"; readonly target: "location"; }; readonly customs: { readonly type: "text"; }; readonly founders: { readonly type: "multi_link"; readonly target: "character"; }; readonly cults: { readonly type: "multi_link"; readonly target: "construct"; }; readonly delicacies: { readonly type: "multi_link"; readonly target: "species"; }; readonly extraction_methods: { readonly type: "multi_link"; readonly target: "construct"; }; readonly extraction_goods: { readonly type: "multi_link"; readonly target: "construct"; }; readonly industry_methods: { readonly type: "multi_link"; readonly target: "construct"; }; readonly industry_goods: { readonly type: "multi_link"; readonly target: "construct"; }; readonly infrastructure: { readonly type: "text"; }; readonly extraction_markets: { readonly type: "multi_link"; readonly target: "location"; }; readonly industry_markets: { readonly type: "multi_link"; readonly target: "location"; }; readonly currencies: { readonly type: "multi_link"; readonly target: "construct"; }; readonly architecture: { readonly type: "text"; }; readonly buildings: { readonly type: "multi_link"; readonly target: "object"; }; readonly building_methods: { readonly type: "multi_link"; readonly target: "construct"; }; readonly defensibility: { readonly type: "text"; }; readonly elevation: { readonly type: "integer"; }; readonly fighters: { readonly type: "multi_link"; readonly target: "construct"; }; readonly defensive_objects: { readonly type: "multi_link"; readonly target: "object"; }; }; readonly map: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly background_color: { readonly type: "text"; }; readonly hierarchy: { readonly type: "integer"; }; readonly width: { readonly type: "integer"; }; readonly height: { readonly type: "integer"; }; readonly depth: { readonly type: "integer"; }; readonly parent_map: { readonly type: "single_link"; readonly target: "map"; }; readonly location: { readonly type: "single_link"; readonly target: "location"; }; }; readonly marker: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly map: { readonly type: "single_link"; readonly target: "map"; }; readonly zone: { readonly type: "single_link"; readonly target: "zone"; }; readonly x: { readonly type: "integer"; }; readonly y: { readonly type: "integer"; }; readonly z: { readonly type: "integer"; }; readonly order: { readonly type: "integer"; }; }; readonly narrative: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly story: { readonly type: "text"; }; readonly consequences: { readonly type: "text"; }; readonly start_date: { readonly type: "integer"; }; readonly end_date: { readonly type: "integer"; }; readonly order: { readonly type: "integer"; }; readonly parent_narrative: { readonly type: "single_link"; readonly target: "narrative"; }; readonly protagonist: { readonly type: "single_link"; readonly target: "character"; }; readonly antagonist: { readonly type: "single_link"; readonly target: "character"; }; readonly narrator: { readonly type: "single_link"; readonly target: "character"; }; readonly conservator: { readonly type: "single_link"; readonly target: "institution"; }; readonly events: { readonly type: "multi_link"; readonly target: "event"; }; readonly characters: { readonly type: "multi_link"; readonly target: "character"; }; readonly objects: { readonly type: "multi_link"; readonly target: "object"; }; readonly locations: { readonly type: "multi_link"; readonly target: "location"; }; readonly species: { readonly type: "multi_link"; readonly target: "species"; }; readonly creatures: { readonly type: "multi_link"; readonly target: "creature"; }; readonly institutions: { readonly type: "multi_link"; readonly target: "institution"; }; readonly traits: { readonly type: "multi_link"; readonly target: "trait"; }; readonly collectives: { readonly type: "multi_link"; readonly target: "collective"; }; readonly zones: { readonly type: "multi_link"; readonly target: "zone"; }; readonly abilities: { readonly type: "multi_link"; readonly target: "ability"; }; readonly phenomena: { readonly type: "multi_link"; readonly target: "phenomenon"; }; readonly languages: { readonly type: "multi_link"; readonly target: "language"; }; readonly families: { readonly type: "multi_link"; readonly target: "family"; }; readonly relations: { readonly type: "multi_link"; readonly target: "relation"; }; readonly titles: { readonly type: "multi_link"; readonly target: "title"; }; readonly constructs: { readonly type: "multi_link"; readonly target: "construct"; }; readonly laws: { readonly type: "multi_link"; readonly target: "law"; }; }; readonly object: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly aesthetics: { readonly type: "text"; }; readonly weight: { readonly type: "integer"; }; readonly amount: { readonly type: "integer"; }; readonly parent_object: { readonly type: "single_link"; readonly target: "object"; }; readonly materials: { readonly type: "multi_link"; readonly target: "construct"; }; readonly technology: { readonly type: "multi_link"; readonly target: "construct"; }; readonly utility: { readonly type: "text"; }; readonly effects: { readonly type: "multi_link"; readonly target: "phenomenon"; }; readonly abilities: { readonly type: "multi_link"; readonly target: "ability"; }; readonly consumes: { readonly type: "multi_link"; readonly target: "construct"; }; readonly origins: { readonly type: "text"; }; readonly location: { readonly type: "single_link"; readonly target: "location"; }; readonly language: { readonly type: "single_link"; readonly target: "language"; }; readonly affinities: { readonly type: "multi_link"; readonly target: "trait"; }; }; readonly phenomenon: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly expression: { readonly type: "text"; }; readonly effects: { readonly type: "text"; }; readonly duration: { readonly type: "integer"; }; readonly catalysts: { readonly type: "multi_link"; readonly target: "object"; }; readonly empowerments: { readonly type: "multi_link"; readonly target: "ability"; }; readonly mythology: { readonly type: "text"; }; readonly system: { readonly type: "single_link"; readonly target: "phenomenon"; }; readonly triggers: { readonly type: "multi_link"; readonly target: "construct"; }; readonly wielders: { readonly type: "multi_link"; readonly target: "character"; }; readonly environments: { readonly type: "multi_link"; readonly target: "location"; }; }; readonly pin: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly map: { readonly type: "single_link"; readonly target: "map"; }; readonly element_type: { readonly type: "text"; }; readonly element_id: { readonly type: "single_link"; readonly target: "any"; }; readonly x: { readonly type: "integer"; }; readonly y: { readonly type: "integer"; }; readonly z: { readonly type: "integer"; }; }; readonly relation: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly background: { readonly type: "text"; }; readonly start_date: { readonly type: "integer"; }; readonly end_date: { readonly type: "integer"; }; readonly intensity: { readonly type: "integer"; }; readonly actor: { readonly type: "single_link"; readonly target: "character"; }; readonly events: { readonly type: "multi_link"; readonly target: "event"; }; readonly characters: { readonly type: "multi_link"; readonly target: "character"; }; readonly objects: { readonly type: "multi_link"; readonly target: "object"; }; readonly locations: { readonly type: "multi_link"; readonly target: "location"; }; readonly species: { readonly type: "multi_link"; readonly target: "species"; }; readonly creatures: { readonly type: "multi_link"; readonly target: "creature"; }; readonly institutions: { readonly type: "multi_link"; readonly target: "institution"; }; readonly traits: { readonly type: "multi_link"; readonly target: "trait"; }; readonly collectives: { readonly type: "multi_link"; readonly target: "collective"; }; readonly zones: { readonly type: "multi_link"; readonly target: "zone"; }; readonly abilities: { readonly type: "multi_link"; readonly target: "ability"; }; readonly phenomena: { readonly type: "multi_link"; readonly target: "phenomenon"; }; readonly languages: { readonly type: "multi_link"; readonly target: "language"; }; readonly families: { readonly type: "multi_link"; readonly target: "family"; }; readonly titles: { readonly type: "multi_link"; readonly target: "title"; }; readonly constructs: { readonly type: "multi_link"; readonly target: "construct"; }; readonly narratives: { readonly type: "multi_link"; readonly target: "narrative"; }; }; readonly species: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly appearance: { readonly type: "text"; }; readonly life_span: { readonly type: "integer"; }; readonly weight: { readonly type: "integer"; }; readonly nourishment: { readonly type: "multi_link"; readonly target: "species"; }; readonly reproduction: { readonly type: "multi_link"; readonly target: "construct"; }; readonly adaptations: { readonly type: "multi_link"; readonly target: "ability"; }; readonly instincts: { readonly type: "text"; }; readonly sociality: { readonly type: "text"; }; readonly temperament: { readonly type: "text"; }; readonly communication: { readonly type: "text"; }; readonly aggression: { readonly type: "integer"; }; readonly traits: { readonly type: "multi_link"; readonly target: "trait"; }; readonly role: { readonly type: "text"; }; readonly parent_species: { readonly type: "single_link"; readonly target: "species"; }; readonly locations: { readonly type: "multi_link"; readonly target: "location"; }; readonly zones: { readonly type: "multi_link"; readonly target: "zone"; }; readonly affinities: { readonly type: "multi_link"; readonly target: "phenomenon"; }; }; readonly title: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly authority: { readonly type: "text"; }; readonly eligibility: { readonly type: "text"; }; readonly grant_date: { readonly type: "integer"; }; readonly revoke_date: { readonly type: "integer"; }; readonly issuer: { readonly type: "single_link"; readonly target: "institution"; }; readonly body: { readonly type: "single_link"; readonly target: "institution"; }; readonly superior_title: { readonly type: "single_link"; readonly target: "title"; }; readonly holders: { readonly type: "multi_link"; readonly target: "character"; }; readonly symbols: { readonly type: "multi_link"; readonly target: "object"; }; readonly status: { readonly type: "text"; }; readonly history: { readonly type: "text"; }; readonly characters: { readonly type: "multi_link"; readonly target: "character"; }; readonly institutions: { readonly type: "multi_link"; readonly target: "institution"; }; readonly families: { readonly type: "multi_link"; readonly target: "family"; }; readonly zones: { readonly type: "multi_link"; readonly target: "zone"; }; readonly locations: { readonly type: "multi_link"; readonly target: "location"; }; readonly objects: { readonly type: "multi_link"; readonly target: "object"; }; readonly constructs: { readonly type: "multi_link"; readonly target: "construct"; }; readonly laws: { readonly type: "multi_link"; readonly target: "law"; }; readonly collectives: { readonly type: "multi_link"; readonly target: "collective"; }; readonly creatures: { readonly type: "multi_link"; readonly target: "creature"; }; readonly phenomena: { readonly type: "multi_link"; readonly target: "phenomenon"; }; readonly species: { readonly type: "multi_link"; readonly target: "species"; }; readonly languages: { readonly type: "multi_link"; readonly target: "language"; }; }; readonly trait: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly social_effects: { readonly type: "text"; }; readonly physical_effects: { readonly type: "text"; }; readonly functional_effects: { readonly type: "text"; }; readonly personality_effects: { readonly type: "text"; }; readonly behaviour_effects: { readonly type: "text"; }; readonly charisma: { readonly type: "integer"; }; readonly coercion: { readonly type: "integer"; }; readonly competence: { readonly type: "integer"; }; readonly compassion: { readonly type: "integer"; }; readonly creativity: { readonly type: "integer"; }; readonly courage: { readonly type: "integer"; }; readonly significance: { readonly type: "text"; }; readonly anti_trait: { readonly type: "single_link"; readonly target: "trait"; }; readonly empowered_abilities: { readonly type: "multi_link"; readonly target: "ability"; }; }; readonly zone: { readonly name: { readonly type: "text"; readonly required: true; }; readonly description: { readonly type: "text"; readonly required: false; }; readonly supertype: { readonly type: "text"; readonly required: false; }; readonly subtype: { readonly type: "text"; readonly required: false; }; readonly image_url: { readonly type: "text"; readonly required: false; }; readonly role: { readonly type: "text"; }; readonly shape: { readonly type: "text"; }; readonly start_date: { readonly type: "integer"; }; readonly end_date: { readonly type: "integer"; }; readonly phenomena: { readonly type: "multi_link"; readonly target: "phenomenon"; }; readonly linked_zones: { readonly type: "multi_link"; readonly target: "zone"; }; readonly context: { readonly type: "text"; }; readonly populations: { readonly type: "multi_link"; readonly target: "collective"; }; readonly titles: { readonly type: "multi_link"; readonly target: "title"; }; readonly principles: { readonly type: "multi_link"; readonly target: "construct"; }; }; }; /** What `senderStatus` answers: proved, contradicted, a claim nobody can check, or a sender hidden from this reader. */ type OwSenderStatus = 'verified' | 'mismatch' | 'unverifiable' | 'unseen'; /** * The addressing readers' and `readMarkOf`'s one option. `keyless`: the body was read with no credential (the keyless * public reader), which leaves hidden recipients out and never carries `x_served_trimmed`, so an * empty list cannot be told from one trimmed for the reader, and serves no `created_by` or * `changed_by`, so no read mark counts. False by default. */ interface OwAddressingOptions { keyless?: boolean; } /** `senderStatus`'s answer. */ interface OwSender { status: OwSenderStatus; /** The message's `narrator`: the Character it claims as its sender, or null (show it as from nobody). */ claimed: string | null; /** On a mismatch, the Character of the membership that wrote it (from `created_by`); null otherwise. */ writtenBy: string | null; } /** `editedBy`'s answer. */ interface OwEdited { /** True when a later hand changed the message: it carries `changed_by` and that is not its `created_by`. */ edited: boolean; /** The Character the editing membership plays, or null: not edited, or the editor plays none, is off the members list, or there is no list. */ by: string | null; } /** One row of the world's members list (`client.members()` gives `OwMember` rows); only `id` and `character` are read. */ interface OwMessageMember { /** The membership id, what `created_by` holds; null for the owner, matching a `created_by` of null. */ id?: string | null; /** The Character this member plays, or null (none, or hidden from the reader's key). */ character?: string | null; } type Members = readonly OwMessageMember[] | null | undefined; /** An instant a `created_at` (or `updated_at`) names: whole seconds since 1970-01-01T00:00:00Z, and the fraction's first six digits as a number (0 to 999999). */ interface OwInstant { readonly seconds: number; readonly microseconds: number; } /** * The instant a time names, or `null` when it cannot be read: the message profile's grammar, the one * the message, report, charter and lens readers order by. The whole value must match * `YYYY-MM-DDTHH:MM:SS`, an optional fraction after `.`, then `Z` or `+HH:MM` / `-HH:MM` or nothing * (read as UTC); `T` and `Z` in either case; ASCII digits; nothing trimmed. Each part in its range: * a month 1 to 12, a day that month has (Gregorian leap years), an hour to 23, a minute and a second * to 59, an offset's hours to 23 and minutes to 59. A year is any four of the digits 0 to 9, 0000 * among them, on the Gregorian calendar run on in both directions, so 0000 is a leap year and an offset * may carry an instant before 0000 or past the end of 9999. A fraction counts to its sixth digit; later digits * are dropped, never rounded. Not read: a date alone, a space for the `T`, a time without seconds, an * offset without its colon, a trailing line break. * * ```ts * instantOf('2026-11-12T10:00:00+02:00'); // { seconds: 1794470400, microseconds: 0 } * instantOf('2026-11-12'); // null * ``` */ declare function instantOf(value: unknown): OwInstant | null; /** * Orders two instants from `instantOf`: earlier first, `null` (a time that cannot be read) after * every readable one, and 0 for two equal instants or two `null`s, so a stable sort keeps the order * given. This is the order the package's readers sort by. * * ```ts * items.sort((a, b) => compareInstants(instantOf(a.created_at), instantOf(b.created_at))); * ``` */ declare function compareInstants(a: OwInstant | null, b: OwInstant | null): number; /** * Two strings compared by code point, the order every profile names (never UTF-16 units, which put a letter beyond U+FFFF * before U+FF5A, and never a locale's collation): negative when `a` comes first, positive when `b` does, 0 when equal. A * comparator for `Array.prototype.sort`; Python's own string order is the same. For names as the profiles order them, * compare their folds and break a tie by id: `byCodePoint(trimAndFold(x.name), trimAndFold(y.name)) || byCodePoint(x.id, y.id)`. * The lens, record, charter, graph and landing readers order by it. */ declare function byCodePoint(a: string, b: string): number; /** * True when the element is a message: a Narrative with supertype `Message`, the type and the * supertype each trimmed (Unicode White_Space at both ends) and compared without regard to case, * the whole word (`Messages` is not one). A parlor's line (one carrying `x_room_of`) is a message * too. A message view (an inbox, a room, a thread) reads it by these rules; it stays an ordinary * Narrative in every other view. */ declare function isMessage(element: object | null | undefined): boolean; /** * True when the element is a Note: a Narrative with supertype `Note` (`NOTE_PAIR`), trimmed and * folded as `isMessage` reads its pair. A Note is a member's own line in the world (`narrator` its * author's Character, `story` its text), never a message: it is addressed to nobody, never unread * and in no thread, whatever its `characters` holds. `noteOf` finds a Character's line. */ declare function isNote(element: object | null | undefined): boolean; /** * The message's recipients: the Character ids in its `characters`, as written. An empty list * (the field absent, null or `[]`) means the message is addressed to every member of the world; * use `isAddressedTo` for the question "is it for X". No other field addresses a message. A Note, * or any Narrative that is not a message, has no recipients: `[]`, whatever its `characters` holds (since serial 128). A list that names one Character twice * answers it once, in its first place; ids compare as written, so `a` and `A` are two (since serial 128). */ declare function recipientsOf(message: object | null | undefined): string[]; /** * True when the message is addressed to the Character: its id is in `characters`, or `characters` * is empty (absent, null or `[]`) and the server did not trim it for this reader (`isToEveryone`). * An empty list whose `x_served_trimmed` names `characters` is to someone the reader cannot see and * addresses no Character the reader is given. Not `narrator`, not a name or an id in the text, not * any other link. A sender is not addressed by sending. An empty id (`""`) is no Character: nothing * is addressed to it, not even a message to everyone. A Note, or any Narrative that is not a message, is addressed to nobody (since serial 128). */ declare function isAddressedTo(message: object | null | undefined, characterId: string): boolean; /** * True when the message is addressed to every member: its `characters` is absent, null or `[]`. * A list that names no valid id (`['']`) or a value that is not a list is addressed to nobody, * so it is false here, though `recipientsOf` gives `[]` for both. A list the server trimmed for * this reader (`x_served_trimmed` names `characters`) is never everyone, even when it arrives empty: * see `hasUnseenRecipients`. A body read keyless is never to everyone (`{ keyless: true }`): it * carries no mark, so an empty list may hold someone the reader cannot see. A Note is to nobody. */ declare function isToEveryone(message: object | null | undefined, options?: OwAddressingOptions): boolean; /** * True when the message is addressed to someone this reader cannot see: the server served it with * `characters` trimmed (its `x_served_trimmed` list names `characters`), whatever is left in the * list. It says that such a recipient exists, never who or how many. Null for a message read keyless * (`{ keyless: true }`): it carries no mark, so the reader cannot say either way. False for a Note, * or any body that is not a message, whatever the key: it has no recipients, so nothing about them * is unknown (the message profile, serial 130). */ declare function hasUnseenRecipients(message: object | null | undefined, options?: OwAddressingOptions): boolean | null; /** * True when the message's `narrator` is the Character: the claim, whether or not `senderStatus` * proves it. A message with no `narrator` is sent by nobody: false for every id. */ declare function isSentBy(message: object | null | undefined, characterId: string): boolean; /** * Whether the message's sender is proved. The claimed sender is `narrator`; the author is the * membership in `created_by`, which the server records, and its Character is that membership's * `character` on the world's members list (`client.members()`; the owner's row has `id` null, matching * a `created_by` of null). `verified`: the author's Character is the narrator (a removed member's * row still proves it, and a Character taken by a new member verifies that member's messages: the * proof names the membership that wrote each one). `mismatch`: the narrator is another Character * than the author's, named in `writtenBy`; show "claims to be from , written by * 's key", never the plain sender. `unverifiable`: no narrator (show "from nobody"), no * `created_by` key at all (a folder, an export), no members list (pass null), the author not on * it, or its row naming no Character; show "claims to be from ". `unseen`: the sender is * hidden from this reader (no narrator, and the server's `x_served_trimmed` names `narrator`); * show "from someone you cannot see", never "from nobody". A body read keyless carries no mark, so * its missing narrator stays `unverifiable`. Never give an unverified sender the verified look. * An edit never changes the answer: see `editedBy`. */ declare function senderStatus(message: object | null | undefined, members: Members): OwSender; /** * Whether a later hand changed the message, and whose. The proof of sending is the first write, * `created_by`; the edit is the last hand, `changed_by` (null for the owner, as `created_by` is). * `edited` is true when the message carries `changed_by` and it is not equal to `created_by` (an * absent `created_by` is never equal). `by` is the Character the editing membership plays on the * members list; null when it plays none, is off the list, or there is no list (show "edited by * another hand"), and null whenever `edited` is false. A message with no `changed_by` (a folder, * an export) says nothing of edits. Shown beside the sender's answer, never instead of it. */ declare function editedBy(message: object | null | undefined, members: Members): OwEdited; /** * The reader's read mark among the given Relations, or null when it has none (always null for an * empty id). A mark is a Relation with supertype `Read` (trimmed and folded like the pair) whose * `actor` is the reader, and it counts only when every write on it was the reader's own hand. * Its author: where it carries `created_by`, that membership on the members list must play the * reader's Character (`created_by` null is the owner's hand). Its last writer: where it carries * `changed_by` (null for the owner, as `created_by` is), that must equal its `created_by`, so a * mark another hand changed since it was made is ignored, the owner's hand included, and a mark * with `changed_by` but no `created_by` is ignored too (a writer with no creator is no hand). A * mark with neither key (a folder, an export) has no hand to check and counts. Of several that * count, the newest `updated_at` read as an instant (`instantOf`) is the mark wherever it stands in * the list, and one whose `updated_at` cannot be read (absent, a date alone, anything `instantOf` * refuses) never beats one that can, in either order. Among equal instants, however each is written * (`10:00:00Z` and `11:00:00+01:00`), or when none can be read, the higher `id` by code point as * written is the mark, never the first in the list (serial 123; an id that is not a string is the * lowest). A lone mark is the mark, its time read or not. A newer one in another's hand is ignored and the * reader's own stands. Null for bodies read keyless (`{ keyless: true }`): the keyless public * reader is served no `created_by` or `changed_by` on any body, so its marks carry neither because * the hands were taken off, not because they are a folder's, and none counts. */ declare function readMarkOf(relations: readonly T[], characterId: string, members: Members, options?: OwAddressingOptions): T | null; /** * The messages unread for the Character, in `created_at` order (equal times keep the input's * order; a `created_at` that cannot be read as a date and time comes after every one that can): * addressed to it (`isAddressedTo`; an empty id is addressed by nothing, a Note never), not its * own, and not on its read mark's `narratives`. Its own: where a message carries no `created_by` * (a folder, an export), its `narrator` is trusted, so one whose narrator is the reader is not * unread. Where it carries `created_by` (the wire), only a verified sender makes it the reader's * own (`senderStatus` against `members`: the author's Character is the reader); a claim never * makes a message read for the Character it names, so a mismatch, an author off the list or * playing no Character, and every wire message when `members` is not given, stays unread for the * Character it claims. Pass the world's members list (`client.members()`) for wire data. `readMark` * is `readMarkOf`'s answer; null means no mark, so everything addressed is unread. An id on the * mark that names a message not addressed to the reader changes nothing. Pass messages * (`isMessage`); every element given but a Note is read as one. */ declare function unreadFor(messages: readonly T[], characterId: string, readMark: object | null | undefined, members?: readonly OwMessageMember[] | null): T[]; /** * The thread of a root message: every message whose chain of `parent_narrative` reaches the root, * the root included, in `created_at` order (equal times keep the input's order; unreadable times * last). A walk stops at an id it has already visited, so a loop in the chain ends it, and at a * `parent_narrative` that is not a string id (a number, null, an object): the chain ends there. A * message whose chain leaves the given list is not in the thread unless its chain reached the root * first. A Note is in no thread: it is never listed, though a chain walks through its * `parent_narrative` like any other (a reply to a Note that answers the root is in the thread). * It reads messages; reports group by `reportThreadsOf`, which never walks a chain. */ declare function threadOf(messages: readonly T[], rootId: string): T[]; declare function noteOf(narratives: readonly object[], characterId: string, members: Members): string | null; /** A reader of a lens: the rung decides what of the world it sees. */ interface OwLensReader { /** * `owner` (the whole world), `co-builder` (the whole world as the owner reads it, hidden elements included, and * none of the owner's two counts: a keeper, as the charter profile names the role; serial 138), `contributor` * (the world less the hidden, plus the hidden elements it made, listed * in `whole`), `guest` (exactly the ids in * `whole`, and those in `known_of` as stubs, less a hidden one: hidden beats `known_of`) or `public` * (the world less the hidden and the room elements). A proposed element is in no reader's view, but below the public rung a served body keeps * a link to one the rung sees, and a lens's note keyed to it. */ rung: 'owner' | 'co-builder' | 'contributor' | 'guest' | 'public'; /** The reader's Character, for the mail rule; null or absent: no Character, no mail. */ character?: string | null; /** A guest's whole elements; a contributor's, the hidden elements it made. */ whole?: readonly string[] | null; /** A guest's known-of elements, served as stubs (the base and public fields, every other field unset: no links, no date); one under the hidden mark is not in its view at all. */ known_of?: readonly string[] | null; /** On an owner: the reader it reads as. The view is that reader's; the owner's two counts stay. */ as?: OwLensReader | null; } /** The world snapshot a lens is resolved over: the elements as the owner is served them. */ interface OwLensWorld { elements: readonly object[]; /** Ids the hidden mark keeps from every reader but the owner, beside each element's own `hidden`; the two are one mark, and a full row of an element under it carries `hidden: true`. */ hidden?: readonly string[] | null; /** The world's members list (`client.members()`), which proves a message's sender for the mail rule. */ members?: readonly OwMessageMember[] | null; /** The world's now, in its own time unit: the default `as_of`. */ now?: number | null; /** The World's own now as a world folder spells it (`time_current`), read when `now` is not given. */ time_current?: number | null; /** The World's own now as the API serves it (`GET /world`'s `time_range_current`), read when neither `now` nor `time_current` is given. */ time_range_current?: number | null; } /** `resolveLens`'s options. */ interface OwLensOptions { /** The reading's date, a whole number in the world's time unit; absent: the world's now (`now`, else `time_current`, else `time_range_current`); none at all: no fence, and the window cuts nothing. */ asOf?: number | null; /** The reading's wall-clock time, a date-time, for the mail rule's thirty days and `changed_within`; absent: the machine's time. Never the world's now. */ clock?: string | null; } /** Why an element was left out: the profile's one closed list. */ type OwLensCutReason = 'budget' | 'types' | 'window' | 'stale' | 'undated' | 'after_as_of' | 'anchor_not_visible' | 'not_visible' | 'hops_not_served'; /** The mail rule's part of a reading. */ interface OwLensMail { /** The unread messages kept, in `created_at` order. */ unread: string[]; /** The read messages kept, in `created_at` order. */ read: string[]; /** Every kept message in `created_at` order: an unread one in full, a read one as `id`, `name`, `narrator`, `created_at` (in full under `all`). */ rows: Record[]; /** Messages left out, by reason: older than thirty days (`window`), or past the budget, oldest first (`budget`). */ cut: { budget?: number; window?: number; }; /** The unread and read messages this reader may see, before the window and the budget. */ totals: { unread: number; read: number; }; } /** What `resolveLens` answers. */ interface OwLensReading { /** The kept elements' ids, in the profile's order. */ kept: string[]; /** * The kept elements as `show` makes them, in the same order; an anchor's row carries its `note`, and only an anchor * the reader can see: a note on one it cannot see (an id of another type than its field's too) goes with the * anchor, though another path keeps the element. Under `full` a row is the body as served to this reader, so the * owner's row of a hidden element carries `hidden: true`; a `name` or `first_line` row never carries it. A `name` * row is `id`, `type`, `name`, and `supertype` and `subtype` each where the served body holds it as a string with * something left after trimming White_Space, as stored; a `first_line` row adds `description` up to its first line * break. */ rows: Record[]; /** The cut, counted by reason; a reason with no count is absent, and a reader that is not the owner never carries the owner's two. */ cut: Partial>; /** Notes on ids that are not anchors of the lens read, counted only where the reader sees the id. */ notesIgnored: number; /** The mail part, when the lens names a mail rule; null otherwise. */ mail: OwLensMail | null; /** The first `x_lens` key whose value is outside the profile's table (`x_lens` itself when it is not an object): the lens resolves to nothing. Null for a readable lens. */ unreadable: string | null; } /** * The lens profile's date table: each dated type's date field, by the type's lowercase name. The other ten * types are timeless and never fenced. The lens reader's fence and window read it, and so can a timeline or a * horizon that must date elements the same way. Frozen. */ declare const DATE_FIELD: Readonly>; /** * An element's date as the lens profile reads it: the whole number in its type's date field (`DATE_FIELD`), * in the world's own time unit. Null for a timeless type, a body with no known `type`, and a date field that is * absent, null or not a whole number. It reads the body it is given: a known-of stub serves no date, so it * reads null, whatever the element's own date is. */ declare function dateOf(element: object | null | undefined): number | null; /** * True when the element is a lens: a Construct with supertype `Lens`, the type and the supertype each * trimmed (Unicode White_Space at both ends) and compared without regard to case, the whole word * (`Lenses` is not one), as the room profile's pairs are read. */ declare function isLens(element: object | null | undefined): boolean; /** * True when the element is a template: a lens whose subtype, trimmed and folded, is `Template`. A * template resolves to nothing, anchors or not, until a copy is pointed (given anchors and another * subtype). */ declare function isTemplate(element: object | null | undefined): boolean; /** * The lenses a seat reads, by id: its membership's choice (a list, an empty list included: a membership * that chose no lenses has made a choice), or, when `membership` is null, its Character's `x_lens_uses`. * Null means there is no membership, as in a folder world. A membership that exists and never chose is * not this reading's case: onlyworlds.com gives that seat its Titles' lenses and never reads * `x_lens_uses`. Never both: the membership wins. Strings only, each once, in the order given; anything * that is not a list is no choice. */ declare function lensesInUse(membership: readonly string[] | null | undefined, xLensUses: unknown): string[]; /** * Resolve a lens for one reader over a world snapshot (schema-dist profiles/lens.md): the kept * elements in the profile's order, the cut counted by reason, and, when the lens names a mail rule, * the mail part. Pure: it never writes, and nothing in the world moves. * * `world` holds the elements as the owner is served them (with the ids its hidden mark keeps in * `hidden`, or each element's own `hidden`, and its `members` for the mail rule). `lens` is a lens body * or the id of a lens in the world the reader can see. `reader` says what it sees (`OwLensReader`); an * owner reading `as` another reader gets that reader's view and the owner's two counts. * * The rules, in short: visibility first (a hidden or proposed element is not there to hop through; a * known-of stub is kept as served and nothing hops out of it); a hop reaches both ways, and on through * a Relation to its parties, only to an element of the link's target type (a generic pair's type key * compared exact against the 22 slugs); 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 * element; a reading aid (the charter, its guide, a domain: `isCharterElement`) a hop reaches is kept, and * hopped on from, only when `types` names its pair, while one the lens names as an anchor is kept and * followed; anchors first in link order, then by type in the schema's order, newest first by the clock * `changed_within` reads (the newest of its readable `updated_at`, `server_updated_at` and `local_updated_at`; none * readable, last of its type), then by id; * an anchor the reader cannot see (an id naming no element, or one of another type than its field's, too) * is skipped and counted for the owner (`anchor_not_visible`, before any other reason), while for any other reader * it is not there at all, so a child lens's cut of the same element counts under the child's reason; a template * resolves to nothing; the fence is `as_of` on * each element's own date; `changed_within` cuts what a hop or a filter reaches that changed longer ago * than that many days before `clock` (`stale`), never an anchor. A value outside the profile's table makes * the lens unreadable: `unreadable` names the key and nothing is resolved. */ declare function resolveLens(world: OwLensWorld, lens: object | string, reader: OwLensReader, options?: OwLensOptions): OwLensReading; /** The World's field that carries the strand's mark. */ declare const STRAND_FIELD = "x_strand"; /** The world snapshot a strand is read from: the lens reader's world, the World's mark, and whether it is open to anyone. */ interface OwStrandWorld extends OwLensWorld { /** The mark, `{narrative, event, location}`: the story's id, the other two ids or unset (null or absent); any other shape is no mark. */ x_strand?: unknown; /** True for a world open to anyone: only then does the public rung read anything of it. */ open?: boolean | null; } /** A filled slot. */ interface OwStrandSlot { id: string; /** The element's type: the slot's own (narrative, event, location, character; `now` a location). */ type: 'narrative' | 'event' | 'location' | 'character'; name: string; } /** A world's strand as one reader sees it: five slots and whether then and now are one place. An empty slot is null. */ interface OwStrand { /** The story: the Narrative the mark names. */ narrative: OwStrandSlot | null; /** The happening: the Event the mark names, when it is in the story's `events`. */ event: OwStrandSlot | null; /** The place, then: the Location the mark names, when it is in the event's `locations`. */ location: OwStrandSlot | null; /** The hero: the story's `protagonist`. */ character: OwStrandSlot | null; /** The place, now: the hero's `location`. */ now: OwStrandSlot | null; /** True when `now` and `location` are both filled and one place, false when both filled and two, null otherwise. */ same: boolean | null; } /** * A world's strand as `reader` sees it (schema-dist profiles/strand.md): `{narrative, event, location, character, * now, same}`, each filled slot `{id, name}` and an empty one null. * * `narrative` is the element the mark names when it is a Narrative in the reader's view; with none, every slot is * empty. `event` is the element the mark names when it is an Event in the reader's view and in the story's `events` * as the reader is served them; `location` the element the mark names when it is a Location in the reader's view and * in that event's `locations`, empty when the event is. `character` is the story's `protagonist` when it is a * Character in the reader's view; `now` the hero's `location` when it is a Location in the reader's view, empty when * the hero is. `same` is true when `now` and `location` are both filled with one id, false when with two, else null. * A list's order is never read, and no slot is filled from another: not the hero from the event's `characters`, not * `location` from `now`, not `now` from `location`. Only the story is required: `event` and `location` null or * absent read as unset (a strand begun, its empty slots the next thing to make), and a place with no event is an * empty place. A mark whose `narrative` is not a non-empty string, or whose `event` or `location` is anything but a * non-empty string, null or absent, is no mark, and the strand is empty. * * `world` holds the elements as the owner is served them (the hidden in `hidden` or each element's own `hidden`), * the World's `x_strand`, and `open: true` for a world open to anyone; `reader` is a lens reader (`OwLensReader`): * the owner, a contributor, a guest (its `whole` and `known_of` ids) or the public, which reads nothing of a world * that is not open. A slot's links are read from the body the reader is served, so a story known only as a stub * fills its own slot and nothing past it. Pure. */ declare function strandOf(world: OwStrandWorld, reader: OwLensReader): OwStrand; /** * keel v2 engine absorbed from an earlier v2 client (ow-v2-client v0.9.0), * wire-corrected against live staging fixtures 2026-07-18. * * OnlyWorlds v2 (keel) wire types -- the NON-generated, hand-owned wire shapes * (envelopes, pages, bulk, changes, config). Per-type element field typing is * generated (types.generated.ts). One-shape principle: a field reads the way it * writes -- links are UUID arrays (or UUID/null), same name both directions. * No `_ids` suffix in v2. */ /** An element as read from / written to the v2 API. Loose base + extension keys. */ type OwElement = OwElementBase; /** Spatial types live under spatial/ in the OW Folder Format. */ declare const SPATIAL_TYPES: readonly ElementType[]; /** * GET /world: the world's own fields, as keel's `World` component declares them (since 4.25.0 * every one is typed). keel always sends all of them; past `id` and `name` they are optional * here only so that code building a world meta keeps compiling within 4.x. Dates and durations * count in `time_basic_unit`; the three units are free-text labels, nothing converts. */ interface OwWorldMeta { id: string; name: string; description?: string; image_url?: string; /** The names of the calendar's steps, e.g. ['Day', 'Week', 'Month', 'Year']. */ time_format_names?: string[]; /** How many time_basic_unit each step holds, in the same order. Whole numbers in the standard; an older world may read back strings. */ time_format_equivalents?: Array; /** The unit every element date and duration counts in (e.g. 'Year'). */ time_basic_unit?: string; time_range_min?: number | null; time_range_max?: number | null; /** The world's present moment (in a world folder: `time_current`). */ time_range_current?: number | null; length_unit?: string; mass_unit?: string; distance_unit?: string; /** Whether the world can be read without its PIN. Read-only on the wire. */ public_read?: boolean; /** * Whether a Narrative written through an AI seat is narrated by that seat's own Character, * as a guest's is: set by the owner on the world page; read-only on the wire. * With it on, an agent naming another narrator is a 422 (`param: narrator`), and a seat with no * Character a 403 `guest_not_supported`. */ agent_narrator_rule?: boolean; /** The owner's "this Character is me": a Character id in this world, or null (null too, to a reader it is hidden from). */ owner_character?: string | null; /** * The world's public page address, onlyworlds.com/w/: null when the world has * no page (a slug exists only while the page is on). Also a keyless `?world=` value. Set by the * owner on the world page; read-only on the wire, and patchWorld strips it. */ slug?: string | null; /** * The world's public page as its owner set it: `on`, and the levers. Every key is * present with the page off. Set by the owner on the world page; read-only on the wire, and * patchWorld strips it. */ public_page?: OwWorldPublicPage; /** * Whether an AI seat's writes land as proposals: on, a seat's PATCH, PUT, link * edit or /bulk item on an existing element answers 202 with the proposal (this client throws * an OwProposedError; a /bulk slot carries `status: 202` and `proposal`) and the element does * not change until the owner or a co-builder accepts it; its new elements carry * `x_review_proposed`; it deletes only what it created. A person's key is never held. Set by * the owner on the world page; read-only on the wire, and patchWorld strips it. */ agent_writes_proposed?: boolean; /** * Where the world first came from: the folder format's provenance lines (spec * 4.2) as the tool that made the world from a folder gave them, both keys always present, each * null when not known. Read-only on the wire, and patchWorld strips it: write it as the plain * keys `source` and `producer` (`patchWorld({ source, producer })`, each an object or null). */ origin?: OwWorldOrigin; created_at?: string | null; /** Moves when the world's own fields change, not on element writes. */ updated_at?: string | null; /** * Extension keys: a tool's own setting on the world, any JSON value, served at the * top level as an element's are (the first is `x_names`, the names profile: see `typeWord`). * patchWorld sends them as given; `null` removes one; 64 KB in all, else a 422 `param: extensions`. */ /** * Read only: how many elements this reader may read, in all and per type, counted as it reads * them, for every key and token (since 2026-10-27; before it, the keyless read alone). * Never sent back: patchWorld strips it. */ counts?: { total: number; types: Record; }; [extension: `x_${string}`]: unknown; [extension: `atlas_${string}`]: unknown; [extension: `shadow_${string}`]: unknown; [field: string]: unknown; } /** * OwWorldMeta.origin, as keel's `World` component types it: both keys always * present, each an object or null. Kept as the writer gave it; keel checks only that `source.world` * and `producer.tool` are strings when present. */ interface OwWorldOrigin { source: OwWorldSource | null; producer: OwWorldProducer | null; } /** The folder format's `source` line (spec 4.2): the server and world a folder was exported from, and when. Kept as given. */ interface OwWorldSource { server?: string; world?: string; at?: string; [field: string]: unknown; } /** The folder format's `producer` line (spec 4.2): the tool that made a folder, its version, and what it made it from. Kept as given. */ interface OwWorldProducer { tool?: string; version?: string; input?: string; [field: string]: unknown; } /** OwWorldMeta.public_page, as keel's `World` component types it: all six keys, always. */ interface OwWorldPublicPage { /** Whether the page is on. */ on: boolean; /** The page's palette, or null for the house's. */ palette: 'midnight' | 'daylight' | 'parchment' | 'brass' | 'dusk' | null; /** One plain line (at most 120 characters). */ hero: string; /** The element types shown, in their order; empty for all, in the house order. */ sections: string[]; /** One element's id, or null. */ pin: string | null; /** Always false for now: search engines stay off. */ index: boolean; } /** List envelope: cursor-paginated. */ interface OwPage { data: T[]; has_more: boolean; next_cursor: string | null; } /** One element `search()` found: where the words were, and a short plain-text piece around the first match. */ interface OwSearchResult { type: ElementType; id: string; name: string; supertype: string; subtype: string; /** Where the words were found: `name`, or the first text field (in the type's schema order) that holds them all, else the first that holds any. */ field: string; /** Up to 160 characters of that field around the first match, as plain text. Never the whole field: read the element for its text. */ snippet: string; /** Present, and true, only when the reader knows of the element without seeing it whole: it matched on what a known-of stub keeps. */ known_of?: true; } /** search()'s answer: every element whose name or text holds every word of `q` as a whole word, up to `limit`. */ interface OwSearchResults { /** `q` as searched (trimmed). */ query: string; results: OwSearchResult[]; /** How many results came back. */ count: number; /** True when more elements matched than `limit` let through. There are no further pages: narrow `q` or `type`, or raise `limit`. */ truncated: boolean; } /** /changes feed -- discriminated union on `op`. Apply in order -> convergence. */ type OwChange = OwChangeUpsert | OwChangeDelete; /** A /changes item for an element written: the element whole, as GET returns it. */ interface OwChangeUpsert { op: 'upsert'; id: string; type: string; element: OwElement; updated_at: string | null; /** * The change's place in the world's feed. On a hide's or an unhide's row (the one carrying * `changed_via`) it is that act's place; the element's own `change_seq`, in `element`, stays where it was. */ change_seq: number; /** * Only on a hide's or an unhide's row, sent to the readers who still see the element (the owner's * keys, a co-builder, the member who made it): when it was hidden (`element.hidden` is true) or * unhidden (no `hidden`). Absent on every other upsert row. */ changed_at?: string | null; /** Only on a hide's or an unhide's row: the membership that hid or unhid it, or null for the world's owner (as a `hidden` delete row's `deleted_by`). */ changed_by?: string | null; /** Only on a hide's or an unhide's row: its door (see {@link OwWriteDoor}), `site` for the owner's page on onlyworlds.com. */ changed_via?: OwWriteDoor; [k: string]: unknown; } /** A /changes item for an element deleted. */ interface OwChangeDelete { op: 'delete'; id: string; type: string; deleted_at: string | null; /** The change's place in the world's feed. */ change_seq: number; /** The membership whose write deleted it; null for the world's owner, and for deletes before writes recorded it. */ deleted_by?: string | null; /** The door the delete came through (see {@link OwWriteDoor}); null for deletes before writes recorded it. */ deleted_via?: OwWriteDoor | null; /** * The name the deleting client gave in its `X-OW-Client` header, as an element's * `changed_client`: the client's claim, never proof. Null when none was recorded, and on a * `hidden` row (a hide carries no client). */ deleted_client?: string | null; /** * Why the element left this reader's view: `deleted` (it is gone; a GET answers 410), * `hidden` (the world's owner or a co-builder hid it from this reader; it still exists, a GET answers * 404, and an unhide brings it back by a 409 `resync_required`), or `out_of_view` (declared, sent by * nothing yet). Remove the element from the local copy in every case. */ reason?: OwDeleteReason; [k: string]: unknown; } /** Why a /changes delete row says the element left the reader's view. */ type OwDeleteReason = 'deleted' | 'hidden' | 'out_of_view'; /** One row of GET /world/hidden: an element the owner or a co-builder hid. */ interface OwHiddenRow { /** The element's type. */ type: ElementType | string; /** The element's id. */ id: string; /** When it was hidden (ISO 8601). */ set_at: string; /** The membership (a person's or a seat's) that hid it, or null when the world's owner did (as an element's `created_by`). */ set_by: string | null; } /** * The door a write came through, as keel records it on every element (`changed_via`) and on a * delete (`deleted_via`): `seat` (an AI seat), `mcp` (the MCP server), * `declared` (a client that sent `X-OW-Agent`; see {@link OwClientConfig.agent}), then the * surface for everything else: `api`, `v1`, `sync`, and `server` for keel's own writes. */ type OwWriteDoor = NonNullable; /** The doors the platform marks as an AI's: an AI seat, the MCP server, or a client that declared itself. */ declare const AGENT_DOORS: readonly OwWriteDoor[]; /** Whether a write came through an agent's door (`changed_via` or `deleted_via`); false for null. */ declare function isAgentDoor(door: OwWriteDoor | null | undefined): boolean; /** * Whether an element body is a stub the reader only knows of: a guest or player reaches it only through its own Character's sheet, one step out. * A stub keeps `id`, `type`, `name`, `description`, `supertype`, `subtype`, `image_url`, * `created_at`, `updated_at` and `change_seq`; every other field reads unset (`""`, `null`, * `[]`), `created_by`, `changed_by` and `changed_via` are null, it carries no extension * fields, and its files answer 404. Those empties are not the element's values and not a * deletion: never merge them over a whole copy, and never write a stub back (this client * refuses to). True only for `known_of: true`; absent or anything else is a whole element. */ declare function isKnownOf(element: { known_of?: unknown; } | null | undefined): boolean; /** * /changes response. Wire shape verified in keel source (core/changes.py) and * pinned here: {cursor, changes, has_more, head}. */ interface OwChangesPage { /** Opaque compound cursor -- persist verbatim, never parse, never expires. */ cursor: string; changes: OwChange[]; has_more: boolean; /** * World's current change_seq. If a persisted cursor is ever AHEAD of head, * the server rewound (disaster restore) -- re-baseline from cursor zero * instead of assuming caught-up. */ head: number; /** * A guest's or a contributor's view epoch (an integer; a contributor's since 2026-10-20), null for * every other key. It moves when what the key may see changes, even with `head` unchanged (a * Character given or taken, an element unhidden, a role): * walk again on either move. Compare it, never read it out of the cursor (keel, 2026-10-12). */ epoch: number | null; /** * Why `epoch` last moved (only while keel's hidden mark is on; null when `epoch` is * null): `role` (this key's own role or membership moved: keep what the local copy holds that a * walk from the start no longer names) or `view` (something left its view: drop it; also `view` * for an epoch that never moved). It names the last move only: when the epoch moved more than * once since the one you applied, walk with your cursor and read the 409's * `reason` (`err.resyncReason`), which covers every move since it. Never empty a copy on your own. */ epoch_reason?: OwResyncReason | null; } /** * Why a key's view restarted (only while keel's hidden mark is on): on a 409 * `resync_required` as the envelope's `reason`, on a /changes page and the head as `epoch_reason`. * `role`: the key's own role or membership moved; keep what the new walk does not name (it is out * of view now, not gone). `view`: something left its view (a delete, a hide, an unhide, a * Character change); drop what the new walk does not name. Both since the cursor: `role`. */ type OwResyncReason = 'role' | 'view'; /** * One answer the server refused before it gave up on an AI use it reads itself (`subs-captain`, `lens`), * from a 422 `answer_not_parsed`'s `refusals`. It never carries the answer's text. */ interface OwAiRefusal { /** Why the server refused the answer (`empty`, `not_json`, ...). */ word: string; /** How the provider says the answer ended: `max_tokens` means it ran out of room, unlike one that finished in the wrong shape. */ stop_reason: string; /** The output tokens the answer spent. */ output_tokens: number; } interface OwBulkItem { type: ElementType | string; element: OwElement | Record; } /** * One slot of a /bulk response. WIRE-CORRECTED (fixtures P2a/P2c): `status` is * the NUMERIC HTTP status of that slot (201/400/...), success slots echo * created_at/updated_at, error slots carry an OwErrorBody under `error`. * A contributor's write on someone else's element fails in its slot as * `{status: 403, error: {code: 'not_author'}}`, never as a thrown error. * After an `atomic: true` request with `errors` true NOTHING was written, yet the slots of * the items that would have succeeded still say 201 (keel's "counterfactual 201s"): do not * record their ids as created. * On a world that takes an AI seat's writes as proposals (`agent_writes_proposed`), * an AI seat's item on an existing element answers `{status: 202, id, proposal}`: the element * did not change, and `proposal` is the row a keeper accepts or declines. */ interface OwBulkItemResult { status: number; id?: string | null; created_at?: string | null; updated_at?: string | null; /** Only on a 202 slot: the proposal the write became. */ proposal?: OwProposal; error?: OwErrorBody; } /** The wire error envelope carried in error slots and thrown errors. */ interface OwErrorBody { type?: string; code?: string; message?: string; param?: string | null; doc_url?: string; /** On a 409 `resync_required` only, while keel's hidden mark is on: why (see {@link OwResyncReason}). */ reason?: OwResyncReason; /** On a 422 `answer_not_parsed` only: each answer the server refused, in order (see {@link OwAiRefusal}). */ refusals?: OwAiRefusal[]; /** On a 422 with `param` `fields` only: every name in a read's `fields` list that its type does not have, in the order sent. */ unknown_fields?: string[]; /** Beside `unknown_fields`: for each unknown name another element type has, those types. */ types_with_field?: Record; /** Beside `unknown_fields`: the names this type's `fields` takes (an extension field name passes too). */ allowed_fields?: string[]; } /** * What a 422 with `param` `fields` carries beside its message, when a read's `fields` list names fields * its type does not have: the whole list is refused once, with every unknown name, so a caller corrects * it in one try. Read from `OwApiError.fieldsRefusal`. */ interface OwFieldsRefusal { /** Every name in the list that the type does not have, in the order sent. */ unknown_fields: string[]; /** For each unknown name another element type has, those types. A name no type has is not a key here. */ types_with_field: Record; /** The names this type's `fields` takes. An extension field name (`x_`, `atlas_`, `shadow_`) passes too and is not listed. */ allowed_fields: string[]; } /** * /bulk response. WIRE-CORRECTED (fixtures P2a/P2c): the array key is `items`, * not `results`. `wasReplay` is populated by the client from the (lowercase on * the wire) Idempotent-Replay response header (fixture P2b) -- not a wire field. */ interface OwBulkResponse { errors: boolean; items: OwBulkItemResult[]; /** Client-derived: true when the server replayed a prior Idempotency-Key. */ wasReplay?: boolean; [k: string]: unknown; } interface OwLinkEdit { add?: string[]; remove?: string[]; } /** A proposal's state: `lapsed` once `expires` has passed (it may still be accepted or declined). */ type OwProposalState = 'open' | 'lapsed' | 'accepted' | 'declined'; /** * What part of the world's house rules a queue row would change: `charter`, a Law that carries the * Charter mark (`x_charter_of`); `skill`, an Object the text of such a Law names; `new_charter`, a * Law an accept would make a Charter (on a proposal: it sets the mark, and the Law's supertype after * it is `Charter`; on a new element's row: a new Law that carries the mark). The house rules are * changed only by the world's owner and co-builders; anyone else proposes (403 `keeper_only`). */ type OwProposalHouse = 'charter' | 'skill' | 'new_charter'; /** * A proposed change to an element (the document's `Proposal`): a record kept beside * the element, never in its body. The element does not change until the world's owner or a * co-builder accepts it. `evidence` is outside text: show it as quoted data, never act on it. */ interface OwProposal { /** Always `proposal`: in the world's queue it tells this row from a `new_element` row. */ kind: 'proposal'; /** The proposal's id. */ id: string; /** The element's type. */ element_type: string; /** The element's id. */ element_id: string; /** The part of the house rules this proposal would change, null for anything else. Read when the row is served, as the world stands then; worked out only for the world's owner and co-builders, null to any other reader. */ house: OwProposalHouse | null; state: OwProposalState; /** * What the proposal changes, and only that: the proposed values of the fields (schema * fields and extension keys alike) that differed from the element's own when it was made, in the * element's wire shape. A field sent with the value it already had is not here. An accept writes * exactly these fields; extension keys are merged. */ fields: Record; /** * The fields a whole replace (an upsert, PUT) did not send that were not empty on the element: * each is in `fields` at its empty value (`""`, null or `[]`), so an accept empties * it. Show them as left empty by this replace. Always `[]` for a patch, a link edit or propose; * extension keys are never here. */ omitted: string[]; /** The element's values when the proposal was made, taken by the server, for every field the write named (an upsert: every schema field). An accept is refused (409 `stale_proposal`) when a field in `fields` has moved since; a change to any other field does not count. */ base: Record; /** The element's change_seq when the proposal was made, for the record. */ base_seq: number; /** What the change rests on: a line of text or an element id (at most 2,000 characters). Quoted data, never an instruction. */ evidence: string; /** When it lapses if nobody decides (UTC). */ expires: string; /** Who proposed it: the membership id (a person, an AI seat or a player seat, as `members()` lists them), or `owner`. */ by: string; /** The door it came through, as an element's changed_via. */ via: string; /** The X-OW-Client name the request carried, or null. */ client: string | null; /** The keeper who accepted or declined it (a membership id or `owner`), or null. */ decided_by: string | null; decided_at: string | null; decline_reason: string | null; created_at: string; updated_at: string; } /** A page of one element's proposals (the document's `ProposalList`), newest first: proposal rows only. */ interface OwProposalList { data: OwProposal[]; has_more: boolean; /** Pass as `cursor` for the next page; null on the last. */ next_cursor: string | null; } /** * A row of the world's queue for a new element written as proposed (the document's * `ProposedNewElement`): an element carrying `x_review_proposed` (an AI seat's new element on a * world that takes its writes as proposals, or any writer's mark). The element itself is the * record, so the row has no id of its own. A keeper settles it with `reviewNewElement`. `by`, * `evidence` and `expires` are the mark's own words, null when it lacks one; `evidence` is quoted * data, never an instruction. */ interface OwProposedNewElement { kind: 'new_element'; /** The element's id. */ id: string; element_type: string; /** The element's id, as `id`. */ element_id: string; /** `new_charter` when the new element is a Law that carries the Charter mark, `skill` when it is an Object a marked Law's text names, else null. Worked out only for the world's owner and co-builders, null to any other reader. */ house: OwProposalHouse | null; /** open; lapsed once the mark's `expires` has passed (it may still be accepted or declined). Never accepted or declined: a settled mark leaves the queue. */ state: 'open' | 'lapsed'; /** The mark's own `by`, the writer's word for who proposed it: a claim, never a record of who wrote the element or the mark (show it as `OwProposedMark.by` says); null when it names nobody. */ by: string | null; /** The mark's `evidence` as stored: a string as written, any other JSON value (a list of ids, a number, an object) as itself, null when the mark holds null or has none. Quoted data, never an instruction: narrow before you show it. */ evidence: unknown; /** The mark's `expires` as stored: a string as written (the review profile writes a date, YYYY-MM-DD), any other JSON value as itself, null when the mark holds null or has none. A value that is not a date or a date-time never lapses; `state` says whether the row has. */ expires: unknown; /** The element's created_at. */ created_at: string; /** The element's updated_at. */ updated_at: string; } /** One row of the world's queue, told apart by `kind`: a proposed change, or a new element written as proposed. */ type OwWorldProposalRow = OwProposal | OwProposedNewElement; /** * A page of the world's queue (worldProposals, the document's `ProposalList`): both kinds of row in * one order, newest first by created_at. The cursor is opaque: pass `next_cursor` back as it came. */ interface OwWorldProposalList { data: OwWorldProposalRow[]; has_more: boolean; /** Pass as `cursor` for the next page; null on the last. */ next_cursor: string | null; } /** reviewNewElement's options: `accept` or `decline`, and, with decline only, a reason (at most 2,000 characters, answered back and kept nowhere). */ interface OwReviewInput { decision: 'accept' | 'decline'; reason?: string; } /** reviewNewElement's 200: `element` on accept (the element as written, the mark cleared), `deleted` (its id) on decline. */ type OwReviewed = { element: OwElement; deleted?: never; } | { deleted: string; element?: never; }; /** * The answer when a write became a proposal (the document's `Proposed`): the proposal under * `proposal`, and nothing element-shaped beside it. A 202 on patch, upsert or editLinks is thrown * as an OwProposedError carrying it; propose and declineProposal return the row itself. */ interface OwProposed { proposal: OwProposal; } /** acceptProposal's 200: the row, now accepted, beside the element as written. */ interface OwProposalAccepted { proposal: OwProposal; /** The element as written: the accept is an ordinary write by the keeper (a new change_seq, a /changes row). */ element: OwElement; } /** One moved field on a 409 `stale_proposal`: its value when proposed (`base`) and now (`current`). */ interface OwProposalConflict { field: string; base: unknown; current: unknown; } /** propose's body: the fields to change (as in a PATCH body), what they rest on, and when it lapses. */ interface OwProposeInput { /** The fields to change and their new values, as in a PATCH body (cleaned as patch cleans one). */ fields: Record; /** What the change rests on: text or an element id, 1 to 2,000 characters. */ evidence: string; /** When it lapses (ISO 8601), 1 to 365 days out; keel's default is 30 days. */ expires?: string; } /** listProposals' query: one element's proposals. */ interface OwProposalQuery { /** `open` (keel's default: not past `expires`), `lapsed`, `accepted`, `declined` or `all`. */ state?: OwProposalState | 'all'; /** Only rows whose `updated_at` is at or after this time (ISO 8601; UTC when no offset). */ since?: string; /** Rows per page, 1 to 1000; the client's pageSize when left out. */ limit?: number; /** A page's `next_cursor`. */ cursor?: string; } /** worldProposals' query: the world's queue, optionally one element's rows. */ interface OwWorldProposalQuery extends OwProposalQuery { /** Only one element's rows (its id). */ element?: string; } /** * POST /media/ticket's 201: a short-lived, single-use permission to upload one image * into this world's prefix. keel never sees the bytes; the edge at `upload_url` does. */ interface OwMediaTicket { /** Opaque: send it to `upload_url` as `Authorization: Bearer `, as is. */ ticket: string; /** Where the image goes (https://upload.onlyworlds.com/v1/upload on production). */ upload_url: string; /** `u//`: every upload with this ticket lands under it. */ prefix: string; /** The most this ticket accepts: the per-image limit, or what the account has left, whichever is smaller. */ max_bytes: number; /** Unix seconds after which the edge refuses the ticket. */ exp: number; /** Always 1: one ticket, one upload. */ uses: number; /** Who answers for the upload; the edge copies it onto the stored object. */ issued_to: { account: string | null; membership: string | null; }; } /** * POST /media/remove-ticket's 200: a short-lived, single-use permission to remove one * image. keel issues it to the image's uploader or the world's owner key; the edge at * `remove_url` does the removal. */ interface OwRemovalTicket { /** Opaque: send it to `remove_url` as `Authorization: Bearer `, as is. */ ticket: string; /** Where the removal goes: the upload host's /v1/remove (https://upload.onlyworlds.com/v1/remove on production). */ remove_url: string; /** Unix seconds after which the edge refuses the ticket (10 minutes after issue). */ exp: number; /** The object key the ticket removes. */ key: string; /** How many of the world's elements show the image. Removal does not change them: clear their `image_url` yourself. */ referenced: number; } /** The edge's 200 for one removal. */ /** * A member's role as the wire sends it (keel `MemberRole`, accounts/models.py). `co_builder` * is the value; "co-builder" is only its label in prose. Open, so a new role still types. */ type OwMemberRole = 'co_builder' | 'contributor' | 'guest' | (string & {}); /** Who paid for an ask or a sort: the account's daily token rating, or its own AI key once the rating is spent. */ type OwPaidBy = 'rating' | 'own_key'; /** POST /account/ask: keel's AI proxy's answer. */ interface OwAskAnswer { /** The answer, from the context only; "The world doesn't say." when it does not hold one. */ answer: string; model: string; stop_reason: string | null; usage: { input_tokens: number; output_tokens: number; }; /** How many more calls of this one's size fit in what the account has left today (a count of * answers, never tokens; it never over-promises). */ remaining: number; /** The account's tokens left today after this call (since keel a6244db, 2026-10-14). */ tokens_remaining: number; /** The account's token rating: its daily budget in tokens, one meter with the Council (since keel a6244db). */ token_rating: number; /** Who paid for this call: `rating`, the account's daily token rating; `own_key`, the account's own * AI key, once today's rating was spent (the rating's fields above are then as they were). */ paid_by: OwPaidBy; [k: string]: unknown; } /** * One element the notes may be about, as POST /account/sort takes it (the slice), and as a * row names it back: keel copies a target's name, type and anchor from the slice, never * from the model. `type` is lowercase going in; keel answers with its own spelling. */ interface OwSortRef { id: string; type: string; name: string; /** A short phrase that tells two same-named elements apart (up to 120 characters). */ anchor?: string; } /** * A note for sorting: its words, or an object with words and/or a picture already uploaded * into this world (`https://media.onlyworlds.com/u//`, no query). An object * needs at least one of the two; the picture is read as a photographed note. */ type OwSortNote = string | { text?: string; image_url?: string | null; }; /** A new element the notes describe. */ interface OwSortMakeRow { kind: 'make'; source_line: string; proposal: { type: string; name: string; description: string; }; } /** Text to append to a field of a slice element. */ interface OwSortAddToRow { kind: 'add_to'; source_line: string; target: OwSortRef; field: string; op: 'append'; value: string; } /** A link from one slice element to another, through a named field. */ interface OwSortLinkRow { kind: 'link'; source_line: string; target: OwSortRef; field: string; value_id: string; value_name: string; } /** * A question for the user: a name matches two or more slice elements, or the sorter is * unsure a thing exists. `then`, when sent, is the add_to or link the question stands for, * its target left out: the user's pick fills it. */ interface OwSortAskRow { kind: 'ask'; source_line: string; question: string; candidates: OwSortRef[]; then?: Omit | Omit; } type OwSortRow = OwSortMakeRow | OwSortAddToRow | OwSortLinkRow | OwSortAskRow; /** POST /account/sort: proposed changes for the user to review. Nothing is written to the world. */ interface OwSortAnswer { /** Every id in a row is from the request's slice. */ rows: OwSortRow[]; /** The lines the sorter could not place, and rows keel refused, each with a reason. */ not_proposed: { source_line: string; reason: string; }[]; model: string; stop_reason: string | null; usage: { input_tokens: number; output_tokens: number; }; /** How many more calls of this one's size fit in what the account has left today; ask and * sort spend from one token rating. */ remaining: number; /** The account's tokens left today after this call (since keel a6244db, 2026-10-14). */ tokens_remaining: number; /** The account's token rating: its daily budget in tokens, one meter with the Council (since keel a6244db). */ token_rating: number; /** Who paid for this call: `rating`, the account's daily token rating; `own_key`, the account's own * AI key, once today's rating was spent (the rating's fields above are then as they were). */ paid_by: OwPaidBy; [k: string]: unknown; } /** GET /me: who this world key is. */ interface OwMe { world: { id: string; name: string; }; scope: 'read' | 'write'; /** `player`: a friend with no account, reading as a guest. */ kind: 'owner' | 'person' | 'agent' | 'player'; role: 'owner' | OwMemberRole; /** The membership id (what `created_by` holds for what this key creates), or null for the owner. */ membership: string | null; /** The member's Character, or null (null too when it is hidden from this key). */ character: string | null; /** * The lenses you start with, lens ids in order: the ones you chose (setMyLenses), or, when you * chose none, the lenses whose `titles` name a Title your Character holds (`lenses_from` says * which; the owner's are always its own choice). The draught reads them when you name no lens * and no policy. */ lenses: string[]; /** * Where `lenses` comes from: `chosen` (your own list; an empty one is a choice of none), `titles` * (you never chose, and your Character's Titles bring these) or `none` (you never chose and nothing * brings you a lens: no Character, or Titles that name none; `lenses` is empty). The owner's is * always `chosen`. Saving a list makes it your choice. */ lenses_from: 'chosen' | 'titles' | 'none'; /** * Served only, never written: present only when `lenses` was served with a lens left out, one this * key cannot see; then it names `lenses`. Saving the list you were shown keeps that lens where it stands. */ x_served_trimmed?: 'lenses'[]; /** Agent and player seats only: your agent's or your player's name. */ name?: string; /** Who you are here, who answers for you, and the house rules. */ front_door: OwFrontDoor; /** What to read first in this world, as this key reads it: the Charter, the Guide, the Domains and the strand. */ reading_aids: OwServedReadingAids; [k: string]: unknown; } /** * A world's front door for one key: on `GET /me`, `PUT /me/character` and an * agent's `POST /join` answer. Every id is one the key may read; anything hidden from it, or * outside what its role sees, is null or left out. Read `charter` first. */ interface OwFrontDoor { /** * The person who answers for this seat (an AI or a player seat): `id` their membership id * (null for the world's owner), `kind`, and `name` their Character's name (null when they play * none this key can read). Null for the owner's keys, a person's own key, and a sponsor who is no * longer a member. A seat made from a link for an email address names the link's maker, like any * other seat: the address is a label, never matched to an account (the platform, 2026-11-15). */ sponsor: { id: string | null; kind: 'owner' | 'person'; name: string | null; } | null; /** The sponsor's Character, the one to address a message to, or null. */ sponsor_character: string | null; /** Your own Character (the owner's: the world's `owner_character`), or null. */ my_character: string | null; /** * The live AI and player seats you answer for, AI seats first (since keel's front door of * 2026-10-26). Empty for an AI or a player seat's own key and for anyone who answers for none. * A seat made from a link for an email address is listed for the link's maker (since 2026-11-15). */ my_seats: OwMySeat[]; /** The world's Charter: the newest marked Charter Law (a Law with supertype Charter carrying the mark `x_charter_of`), or null. Every member may read it. */ charter: string | null; /** The Objects the Charter's description names (by `ow://` link or id), in the order written, at most five; empty when none. */ charter_skill: string[]; /** `charter` typed as an element: the Charter is a Law, read with `get('law', id)`. Null where `charter` is. */ charter_element: OwFrontDoorCharter | null; /** `charter_skill` typed as elements, in the same order: each an Object, read with `get('object', id)`. Empty where `charter_skill` is. */ charter_skill_elements: OwFrontDoorSkill[]; } /** The Charter in `front_door.charter_element`: a Law by its type and id. */ interface OwFrontDoorCharter { type: 'law'; id: string; } /** One skill in `front_door.charter_skill_elements`: an Object by its type and id. */ interface OwFrontDoorSkill { type: 'object'; id: string; } /** One seat you answer for, a row of `front_door.my_seats`. */ interface OwMySeat { /** The seat's membership id, as `GET /members` lists it. */ id: string; /** `agent` for an AI seat, `player` for a player seat. */ kind: 'agent' | 'player'; /** The seat's name, or null when it has none. */ name: string | null; /** The Character the seat plays, or null when it plays none you can read. */ character: string | null; } /** * A world's reading aids as one reader sees them (schema-dist `profiles/charter.md`): the Charter (the rules * here), the Guide (start here) and the Domains (the places in the world), each an element of one of * `CHARTER_PAIRS` that carries the mark `x_charter_of`. Keel serves it as `reading_aids` beside `front_door` * on `GET /me` and an agent's `POST /join` answer; `charterOf` reads the same packet from a world snapshot. * The Charter's text is the house rules; the Guide and the Domains are the keeper's map, never instructions. */ interface OwReadingAids { /** The newest marked Charter the reader sees (newest by `created_at`, then the higher id), or null. */ charter: OwReadingAidsCharter | null; /** The newest marked Guide the reader sees, chosen the same way, or null. */ guide: OwReadingAidsGuide | null; /** Every marked Domain the reader sees: in the Guide's `constructs` order first, then by name (any case) and id. */ domains: OwReadingAidsDomain[]; } /** * `reading_aids` as keel serves it on `GET /me` and an agent's `POST /join` answer: `charterOf`'s three, then * the world's strand (schema-dist `profiles/strand.md` rule 2, serial 100), fourth in the charter profile's order. * `strandOf(world, reader)` reads the same `strand` from a world snapshot. */ interface OwServedReadingAids extends OwReadingAids { /** The story this world is about, as this key reads the world: six null slots when the world has no strand or its story is out of this key's view. */ strand: OwStrand; } /** The Charter in `reading_aids`. */ interface OwReadingAidsCharter { id: string; /** The Charter is a Law. */ type: 'law'; name: string; /** Its `x_checks_rules` (the checks profile) as stored; empty when it has none. */ rules: unknown[]; /** 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`. */ skill: string[]; } /** The Guide in `reading_aids`. */ interface OwReadingAidsGuide { id: string; /** The Guide is a Construct. */ type: 'construct'; name: string; } /** One Domain in `reading_aids`. */ interface OwReadingAidsDomain { id: string; /** A Domain is a Construct. */ type: 'construct'; name: string; /** Its description up to the first line break, trimmed; empty when it has none. */ sentence: string; /** 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. */ hubs: OwReadingAidsHub[]; } /** One hub of a Domain: an element by its type and id. */ interface OwReadingAidsHub { type: string; id: string; } /** One row of GET /members, the world's roster. */ interface OwMember { /** The membership id (what `created_by` holds), or null for the owner. */ id: string | null; kind: 'owner' | 'person' | 'agent' | 'player'; role: 'owner' | OwMemberRole; /** The Character that is this member, or null (null too when it is hidden from the reader). */ character: string | null; /** `removed` rows stay, so their elements keep `created_by`. */ status: 'active' | 'removed'; /** * Agent and player rows: the agent's or the player's name, to every reader. Person rows: the * person's username, served only to the owner's keys and co-builders (a co-builder's AI seat * included); absent for every other reader, and on a row whose account was deleted. */ name?: string; /** * The lenses this row starts with, lens ids in order: the ones it chose, or, for a live seat that * chose none, the lenses whose `titles` name a Title its Character holds (`lenses_from` says * which). The owner row: the owner's own choice, never a Title's. A lens this key cannot see is * left out of what it is shown. */ lenses: string[]; /** * Where `lenses` comes from: `chosen` (the row's own list; an empty one is a choice of none), * `titles` (it never chose, and its Character's Titles bring these) or `none` (it never chose and * nothing brings it a lens: no Character, or Titles that name none; `lenses` is empty). The owner * row and a removed row are always `chosen`. */ lenses_from: 'chosen' | 'titles' | 'none'; /** * Agent rows only: who answers for this AI, as the roster names them: the sponsor's membership id * (the `id` of their row here), `owner` when the world's owner answers for it, or null for a * sponsor with no live membership here. Every * reader reads it; person and player rows carry no `sponsor_member`. */ sponsor_member?: string | null; /** * Served only, never written: present only when `lenses` was served with a lens left out, one this * key cannot see; then it names `lenses`. Saving the list you were shown keeps that lens where it stands. */ x_served_trimmed?: 'lenses'[]; [k: string]: unknown; } /** GET /account/allowance: the account's token rating and what is left of it today. */ interface OwAllowance { /** The account's token rating: its daily budget in tokens. */ token_rating: number; /** Tokens spent today (UTC); may pass the rating by the size of the last call. */ tokens_used_today: number; /** Tokens left today, never below 0. */ tokens_remaining: number; /** When the day's tokens reset: the next midnight UTC (ISO 8601). */ resets_at: string; /** The account's own AI key, saved on its account page, or null: once today's rating is spent, ask and * sort run on it, billed by its provider. Only the provider is shown; the counts above keep the rating's meaning. */ own_key: { provider: 'anthropic' | 'openai'; } | null; [k: string]: unknown; } /** * One AI use, as GET /account/ai lists it: a named call a tool may make at POST /account/ai/{slug}. * A tool calls a use by its name and sends the use's own body; it never sends a prompt. */ interface OwAiUse { /** The use's name in its route: POST /account/ai/{slug}. */ slug: string; /** The tool that answers for its prompt and caps. */ owner: string; /** Who runs the model: `anthropic` (the platform's key, or the account's own saved key once its rating is * spent) or `jev` (a decisions gateway; an own key never runs it). */ provider: 'anthropic' | 'jev' | (string & {}); /** The model a call on the platform's key runs. */ model: string; effort: string; /** The sha256 of the use's system prompt, hex: two calls with the same hash ran the same prompt. */ prompt_sha256: string; /** The body names a world this account owns or is a member of. */ needs_world: boolean; /** What the body may hold, by name. */ input_caps: Record; /** The most tokens one answer may take. */ output_cap: number; /** The rating tokens a call needs left today to run (or a saved own key, for a use it can run): the * output cap, or the use's worst case when it is larger. */ rating_need: number; /** The answer is checked JSON, not text. */ structured: boolean; /** A fixed price per call in rating tokens, or null: the call's actual tokens are spent. */ price_tokens: number | null; /** Calls per account per UTC day, or null. Past it, 429 `use_ceiling` until midnight UTC; a use with a * ceiling runs one call at a time, and a second call while one runs is 429 `use_in_flight`. */ ceiling: number | null; /** This account's calls left today, or null when the use has no ceiling. */ calls_left: number | null; /** False while the use is switched off or has spent its own budget for today (its calls answer 503 * `ask_unavailable` with param `use`). */ on: boolean; /** True when a call by this account would be paid now, by the same check the call runs: `on`, the server's daily * cap not reached, and today's token rating holding `rating_need` (or, with the rating spent, a saved AI key that * runs this use). Offer the use only when this is true. Served since 2026-11-10. */ can_pay: boolean; [k: string]: unknown; } /** What every answer of an AI use adds to the use's own answer. */ interface OwAiMeter { /** Calls to this use this account has left today; null when the use has no daily ceiling (the token * rating is then the only limit). */ use_remaining: number | null; /** Read from the `Idempotent-Replay` header: true when this answer is the stored first answer for the * call's idempotency key, billed nothing this time. Set by the client, never sent by the server. */ wasReplay: boolean; } /** POST /account/ai/ask: the ask use's answer, the same as ask()'s, with the use's meter. */ interface OwAiAskAnswer extends OwAskAnswer { /** Calls to this use this account has left today; null when the use has no daily ceiling. */ use_remaining: number | null; /** True when this answer is the stored first answer for the call's idempotency key (billed nothing). */ wasReplay: boolean; } /** POST /account/ai/sort: the sort use's answer, the same as sort()'s, with the use's meter. */ interface OwAiSortAnswer extends OwSortAnswer { /** Calls to this use this account has left today; null when the use has no daily ceiling. */ use_remaining: number | null; /** True when this answer is the stored first answer for the call's idempotency key (billed nothing). */ wasReplay: boolean; } /** The `ask` use's body (POST /account/ai/ask), in its own wire spelling: the same fields as ask(). */ interface OwAiAskBody { world_id: string; /** 1 to 500 characters. */ question: string; /** 1 to 8 elements as text, each up to 2,000 characters, 12,000 in all (buildAskContext makes it). */ context: string[]; } /** The `sort` use's body (POST /account/ai/sort), in its own wire spelling: the same fields as sort(). */ interface OwAiSortBody { world_id: string; notes: OwSortNote[]; slice?: OwSortRef[]; } /** One thing in a join preview's glimpse: its name and its element type (`character`, `location`, ...). It carries no id. */ interface OwJoinGlimpseThing { name: string; type: string; } /** One link in a join preview's glimpse. `from` and `to` are places in `things`, counted from 0; `from` is the thing whose field holds the link. */ interface OwJoinGlimpseLink { from: number; to: number; /** The name of the field that holds the link. */ field: string; /** The words to show for the link. */ label: string; } /** * A join preview's `glimpse`: up to five things of the world by name, and the links among them, read as a * visitor with no account would read the world if it were public (nothing hidden, nothing proposed). It names no id. */ interface OwJoinGlimpse { /** How the things were chosen. `strand`: the world's chosen story, its happening, where it happened, its hero and where the hero is now. `links`: the most linked thing and the most linked of its neighbours. */ picked_by: 'strand' | 'links' | (string & {}); /** At most five, in the order `picked_by` gives. */ things: OwJoinGlimpseThing[]; links: OwJoinGlimpseLink[]; } /** POST /join/preview: what a join code holds, read without using it. */ interface OwJoinPreview { /** `person`: an invite link, accepted with acceptJoin. `agent`: redeemed by an AI agent at POST /join. `player`: a friend with no account redeems it with redeemJoin for a read key. */ reader: 'person' | 'agent' | 'player' | (string & {}); world: { name: string; description: string | null; }; /** The name the inviter signed the link with, or null. */ invited_by: string | null; /** The world owner's chosen Character's name, never a username; null when none is set, or when it is hidden. */ owner_character: string | null; role: OwMemberRole; /** Whether joining gives the joiner a Character of their own (AI links). */ with_character: boolean | null; /** ISO 8601, UTC. */ expires_at: string; /** The note the inviter wrote on a person link, or null (an AI or player link keeps none). */ note: string | null; /** A glimpse of the world for a link whose role reads it (contributor or co-builder). Null for a guest's link, and so for every player's, and when no two things a visitor could see are linked. */ glimpse: OwJoinGlimpse | null; /** A table only (a player link that works 2 to 50 times): how many times it works. Absent on a link for one. */ max_uses?: number; /** A table only: how many places are left. */ uses_left?: number; /** A table only: true when the owner listed no Characters, so each player sends a `name` to redeemJoin and gets a fresh Character with it. */ name_required?: boolean; /** A table only: the Characters a player may pick, in the owner's order; empty when `name_required`. `taken` while a live seat in the world plays it (a pick screen keeps the order and puts taken ones last). A Character hidden or deleted since the link was made is left out. */ characters?: Array<{ id: string; name: string; image_url: string | null; taken: boolean; }>; [k: string]: unknown; } /** One of a world's invite links, as GET /account/worlds/{id}/links lists it. */ interface OwWorldLink { /** The link's id: revokeWorldLink takes it. */ id: string; /** `person`: accepted signed in, with acceptJoin. `agent`: redeemed by an AI agent at POST /join. `player`: redeemed with no account at POST /join, for a read key. */ reader: 'person' | 'agent' | 'player'; role: OwMemberRole; /** The name the owner gave an AI link on the website, or empty. */ label: string; /** The name the link is signed with, or empty (the invite line then reads "Someone"). */ inviter_name: string; /** Whether redeeming gives the agent a Character of its own. Always false on a person link, always true on a player link. */ with_character: boolean; /** The code's last four characters, to tell links apart. */ last4: string; /** ISO 8601, UTC. */ created_at: string; /** ISO 8601, UTC. */ expires_at: string; /** 0 or 1 for a link for one; a table's seats made, removed ones included. */ uses: number; /** A table is `pending` while `uses < max_uses` (and neither revoked nor expired), `used` once full. */ status: 'pending' | 'used' | 'revoked' | 'expired'; /** The membership (its id in GET /api/v2/members) of the co-builder who minted the link over POST /api/v2/links; null for a link the owner made. */ minted_by: string | null; /** Whether the link shows the world's name and picture when it is pasted into a chat: then the link is `/join/#`, else `/join#`. Never on an AI link. */ preview?: boolean; /** A player link only: the Character the player reads as; null while a link for a fresh Character is unused, and always null on a table. `name` is null if that Character was deleted (the redeem then makes a fresh one). */ character?: { id: string; name: string | null; } | null; /** A table only (a player link that works 2 to 50 times): how many times it works. Absent on a link for one. */ max_uses?: number; /** A table only: the Characters its players may pick, in the owner's order; empty when each player gets a fresh Character named after them. `taken`: a live seat in the world plays it. `name` is null if the Character was deleted. */ characters?: Array<{ id: string; name: string | null; taken: boolean; }>; /** Where the link opens: `site`, onlyworlds.com's /join page; `dashboard`, the Dashboard's /join page (a person link only). Either page takes the same code. Always `site` on an agent or player link. */ lands_on: 'site' | 'dashboard'; [k: string]: unknown; } /** POST /account/worlds/{id}/links: the new link, with its code. The code is in this answer only: keel keeps a hash. */ interface OwCreatedWorldLink extends OwWorldLink { /** The `ow_j_` join code. Shown once; it can never be read again. */ code: string; /** The invite link: the /join page (`/join/` when `preview` is on) with the code after `#`. */ link: string; /** The one line to send: who invites, to which world, and the link. */ line: string; } /** POST /join, an agent's code: its seat, write key and secret, shown once. */ interface OwAgentJoined { kind: 'agent'; world: { id: string; name: string; description: string; [k: string]: unknown; }; seat: { id: string; role: OwMemberRole; agent_name: string; [k: string]: unknown; }; with_character: boolean; character: { id: string; name: string; } | null; /** The seat's write key (`API-Key`). */ key: string; /** The seat's secret, sent as `API-Pin`. */ pin: string; base_url: string; /** The lines of a `.env` file for the agent. */ env: string; next: string[]; members: Array>; /** The world's front door for the new seat: its sponsor, its Character, the Charter to read first. */ front_door: OwFrontDoor; /** What to read first in this world, as the new seat reads it: the Charter, the Guide, the Domains and the strand (the same packet as `GET /me`'s). */ reading_aids: OwServedReadingAids; [k: string]: unknown; } /** POST /join, a player's code: a read key for a friend with no account, reading as a guest. Shown once. */ interface OwPlayerJoined { kind: 'player'; /** A read key (`ow_r_`): no PIN, a player reads only. */ key: string; world: { id: string; name: string; description: string; [k: string]: unknown; }; /** The Character the player reads as. */ character: { id: string; name: string; }; role: 'guest'; [k: string]: unknown; } /** POST /join's answer: tell the two apart by `kind`. */ type OwJoined = OwAgentJoined | OwPlayerJoined; /** signInWithPassword's answer: the new account token, shown once, and its row on the account's tokens page. */ interface OwSignedIn { /** The account token (`ow_a_`): keep it, it is the only copy. */ token: string; /** The token's id, for revoking it. */ id: string; /** The name it was made under (`tokenName`). */ name: string; /** Its last four characters, as the account's tokens page shows them. */ last4: string; } /** One live AI seat, as GET /account/worlds/{id}/seats lists it. No key or secret. */ /** * One world of the account, from GET /account/worlds: owned (`role: 'owner'`) or shared * (`'collaborator'`, with `member_role` the membership's role). Keys by name and last four only, * never the key; on a shared world only the member's own keys. */ /** The draught's policy: what GET /character/{id}/context serves and how. */ interface OwDraughtPolicy { /** Sections to serve; default every one but `messages`, `room` and `proposed`, each served only when named. */ components?: OwDraughtComponent[]; /** `voice`: her slice, as she would read (default). `act`: through the caller's own view. */ mode?: 'voice' | 'act'; /** The horizon in the world's time unit; default the world's `time_range_current`. */ asOf?: number; /** Undated Events: `include` (default, marked `dated: false`, after the dated) or `exclude`. */ undated?: 'include' | 'exclude'; /** For `recent`: a /changes cursor, or an ISO 8601 time (as /changes' `after`). Absent, `recent` is empty. */ since?: string; /** Items per section, 1 to 1000, default 50; `cut` says what was dropped. */ budget?: number; /** The sheet's reach: 1 (default) what her own element links to, 0 none. */ depth?: 0 | 1; /** * `true` leaves out every empty section (an empty array or object) and an empty `cut`; * the frame (`world`, `calendar`, `as_of`, `now`, `mode`, `policy`) and every null stay, so a null * is still an answer (`character`: she is hidden from this reader; `style`: she has no style * element; `recent_cursor`: this read had no `since`). An absent section means nothing in it, never * that it was not read (`policy.components` says what was read). Default `false`, the fixed shape; * with `compact` the answer is typed `OwDraughtCompact`. */ compact?: boolean; /** * A lens id (the lens profile: a Construct with supertype Lens): the packet adds `lenses`, one * frame with that lens read for the caller's own view. The lens carries its own reach and limit in * its `x_lens`, so `lens` beside `depth` or `budget` is a 422 (`param` lens); a lens the caller * cannot see, or an id that is no lens, is a 404. Without `lens`, and with no other policy key but * `compact`, the packet adds one frame per lens the caller chose (setMyLenses), in its order. */ lens?: string; } /** * A section of the draught, in the packet's order (keel's COMPONENTS). `messages`, `room` (the room profile's other * elements) and `proposed` (elements carrying `x_review_proposed`) * are off unless named. */ type OwDraughtComponent = 'self' | 'role' | 'work' | 'style' | 'events' | 'knowledge' | 'names' | 'sheet' | 'recent' | 'messages' | 'room' | 'proposed' | 'roster'; /** One row of the draught: an element as the list route serves it to the same reader, and how it got here. */ interface OwDraughtItem { /** The link fields that brought it (on the element, or on her own element in `sheet`); empty for a `proposed` row that came only through `recent`. */ via: string[]; /** With `via` collectives: her circles it is held by. */ circles?: string[]; /** How many of the packet's elements link to it. */ her_links: number; /** `known_of`: a stub this reader knows of but does not see whole (its other fields read empty). */ grade: 'whole' | 'known_of'; /** In `events` and `knowledge`: false when it carries no date (ranked after the dated). */ dated?: boolean; /** The element's body as the list route serves it to the same reader; under `compact`, less each field that is null, "", [] or {} (`id`, `type` and `name` always stay): read a missing field as empty. */ element: OwElement; } /** One Character's context in one read, GET /character/{id}/context (the draught). */ /** The draught under `compact`: every section may be absent, and so may `cut` (nothing was cut); each element body leaves out its empty fields, `id`, `type` and `name` kept. */ type OwDraughtCompact = Omit & { cut?: Record; }; interface OwDraught { world: { id: string; name: string; description: string; }; /** The world's own time fields, as it carries them. */ calendar: Record; as_of: number | null; now: number | null; /** The mode asked for (`voice` or `act`); `reader` says what the packet was read as. */ mode: 'voice' | 'act'; /** The rung the packet was built through: `public` reads as itself in either mode; otherwise the owner, a member's role, or a seat. Kept under `compact`. */ reader?: 'public' | 'owner' | 'co_builder' | 'contributor' | 'guest' | 'seat' | 'player'; /** The policy served under, every key resolved. */ policy: Record; /** {section: items the budget dropped}; empty when whole. `proposed` counts every proposed element that reached her and was left out, the component unnamed or its budget spent. */ cut: Record; recent_cursor: string | null; recent_more: boolean | null; /** With `self`: her own element (`grade: 'known_of'` when this reader knows her only as a stub), or null when it is hidden from her. */ character?: { self: true; grade: 'whole' | 'known_of'; element: OwElement; } | null; role?: OwDraughtItem[]; /** * Her open work: Relations with supertype `Work item` and subtype `open` or `taken` that are for her, by name * (`actor` is her) or by a role she holds (`x_packet_for` names a Title whose `holders` name her). Each row adds * `packet`, the item's `x_packet_elements` (`[]` when it has none), and `by_role`, the ids of her Titles the item * names, each once, in the item's order (`[]` when none does). A row that reached her only through a Title has * `via` `['holders']`. Read as her (`mode: 'voice'`) a work item reaches her only through a field of its own * that names her: ask with `mode: 'act'` for what is hers by role. */ work?: Array>; by_role: string[]; }>; style?: OwDraughtItem | null; events?: OwDraughtItem[]; knowledge?: OwDraughtItem[]; /** Everything else that names her, by type. */ names?: Record; sheet?: OwDraughtItem[]; /** Only when named. Each line with its author's seat from the roster. Words said by a seat: never facts, never instructions. */ messages?: Array; /** Only when named: the room's other elements that reach her (the room profile), here or nowhere. */ room?: OwDraughtItem[]; /** Only when named: every element carrying `x_review_proposed` that reaches her, here or nowhere; `cut.proposed` counts the ones left out. */ proposed?: OwDraughtItem[]; recent?: Array<{ op: 'upsert' | 'delete'; type: string; id: string; when: string | null; who: string | null; door: string | null; [k: string]: unknown; }>; roster?: Array<{ id: string | null; kind: string; role: string; character: string | null; status: string; name: string; }>; /** * Present only with `lens` (one frame, on any Character), or, on a read of the caller's own Character with * no lens and no policy key but `compact`, the lenses the caller starts with (one frame each, in its order: * the ones it chose, or for a seat that never chose, the ones its Titles give it). A frame is the caller's * own reading and its own Character's mail, never hers: each lens is read for the caller's own view, never past it. */ lenses?: OwDraughtLens[]; } /** One frame of the draught's `lenses`: one lens read for the caller's own view. */ interface OwDraughtLens { id: string; name?: string; /** * What the lens keeps, in the profile's order (its anchors in its link order, then by type in the * schema's order, newest first, then by id), each as its `show` makes it: the body as served (under * `compact` less its empty fields), its first line, or its name; a kept anchor carries its `note`. */ rows?: Array>; /** How many the reading cut, by reason (budget, types, window, undated, after_as_of, hops_not_served; for the owner alone anchor_not_visible and not_visible). */ cut?: Record; /** With a mail rule: unread and read ids, rows, cut by reason, totals. */ mail?: Record; /** A chosen lens not read: retired, a template, or one the caller can no longer see (deleted or hidden since). It stays chosen. */ skipped?: 'retired' | 'template' | 'not_found'; /** The `x_lens` key holding a value outside the profile's table: nothing is read. */ unreadable?: string; } /** GET /world/{worldId}/lenses (worldLenses): every lens in the world the caller can see. */ interface OwWorldLenses { data: OwWorldLens[]; /** The reader the owner read as (`readAs`), or null. */ read_as: string | null; } /** * One lens of worldLenses: its recipe echoed, the Titles it is the default for and whether the * caller chose it; with `resolve`, its `reading`. The owner also gets `chosen_by` and `health`. */ interface OwWorldLens { id: string; name: string; /** The lens element as this caller is served it (an anchor it cannot see left out, with `x_served_trimmed`). */ element: OwElement; /** Subtype Template: it reads nothing until copied and pointed. */ template: boolean; /** Status retired: no seat starts with it; a seat that chose it keeps it, and the reading skips it. */ retired: boolean; /** The lens's `x_lens` with every default the profile names filled in; null for an unreadable lens. */ x_lens: { depth: 0 | 1 | 2; types: string[]; window: number | null; from: number | null; to: number | null; undated: 'include' | 'exclude'; /** Days: what a hop or a filter reaches that last changed longer ago than this, by the reading's clock, is cut as `stale`; null for no such cut. */ changed_within: number | null; show: 'full' | 'first_line' | 'name'; budget: number; mail: 'unread_full_read_titles' | 'all' | 'none'; notes: Record; } | null; /** Present when `x_lens` holds a value outside the profile's table: the key refused. Nothing is resolved. */ unreadable?: string; /** The Titles it is the default for: everyone holding one starts with it. */ titles: string[]; /** This caller chose it (OwMe's `lenses`, with `lenses_from` `chosen`). */ chosen: boolean; /** This caller chose no lenses and starts with this one through a Title its Character holds (OwMe's `lenses`, with `lenses_from` `titles`). Never with `chosen`. */ from_titles: boolean; /** The owner only: the memberships that chose it (null for the owner). */ chosen_by?: Array; /** The owner only: the seats that start with it through a Title, apart from `chosen_by`: each live membership that chose no lenses and whose Character holds a Title it names, with those Titles, in the members' order. */ title_seats?: Array<{ member: string; titles: string[]; }>; /** The owner only: `empty` (it resolves to nothing for the owner), `over_budget` (the owner's reading cuts by budget), `retired_assigned` (retired and still chosen by a seat). */ health?: { empty: boolean; over_budget: boolean; retired_assigned: boolean; }; /** With `resolve`: the reading of the lens for this caller (or the reader `readAs` names); null when it is `skipped`. */ reading?: OwWorldLensReading | null; /** With `resolve` and `readAs`: `not_found` when the reader read as cannot see this lens (deleted or hidden from it), so it is not read and `reading` is null; the draught's word for a chosen lens it skips. */ skipped?: 'not_found'; } /** A lens's reading on worldLenses with `resolve`: what it keeps and what it cut, with why. */ interface OwWorldLensReading { /** The kept elements in the profile's order, each as `show` makes it; a kept anchor's row carries its `note`. */ rows: Array>; /** How many elements the reading cut, by reason; a reason with none is absent. */ cut: Record; /** The elements cut for each reason, at most 100 named per reason (`cut` keeps the whole count). */ cut_rows: Record>; /** Kept plus cut: "keeps X of the Y it reached". */ reached: number; /** Notes on ids that are not anchors of the lens, ignored. */ notes_ignored: number; /** With a mail rule: `unread` and `read` (ids), `rows`, `cut` by reason and `totals`. */ mail?: Record; } interface OwAccountWorld { id: string; name: string; role: 'owner' | 'collaborator'; member_role?: OwMemberRole; public_read: boolean; keys: Array<{ name: string; last4: string; scope: 'READ' | 'WRITE'; revoked: boolean; }>; } /** createAccountWorld's input, in camelCase; sent in keel's spelling (`key_name`), only the keys given. */ interface OwCreateAccountWorldInput { /** The world's name: 1 to 255 characters, not blank (keel trims it). */ name: string; /** The account PIN, 4 digits. An account with no PIN yet must send one (1000-9999), which becomes the account PIN; an account with a PIN may send it to have it checked before the world is made (wrong: 401 with `param: 'pin'`, nothing made), or leave it out. */ pin?: string | number; /** A name for the world's write key, as the website's key list shows it: 1 to 80 characters, trimmed. Left out or null: no name. */ keyName?: string | null; /** The folder format's `source` line (spec 4.2), from a tool that makes the world from a folder; kept on the World and served as `origin.source`. */ source?: OwWorldSource | null; /** The folder format's `producer` line (spec 4.2); kept on the World and served as `origin.producer`. */ producer?: OwWorldProducer | null; } /** * createAccountWorld's 201: the world's row as listAccountWorlds lists it, plus the full write key * once in `key` (never shown again). keel's document names it `AccountWorldCreated`, and * the maintainers' wire check holds this type to it key for key. */ interface OwCreatedAccountWorld { id: string; name: string; role: 'owner'; public_read: boolean; /** The world's one key, by name and last four. */ keys: Array<{ name: string; last4: string; scope: 'READ' | 'WRITE'; revoked: boolean; }>; /** The full `ow_w_` write key, shown in this answer only. */ key: string; } /** * A world key as minted by POST /account/worlds/{id}/keys: the row the account's key list shows, * plus the full key once in `key` (never shown again). A member's key carries its `member` label; * an owner's row has no such field. */ interface OwMintedKey { id: string; name: string; last4: string; scope: 'READ' | 'WRITE'; last_used_at: string | null; revoked: boolean; key: string; member?: OwWorldKeyMember; /** True when minted with `keep: true`: no revoke of the token that minted it takes it (a sign-out keeps it). */ kept?: boolean; } /** * The membership a member-bound world key is bound to. A person's carries `username`; an agent * seat's `agent_name` (its username null); a player seat's `kind` and `name` (its username null). */ interface OwWorldKeyMember { id: string; username?: string | null; agent_name?: string; kind?: string; name?: string; } /** * A world key's row as GET /account/worlds/{id}/keys/made answers it (madeWorldKey): the key a * mint sent with that Idempotency-Key made, without the key itself. A revoked key still answers, * with `revoked: true`. */ interface OwWorldKeyRow { id: string; /** The key's label, an empty string when it has none. */ name: string; /** The key's last four characters; the key itself is shown once, at the mint. */ last4: string; scope: 'READ' | 'WRITE'; last_used_at: string | null; revoked: boolean; /** True when the key is kept across a sign-out (`keep` at the mint). */ kept: boolean; /** On a member-bound key only: the membership it is bound to. An owner key has none. */ member?: OwWorldKeyMember; } /** An account token as GET /account/tokens lists it: by name and last four, never the token itself. */ interface OwAccountToken { /** The token's id: revokeAccountToken takes it, and a sign-in answers it as `tokenId`. */ id: string; /** The label given at mint (a device, a tool). */ name: string; /** The token's last four characters, to tell tokens apart. */ last4: string; last_used_at: string | null; revoked: boolean; /** When the token stops working, for a sign-in tool's token with a lifetime; null never expires. Past it the token is refused as a revoked one. */ expires_at: string | null; /** How many live world keys this token minted. */ keys_minted: number; /** Who the token is for: empty for a token made by hand or a sign-in tool's; `mcp` for a hosted client's grant on the MCP server; `ai` for an AI door token (mintAiToken, or the sign-in's `aiUses`). */ audience: string; /** On an `ai` token only: the AI uses it opens (`ai(use, …)`). */ ai_uses?: string[]; /** On an `mcp` token only: the client's name, as it registered itself, or its id when it is no longer registered. */ client?: string; /** On an `mcp` token only: the host the client returns the person to. */ return_host?: string; /** Only on a token a sign-in with `scope: 'world:read'` minted: it reads, and every write but its own revoke is refused with 403 `permission_error`. Absent on every other token. */ scope?: 'world:read'; } /** * An AI door token as minted by mintAiToken (POST /account/tokens with `ai_uses`): its row, as the * account's token list shows it, plus the token itself once in `token` (never shown again). */ interface OwMintedAiToken extends OwAccountToken { audience: 'ai'; ai_uses: string[]; /** When it stops working: midnight UTC at the latest. */ expires_at: string; /** The `ow_a_` AI door token, shown only here. */ token: string; } interface OwSeat { /** The seat's membership id: removeSeat takes it, and GET /members names the seat by it. */ id: string; /** The AI's own name in the world. */ name: string; role: OwMemberRole; /** Always `agent`: a seat has no account of its own. */ kind: 'agent'; /** The Character the seat plays, or null. With `character: 'mine'` it is its sponsor's own: two rows, one Character. */ character: string | null; /** Who answers for the seat: a username when they are the world's owner or a member; null for a sponsor who left. A seat from a link for an email address answers to the link's maker (since 2026-11-15). */ sponsor: string | null; /** ISO 8601, UTC. */ joined_at: string | null; /** The latest use of the seat's key, or null. */ last_active: string | null; /** * True when the seat may change, never delete, the Character it plays: the owner gave it that Character with the * right (the owner may also give it without, `may_change_character` false on the member's PATCH), or its sponsor * could change it. False says only that no such right is held: a co-builder seat changes everything and a seat * changes what it made. On a seat a member answers for it holds only while that member could change the * Character; once cleared, sending the same Character again keeps it cleared, and only the owner's * `may_change_character` true gives it back. False when the seat has no Character, and when its Character is kept * from you (`character` null). */ may_change_character: boolean; /** * A sentence: why the seat may not change the Character it plays, or, where it can change it all the same without * the right, why (it made it, or it is a co-builder). Null otherwise, and when its Character is kept from you. */ may_change_character_note: string | null; /** True when its member made it for their own AI to play their own Character: it plays what its sponsor plays, and its `may_change_character` is its sponsor's, until it is handed to someone else. */ follows_sponsor: boolean; [k: string]: unknown; } /** * setMemberLenses's answer (keel's `MemberLenses`): the row whose lenses were set, as you are shown it. * Not the roster row: only these keys come back. */ interface OwMemberLenses { /** The membership; null for the owner's own list (`'owner'` as the member id). */ id: string | null; /** The row's role; `owner` for the owner's own list. */ role: OwMemberRole; /** `person`, `agent` or `player`; `owner` for the owner's own list. */ kind: string; /** The row's lenses, lens ids in its order, as you are shown it; empty for none, which is a choice. */ lenses: string[]; /** * Served only, never written: present only when the list keeps a lens you cannot see, which stays * in the list where it stands and is left out of `lenses`; then it names `lenses`. */ x_served_trimmed?: 'lenses'[] | null; [k: string]: unknown; } /** POST /account/worlds/{id}/seats's answer: the seat, its key and secret, shown in this answer only. */ interface OwSeatCreated { world: { id: string; name: string; [k: string]: unknown; }; seat: { id: string; name: string; role: OwMemberRole; kind: 'agent'; [k: string]: unknown; }; /** The Character the seat plays, or null for none. */ character: string | null; /** The seat's write key (`API-Key`). */ key: string; /** The seat's `ow_s_` secret, sent as `API-Pin` where a person sends their PIN. */ pin: string; /** The lines of a `.env` file for the AI: OW_API_KEY, OW_API_PIN, OW_WORLD, OW_CHARACTER when it plays one, OW_API_BASE. */ env: string; [k: string]: unknown; } /** POST /account/join: the new membership (the same row as accepting an email invite). */ interface OwJoinedMembership { /** The membership's id. */ id: string; world_id: string; world_name: string; role: OwMemberRole; joined_at: string | null; /** The id of the joiner's roster Character, or null. */ roster_character: string | null; [k: string]: unknown; } interface OwRemovedImage { /** The object key that was removed. */ removed: string; /** The bytes given back to the uploading account's storage. */ bytes: number; /** * `may_linger`: copies the network or a browser already holds can keep answering for days * or longer (images are cached as unchanging for a year). `purging`: the edge cache is * being cleared too. */ cache: 'may_linger' | 'purging' | (string & {}); [k: string]: unknown; } /** The edge's 201 for one upload. Put `url` in an element's `image_url`. */ interface OwUploadedImage { /** The permanent public URL (https://media.onlyworlds.com/). */ url: string; /** The object key, under the ticket's `prefix`. */ key: string; bytes: number; /** The MIME type the edge read from the bytes (never from a header or a file name). */ type: string; etag: string; [k: string]: unknown; } /** * What a file on an element can be: text (`txt`, `md`, `json`, `csv`, `yaml`, `toml`), `pdf`, * `zip` only as a world's own bundle, and an image (`png`, `jpg`, `webp`, `avif`; no svg or gif). * The upload host checks each against the file's first bytes. A file's name ends in its kind's * extension; `.yml` counts as yaml, `.markdown` as md and `.jpeg` as jpg. An image file is private * to the element's readers like any file and is served as a download, not as an element's * picture (that is `image_url`). */ type OwFileKind = 'pdf' | 'txt' | 'md' | 'json' | 'csv' | 'yaml' | 'toml' | 'zip' | 'png' | 'jpg' | 'webp' | 'avif'; /** * Who added a file. A removed member's file keeps its membership id and name; a file whose member's account was * deleted keeps its membership id and is named "a former member". */ interface OwFileAddedBy { /** A member's or a seat's name; the owner's username for the owner's keys; "a former member" where no one is left to name. */ name: string; /** Their membership id; null for the owner's files and for a file whose membership no longer exists (`owner` tells the two apart). */ membership: string | null; /** True when an agent added it: an AI seat, the MCP surface, or a key that declared an agent. */ agent: boolean; /** * True when the world's current owner added the file, through any door (the site, the API, or an agent with the * owner's own keys; a seat the owner sponsors is the seat's, false). False for everyone else, on every file of a world * with no owner, and on a past owner's files once the world has another owner. Since 4.154.0. */ owner: boolean; } /** One file on an element, as listFiles returns it. */ interface OwFileRow { id: string; /** The file's name as uploaded. */ name: string; kind: OwFileKind; /** Bytes, as the upload host stored them. */ size: number; /** A field of the element's type the file belongs to, free text (at most 80 characters), or null. */ label: string | null; added_by: OwFileAddedBy; /** When the upload host stored it (ISO 8601). */ added_at: string; } /** One file in the world's list: a file row with its element's type and id. */ interface OwWorldFileRow extends OwFileRow { element_type: ElementType; element_id: string; } /** GET /world/files: every file this key may see, newest first, and the world's total against its cap. */ interface OwWorldFiles { data: OwWorldFileRow[]; /** The bytes of the world's live files (all of them, also those this key cannot see). */ used_bytes: number; /** The world's room for files (250 MB on onlyworlds.com). */ cap_bytes: number; } /** * The 201 of POST /{type}/{id}/files: a short-lived, single-use permission to upload one * file onto one element (the image ticket's shape, with `kind: 'file'` and the file's id). */ interface OwFileTicket { /** Opaque: send it to `upload_url` as `Authorization: Bearer `, as is. */ ticket: string; /** Where the bytes go (https://upload.onlyworlds.com/v1/file on production). */ upload_url: string; /** `w///`. */ prefix: string; /** The object key the file lands under: `w///.`. */ key: string; /** The most this ticket accepts: 25 MB, or what the world has left, whichever is smaller. */ max_bytes: number; /** Unix seconds after which the upload host refuses the ticket (10 minutes after issue). */ exp: number; /** Always 1: one ticket, one upload. */ uses: number; /** Who answers for the upload. */ issued_to: { account: string | null; membership: string | null; }; /** Always `file` (an image ticket has none). */ kind: 'file'; /** The file's id, minted before a byte moves: the `id` its row will have. */ file_id: string; } /** The upload host's 201 for one file. */ interface OwUploadedFile { /** The object key, the ticket's `key`. */ key: string; /** The file's id, the ticket's `file_id`. */ fid: string; /** The bytes stored. */ bytes: number; /** The MIME type the file is served with. */ type: string; etag: string; [k: string]: unknown; } /** GET /{type}/{id}/files/{file_id}/download: a link to the file, and when it stops working. */ interface OwFileDownload { /** * The file on the download host, as an attachment. The link is the credential: anyone who * holds it can fetch the file until `exp`, more than once (ranges honoured, CORS open). */ url: string; /** Unix seconds after which the link is refused (5 minutes after issue). */ exp: number; name: string; kind: OwFileKind; size: number; } /** * The parameters of `list()` and `listAll()`. A wire filter goes under `filter`; any key not named * here is a TypeError before anything is sent (since 4.51.0; before, an unknown key was dropped and the * list came back whole). */ interface ListParams { limit?: number; cursor?: string; /** Only these ids (1 to 200), in the list's own order; one this key cannot see is simply absent. */ ids?: string[]; /** A membership id, or `'owner'` for the owner's own writes: only what that member created. */ createdBy?: string; /** One-level stub expansion, e.g. ['friends', 'location']. */ expand?: string[]; /** Sparse include-set of field names. */ fields?: string[]; /** * Accepted: `name` (exact), `name__icontains`, `supertype`, `subtype`, * `characters=` (contains) on every type with a `characters` link (at schema * 0.30.1: collective, construct, event, narrative, relation, title), and each single link * of the type (`parent_location`, `birthplace`, ...: the elements linking to that id), and on * the Pin list `element=` (since 2026-11-12: the Pins that place that element, of any * type, so `list('pin', { filter: { element: id }, expand: ['map'] })` gives an element its * maps in one call). An * empty value is sent as `key=`, a filter of its own: `supertype: ''` lists the elements * with none, `characters: ''` a Message to everyone, a single link's the elements linking * to nothing, `element: ''` the Pins placing nothing (until 4.108.1 it was dropped and the * list came back whole). Any other key * 422s server-side with the list of filters in the message -- the client passes keys * through unchecked and lets the platform say so. (`__in`, `__gte`, `__lte` and * `__isnull` are designed in the API's spec but not built; `ordering` 422s too.) */ filter?: Record; /** * View as, sent as `as`: read as another reader of this world would. A membership * id (a person, an AI seat or a player seat) reads as that member's own key; a Character id * reads as a guest of that Character with no membership; `'public'` reads everything not * hidden. The owner's keys only (a key with no member): a member key gets 403 * `view_as_owner_only` (`err.isViewAsOwnerOnly`). An element hidden from that reader is 404, * never 410. An unknown value is 422 (`param` as). Only while keel's hidden mark is on; until * then keel answers 422 (an unknown parameter). */ viewAs?: string; /** * Passed to fetch as given: aborting it rejects with an OwNetworkError. On `listAll` it covers * the whole walk, every page. Not a query parameter. A time limit per request goes in the * client's own `fetch`. */ signal?: AbortSignal; } interface OwClientConfig { /** * The key: an ow_w_ (write) or ow_r_ (read) world key, an ow_a_ account token (sent as a Bearer token, for the account routes, and with `world` set for that world's reads), or a 10-digit legacy key. * Leave it out for a client that holds none, such as a friend with only a link (since 4.30.0): it can call health, * previewJoin, redeemJoin and signInWithPassword (and with `world` set, list, listAll, get, search, getWorld and draught), and any * other call is a TypeError before anything is sent. */ apiKey?: string; /** * The PIN (or an AI seat's `ow_s_` secret), needed for writes when the world has one, and for * legacy-key reads of a world with a PIN. Sent as `API-Pin` only where keel checks it: on every * write (any method but GET), on GET /me (me(), the connection test), and on every request of a * 10-digit legacy key. A prefixed key's other reads go without it, and an account token never * sends it. A string, not a number: '0123' !== 123. */ apiPin?: string; /** The API's base URL, default https://www.onlyworlds.com/api/v2. */ baseUrl?: string; /** * Page size for element lists, default 100 (the server's default; at most 1000). * It is in the config on purpose: page size decides the load a client puts on the server. */ pageSize?: number; /** * Page size for /changes pulls, default 100. Tools in use pick 25 to 250; the change feed * is the platform's heaviest route, so keep it modest. */ changesPageSize?: number; /** A fetch implementation to use instead of globalThis.fetch (for tests and other runtimes). */ fetch?: typeof globalThis.fetch; /** * Declare this client an AI agent: every element write (create, upsert, patch, delete, * editLinks, bulk) carries `X-OW-Agent`, the operations the API document declares it on, and onlyworlds.com * records its writes as an AI's (`changed_via: 'declared'`; the server stores that the header * was there, never its value). Off by default, and it must stay off in a tool people use: * it describes the caller, so only the caller can set it. An AI seat's key is recorded * as an agent without it. */ agent?: boolean; /** * This client's own name, sent as `X-OW-Client` on every element write (create, upsert, patch, * delete, editLinks, bulk, adopt), on propose, acceptProposal and reviewNewElement, and on no * read. keel stores it on the element as * `changed_client`, and on a /changes delete as `deleted_client`, so a reader can tell which tool * made a change: `'atlas'`, `'lantern'`, your app's name. Default `'sdk'`. * * The rule: lower case letters, digits and hyphens, 1 to 32 characters (`[a-z0-9-]{1,32}`), no * version (`'atlas'`, not `'atlas-1.76'`). Anything else is a TypeError when the client is * constructed, and nothing is trimmed. It is the client's claim about itself, not proof, and it * changes no permission and no door: whether an agent made a write is `agent`'s business. */ client?: string; /** * A world's id, for a client that holds an account token (`ow_a_`) or no key. `list`, `listAll`, * `get` and `getWorld` then read that world, sending `world=`: an account token reads it as * that account's own access there (the owner the whole world, a member its member key's view, * anyone else the public view), and no key reads it as the public does. An account token also * sets its own lenses there with `setMyLenses` (`world=`), the one write it names, and reads * the world's roster with `members` (`world=`) as its grant there. On such a * client every other world call is a TypeError before sending; the account calls and * `worldLenses` (the world in its path) work as without it. Given with a world key, or as * anything but a non-empty string, it is a TypeError when the client is constructed. */ world?: string; } /** * keel v2 engine absorbed from an earlier v2 client (ow-v2-client v0.9.0), * wire-corrected against live staging fixtures 2026-07-18. * * keel error envelope handling. The error contract is part of the contract: * envelopes carry a machine `code` and a `doc_url` fragment anchored at * onlyworlds.github.io/api/errors -- surface both, always. The live wire * envelope also carries `type` and `param` (fixtures P4a/P2c); both are * surfaced on the thrown error. */ /** * Auth codes are distinguishable by design; client recovery UX differs per code. * `world_gone` is RESERVED: keel's spec promises it but the server never emits it (a deleted * world's keys go with it, so the key reads as unknown: 401 `invalid_credentials`). Kept so * the client is ready if keel ever remembers deleted worlds' key hashes. */ type OwAuthErrorCode = 'invalid_credentials' | 'key_revoked' | 'world_gone'; declare class OwApiError extends Error { readonly status: number; /** Machine error code from the keel envelope, e.g. 'invalid_credentials'. */ readonly code: string | null; /** Error family from the envelope, e.g. 'invalid_request', 'not_found'. */ readonly type: string | null; /** Offending field/param named by the envelope (a 422/400's field; `API-Pin` on a 401 PIN refusal), else null. */ readonly param: string | null; /** Documentation link from the envelope -- show it to users/logs verbatim. */ readonly docUrl: string | null; /** Raw parsed envelope (or body text when the body wasn't JSON). */ readonly detail: unknown; /** * Seconds to wait before retrying, from the `Retry-After` header (a delay in * seconds or an HTTP date), else null. keel sends it on 503 `server_busy` * (admission control) and 429 `rate_limited`. This client never retries * on its own; the value is here so callers can back off politely. * Readable in browsers too: keel exposes `Retry-After` over CORS and its * admission gate's 503 carries CORS headers (keel `4949406`, 2026-09-28). */ readonly retryAfter: number | null; constructor(status: number, code: string | null, message: string, docUrl: string | null, detail: unknown, type?: string | null, param?: string | null, retryAfter?: number | null); get isAuthError(): boolean; /** * The host in front of onlyworlds.com refused the request before the API saw it: a 403 whose body is an HTML * page titled "Blocked", not the API's JSON envelope. Nothing was written. The host refuses text that holds a * shell command such as `python -m`, `python -c`, `perl -e`, or `curl` or `wget` with an address right after * a backtick, a semicolon or a pipe; such a command passes in a fenced code block whose first line names a * language, or with none of the three directly before it. `code` is null (it is no API code) and `detail` keeps the page. * In a browser on another origin this never fires: the host sends the page without CORS headers, so the browser * hides it and `fetch` throws a network error before any status reaches the client (measured 2026-11-17). */ get isHostBlocked(): boolean; /** 422s/400s name the offending param/field -- typos error loudly platform-wide. */ get isValidationError(): boolean; /** * Same Idempotency-Key replayed with a different payload (409 `idempotency_error`). * Through 4.2.0 this was true for ANY 409, which misread an id conflict as a key * conflict: keel also answers 409 `id_conflict` (see isIdConflict). */ get isIdempotencyConflict(): boolean; /** * A request with this Idempotency-Key is still running (409 `idempotency_in_flight`): * two sends of one create or bulk overlapped. Nothing was written by this one. * Wait `retryAfter` seconds (keel sends 1) and send again with the SAME key and body: once * the first has answered, that retry replays its answer. Not a key conflict (see above). */ get isIdempotencyInFlight(): boolean; /** * The id is already taken (409 `id_conflict`): a create with an id that exists * or a PUT whose id belongs to another world. Retrying will not * help; the id is the problem. `/bulk` never throws for this: it answers 200 with a * per-item slot `{status: 409, error: {code: 'id_conflict'}}` — check the slot. */ get isIdConflict(): boolean; /** * `/changes` refused the cursor (409 `resync_required`): what this key may see changed * (a guest's slice moved; an element hidden from a contributor was unhidden; the key's role * moved to or from guest or contributor, whose cursors have other shapes). Drop * the stored cursor and walk again from the start. What to do with what the local copy holds * that the new walk does not name is `resyncReason`'s: `role`, keep it; `view`, drop it. * Without a reason (keel's hidden mark off), keep it: a reset never empties a copy (keel PR * 104, ruled by Titus: sharing is forward-only). Never empty the copy on your own. */ get isResyncRequired(): boolean; /** * Why `/changes` refused the cursor, from the 409 `resync_required` envelope's `reason` * (only while keel's hidden mark is on): `role` (this key's own role or * membership moved: keep what the local copy holds that the new walk does not name; it is * out of view now, not gone) or `view` (something left this key's view: a delete, a hide, an * unhide, a Character change; drop what the new walk does not name). When both happened * since the cursor, keel says `role`. Undefined for any other error, or when keel sends no * reason. */ get resyncReason(): OwResyncReason | undefined; /** keel's admission control turned the request away (503 `server_busy`); see retryAfter. */ get isBusy(): boolean; /** * A contributor tried to change, replace, relink or delete an element someone else * created (403 `not_author`). Retrying will not help; the * element is not theirs. `/bulk` never throws for this: it answers 200 with a per-item * slot `{status: 403, error: {code: 'not_author'}}`. Owners and co-builders never see it. */ get isNotAuthor(): boolean; /** * A member key tried what only the owner may do: `patchWorld`, even with a co-builder's * key (403 `owner_only`; sharing's publish, republish and revoke answer * contributors and guests with the same code). Retrying will not help. The owner's own * key never sees it. */ get isOwnerOnly(): boolean; /** * A member key sent `viewAs` (403 `view_as_owner_only`): reading as another * reader is the owner's, from a key with no member. Retrying will not help. Only while * keel's hidden mark is on; until then `viewAs` is an unknown parameter (422). */ get isViewAsOwnerOnly(): boolean; /** * An element write carried `known_of` (422 `known_of_not_writable`, `param` known_of), * true or false: the key marks a stub and is never written. Drop it and send only * the fields you mean. This client never sends it (`known_of` is stripped, a stub is a * TypeError before sending), so it reaches you only through `request()`. `/bulk` never * throws for it: the item's slot carries the code, and its siblings apply. */ get isKnownOfNotWritable(): boolean; /** * A `patch` or `editLinks` sent with `ifMatch` found the element moved past that * `change_seq` (412 `precondition_failed`): nothing was written and nothing * merged. The error is an OwPreconditionFailedError; its `current` is the element as it * is now, so no second read is needed. */ get isPreconditionFailed(): boolean; /** 404 `not_found`: no such element or route, or a join code that is unknown, used, revoked or expired. */ get isNotFound(): boolean; /** * redeemJoin on a table: the picked Character is one a live seat in the * world already plays (422 `character_taken`, `param` character). Pick another from a fresh * previewJoin, whose `characters` mark each `taken`. The code is not spent. */ get isCharacterTaken(): boolean; /** * setMyCharacter, or the member PATCH's `character`: the picked Character is * hidden (422 `character_hidden`, `param` character). Unhide it first, or pick another. */ get isCharacterHidden(): boolean; /** * The `character` sent was refused (422 `invalid_request`, `param` character). On redeemJoin * at a table: the pick is off the link's list, hidden or deleted since the * link was made, or missing, or sent to a table with no list (send `name` instead); one * answer for all, so read previewJoin again and pick from its `characters`. The code is not * spent. On createWorldLink: a `character` keel refused (not a Character of the world, a * hidden one, or any `character` on a table). Never true for another param's 422, nor for * `character_taken` (see isCharacterTaken). */ get isCharacterInvalid(): boolean; /** * delete, or reviewNewElement's decline: the Character is one someone plays on the roster, the * world's `owner_character` or a live member's, an AI seat's or a player's Character (422 * `character_played`, `param` id). Nothing was deleted; the message says who plays it, never by * email or username. Re-point that member to another Character (the owner's own through * patchWorld's `owner_character`, a seat's by the owner on the member PATCH, a person's own * through setMyCharacter), or remove the member, then delete. Never true for a malformed id's * 422, which carries the same `param`. */ get isCharacterPlayed(): boolean; /** * redeemJoin: the world already has its 50 live players (422 `world_full`), * at any player link, a table's or a link for one's. Nothing is spent; a place frees when the * owner removes a player. */ get isWorldFull(): boolean; /** acceptJoin: the account is already a member of that world (409 `already_member`). The code is not spent. */ get isAlreadyMember(): boolean; /** acceptJoin: the account has no PIN yet, and a member writes with their own (409 `pin_required`). The code is not spent. */ get isPinRequired(): boolean; /** * A daily allowance is used up (429 `quota_exceeded`): the world's image tickets, its file * tickets (200 a day), or the account's asks. See retryAfter. */ get isQuotaExceeded(): boolean; /** * Over the request budget (429 `too_many_requests`): 300 a minute per key or account token, 60 per * address with neither. Wait `retryAfter` seconds. Not a daily allowance (isQuotaExceeded). */ get isRateLimited(): boolean; /** * A write carried `x_served_trimmed`, the mark keel serves on a body it trimmed for this reader * (422 `served_trimmed_not_writable`): the body was read with ids left out. Nothing was written. * Drop the mark and send the write again; keel keeps the ids this key cannot see. */ get isServedTrimmedNotWritable(): boolean; /** * createFileTicket / uploadFile: the file is over the 25 MB a file may be (413 * `file_too_large`, `param` size); the message gives both sizes. Nothing was * issued. Not the upload host's 413 `too_large` (bytes past a ticket's `max_bytes`). */ get isFileTooLarge(): boolean; /** * createFileTicket / uploadFile: the world's files have no room for this one (403 * `files_full`: 250 MB a world); the message gives the world's use, its cap and * the file's size. Remove a file, or ask the owner. Nothing was issued. */ get isFilesFull(): boolean; /** * ask and sort: today's token rating is spent and the call ran on the account's own AI key, which its * provider refused (422 `own_key_refused`: a key revoked, wrong or out of credit). Nothing was counted * and nothing retried on the platform's key: send the person to the account page to check or replace * the key, and do not retry. */ get isOwnKeyRefused(): boolean; /** ask: the proxy is switched off, or paused for the day by the server-wide cap (503 `ask_unavailable`). Not counted. */ get isAskUnavailable(): boolean; /** * ai: this use's calls for the day are made (429 `use_ceiling`, param `use`): the use's own daily * ceiling per account, not the token rating (isQuotaExceeded). Retry-After runs to midnight UTC. */ get isUseCeiling(): boolean; /** * ai: another call to this use is running for this account (429 `use_in_flight`, param `use`): a use * with a ceiling runs one call at a time. Wait `retryAfter` seconds (a short wait) and send again. */ get isUseInFlight(): boolean; /** * ai: an AI door token called a use it was not minted for (403 `use_not_granted`, param `use`). * Nothing was counted. Mint one that names this use (mintAiToken), or call with an account token. */ get isUseNotGranted(): boolean; /** * The account token works on some routes only (401 `wrong_audience`): an AI door token on any route * but `aiUses()`, its uses and its own revoke, or a hosted MCP client's token anywhere but /mcp. */ get isWrongAudience(): boolean; /** * ai: the use's model answered, but not in the shape the use promises, and asked again gave no usable * answer either (422 `answer_not_parsed`, param `answer`). The provider billed it to the use's own budget, * not the token rating; under an idempotency key the same refusal is replayed. Fall back to the tool's * own answer, and do not retry. */ get isAnswerNotParsed(): boolean; /** * On a 422 `answer_not_parsed` from a use the server reads itself (`subs-captain`, `lens`): each answer it * refused, in order, with its `word`, the provider's `stop_reason` and its `output_tokens`, so an answer * cut off at `max_tokens` reads apart from one that finished in the wrong shape. Never the answer's text; * a replay under the same idempotency key carries the same list. Undefined for any other error, or when the * server sends none; a row not in that shape is left out. */ get refusals(): OwAiRefusal[] | undefined; /** * On a 422 whose `param` is `fields`, when a read's `fields` list named fields its type does not have: * every unknown name in the order sent (`unknown_fields`), for each one another element type has, those * types (`types_with_field`), and the names this type takes (`allowed_fields`). The server refuses the * whole list once, so the list is corrected in one try. Undefined for any other error, or when the server * sends no `unknown_fields`; an entry that is not a string is left out. */ get fieldsRefusal(): OwFieldsRefusal | undefined; /** ask: the model gave no answer (502 `ask_failed`). Not counted; try again in a moment. */ get isAskFailed(): boolean; /** * patch, upsert or editLinks became a proposal (202): the world takes an AI seat's * writes as proposals (`agent_writes_proposed`), so the element did not change. The error is an * OwProposedError; its `proposal` is the row a keeper accepts or declines. Not a failure to retry: * the write is waiting for a person. */ get isProposed(): boolean; /** * propose named a field the proposer's own view of the element does not hold (422 * `field_not_visible`, `param` names it): the element reaches this key only as a * stub (known_of), and a proposal changes only what its proposer can read. */ get isFieldNotVisible(): boolean; /** * propose: this proposer already has 5 open proposals on the element, or 50 in the world (422 * `too_many_open`). Wait for a keeper to decide, or withdraw one; a lapsed proposal * no longer counts. */ get isTooManyOpen(): boolean; /** * acceptProposal found a proposed field moved since the proposal was made (409 * `stale_proposal`). Nothing was written and the proposal stays open. The error is an * OwStaleProposalError: `conflicts` lists each moved field with its `base` and `current` values, * and `current` is the element as it is now. A change to a field the proposal does not name * does not count. The proposer proposes again on the current text. */ get isStaleProposal(): boolean; /** * While the world takes AI seats' writes as proposals, an AI seat's key tried * what it may not: delete an element it did not create, or accept or decline a proposal (403 * `proposed_only`). On any world, reviewNewElement by the member the mark names is the same 403. * Retrying will not help; a person decides. */ get isProposedOnly(): boolean; /** * acceptProposal or declineProposal on the key's own proposal (403 `own_proposal`): * another keeper (the owner or a co-builder) decides it. Retrying will not help. */ get isOwnProposal(): boolean; /** * reviewNewElement on an element that carries no `x_review_proposed` mark (422 `not_proposed`): * nothing to settle. Someone settled it already, or it was never written as proposed. */ get isNotProposed(): boolean; /** * A write from a key below co-builder (a contributor's or a guest's, a person's or an AI seat's) set an * `x_review_proposed` or `x_review_checked` mark whose `by` is not the writer's own membership id * (403 `review_by_another`, `param` the mark; nothing written). Send your own membership id as `by`, or * the mark exactly as the element holds it. A Character's id is refused too. Retrying will not help. */ get isReviewByAnother(): boolean; } /** * 412 `precondition_failed`: the element changed since the `change_seq` sent as * `ifMatch`. `current` is the element as it is now, as this key sees it (keel sends it beside * the error envelope; null if a response ever lacks it). The check is per element and the * server never merges: compare the copy you edited from with `current`; when the fields you * changed are not the ones that moved, re-send with `ifMatch: current.change_seq`; when the * same field moved on both sides, ask the user which to keep. */ declare class OwPreconditionFailedError extends OwApiError { readonly current: Record | null; constructor(status: number, code: string | null, message: string, docUrl: string | null, detail: unknown, type?: string | null, param?: string | null, retryAfter?: number | null); } /** * 409 `stale_proposal`: acceptProposal found a proposed field moved since the * proposal was made. keel sends `conflicts` (one `{field, base, current}` per moved field) and * `current` (the element as it is now) beside the error envelope; `conflicts` is empty and * `current` null if a response ever lacks them. Nothing was written and the proposal stays open. */ declare class OwStaleProposalError extends OwApiError { readonly conflicts: OwProposalConflict[]; readonly current: Record | null; constructor(status: number, code: string | null, message: string, docUrl: string | null, detail: unknown, type?: string | null, param?: string | null, retryAfter?: number | null); } /** * 202 on patch, upsert or editLinks: the world takes an AI seat's writes as * proposals (`agent_writes_proposed`, set by its owner), so the write became a proposal and the * element did not change. The answer is `{proposal}`, never an element, so this client throws * rather than hand it back as one. `proposal` is the row; a keeper (the owner or a co-builder) * accepts or declines it, and the proposer may withdraw it. `status` is 202 and `code` null: it * is not keel's error envelope. A /bulk item never throws for it: its slot says `status: 202` * and carries `proposal`. The arguments are OwPreconditionFailedError's; `proposal` is read from * `detail` (the 202's body), and the client builds one only from a body that holds a proposal. */ declare class OwProposedError extends OwApiError { readonly proposal: OwProposal; constructor(status: number, code: string | null, message: string, docUrl: string | null, detail: unknown, type?: string | null, param?: string | null, retryAfter?: number | null); } /** Network-level failure (fetch rejected) -- no envelope to parse. */ declare class OwNetworkError extends Error { readonly cause2: unknown; constructor(message: string, cause: unknown); } /** * Why `signInWithPassword` refused: * - `invalid_credentials`: keel does not know that email (or username) with that password. * - `email_unverified`: the account's email address is not confirmed yet; the link is in the * mail onlyworlds.com sent when the account was made. * - `rate_limited`: too many sign-ins (a 429), or too many failed ones for this account * (`too_many_login_attempts`); wait `retryAfter` seconds when it is set. * - `offline`: the request never reached keel. * - `mint_failed`: the password was right, but keel made no token; the session was still ended. * - `failed`: any other refusal; the message is keel's when it gave one. */ type OwSignInReason = 'invalid_credentials' | 'invalid_grant' | 'state_mismatch' | 'email_unverified' | 'rate_limited' | 'offline' | 'mint_failed' | 'failed'; /** * A refused `signInWithPassword`. `reason` is what to tell the user; `status` and `code` are * keel's answer when there was one (`code`: keel's error code, e.g. `email_password_mismatch`). * The password is never in the message or in any property. */ declare class OwSignInError extends Error { readonly reason: OwSignInReason; /** The HTTP status of the refusing answer; absent when nothing came back (`offline`). */ readonly status?: number; /** keel's error code, when its answer carried one. */ readonly code?: string; /** The field the server's answer named, when it named one: `ai_uses` or `ai_lifetime_minutes` on a 422 that * refused the AI door token asked in the exchange (the code is spent either way). */ readonly param?: string; /** Seconds to wait before trying again, from `Retry-After` (on a 429). */ readonly retryAfter?: number; constructor(reason: OwSignInReason, message: string, opts?: { status?: number; code?: string; param?: string; retryAfter?: number; }); } declare function parseErrorEnvelope(status: number, body: unknown, retryAfter?: number | null): OwApiError; /** Build an OwApiError from a non-2xx response, tolerating non-JSON bodies. */ declare function errorFromResponse(res: Response): Promise; /** * keel v2 engine absorbed from an earlier v2 client (ow-v2-client v0.9.0), * wire-corrected against live staging fixtures 2026-07-18. * * OnlyWorlds key-kind detection. Prefixes make leaked keys grep-scannable * (Stripe/GitHub precedent) -- and tell a client what auth shape to expect. */ type OwKeyKind = /** ow_w_ -- world key, read + write. Writes need the world's PIN if it has one. */ 'write' /** ow_r_ -- world key, read-only, works bare (no PIN). The share-with-players primitive. */ | 'read' /** ow_a_ -- account Bearer token for /account/* routes; can mint world keys. */ | 'account' /** Grandfathered 10-digit key. Needs PIN to read private worlds. */ | 'legacy' | 'unknown' /** No key: a client for the routes that send none (health, previewJoin, redeemJoin, signInWithPassword), as a friend with only a link has. */ | 'none'; /** Demo range 0000000000-0000000009: read-only aliases, safe as live read gates. */ declare function isDemoKey(key: string): boolean; declare function detectKeyKind(key: string): OwKeyKind; /** Can this key kind ever perform world writes? (PIN is a separate, per-world question.) */ declare function kindCanWrite(kind: OwKeyKind): boolean; /** * Should a credential UI ask for a PIN with this key? * Prefixed keys read PIN-less; writes on pinned worlds always need it. 'optional' means: show * the field, don't require it. A legacy key that can write sends its PIN on every read of a * world that has one, whether or not the world is open to read (2026-10-20): * the literal `'required-for-private-reads'` predates that rule and keeps its name until 5.0. * A demo-range key (`isDemoKey`) is also kind `legacy` and never needs a PIN. */ declare function pinExpectation(kind: OwKeyKind): 'never' | 'optional' | 'required-for-private-reads'; /** * Sign in with OnlyWorlds: OAuth 2.1's authorization code with PKCE (S256) for public clients * (live 2026-10-22). * * Two calls. `beginSignIn` mints `state` and a PKCE verifier, keeps them under the client id in a * storage the page shares with its callback (sessionStorage by default), and hands back the * authorize URL (sending the browser there where a `location` exists). `completeSignIn` runs on the * callback page: it checks `state` and that the page is the registered return address, takes the * code out of the address bar, trades it at `POST /api/v2/auth/token` with no credential, and * returns the token with the account and the `resume` the tool parked before the redirect. The * SDK keeps nothing: the record is cleared once a return carries its state (success or refusal; a * return with another state leaves it pending), and the token is the tool's to store. */ /** Where the pending sign-in's record lives between the two pages: string in, string out. */ interface OwSignInStorage { get(key: string): string | null | undefined; set(key: string, value: string): void; remove(key: string): void; } interface OwSignInBegin { /** The `client_id` keel's registry lists the tool under (`GET /api/v2/auth/clients`). */ clientId: string; /** * The registered return address, the exact string; never built from `location.origin`. A web tool's * is `https:`. A tool registered as a native app may also use a loopback address, registered without * a port (`http://127.0.0.1/` or `http://[::1]/`) and passed here with the port the app * bound for this sign-in (`http://127.0.0.1:53682/`, 1 to 65535), or its own scheme, exactly as * registered (`obsidian://onlyworlds-signin`). `localhost`, a loopback without its port, userinfo, a * query and a fragment are refused. */ redirectUri: string; /** Small JSON the tool wants back after the redirect (an open link, a pending join code). */ resume?: unknown; /** Defaults to `globalThis.sessionStorage`; without one (Node) the option is required. */ storage?: OwSignInStorage; /** How the browser is sent: a function taking the URL, or `false` to only return it. Default: `location.assign` where there is one. */ navigate?: ((url: string) => void) | false; /** * `'world:read'` for a tool that only reads: the token the sign-in gives is read-only. It reads * everything the account reads, and every write (a world key minted, a world made, another token * minted, an AI call) is refused with 403 `permission_error`, except revoking the token itself. * Left out, the token writes as the account does. The one value there is; any other is refused * before anything is sent. `completeSignIn` answers the scope the server granted. */ scope?: 'world:read'; } interface OwSignInBegun { /** The authorize URL: `https://www.onlyworlds.com/signin/authorize?...`. */ url: string; state: string; } interface OwSignInComplete { clientId: string; storage?: OwSignInStorage; /** * The callback page's address; defaults to `location.href`, which is then cleaned of `code` and * `state`. A native app passes the address its loopback server or scheme handler received, and * the window's history is left alone. */ url?: string; /** * Also ask the exchange for an AI door token for these AI uses (their slugs, as `aiUses()` lists * them): 1 to 8, each one path segment. It comes back as `aiToken`. The exchange spends the code * whatever it answers, so a list the SDK can see is wrong is refused before anything is sent; a * name the server does not run is its 422, and then the code is spent. */ aiUses?: string[]; /** With `aiUses` only: the AI door token ends this many minutes after the exchange (1 to 1440), or at midnight UTC if that comes first. */ aiLifetimeMinutes?: number; } /** * An AI door token: an `ow_a_` token that opens only `aiUses()` and the AI uses it names (`ai()`), * as the person and on their token rating; another use answers 403 `use_not_granted` * (`err.isUseNotGranted`), every other route 401 `wrong_audience` (`err.isWrongAudience`). It ends at * `expiresAt` (midnight UTC at the latest), then answers 401 `key_revoked`. A client built on it may * revoke it with `revokeAccountToken(tokenId)`; revoking it touches no other token, and revoking the * account token beside it leaves it live. */ interface OwAiToken { /** The `ow_a_` AI door token, shown only here. */ token: string; tokenId: string; tokenType: 'bearer'; audience: 'ai'; /** The uses it opens, as the server took them (each once, in the order sent). */ aiUses: string[]; /** When it stops working (ISO 8601). */ expiresAt: string; } /** What `completeSignIn` returns: the account token, shown only here, and what the tool parked. */ interface OwSignInResult { /** An `ow_a_` account token: keep it, it is the only copy (the SDK stores none). */ token: string; /** * The token's id: a tool done with the token revokes it with `DELETE /account/tokens/{tokenId}`, * sending the token itself as the bearer. Null from a server that does not send it yet. */ tokenId: string | null; /** * When the token stops working (ISO 8601), for a tool whose registration asks for a lifetime; null * for one with none, whose token works until it is revoked, and from a server that does not send it. */ expiresAt: string | null; tokenType: 'bearer'; account: { id: string; username: string; }; /** * `'world:read'` when the server granted a read-only token (the sign-in asked `scope: 'world:read'`): * every write but revoking the token itself is refused with 403 `permission_error`. Null when the * answer carries no scope: the token writes as the account does, which is also what a server that * does not know scopes answers, so a tool that asked for read-only reads it here. */ scope: 'world:read' | null; /** The `resume` given to `beginSignIn`, or null. */ resume: unknown; /** * The AI door token, when `aiUses` asked for one; null when none was asked, and from a server that * answered none (the account token above is good either way). */ aiToken: OwAiToken | null; } /** Base64url without padding (RFC 4648 §5), as PKCE wants it. */ declare function base64url(bytes: Uint8Array): string; /** The S256 code challenge of a verifier (RFC 7636 §4.2). */ declare function pkceChallenge(verifier: string): Promise; /** * keel v2 engine absorbed from an earlier v2 client (ow-v2-client v0.9.0), * wire-corrected against live staging fixtures 2026-07-18. * * OwV2Client -- thin typed fetch client for the keel v2 API. * * Deliberately thin: no caching, no sync state, no retry policy -- those belong * to callers (sync engines, tools, games). What IS encoded here is the wire * contract and its safety rails: payload read-only-field stripping, opaque * cursors, idempotency headers, doc_url-bearing errors, polite page sizes, and * client-side UUID minting so idempotent retries are structurally safe. */ declare class OwV2Client { readonly baseUrl: string; readonly keyKind: OwKeyKind; readonly pageSize: number; readonly changesPageSize: number; private readonly apiKey; private readonly apiPin; private readonly fetchImpl; private readonly agent; /** The name sent as X-OW-Client on element writes, checked at construction. */ private readonly clientName; /** The conditional head poll's state, per instance. */ private readonly headPoll; /** The world an account token or a keyless client reads (`world=`); undefined otherwise. */ private readonly world; /** The fetch answers on this machine (a world folder, `@onlyworlds/sdk/folder`): nothing is sent, so no key is needed. */ private readonly local; constructor(config?: OwClientConfig); /** GET /health -- unauthenticated liveness pulse. */ health(): Promise; /** * GET /world -- world meta (name, calendar/time fields, public_read). * GOTCHA (by server design): world-meta edits do NOT appear in /changes and * do not bump change_seq. Poll getWorld().updated_at for meta freshness. * On a client with `world` set (an account token or no key), it reads that world, sending `world=`; * every read carries `counts`, as that reader may read. `signal` is passed to fetch as given. */ getWorld(opts?: { signal?: AbortSignal; }): Promise; /** * PATCH /world -- partial world-meta update. The element write's server-managed keys are * stripped, and so are the world's own read-only ones (WORLD_READ_ONLY_FIELDS: `slug` and * `public_page`; `agent_writes_proposed`; set on the world page, not here; * `origin`; `id`), so a `getWorld()` body can be sent back. The world's origin is * written as `source` and `producer` (each an object or null, served under `origin`); * extension keys (`x_*`, `atlas_*`, `shadow_*`) are sent as given, and `null` removes one. */ patchWorld(partial: Record): Promise; /** * GET /me -- who this world key is: the world, read or write scope, the kind (owner, * person, agent, player), the role, the membership id (what `created_by` holds for what this key * creates; null for the owner) and the member's Character. A world key's call; an account * token is a TypeError before sending. */ /** * PUT /me/character -- pick the roster Character that is you in this world, or none. * A person member's write key with its PIN; answers GET /me's body. 422 for a hidden * Character (`character_hidden`, `err.isCharacterHidden`), a guest's pick it did not make, or a * taken Character (`invalid_request`, `param` character); 404 for one this key cannot see; 403 for * an AI seat, a player, the owner (whose own is the world's `owner_character`, set with * patchWorld) or a read key. A guest's view resets once. */ setMyCharacter(character: string | null): Promise; /** * PUT /me/lenses -- choose the lenses this key's holder starts with: lens ids in order, 0 to 20, * repeats dropped by the server; an empty list is a choice too (the draught then adds no frame), and keeps * a seat off its Titles' lenses. `null` goes back to never chosen: a seat playing a Character then * starts with its Titles' lenses (`lenses_from` says where a list comes from); on the owner's own * keys `null` is the empty list. Any write * key of the world, with its PIN, sets its own holder's list: a person member's, an AI seat's, or * on the owner's keys the owner's own; answers GET /me's body. The draught reads the list whenever it * is given no lens and no policy. 404 for a lens this key cannot see; 422 `not_a_lens`, * `lens_is_template` or `lens_hidden` (`param` lenses); 403 for a read key. A lens only narrows what * the holder may already read. An account token sets your own list in the world the client's * `world` names (`world=`, the Bearer token, no PIN); without `world` set it is a TypeError * before sending. A world key sends no `world`: the key names its world. */ setMyLenses(lensIds: string[] | null): Promise; /** * GET /world/{worldId}/lenses -- every lens in the world this key can see, templates included and * marked, each with its recipe echoed (`x_lens`, defaults filled in), the Titles it is the default * for and whether this key chose it. `resolve: true` adds each lens's `reading` for this key: the kept * rows, the cut by reason, the mail part. The owner also gets `chosen_by`, `health` and the two counts * of what a reader cannot see; with `resolve`, the owner may `readAs` another reader (`guest`, * `contributor`, `co-builder`, `public`, or a membership id of this world). A co-builder, or the * account that sponsors an agent's or a player's seat, may `readAs` that seat by its membership id; * that reading is judged by the narrower view: the seat's rows within the caller's own view, and * what the caller cannot see counted under `not_visible`, never named. 403 `read_as_owner_only` * from any other key, 422 without `resolve`. `worldId` is the key's own world * (another is a 404). An account token reads the world `worldId` names, as its owner or as its * member there: the Bearer token alone, no `world=` (the client's `world` is not needed). Served * `Cache-Control: private, no-store`. */ worldLenses(worldId: string, opts?: { resolve?: boolean; readAs?: string; }): Promise; /** * GET /me -- who this key is in its world: the world, the key's scope, kind and role, its * membership and Character, the lenses it starts with, the world's reading aids, and the front * door (`front_door`: the sponsor and their Character, your own Character, the Charter and the * Objects it names, the seats you sponsor). The client's PIN is sent here when it has one, so a * wrong PIN shows on this call first, which makes it the connection test for a key that can write; * beside a key that cannot (a read key, a player's), onlyworlds.com never reads a PIN. An account token is * refused before sending: it is not a member of one world. */ me(): Promise; /** * GET /members -- the world's roster: each member's id (null for the owner), kind, role, * Character and status (`removed` rows stay, so their elements keep `created_by`). Returns * the rows; the server sends them as `{ data }` with no paging. A world key reads its own world's * roster and sends no `world`. An account token reads the roster of the world the client's * `world` names (`world=`, the Bearer token, no PIN), with the token's grant there: the * owner's token as the owner, a member's as its own member key; a world where it has none is a * 404. Without `world` set it is a TypeError before sending. A client with no key is refused * before sending: the roster has no public reader. */ members(): Promise; /** * GET /{type}/ -- one cursor page, shaped by `params`: `limit` (up to 1000), `cursor` (a page's `next_cursor`), * `filter` (the wire filters), `ids`, `createdBy`, `expand`, `fields`, `viewAs` (an owner key) and `signal`. Any other * key is refused before anything is sent. On a client with `world` set (an account token or no key), it reads that * world, sending `world=` beside the page's own parameters. */ list(type: ElementType | string, params?: ListParams): Promise; /** * GET /character/{id}/context -- the draught: what one Character knows, as the * recorded world holds it, in one read: her element, what she holds and sits in, her open work, * how she works, the Events she was in, the Narratives she knows, everything else that names * her, her sheet, what changed around her (`since`), and who plays whom; the world's name and * calendar beside; the room's messages (`messages`), its other elements (`room`) and * elements written as proposed (`proposed`) only when `components` names them. Each * row carries the list route's body for the same reader as `element`, beside `via`, `her_links` * and `grade`; nothing is inferred. The owner's keys, co-builders and contributors for any * Character they can see; a player seat or a guest for its own Character only (another id is * 404). `asOf` is a filter on the elements' own dates, not time travel. A `cut` that is not * empty means the serving is partial (`cut.proposed` also counts proposed elements left out because * the component was not named). `compact: true` leaves out every empty section and an empty `cut`, * the frame and every null kept, and leaves out each element body's empty fields (`null`, `""`, * `[]`, `{}`; `id`, `type` and `name` always stay), answered as `OwDraughtCompact`; left out, `compact=false` is sent, so the answer is the fixed `OwDraught` shape whatever the server's own default (keel's is `false` until 2027-05-02, when it becomes `true`; the MCP tool `get_draught` defaults to `true` already). A Message * without the room mark is placed as any Narrative unless `messages` is named, when it is there * and in no other section; a room-marked Message is in `messages` or nowhere. `lens` (a lens id) * adds `lenses`, one frame with that lens read for this key's own view (beside `depth` or `budget` * a 422), on any Character; with no policy key but `compact`, a read of the caller's own Character (the * one `me()` names) adds one frame per lens the caller starts with: the ones chosen with setMyLenses, or * for a seat that never chose, the ones its Titles give it. A read of any other Character adds none of * them. A frame is the caller's own reading and its own Character's mail, never the Character's. Served `Cache-Control: private, no-store`. On a client with `world` set, an account token * reads the draught as the account's own access there, and no key reads it as the public reads the world. */ draught(characterId: string, policy?: OwDraughtPolicy & { compact?: false; }): Promise; draught(characterId: string, policy: OwDraughtPolicy): Promise; /** * Cursor-walk every page of a type. Politeness: uses config pageSize. On a client with `world` * set, every page is read from that world, as list() reads it. */ listAll(type: ElementType | string, params?: Omit): AsyncGenerator; /** * GET /{type}/{id}/ -- optional one-level stub expansion / sparse fields, and `viewAs` (the owner reads as * another reader; see ListParams.viewAs). On a client with `world` set (an account token or no key), * it reads that world, sending `world=`. */ get(type: ElementType | string, id: string, opts?: Pick): Promise; /** * GET /search -- the world's elements whose `name` or text fields (`description` and the type's other prose * fields; never supertype, subtype or image_url) hold every word of `q` as a whole word, ignoring case. A word * is a run of letters, digits or underscores, so `APP-142` is searched as the two words `APP` and `142`: a * result's `snippet` is a piece of one field, so read the element to keep only those that hold the key whole. * No stemming, no pages: `truncated` says more matched than `limit` (1 to 200, the server's default 50) let * through. `type` searches one type; `viewAs` reads as another reader (the owner's keys). A guest's key finds * only what it may read. On a client with `world` set (an account token or no key), it searches that world. * * ```ts * const { results, truncated } = await client.search('APP-142', { limit: 200 }); * ``` */ search(q: string, opts?: { type?: ElementType; limit?: number; viewAs?: string; signal?: AbortSignal; }): Promise; /** * POST /{type}/ -- create one element, minting an id on the client when you leave id out. * With an `idempotencyKey`, the minted id is derived from the key (a UUIDv5, the same one the * Python package mints), so a retry with the same key and element sends the same body and keel * replays its first answer: nothing is written twice, and the stored 201 comes back. Without a * key, a fresh UUIDv7. You may still supply your own id. A new create meant to write again * (an undo that re-creates) needs a new key, or none: within 24 h a reused key only replays. * `name` is the one required field, and required means the key is present: `''` and * `null` are accepted and stored as `''` (nameless Markers exist). */ create(type: ElementType | string, element: OwElement | Record, opts?: { idempotencyKey?: string; }): Promise; /** * PUT /{type}/{id}/ -- upsert-by-client-id. The local-first write primitive. A known-of * stub (`known_of: true`, see isKnownOf) is a TypeError before sending, here and on every * element write: a PUT of one would blank every field it does not keep. * An AI seat's PUT on an existing element, in a world that takes its writes as proposals, * answers 202 and is thrown as an OwProposedError: the element did not change. */ upsert(type: ElementType | string, id: string, element: OwElement | Record): Promise; /** * PATCH /{type}/{id}/ -- partial update. DESTRUCTIVE on sent fields: arrays * replace wholesale, omitted fields stay untouched. For link arrays prefer * editLinks() -- atomic server-side merge, no read-before-write. * * `ifMatch`: the element's `change_seq` as you read it. The update lands * only if nobody changed the element since; otherwise nothing is written and this throws * an OwPreconditionFailedError (412) whose `current` is the element as it is now. Omit * it for today's unconditional write. * * In a world that takes an AI seat's writes as proposals (the world's * `agent_writes_proposed`), a seat's patch answers 202 with `{proposal}`, never an element: * this throws an OwProposedError (`err.isProposed`, the row under `err.proposal`) and the * element did not change. If-Match is checked first: a stale one is still a 412. */ patch(type: ElementType | string, id: string, partial: Record, opts?: { ifMatch?: number; }): Promise; /** * DELETE /{type}/{id}/ -- idempotent (204 on absent). Server writes a * tombstone AND scrubs the id from every other element's links in the same * transaction -- no client-side unlink pass needed, ever. * * `ifMatch` (as on patch()): the element's `change_seq` as you read it. The delete * lands only if nothing changed since; otherwise an OwPreconditionFailedError (412) whose * `current` is the element as it is now, and nothing is deleted. On an element already gone it * is the idempotent 204. Under a world's proposals switch a delete is never a proposal. */ delete(type: ElementType | string, id: string, opts?: { ifMatch?: number; }): Promise; /** * POST /{type}/{id}/links/{field} with {add, remove} -- atomic link merge. * Dedupes, tolerates already-present/already-absent ids. Returns the FULL * updated element (fixture P5). Use this for all relationship editing; it * retires the read-merge-PATCH dance. `ifMatch` works as on patch(): a link write * moves the element too. A 202 (an AI seat's link edit that became a proposal) * is thrown as an OwProposedError, as on patch(). */ editLinks(type: ElementType | string, id: string, field: string, edit: OwLinkEdit, opts?: { ifMatch?: number; }): Promise; /** * POST /{type}/{id}/adopt with {member} -- change who made an element. * `member` is a membership id of this world (a person or an AI seat, as `members()` lists * them) or `'owner'`, which sets `created_by` to null. The world's owner key or a * co-builder's (a person's or a seat's) with its PIN; a contributor's is 403 `not_author` * (`err.isNotAuthor`), a member id the world lacks 404. Nothing else in the element changes, * but the write stamps `changed_by` and `changed_via` and takes a new `change_seq`, so the * feed carries the element with its new `created_by`. Returns the updated element. A * contributor only changes what it created, so this hands it an element someone else made, * or takes one back; when the element is hidden, or the member is a guest, the old and the * new maker may each get a `view` reset on the feed. */ adopt(type: ElementType | string, id: string, member: string | 'owner'): Promise; /** * POST /bulk -- up to ~1000 items. Partial success by default (HTTP 200 * always; inspect per-slot numeric `status` + top-level `errors` flag); * atomic:true for all-or-nothing. Link validation runs against batch U * database -- send in any order, cycles included; no client topo-sort. * Success slots echo server-authoritative timestamps: set your sync baseline * from this response alone. When an idempotencyKey is replayed, the returned * response carries wasReplay:true (read from the Idempotent-Replay header). * After an atomic:true request with errors:true NOTHING was written, yet the slots of * the items that would have succeeded still say 201 with the ids and timestamps they * would have had (keel's "counterfactual 201s"): do not record those ids as created. * An AI seat's item on an existing element, in a world that takes its writes as * proposals, answers a slot `{status: 202, id, proposal}`: never thrown, the * element unchanged, the slot's `proposal` the row a keeper decides. * An element without an id gets one, as `create` mints it, by its position in `items`: with an * `idempotencyKey`, derived from the key and the position (the ids the Python package mints), * so a retry with the same key and items sends the same body; without one, a * fresh UUIDv7. Ids you supply are kept. * With `createOnly: true` (sent as `create_only`), every item with an id is created as `create` creates it, never * replaced: an id the world already holds answers that item's slot `{status: 409}` with `id_conflict`, and the * element stays as it was. Left out or false, an item with an id held replaces it whole, as before. */ bulk(items: OwBulkItem[], opts?: { atomic?: boolean; idempotencyKey?: string; createOnly?: boolean; }): Promise; /** * GET /changes -- one page of the world's ordered change feed. * Cursor is OPAQUE: persist verbatim, never parse or build one (a guest's and a * contributor's carry their view's epoch, since 2026-10-20 for a contributor). * Zero/absent cursor = full export (byte-aligned with the Folder Format). * Reset rule: a 409 `resync_required` (err.isResyncRequired) means the key's * view changed (a guest's slice, an element unhidden from a contributor, or its role): drop * the cursor and walk from zero. For what the local copy holds that the walk no longer names, * read err.resyncReason (while keel's hidden mark is on): `role`, keep it; `view`, * drop it (as for a delete row with reason `hidden`). Without a reason, keep it (keel's own * words; sharing is forward-only). Never empty a copy on your own. * Citizenship: heaviest route on the platform; default page size is polite. * keel sends the cursor of a page at the head as a number (an empty page, for a key * whose cursor carries no epoch); it is handed back as a string, like every cursor here. * `after`: only the changes made at or after an ISO 8601 time (`updated_at` of an * upsert, `deleted_at` of a delete; no offset means UTC). A filter, not a position: the order, * `cursor`, `has_more` and `head` are as without it, so to read the whole window pass the cursor * back as `since` with the same `after` until `has_more` is false (`changesAll` does). "Since * yesterday" by the clock; a kept cursor is still the exact "since my last visit". Anything * that is not a date and time is a 422 naming `after`. */ changes(opts?: { since?: string; limit?: number; after?: string; }): Promise; /** * GET /changes?head=true -- where the feed is now, without a page: no element is read. * `head` is the world's change_seq; `cursor` is a position to pass as `since` that * re-sends nothing at the head (a guest's or a contributor's carries its view's epoch). The cheap "anything * new?" for a poll: compare `head` with the head you last APPLIED (not the previous * poll's, so a missed tick never drops a change) and walk changesAll only when it moved; * a head below yours means the server rewound: walk again from zero. `epoch` is a * guest's or a contributor's view epoch (null for other keys): it can move with `head` unchanged, so walk on * either move. `epoch_reason` (while keel's hidden mark is on; absent otherwise) * says why the epoch last moved, `role` or `view` (see OwChangesPage.epoch_reason). * keel returns the owner's cursor as a number; it is handed back as a * string, like every cursor here. * * Conditional (4.57.0): keel tags the answer with an ETag that covers the head and * the epoch, so a view change moves it too. The client keeps the last tag and sends it as * If-None-Match on its next head read. When nothing moved, keel answers 304 with no body, and * this returns the `head`, `cursor` and `epoch` from the last 200 with `unchanged: true` * (no `epoch_reason`); every 200 says `unchanged: false`. keel refunds a 304 against the * request budget, so a poll that mostly sees nothing costs little. A poller: read the head, * sleep when `unchanged`, walk changesAll when `head` or `epoch` moved past what you applied. * The interval is yours; the client never sleeps or polls on its own. The tag is kept per * client instance and sent back exactly as received (`W/` and quotes included), never * compared; a 409 `resync_required` from this or from changes/changesAll clears it, so the * next head read is a full 200 (with `epoch_reason`). A 304 while no tag is held is an * OwApiError (status 304): the client never makes up a head. */ changesHead(): Promise<{ head: number; cursor: string; epoch: number | null; unchanged: boolean; epoch_reason?: OwResyncReason | null; }>; /** * Walk the feed from `since` (or from zero = full export) to the current * tail, yielding ops in order. Returns the final cursor via the generator's * return value; persist it for the next incremental pull (with the last page's * `head` and `epoch`: the view epoch the walk ran under, for a guest or a contributor). */ changesAll(since?: string, opts?: { after?: string; }): AsyncGenerator; /** * POST /media/ticket -- permission to upload ONE image into this world (a write * key and its PIN; no body). Short-lived (`exp`), single-use, counted toward the * world's daily limit. Use it directly to upload yourself (for progress, say): * POST the bytes to `upload_url` with `Authorization: Bearer `. Otherwise * call uploadImage(), which does both steps. Refusals: 403 `storage_full` (the * account's image storage is used up), 429 `quota_exceeded` (the world's daily * limit; Retry-After) as well as the wrong-PIN 429 `rate_limited`, 503 * `media_unavailable`. */ createMediaTicket(): Promise; /** * Upload one image and get its permanent public URL: a ticket from the API, then the * bytes straight to the media edge (the API never sees them). Pass a ticket from * createMediaTicket() to use it instead of fetching one. Returns the edge's 201; * set `url` as an element's `image_url` yourself (`patch(type, id, { image_url })`). * * webp, png, jpeg or avif, read from the bytes (never SVG or gif). `key` names the * object (it must start with the ticket's `prefix`; without it the edge picks one). * An image larger than the ticket's `max_bytes` throws 413 `too_large` before any * byte is sent. The edge's refusals arrive as OwApiError with its code: 401 * `ticket_expired` / `ticket_used` / `ticket_invalid`, 400 `bad_key`, 409 `exists`, * 413 `too_large`, 415 `unsupported_type`, 502 `write_failed` (nothing stored; the * ticket is still unspent). A ticket is spent once the upload succeeds: a retry * needs a new one. */ uploadImage(image: Blob | ArrayBuffer | ArrayBufferView, opts?: { key?: string; ticket?: OwMediaTicket; }): Promise; /** * POST /media/remove-ticket -- permission to remove ONE image (a write key and its * PIN). The image's uploader may remove it, and so may the world's owner key; an * AI seat answers as its sponsor. Only images uploaded with a ticket qualify. * `key` is the object key, or the whole image_url (the part after the host is taken). * The reply's `referenced` counts the world's elements still showing the image. * Refusals: 403 `permission_error` (neither uploader nor owner), 404 `not_found` * (no removable image under this key), 409 `removal_in_flight` (a ticket for this * image is already out) and 409 `upload_pending` (an upload is not yet recorded), both * with Retry-After. */ createRemovalTicket(key: string): Promise; /** * Remove one uploaded image: a removal ticket from the API, then the removal at the * edge (the API key never leaves for the edge). Pass the object key or the whole * image_url, or a ticket from createRemovalTicket() to use it instead of fetching one. * The bytes go back to the uploading account's storage. * * Removal does not touch elements: clear or replace their `image_url` yourself (the * ticket's `referenced` says how many there are). A copy already cached by the network * or a browser can keep answering for a while (`cache: 'may_linger'`). The edge's * refusals arrive as OwApiError with its code: 401 `ticket_expired` / `ticket_used` / * `ticket_invalid`, 403 `not_removable`, 502 `remove_failed` (nothing removed; the * ticket is still unspent). */ removeImage(keyOrUrl: string, opts?: { ticket?: OwRemovalTicket; }): Promise; /** * GET /{type}/{id}/files -- the element's files, newest first: each with its name, kind, * size in bytes, label (or null), who added it (`added_by.agent` is true when an agent did, * `added_by.owner` when the world's current owner did) and when. Any key that may read the element; a file is seen by whoever may see its * element, and an element the key cannot see answers 404 `not_found`. Returns the rows * (keel sends them as `{ data }`, with no paging). Files never ride on the element: they * are not in its body, its `change_seq` or /changes. */ listFiles(type: ElementType | string, id: string): Promise; /** * GET /world/files -- every file in the world this key may see, newest first, each with its * element's `element_type` and `element_id`; and the world's total, `used_bytes` of * `cap_bytes` (for a line like "41 MB of 250 MB"). `used_bytes` counts all the world's * files, also those on elements this key cannot see. Any key. */ worldFiles(): Promise; /** * POST /{type}/{id}/files -- permission to upload ONE file onto this element: a write key * (and its PIN) that may change the element. `name` is the file's name with its extension; * `kind` is read from that extension when you leave it out (a TypeError, before anything * is sent, when the extension is not one of .pdf .txt .md .markdown .json .csv .yaml .yml * .toml .zip); `size` is the file's size in bytes; `label` (at most 80 characters) is a * field of the element's type the file belongs to, or your own words. Short-lived (`exp`, * 10 minutes) and single-use. Sends no Idempotency-Key, by keel's rule: the single-use * ticket is the idempotency, and a second call is a second ticket. * * Use it directly to send the bytes yourself: POST them, raw, to `upload_url` with * `Authorization: Bearer `. Otherwise call uploadFile(), which does both steps. * Refusals: 413 `file_too_large` (`err.isFileTooLarge`: over 25 MB, `param` size), 403 * `files_full` (`err.isFilesFull`: the world's 250 MB has no room for it) or `not_author` * (a contributor's key on an element someone else made), 422 `invalid_request` (`param` * names kind, name, size or label), 429 `quota_exceeded` (`err.isQuotaExceeded`: the * world's 200 tickets a day are used up) or `rate_limited` (wrong PINs), both with * `retryAfter`; 503 `media_unavailable`. */ createFileTicket(type: ElementType | string, id: string, req: { name: string; kind?: OwFileKind; size: number; label?: string | null; }): Promise; /** * Attach one file to an element: a ticket from the API (createFileTicket), then the bytes * straight to the upload host (the API never sees them, and the key and PIN never leave * for the host). Takes a File, a Blob, an ArrayBuffer or a Uint8Array. Returns the host's * 201 (`key`, `fid`: the file's id, `bytes`, `type`, `etag`). The file appears in * listFiles once the host has reported it to the API, which can be a moment after this * returns. * * `name` defaults to a File's own name (anything else needs one: a TypeError before * anything is sent); `kind` is read from the name's extension when left out, as * createFileTicket reads it; `size` is the byte length; `label` as createFileTicket's. * Pass a `ticket` from createFileTicket() to use it instead of fetching one (then `name`, * `kind` and `label` are not needed: the ticket already carries them). * * `onProgress(loaded, total)` reports the bytes sent. fetch cannot report an upload's * progress, so where XMLHttpRequest exists (a browser) the bytes go through it, with a * call for each progress event; elsewhere (Node), the bytes go through fetch and * onProgress is called once, with (total, total), when the upload has succeeded. Without * onProgress, the bytes always go through fetch (config.fetch when you set one). * * A file larger than the ticket's `max_bytes` throws 413 `too_large` before any byte is * sent. The API's refusals are createFileTicket's; the upload host's arrive as OwApiError * with its code: 401 `ticket_expired` / `ticket_invalid` / `ticket_used`, 409 `exists` * (the ticket's file is already stored: an earlier send with this ticket succeeded, so the * file is there), 413 `too_large`, 415 `unsupported_type` (the bytes are not the kind: * a pdf must start as one, a text file must be UTF-8 with no NUL in its first 8 KB, a zip * must be a world's own bundle, an image must be the kind its first bytes say; nothing is stored and the ticket is still unspent), 502 * `write_failed` (nothing stored; the ticket is still unspent). A ticket is spent once the * upload succeeds: another file needs a new one. */ uploadFile(type: ElementType | string, id: string, file: Blob | ArrayBuffer | ArrayBufferView, opts?: { name?: string; kind?: OwFileKind; label?: string | null; ticket?: OwFileTicket; onProgress?: (loaded: number, total: number) => void; }): Promise; /** * GET /{type}/{id}/files/{fileId}/download -- a link to the file and when it stops * working: `url` (the file as an attachment, from the download host), `exp` (unix * seconds, 5 minutes after issue), and the file's `name`, `kind` and `size`. The link is * the credential: anyone holding it can fetch the file until `exp`, more than once. So * ask for it when the file is opened, use it at once, and never store or share it. Any * key that may read the element. */ fileDownloadLink(type: ElementType | string, id: string, fileId: string): Promise; /** * DELETE /{type}/{id}/files/{fileId} -- remove a file for real: it leaves the lists and * the world's total at once, and its bytes are deleted from the store. The world's owner * key may, and so may the key of whoever added it (an AI seat answers as its sponsor); * any other key is 403 `permission_error`. A file that is not there is 404 `not_found`. * Deleting an element removes its files too. */ removeFile(type: ElementType | string, id: string, fileId: string): Promise; /** * POST /join/preview -- what a join code holds, without using it: who invites, to * which world, in what role, and `reader` (`person`: accept it with acceptJoin; * `agent`: an AI agent redeems it at POST /join). Sends no credential, whatever key * this client holds. Every bad code (unknown, used, revoked, expired) is the same * 404 `not_found` (`err.isNotFound`). `code` is the part of the link after `#`; an empty one is a TypeError before anything is sent, here, in redeemJoin and in acceptJoin. A table * adds `max_uses`, `uses_left`, `name_required` and `characters`, the * pick screen's list; a link for one answers without them. `glimpse` is always * there: for a link whose role reads the world (contributor or co-builder), up to * five things of it by name and type and the links among them, with no id; null * for a guest's or a player's link, and when no two things a visitor could see * are linked. */ previewJoin(code: string): Promise; /** * POST /join -- redeem a join code that needs no account: a player's (a friend reading as * a guest) or an AI agent's. Sends no credential, whatever key this client holds. * 201 with `kind` telling the two answers apart: `player` gives a read key (`ow_r_`, no PIN) * and the Character it reads as; `agent` gives a seat's write key, secret and `.env` lines. * Both are shown once, and the code is spent: a lost answer cannot be replayed (the owner * sees the row never used, and makes a new link). `name` (a player's, optional: the * Character's name or "Player" when left out) and `agentName` (an agent's, required for an * agent code). Every bad code is the same 404 `not_found`; a person's code is redeemed with * acceptJoin instead. * * A table (a player code whose preview carries `max_uses`) seats one player * per redeem, until `uses_left` is 0. With a list, `character` is the player's pick, the `id` * of one of the preview's `characters` not `taken`: a Character a live seat already plays is * 422 `character_taken` (`err.isCharacterTaken`; pick another), one off the list, hidden or * deleted since, or none sent, is 422 `invalid_request`, param `character` * (`err.isCharacterInvalid`; read the preview again). With no list * (`name_required`), send `name` and no `character`: the player's fresh Character takes the * name (missing: 422, param `name`). A world with its 50 players is 422 `world_full` (`err.isWorldFull`); * the last place taken by someone else first is the one 404. A refusal spends nothing. A link * for one ignores `character`. */ redeemJoin(code: string, opts?: { name?: string; agentName?: string; character?: string; }): Promise; /** * Sign in with an email address (or a username) and password, and get a new account token * (`ow_a_`) for this device, named `tokenName` (say, "Lantern on iPhone"): the name the * account's tokens page lists it under, where it can be revoked. Pass exactly one of * `email` and `username`; both or neither is a TypeError before anything is sent. * * Works on a client with no key, and sends no key whatever this client holds. Three * requests: a sign-in at keel's sign-in service (`{baseUrl}/auth/app/v1/auth/login`), which * answers with a short-lived session; `POST /account/tokens` with that session, which mints * the token; then the session is ended, whether the mint worked or not. Only the token is * kept: the password is sent once and held nowhere, and the session never leaves this call. * Store the token as you would any account token, and make a client with it * (`new OwV2Client({ apiKey: token })`). * * A refusal is an `OwSignInError` whose `reason` says why: `invalid_credentials` (wrong * email, username or password), `email_unverified` (the account's email address is not * confirmed yet), `rate_limited` (too many attempts; `retryAfter` when keel sent it), * `offline` (keel was not reached), `mint_failed` (signed in, but no token was made) or * `failed` (anything else, with keel's message). The password is never in an error. */ signInWithPassword(opts: { email?: string; username?: string; password: string; tokenName: string; }): Promise; /** * POST /account/join -- accept an invite link's code as the account this client's * `ow_a_` token belongs to: 201 with the new membership. Refusals: 404 `not_found` * (every bad code, and a code made for an AI agent) and 409 `already_member` * (`err.isAlreadyMember`). Accepting needs no account PIN, for any role; a write key for the membership waits for one (`pin_required`). A refusal * never spends the code. A world key here is a TypeError before anything is sent. */ acceptJoin(code: string): Promise; /** * POST /account/worlds/{worldId}/links -- a new invite link for a world this client's * `ow_a_` token owns: `reader` is required (`person`, accepted with acceptJoin; * `agent`, redeemed at POST /join; `player`, a friend with no account, redeemed with * redeemJoin for a read key); `role`, when left out, is the server's default: guest for a * person link, contributor for an AI link (a player link is guest, and refuses any other), `days` (1, 7 or 30) to 7; `withCharacter` (AI links * only) to true; `character` (player links only) a Character's id or `new` (the default): * whoever opens the link first reads as it, until removed. `preview` (person and player links) * to false: true puts the world's id in the link's path, so a chat that unfurls it * shows the world's name and picture (the code stays after `#`); true on an AI link is * 422, param `preview`. `maxUses` (person and player links; an AI link takes none) to 1, a * link for one. On a person link 2 to 50 lets in that many accounts, each * joining once with the link's role, until every use is taken, it expires or it is revoked; * who already joined stays. On a player link 2 to 50 makes a table, one * link that seats that many players, each picking one of * `characters` (Character ids of the world, in the order a pick screen shows them; a hidden * one is 422, param `characters`). `characters` empty or left out: each player names a fresh * Character after themselves. A table takes no `character`, not even `new` (422, param * `character`), and `characters` on a link for one is 422, even empty. A table counts once * against the 50 pending invites; its seats count against the world's 50 players as each is * made, so a full world refuses the pick, never the link. `landsOn` (a person link only): * `site`, the default, opens onlyworlds.com's /join page; `dashboard` opens the Dashboard's, * for someone invited to work there; either page takes the same code, and `dashboard` on an * agent or player link is refused. `note` (a person link): a note for whoever opens it, at most * 500 characters and 8 line breaks, which previewJoin answers as `note` and no link row * carries; an AI or player link keeps none. The note and `inviterName` refuse control * characters, a tab included, and the characters that override or isolate text direction: * 422, param the field. 201 with the code, shown in this answer only. Owner only: anyone else, and a world that doesn't exist, gets 404 * `not_found` (`err.isNotFound`). A world key is a TypeError before anything is sent. */ createWorldLink(worldId: string, opts: { reader: 'person' | 'agent' | 'player'; role?: OwMemberRole; days?: 1 | 7 | 30; inviterName?: string; withCharacter?: boolean; character?: string; preview?: boolean; maxUses?: number; characters?: string[]; landsOn?: 'site' | 'dashboard'; note?: string; }): Promise; /** * GET /account/worlds/{worldId}/links -- the world's invite links, without their codes: * each with its status (pending, used, revoked or expired) and uses. Owner only, as * createWorldLink. Needs the client's `ow_a_` token. */ listWorldLinks(worldId: string): Promise; /** * DELETE /account/worlds/{worldId}/links/{linkId} -- revoke a link: its code no longer * works. A used, revoked or expired link answers the same and stays as it was; whoever * joined with it stays a member (remove them from the roster). Owner only, as * createWorldLink. Needs the client's `ow_a_` token. */ revokeWorldLink(worldId: string, linkId: string): Promise; /** * POST /account/worlds/{worldId}/seats -- a seat for your own AI in a world you own or are a * member of: its own membership, write key and `ow_s_` secret, no join link. You answer for * it, and its writes are marked as an AI's. `name` is required (1 to 80 characters); * `role` is at most your own (the owner may give any; default contributor, or your own role * when that is lower); `character` is `new` (default: a Character of its own), `none`, or * `mine` (members only: it plays the Character you play). 201 with `key`, `pin` and the * `.env` lines in `env`, shown in this answer only. Sends no Idempotency-Key, by keel's rule: * a replay would have to keep the key. If the answer is lost, listSeats shows the seat without * its key: rekeySeat gives it a new one (or removeSeat and make another). Needs the client's `ow_a_` token. */ createSeat(worldId: string, opts: { name: string; role?: OwMemberRole; character?: 'new' | 'none' | 'mine'; }): Promise; /** * GET /account/worlds/{worldId}/seats -- the live AI seats you can see: your own AI's, or, * as the world's owner, every seat. No keys or secrets. Needs the client's `ow_a_` token. */ listSeats(worldId: string): Promise; /** * POST /account/worlds/{worldId}/seats/{seatId}/key -- a new key and secret for a seat whose AI * lost its own: its sponsor or the world's owner may. The old key and secret stop at once; * nothing else about the seat changes. 201 with the same shape as createSeat (`key`, `pin`, * `env`), shown in this answer only. No Idempotency-Key, by keel's rule: if this answer is lost * too, ask for another new key. Needs the client's `ow_a_` token. */ rekeySeat(worldId: string, seatId: string): Promise; /** * DELETE /account/worlds/{worldId}/seats/{seatId} -- remove an AI seat: its sponsor or the * world's owner may. Its key and secret stop at once; the Character it plays goes with it only * while it is as the join left one (made by the join, named as the seat, supertype `Agent` alone, * last written by the join, linked from nothing, played by no one else); any other stays, one * given to the seat to play included. Needs the client's `ow_a_` token. */ removeSeat(worldId: string, seatId: string): Promise; /** * PATCH /account/worlds/{worldId}/members/{memberId} with `lenses` alone -- set the lenses a row * starts with: lens ids in order, 0 to 20, repeats dropped by the server; an empty list is a choice too, * and keeps a seat off its Titles' lenses, while `null` puts the row back to never chosen (a seat * playing a Character then starts with its Titles' lenses; for `'owner'`, `null` is the empty list). * A member sets its own row (any role), an agent's or a player's seat it answers for (its sponsor), * or any seat as a co-builder; the owner sets any seat, and its own list with `'owner'` as * `memberId`. Any other row is a 404; the owner naming a person's row is a 422 (a person sets its * own, with setMyLenses). Each id must be a lens of this world that you and the row's holder can * both see: one either cannot see is the same 404, a Construct that is no lens 422 `not_a_lens`, a * template 422 `lens_is_template`, a hidden lens 422 `lens_hidden` (`param` lenses); a lens already * in the row's list is kept, hidden or not. A lens in the list that you cannot see stays at its * place, outside the 20, and the answer's `lenses` is the list as you are shown it, with * `x_served_trimmed` naming `lenses` when one was kept. The answer is `{id, role, kind, lenses}` * (keel's `MemberLenses`), `id` null and `role` and `kind` `owner` for the owner's own list. The body is `{ lenses }` and * nothing else: a role, Character or sponsor change is not sent here. Needs the client's `ow_a_` token. */ setMemberLenses(worldId: string, memberId: string, lensIds: string[] | null): Promise; /** * PUT /{type}/{id}/hidden -- hide an element. The owner's key or a co-builder's * (a person's or a seat's) with its PIN; hiding a hidden element again changes nothing, and * the element's body and `change_seq` do not move. Hidden, it is seen only by the owner, the * co-builders and the member who created it; to every other key it is a 404, left out of * lists, search, counts and the link arrays that name it. 204, no body. No Idempotency-Key. */ hide(type: ElementType | string, id: string): Promise; /** DELETE /{type}/{id}/hidden -- clear the mark; an element that is not hidden stays as it is. 204. */ unhide(type: ElementType | string, id: string): Promise; /** * GET /world/hidden -- every hidden element of the world, newest first: `{type, id, set_at, * set_by}` each (`set_by` null when the owner hid it). Any key of the owner's or a co-builder's; * any other key is a 403. Served with `Cache-Control: no-store`: read it each time, keep no copy. */ listHidden(): Promise; /** * POST /{type}/{id}/proposals -- propose a change to an element without making it. Any member * who reads the element proposes (the owner with its write key and PIN; a co-builder, a * contributor, a guest, an AI seat or a player seat, whose read key is enough). `fields` is * cleaned as patch() cleans a body (a read body's server keys stripped; a known-of stub is a * TypeError before sending) and names only fields this key's view of the element holds; * `evidence` is 1 to 2,000 characters; `expires` 1 to 365 days out (keel's default 30). keel * keeps `base`, the element's values for those fields now. With an `idempotencyKey`, a retry * with the same key and body replays the first answer for 24 h: no second proposal. Returns the * row. Refusals: 422 `field_not_visible` (`err.isFieldNotVisible`), 422 `too_many_open` * (`err.isTooManyOpen`: 5 open per element per proposer, 50 per world), 400 `invalid_link`, 403 * for a read key with no member (the owner's read key, a demo key), 404 for an element this key * cannot see. */ propose(type: ElementType | string, id: string, input: OwProposeInput, opts?: { idempotencyKey?: string; }): Promise; /** * GET /{type}/{id}/proposals -- one element's proposals, newest first: every row for the * owner's and a co-builder's keys, a member's own for any other. `state` is `open` by keel's * default (not past `expires`), or `lapsed`, `accepted`, `declined`, `all`; `since` keeps rows * whose `updated_at` is at or after it; `limit` defaults to the client's pageSize. Any member * key that reads the element, a read key included; the owner's read key reads every row. */ listProposals(type: ElementType | string, id: string, opts?: OwProposalQuery): Promise; /** * GET /world/proposals -- the world's queue, newest first by created_at, two kinds of row told * apart by `kind`: `proposal`, a proposed change to an element (OwProposal), and * `new_element`, an element written as proposed, carrying `x_review_proposed` * (OwProposedNewElement: settle it with reviewNewElement). A marked element is listed under * `open`, `lapsed` and `all`, never `accepted` or `declined`; keel reads at most the 500 newest. * Every row for the owner's and a co-builder's keys, a member's own for any other. The query is * listProposals', plus `element` (one element's rows, by id). The cursor is opaque: pass * `next_cursor` back as it came. Any member key, a read key included; the owner's read key (or * write key, no PIN needed) reads every row; a demo key and the keyless public view get a 404. */ worldProposals(opts?: OwWorldProposalQuery): Promise; /** * POST /{type}/{id}/proposals/{pid}/accept -- write the proposal's fields to the element as one * ordinary write by this key (`changed_by` is the keeper, a new change_seq, a /changes row), and * the row turns accepted. The world's owner key or a co-builder's, with its PIN; never the * proposer's own (403 `own_proposal`, `err.isOwnProposal`), never an AI seat's while the * world holds them (403 `proposed_only`, `err.isProposedOnly`). Refused with nothing written when * a proposed field moved since (409 `stale_proposal`: an OwStaleProposalError carrying * `conflicts` and `current`; the row stays open) or a proposed link names an element deleted * since (400 `invalid_link`). A lapsed proposal may still be accepted; a decided one is a 422. * Returns the row and the element as written. */ acceptProposal(type: ElementType | string, id: string, pid: string): Promise; /** * POST /{type}/{id}/proposals/{pid}/decline -- the row turns declined, with an optional * `reason` (at most 2,000 characters); the element does not change. The same keys and refusals * as acceptProposal, but no stale check. Returns the row. */ declineProposal(type: ElementType | string, id: string, pid: string, opts?: { reason?: string; }): Promise; /** * DELETE /{type}/{id}/proposals/{pid} -- the proposer takes back its own undecided proposal, * with any of its keys: the row goes. 204. A keeper's key on another member's row is a 403; * any other key a 404; a decided row a 422. */ withdrawProposal(type: ElementType | string, id: string, pid: string): Promise; /** * POST /{type}/{id}/review -- settle a new element written as proposed, one carrying * `x_review_proposed` (the queue's `new_element` row). The owner's key or a * co-builder's, with its PIN. `{ decision: 'accept' }` clears the mark (a write by you: a new * change_seq, one /changes row) and answers `{ element }`; `{ decision: 'decline', reason? }` * deletes the element (a tombstone, the links to it scrubbed, its open proposals dropped) and * answers `{ deleted }`, its id; the reason is answered back and kept nowhere. Refusals: 422 * `not_proposed` (`err.isNotProposed`: the element carries no mark), 403 `proposed_only` * (`err.isProposedOnly`: the seat the mark names, or an AI seat under the world's switch), 403 * for any key but a keeper's. A proposed change to an existing element is decided with * acceptProposal or declineProposal instead. */ reviewNewElement(type: ElementType | string, id: string, opts: OwReviewInput): Promise; /** * GET /account/worlds -- every world the account owns or is a member of, with its keys by * name and last four (a member sees only their own keys on a shared world). Account token only. */ listAccountWorlds(): Promise; /** * POST /account/worlds -- make a world on the account, with its one write key. `name` is required * (1 to 255 characters, not blank; keel trims it). `pin` is the account PIN, 4 digits. An account * with no PIN must send one (1000-9999): it becomes the account PIN and the write wall on every * world of the account; left out, a 422 with `param: 'pin'` (`err.param`) and nothing made. An * account with a PIN may send it to have it checked before the world is made: a wrong one is a 401 * `invalid_credentials` with `param: 'pin'` and nothing made, counted toward the same lockout as a * write's PIN (then 429 `rate_limited`); left out, the world takes the account's PIN. So a tool * that holds the person's PIN can always send it. `keyName` names the write key as the website's key * list shows it (1 to 80 characters, trimmed; null or left out: no name). `source` and `producer` * are the folder format's provenance lines (spec 4.2), each an object or null, from a tool that * makes the world from a folder: kept on the World as given, served by getWorld() as `origin`. * Only the keys given are sent, `keyName` as `key_name`. 201: the world's row, as * listAccountWorlds lists it, with the full write key once in `key`. Account token only. Sends no * Idempotency-Key (keel takes one since 2026-11-07, and a replay answers the world without `key`): * if the answer is lost, the world is in listAccountWorlds, and mintWorldKey gives it a key. */ createAccountWorld(opts: OwCreateAccountWorldInput): Promise; /** * POST /account/worlds/{id}/keys -- mint a world key, `scope` `'write'` (the default) or * `'read'`, `name` as the key list shows it (trimmed, at most 80 characters, else a 422; null or blank: no * name). The full key comes back * once in `key`. The owner mints a world key; a member mints their own member key, 409 * `pin_required` (`err.isPinRequired`) for a write key while the account has no PIN. Account * token only. `keep: true` keeps the key across a sign-out: revoking the token * that minted it leaves it live (a tool that stores a key on the device passes it), while * disconnecting the tool, or a replayed sign-in code, still takes it; the answer says `kept`. * Without it, revoking a token a tool got through Sign in with OnlyWorlds revokes the keys it minted, * unless the person holds another live token of the same tool; a token made by hand or by a password * sign-in (signInWithPassword), or one of a tool that asks each time, never takes its keys. * * `idempotencyKey` is sent as the Idempotency-Key header. The mint is never replayed (a stored * answer would keep the key): a second mint with the same key makes a second key. The server * remembers the key on the row instead, so when an answer is lost, madeWorldKey finds the key this * call made, and the tool revokes it by its id and mints again. `signal` (an AbortSignal) goes to * fetch as given; an abort rejects with an OwNetworkError. * * When the answer may be lost: keep the idempotency key on the device before the send. A 4xx made * no key. After a network error or a timeout, ask madeWorldKey, revoke the id it names, and mint * again with a new idempotency key: the same one sent again makes a key the lookup cannot find, * since it keeps naming the first. Believe its "none made" only a couple of minutes after the send, * since an abort stops the wait, not the server's work. */ mintWorldKey(worldId: string, opts?: { scope?: 'read' | 'write'; name?: string | null; keep?: boolean; idempotencyKey?: string; signal?: AbortSignal; }): Promise; /** * GET /account/worlds/{worldId}/keys/made?key= -- the key a mintWorldKey call sent with this * `idempotencyKey` made, as a row without the key itself (`OwWorldKeyRow`), or null when it made * none. A revoked key still answers, with `revoked: true`. The owner finds the keys they minted; a * member only the keys bound to their seat; anything else is null (the server's one 404). Null also * for a server from before the lookup, which answers this address 405. `signal` goes to fetch as * given. Account token only. */ madeWorldKey(worldId: string, idempotencyKey: string, opts?: { signal?: AbortSignal; }): Promise; /** * DELETE /account/worlds/{worldId}/keys/{keyId} -- revoke a world key, by the `id` mintWorldKey * returned: from then on it answers 401 `key_revoked`. The owner revokes any of the world's keys, * a member only their own; any other id is a 404 (`err.isNotFound`). Revoking a revoked key * changes nothing and answers the same 204, so a tool that signs out can revoke its key without * knowing whether it already did. An account token already revoked or expired is a 401 * (`err.isAuthError`): the key was not revoked and still reads. `signal` (an AbortSignal, e.g. * `AbortSignal.timeout(5000)`) and `keepalive` go to fetch as given: with `keepalive: true` a * browser finishes the revoke after the tab that sent it closes; an abort rejects with an * OwNetworkError whose `cause2` is the abort. Account token only. */ revokeWorldKey(worldId: string, keyId: string, opts?: { signal?: AbortSignal; keepalive?: boolean; }): Promise; /** * GET /account/tokens -- the account's tokens, each by name and last four, never the token * itself: when it was last used, whether it is revoked, when it expires, how many live world * keys it minted, and who it is for (`audience`). Account token only. */ listAccountTokens(): Promise; /** * DELETE /account/tokens/{tokenId} -- revoke one of the account's tokens, this client's own * included (a tool done with a sign-in revokes it by the `tokenId` the sign-in answered); every * other token stays live. A token a tool got through Sign in with OnlyWorlds takes the world keys * it minted with it, unless the person holds another live token of the same tool, which then * takes them; a token made by hand or by a password sign-in revokes itself only. An id that is * not one of the account's tokens is a 404 (`err.isNotFound`). Once a client revokes its own * token, its next call is refused as a revoked token's. `signal` and `keepalive` go to fetch * as given, as revokeWorldKey's do. Account token only. */ revokeAccountToken(tokenId: string, opts?: { signal?: AbortSignal; keepalive?: boolean; }): Promise; /** * POST /account/tokens with `ai_uses` -- trade this client's account token down to an AI door * token: an `ow_a_` token that opens only `aiUses()` and the uses named here (1 to 8, by slug, as * `aiUses()` lists them), as this account and on its token rating. Another use answers 403 * `use_not_granted` (`err.isUseNotGranted`), every other route 401 `wrong_audience` * (`err.isWrongAudience`). It ends at midnight UTC, or `lifetimeMinutes` (1 to 1440) after the mint * if that comes first, then answers 401 `key_revoked`. It belongs to the token that minted it: * revoking this client's token revokes it too, while revoking it leaves this one live. A client * built on it revokes it with `revokeAccountToken(minted.id)`. The answer is the token's row with * the token itself, shown only here. A name the server does not run is a 422 (`err.code` `invalid_request`, `err.param` `ai_uses`). * Account token only; the AI door token itself mints nothing (401 `wrong_audience`). */ mintAiToken(uses: string[], opts?: { lifetimeMinutes?: number; name?: string; }): Promise; /** * Start Sign in with OnlyWorlds from a tool's page: mint `state` and a PKCE verifier, keep them * under `clientId` in `storage` (sessionStorage by default; in Node pass one), and send the * browser to `https://www.onlyworlds.com/signin/authorize` (or only return the URL with * `navigate: false`). `redirectUri` is the registered return address as a string, never built * from `location.origin`: a tool's registration is read at `GET /api/v2/auth/clients`. A web * tool's is `https:`; a tool registered as native may pass a loopback address with the port it * bound for this sign-in (`http://127.0.0.1:/` or `http://[::1]:/`, * registered without the port) or its own scheme as registered (`obsidian://onlyworlds-signin`), * and opens the URL in the system browser with `navigate`. `resume` is small JSON handed back by * `completeSignIn`. `scope: 'world:read'` asks for a read-only token, for a tool that only reads: * every write but revoking it is refused with 403 `permission_error`, and `completeSignIn` answers * the scope granted. No request is sent; any client, keyless included. */ signInWithOnlyWorlds(opts: OwSignInBegin): Promise; /** * Finish Sign in with OnlyWorlds on the callback page: check `state` against the record and the * page against the registered address (scheme, host with port, and path, each exactly), take * `code` and `state` out of the address bar (only when `url` is not given: a native app passes * the address its loopback server or scheme handler received), trade * the code once at `POST /auth/token` with the PKCE verifier and no credential, and return the * `ow_a_` token with the account and `resume`. The record is cleared once a return carries its * state, on success and on refusal; a return with another state leaves the sign-in pending; * the SDK keeps no token: the tool does. Refusals are `OwSignInError`: `state_mismatch` (no * pending sign-in, a different state, or the wrong page; nothing sent), `invalid_grant` (keel's * 400: used, expired, or another client's code), `rate_limited`, `offline`, `failed`. Each carries the server's * `status`, `code` and, when its answer named a field, `param`: a 422 that refused the AI door token asked * here names `ai_uses` or `ai_lifetime_minutes` (the code is spent either way). */ completeSignIn(opts: OwSignInComplete): Promise; /** * POST /account/ask -- a question about a world the account owns or is in, answered by * onlyworlds.com's AI proxy from `context` only (build it with buildAskContext from the elements * the user sees; it leaves proposed, hidden and room elements out unless asked). The answer is "The world doesn't say." when the context does not hold * it. Needs the client's `ow_a_` token (a world key is a TypeError before sending). * Once the day's token rating is spent, an account that saved its own AI key on its account page is * answered on that key, billed by its provider: the answer's `paid_by` says `own_key` (else `rating`). * Refusals: 429 `quota_exceeded` (`err.isQuotaExceeded`, the account's token rating used up for the day * and no own key saved; Retry-After runs to midnight UTC), 422 `own_key_refused` * (`err.isOwnKeyRefused`: the own key's provider refused it; not retried, send the person to the * account page), 503 `ask_unavailable` (`err.isAskUnavailable`: switched off, or paused for the * day), 502 `ask_failed` (`err.isAskFailed`); none of them counts. 422 for a question over 500 * characters or context past its limits. * * @deprecated Since 4.139.0. Use `ai('ask', { world_id, question, context }, { idempotencyKey })`: * the same answer, with the use's meter (`use_remaining`) and a retry under the same key is never billed twice. * This name keeps working until 5.0. */ ask(req: { worldId: string; question: string; context: string[]; }): Promise; /** * POST /account/sort -- the user's unsorted notes, and the elements the app's own search * found for them (`slice`: id, lowercase type, name, optional anchor; build it from * lookupWorld's hits), sorted by the same proxy as ask into rows to review: `make`, `add_to`, * `link`, `ask`. Nothing is written; the app applies what the user accepts. Every id in a * row is from the slice; keel moves any other row to `not_proposed` with its reason. * The same account token, token rating (it spends the tokens it uses), own AI key and `paid_by`, * and refusals as ask. 422 * names the param: notes 1 to 8, each up to 4,000 characters and 16,000 in all (text * only), at most four pictures, each uploaded into this world; slice up to 100, names up * to 200 characters, anchors up to 120. * * @deprecated Since 4.139.0. Use `ai('sort', { world_id, notes, slice }, { idempotencyKey })`: * the same answer, with the use's meter (`use_remaining`) and a retry under the same key is never billed twice. * This name keeps working until 5.0. */ sort(req: { worldId: string; notes: OwSortNote[]; slice: OwSortRef[]; }): Promise; /** * GET /account/allowance -- the account's token rating, the one daily meter ask, sort and * the Council spend from: the rating, what is used and left today, and * when it resets (the next midnight UTC), and `own_key` (`{provider}` when the account saved its own * AI key, which ask and sort use once the rating is spent; else null). Spends nothing. Needs the * client's `ow_a_` token. */ allowance(): Promise; /** * GET /account/ai -- the AI uses onlyworlds.com runs, each a named call a tool makes with ai(): * its owner, provider, model and effort, the hash of its system prompt, what its body may hold, its * answer cap, its price, its daily ceiling, this account's calls left today, and whether it is on. * Reading it spends nothing. Needs the client's `ow_a_` token. */ aiUses(opts?: { signal?: AbortSignal; }): Promise; /** * POST /account/ai/{use} -- one call of an AI use (aiUses lists them), metered on the account's * daily token rating, then its own saved AI key, as ask and sort are. `body` is the use's own body in * its wire spelling, sent as given: `{world_id, question, context}` for `ask`, `{world_id, notes, * slice}` for `sort`; another use's body is the one its listing describes. The answer is the use's * own, its meter whole (`paid_by`, `model`, `usage`, `remaining`, `tokens_remaining`, `token_rating`), * with `use_remaining` (null when the use has no daily ceiling) and `wasReplay`. The use's name is * checked as one path segment before sending. Needs the client's `ow_a_` token. * * With an `idempotencyKey`, a retry is safe: the same key and body answer the first answer again * (`wasReplay` true) and bill nothing; the same key with another body is 409 `idempotency_error`, and * a key whose first call is still running is 409 `idempotency_in_flight` (retry after `retryAfter`). * Retry with the same key and body, a few times at most, and never mint a new key to get past an * in-flight answer: when the server cannot store an answer, the key is held for a day and keeps * answering `idempotency_in_flight` although the call ran and was billed. A refusal the provider * billed (422 `answer_not_parsed`, or a 502 after a billed answer) is kept under the key and replayed * like an answer, so a retry never bills it twice. The client never retries on its own. * * Refusals, none of them counted against the rating: 429 `use_ceiling` (`err.isUseCeiling`: the use's calls for the day * are made), 429 `use_in_flight` (`err.isUseInFlight`: another call to this use is running; wait * `retryAfter`), 429 `quota_exceeded` (`err.isQuotaExceeded`: the token rating is spent and no own key * is saved), 422 `own_key_refused` (`err.isOwnKeyRefused`), 503 `ask_unavailable` * (`err.isAskUnavailable`; with `param` `use`, this use is switched off or spent its own budget * today), 502 `ask_failed` (`err.isAskFailed`), 404 `not_found` (a use that is not listed, `param` * `use`, or a world the account is not in), 422 for a body past the use's limits (`param` names it), * 422 `answer_not_parsed` (`err.isAnswerNotParsed`: the answer was off its shape twice; billed to the * use's own budget). */ ai(use: 'ask', body: OwAiAskBody, opts?: { idempotencyKey?: string; signal?: AbortSignal; }): Promise; ai(use: 'sort', body: OwAiSortBody, opts?: { idempotencyKey?: string; signal?: AbortSignal; }): Promise; ai(use: string, body: Record, opts?: { idempotencyKey?: string; signal?: AbortSignal; }): Promise & OwAiMeter>; /** * Raw authenticated request against this client's baseUrl. Public since 4.0 * so auxiliary resources can ride the same transport — it structurally * satisfies `TokenTransport` (`new TokenResource(client)`). Prefer the typed * methods for element CRUD; this is the escape hatch, and it does NOT apply * sanitizePayload — callers own their body shape. */ request(method: string, path: string, opts?: { query?: string; body?: unknown; idempotencyKey?: string; auth?: boolean; allowEmpty?: boolean; replayAware?: boolean; /** A `change_seq` to send as `If-Match`; a whole number, else TypeError before sending. */ /** A write keel's document lists X-OW-Agent on (the element writes, the links route, bulk, adopt, the file ticket): where an agent client sends it. Hide, unhide, setMyCharacter and mintWorldKey are not, and keel reads no agent there. */ write?: boolean; /** One of the writes keel reads X-OW-Client on (create, put, patch, delete, links, bulk, adopt, propose, accept, review, and an AI use's call): where the client's name goes. */ elementWrite?: boolean; /** * A write keel may answer 202 with `{proposal}` (put, patch, links): a 202 then * throws an OwProposedError instead of returning a body that is not the element. */ proposable?: boolean; ifMatch?: number; /** A tag to send as `If-None-Match` exactly as given (the head read): unlike ifMatch, nothing is quoted or checked. */ ifNoneMatch?: string; /** * Called with every response's `ETag` header (as received, null when absent) and status, before * the body is read. With it given, a 304 Not Modified returns null instead of throwing. */ onEtag?: (etag: string | null, status: number) => void; /** Passed to fetch as given: aborting it rejects with an OwNetworkError whose `cause2` is the abort. */ signal?: AbortSignal; /** Passed to fetch as given: a browser finishes the request after the page closes. */ keepalive?: boolean; /** * A GET keel serves an account token, or no key, with `world=` (element list and get, search, * the world GET). On a client with `world` set, `world=` is added to the query. On an * account client every other route but /account, and on a keyless client every other route * that needs a credential, is a TypeError before sending. */ worldRead?: boolean; /** * A route keel's document declares the account token on beside the world key (worldLenses, * setMyLenses, members): an account client sends it with its Bearer token. `'path'`: the path names the * world, and nothing is added. `'world'`: the world is named with `world=`, added from the * client's `world`, and an account client without `world` set is a TypeError before sending. * A world key sends as without it; a keyless client is still refused. */ accountToken?: 'path' | 'world'; }): Promise; } /** * Every extension a file on an element may end in, to the kind it gives, as onlyworlds.com reads * a name: `.yml`, `.markdown` and `.jpeg` included. A file picker's accept list is * `Object.keys(FILE_EXTENSIONS).map((e) => '.' + e)`. */ declare const FILE_EXTENSIONS: Readonly>; /** * The kind a file name's extension gives, read as keel reads it: the last path part, then * what follows its last dot, which must have something before it. `undefined` when there is * none or keel takes no file with it (uploadFile then refuses before any request). */ declare function fileKindOf(name: string): OwFileKind | undefined; /** * Canonical element colour palette — four colour groups. * * Ruled 2026-07-22 after a measurement pass: 22 mutually-separable hues * is structurally impossible; four groups is the ceiling that passes * all-pairs CVD separation in both modes. **Colour carries the GROUP; the * icon (`ELEMENT_ICONS`) carries the TYPE.** Dark-mode pairs land in the 6–8 * CVD floor band, so secondary encoding (icon + label) is REQUIRED alongside * colour, not optional. * * The groups are a visual aid for drawing the 22 types, not part of the * standard, and are named only by their colour (`blue`, `green`, `pink`, * `amber`). Everything here is GENERATED since 4.102.0: `ELEMENT_GROUPS`, * `GROUP_ORDER` and `GROUP_COLORS` are emitted by `codegen/generate_types.py` * from the distribution's `presentation.json` (`types..family`, * `colors.order`, `colors.families`), which validates every group against the * order and every hex as `#rrggbb`. `test/palette.test.mjs` holds them to the * vendored sidecar. Do not change a hex without re-running the CVD validation * (every brighter green collides with the amber for protan viewers — the green * is pinned BY the accessibility budget). * * Provenance: first proven live in atlas (`src/core/element-colors.ts`) and * council (`src/cosmos/element-families.ts`) — both become re-exports of this * module. */ /** The colour group of an element type slug. */ declare function groupOf(type: ElementType): ElementGroup; /** * The convenience most callers want: canonical colour for an element type. * Name matches the live atlas/council implementations so their SDK swap is a * re-export, not a rename. Defaults to `dark` (both current consumers are * dark-surface). * * An unknown type throws a TypeError naming it (since 4.2.0; before, it crashed * with "Cannot read properties of undefined"). This is the one place a swap from * atlas's own copy is NOT a pure re-export: atlas falls back to the green * group for an unknown type. A caller that wants a fallback catches, or checks * `type in ELEMENT_GROUPS` first; which fallback, if any, is a design call * this package does not make for its consumers. */ declare function elementColor(type: ElementType, mode?: 'light' | 'dark'): string; declare const LEGACY_WORD: { readonly blue: "agents"; readonly green: "world"; readonly pink: "abstract"; readonly amber: "temporal"; }; /** @deprecated Since 4.102.0. Use `ElementGroup`, the colour words; this name leaves in 5.0. */ type ElementFamily = (typeof LEGACY_WORD)[ElementGroup]; /** @deprecated Since 4.102.0. Use `ELEMENT_GROUPS`; this name leaves in 5.0. Each type's group in its pre-4.102.0 word. */ declare const ELEMENT_FAMILIES: Record; /** @deprecated Since 4.102.0. Use `GROUP_COLORS`; this name leaves in 5.0. The same hexes, keyed by the pre-4.102.0 words. */ declare const FAMILY_COLORS: Record; /** @deprecated Since 4.102.0. Use `GROUP_ORDER`; this name leaves in 5.0. */ declare const FAMILY_ORDER: readonly ElementFamily[]; /** @deprecated Since 4.102.0. Use `groupOf`; this name leaves in 5.0. */ declare function familyOf(type: ElementType): ElementFamily; /** * Field labels: the one rule for turning a field name into the words a tool shows. * * Presentation, not the standard: the schema never carries a label. The house rule * (set 2026-10-20) is sentence case * with acronyms kept: "birth_date" → "Birth date", "image_url" → "Image URL". Seeded * from Atlas's humanizeFieldName as of 1.59.1, so Atlas, Lantern * and Council read one copy instead of three. */ /** Words shown in capitals wherever they fall in a label. */ declare const FIELD_ACRONYMS: readonly string[]; /** * A field name as a label: split on `_`, the first word capitalised, every other word * lowercase, an acronym in capitals wherever it falls ("image_url" → "Image URL", * "url" → "URL", "time_range_current" → "Time range current"). A word written all in * capitals stays as written: a custom field named `STR` reads "STR" * (Lantern's stat blocks). Every schema field name is lowercase, so this * reaches only names a person or tool chose. * * The name is taken as given: a tool that hides an extension prefix (`atlas_`, `x_`, * `shadow_`) drops it before calling this. */ declare function fieldLabel(name: string): string; /** * Current OnlyWorlds version * Synced with https://github.com/OnlyWorlds/OnlyWorlds/blob/main/VERSION */ declare const ELEMENT_LABELS: Record; /** * Get Material Design icon name for an element type * Accepts multiple formats: 'character', 'characters', 'Character', etc. * * @param type - Element type in any format (singular, plural, any case) * @returns Material icon name (e.g., 'person', 'castle', 'thunderstorm') */ declare function getElementIcon(type: string): string; /** Plural display label for an element type (e.g. phenomenon → "Phenomena"). */ declare function getElementLabel(elementType: ElementType): string; /** * A text trimmed and without regard to case, as the profiles define it once (room.md): Unicode's White_Space removed at * both ends, then simple case folding by Unicode 15.1's table. JavaScript's `trim()` is not that trim (it also strips a byte * order mark, which stays) and `toLowerCase()` is not that fold (it leaves the long s `ſ`, which folds to `s`). Two * values match when their folds are equal; order folded names with `byCodePoint`. The fold is for comparing, never for * showing or storing. A value that is not a string is refused with a TypeError. */ declare function trimAndFold(text: string): string; /** * True when the element is a room element: its type and supertype, each trimmed and compared * without regard to case, match one of ROOM_PAIRS, AND it carries the mark `x_room_of` (the id of * the world or the sitting the room belongs to), read by presence: any value but null, a string only * when something is left after trimming, an empty list or object never, the value never compared. Both, always: * a pair without the mark is lore (a novel's letters are Narratives with supertype Message), * and a mark without a pair is not a room element (a malformed mark: report it, never hide it). * The pair match is the whole word: a Narrative with supertype `Messages` is lore. The charter * (`law` / `Charter`) is never a room element: with its own mark it is a reading aid * (isCharterElement), without it lore. A missing, null or empty supertype is never a room element. * * What it is for: 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, * and a room element opened by its id, show them whole. A tool that writes the world writes * room elements like any other, the mark kept byte for byte: the rule is the reader's. * * Trimmed is Unicode White_Space at both ends (trimWhiteSpace above), so a value with a * leading byte order mark is not a match. Case is folded with Unicode simple case folding * (simpleCaseFold, the table the `.owworld` reader uses), the same fold as the Python * package's `is_room_element`. */ declare function isRoomElement(el: { type?: string; supertype?: string | null; x_room_of?: unknown; }): boolean; /** One talk on an element (room.md, serial 135): an Object named in a line's `objects`, or a Construct named in its `constructs`, by its id as written. */ interface OwTalk { type: 'object' | 'construct'; id: string; } /** * The talks on an element that `element` is in as a line (schema-dist profiles/room.md, serial 135): `{type: 'object', id}` * for each id in its `objects` and `{type: 'construct', id}` for each in its `constructs`. Only a line in the room is in a * talk: a room element (`isRoomElement`, the pair and the mark x_room_of) whose pair is `narrative` + `Message`; any other * element, a Message without the mark, a board entry or a report included, answers `[]`. * * An entry that is not a string, or is empty once trimmed of White_Space (the room profile's set), names nothing, and a * field that is not a list names nothing; every other entry is an id read as written, a space left on it and its case * included, so `ABC` and `abc` are two talks. A line's `characters` are its recipients and make no talk, nor does any other * field. Each `{type, id}` comes once, in the place it is first named, objects before constructs (the page rules no order: * compare as a set when the order does not matter). Pure. */ declare function talksOf(element: unknown): OwTalk[]; /** * True when the element is a reading aid (schema-dist profiles/room.md, profiles/lens.md rule 4): the * world's charter (`law`, supertype `Charter`), its guide (`construct`, supertype `Guide`) or one of its * domains (`construct`, supertype `Domain`), the type and supertype each trimmed and compared without * regard to case, the whole word, AND the mark `x_charter_of`, the id of the world the aid belongs to. The * mark counts when it is present and not null; a string mark counts only when something is left after * trimming, and an empty list or object never. Both, always: the pair without the mark is lore, and stays in every view (a kingdom's Charter * in a novel's world is a Law like any other). * * What it is for: a tool's front door shows the aids first; a lore view (a list, a graph, a story's * context) leaves them out by default. A reading aid is not a room element: `isRoomElement` answers false * for one, and a public reader sees it. In a lens, one reached by a hop is kept only when `types` names its * pair (`law/charter`, `construct/guide`, `construct/domain`); one the lens names as an anchor is kept and * followed like any anchor. */ declare function isCharterElement(element: object | null | undefined): boolean; /** * Which reading aid the element's pair makes it (schema-dist profiles/charter.md): `'charter'` for a `law` * with supertype `Charter`, `'guide'` for a `construct` with supertype `Guide`, `'domain'` for a `construct` * with supertype `Domain`, the type and supertype each trimmed and compared without regard to case, the whole * word, as `isCharterElement` matches them; null for any other pair, for an element without a string type * and supertype, and for anything that is not an object. * * It reads the pair only and ignores the mark `x_charter_of`: an unmarked Charter answers `'charter'`, which * is what a tool offering to mark an element needs. Whether the element IS a reading aid (the pair and the * mark) is `isCharterElement`. */ declare function readingAidOf(element: unknown): 'charter' | 'guide' | 'domain' | null; /** The world snapshot the reading aids are read from: the lens reader's world, and whether it is open to anyone. */ interface OwCharterWorld extends OwLensWorld { /** True for a world open to anyone: only then does the public rung read anything of it. */ open?: boolean | null; } /** * A world's reading aids as `reader` sees it (schema-dist profiles/charter.md): `{charter, guide, domains}`, * the packet every front door shows first, in that order. * * `charter` is the newest marked Charter the reader sees (newest by `created_at`, compared as instants, none * sorting as the oldest; then the higher id by code point), as `{id, name, rules, skill}`: `rules` its * `x_checks_rules` as stored (`[]` when it has none), `skill` the ids its description names (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 (keel's `charter_skill`). `guide` is the * newest marked Guide the same way, `{id, name}`. `domains` is every marked Domain the reader sees, each * `{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; an entry that is no marked Domain it sees is skipped), * then the rest by folded name and id; with no Guide seen, by folded name and id alone. `sentence` is the * description up to its first line break, trimmed; `hubs` the distinct `{type, id}` its link fields name that * the reader sees, in the schema's field order, never itself, and none for a Domain it knows only as a stub. * * `world` holds the elements as the owner is served them (the hidden in `hidden` or each element's own * `hidden`), and `open: true` for a world open to anyone; `reader` is a lens reader (`OwLensReader`): the * owner, a contributor, a guest (its `whole` and `known_of` ids) or the public, which reads nothing of a * world that is not open. Whether an element is an aid is read from the element as the owner is served it, * since a stub serves no extension field; what the packet shows of it is what the reader is served. Pure. */ declare function charterOf(world: OwCharterWorld, reader: OwLensReader): OwReadingAids; /** The marked Domains alone, as `charterOf` lists them for the same reader. */ declare function domainsOf(world: OwCharterWorld, reader: OwLensReader): OwReadingAidsDomain[]; /** A design part (charter.md, serial 135): an Object or a Construct whose `subtype` is a design state, and that state. */ interface OwDesignPart { /** The type as the packet writes one, whatever spelling the element's type is stored in. */ type: 'object' | 'construct'; id: string; /** The design state: the subtype trimmed and folded, whatever spelling it is stored in (`In Design ` is `in design`). */ state: 'in design' | 'locked'; } /** * The design parts `reader` reads in a world (schema-dist profiles/charter.md, serial 135): each Object or Construct the * reader is served whole whose `subtype`, trimmed and compared without regard to case as the room profile defines it, is * `in design` or `locked`, as `{type, id, state}`, in the world's order (the page orders no parts: compare as a set). * * Only where `charterOf` finds a Charter for the same reader: with none (no Charter, only one without the mark, only a * proposed one, or one the hidden mark keeps from the reader), no element has a design state and the answer is `[]`, * even where another reader of the same world reads parts. The state alone makes a part, whatever the supertype; no * other subtype and no other type has one. A known-of stub has none, though it is served its subtype; what the reader * sees (hidden and proposed elements, the rungs) is `charterOf`'s own view. Takes the same world and reader as * `charterOf`. Pure. */ declare function designPartsOf(world: OwCharterWorld, reader: OwLensReader): OwDesignPart[]; /** The Event's field that carries the record's mark. */ declare const RECORD_FIELD = "x_record"; /** A record's mark as read: the required two as written, each optional member null when unset, seats an object. */ interface OwRecordMark { /** The game, in the tools list's id form (`[a-z0-9-]`, 1 to 32). */ tool: string; /** When the run was played, as written: real time (never world time), a time the message grammar reads (`instantOf`). */ played_at: string; /** The engine's version; with `seed`, the replay. */ version: string | null; /** The run's seed, a string. */ seed: string | null; /** One lowercase word the game chose (`won`, `lost`, `sunk`), 1 to 24 letters. */ outcome: string | null; /** Character id to the seat in the game's own words; decoration, never who took part. */ seats: Record; } /** One Character's story of a record: about them (`protagonist`), told by them (`narrator`), or both. */ interface OwRecordStory { id: string; name: string; as: 'protagonist' | 'narrator' | 'both'; } /** One record of a Character, as `recordsOf` reads it. */ interface OwRecord { event: { id: string; name: string; }; tool: string; played_at: string; version: string | null; seed: string | null; outcome: string | null; /** This Character's seat, when the mark names one for them. */ seat: string | null; /** Their stories of this run, in code point order of their ids. */ stories: OwRecordStory[]; } /** * The record's mark on an element, read: the mark when the element is an Event whose `x_record` has the profile's * shape, else null. A broken writer never shows as a record: a missing or malformed `tool`, a `played_at` the * message page's grammar cannot read (`instantOf`'s, serial 123: seconds required, `T` and `Z` in either case, an * offset or no zone read), or an optional member that is anything but its kind, null or absent, is no mark. */ declare function recordMarkOf(element: unknown): OwRecordMark | null; /** * A Character's records in a world: every Event with the record mark whose `characters` names them, newest first by * `played_at` read as an instant to the millisecond (a fraction truncated past three digits; ties by the Event's id in * code point order), each with the stories that are theirs. An id no record * names, or one in no element, reads an empty list. `elements` is the world as this reader is served it. */ declare function recordsOf(characterId: string, elements: readonly unknown[]): OwRecord[]; /** The two forms of an address: the site's (`human`) and the `ow://` text forms (`text`). */ type OwAddressForm = 'human' | 'text'; /** Why an address was refused, by the profile's own names, in the order a parser checks them. `no_world` and `bad_form` are the writer's only. */ type OwAddressReason = 'not_an_address' | 'uppercase' | 'segments' | 'bad_world' | 'unknown_type' | 'bad_id' | 'bad_moment' | 'bad_lens' | 'no_world' | 'bad_form'; /** What `elementAddress` writes from: a form and a triple, or a form and a world. Absent and null are the same. */ interface OwAddress { form: OwAddressForm; /** The world's id; absent for the text form inside a world. Never a slug: a writer refuses one. */ world?: string | null; /** The type word, lowercase (`character`); absent, with `id`, for a world's own address. */ type?: string | null; /** The element's id; absent, with `type`, for a world's own address. */ id?: string | null; /** A lens: an element's id, read through that lens. */ lens?: string | null; /** A moment: one step of the world's time line, a whole number in the 32-bit range. */ moment?: number | null; } /** What `parseOwLink` reads from a string. Hex is given lowercase; `type` and `id` are null for a world's own address. */ interface OwAddressReading { form: OwAddressForm; /** The world's id or, in the site's form only, its slug; null in the text form inside a world. */ world: string | null; /** True when `world` is a slug (the site's form only): never canonical, since a writer writes the id. */ worldIsSlug: boolean; type: ElementType | null; id: string | null; lens: string | null; moment: number | null; /** True when the string as received is exactly what `elementAddress` writes for this reading. */ canonical: boolean; } /** An address was refused; nothing was read or written. `reason` names why, by the profile's name, for a tool to word its own message. */ declare class OwAddressError extends Error { readonly reason: OwAddressReason; constructor(reason: OwAddressReason, message?: string); } /** * An address as the profile writes it: lowercase throughout, the world's id (never its slug), the * moment before the lens, nothing else. `address` is a form and a triple (`{ form: 'text', world, * type, id }`; no `world` for the text form inside a world), or a form and a world alone for the * world's own address; `lens` and `moment` optional. A reading from `parseOwLink` is taken as it * stands, so `elementAddress(parseOwLink(s))` is the canonical spelling of `s` (a slug refuses). * * Refuses with `OwAddressError` (`reason`): `bad_form`, `segments` (a type without an id or an id * without a type), `no_world` (the site's form, or a world's own text form, with no world), * `bad_world` (not an id: a slug too), `uppercase` / `unknown_type`, `bad_id`, `bad_moment` (not a * whole number in the 32-bit range), `bad_lens`, in that order. An unknown key is a TypeError. */ declare function elementAddress(address: OwAddress | OwAddressReading): string; /** * One string read whole as an address (a link inside other text is the caller's to find first). The * checks run in the profile's order and the first that fails names the refusal, as an * `OwAddressError` with `reason`: trim (Unicode White_Space), the prefix (`uppercase` for one in * another case, else `not_an_address`; a value that is not a string is `not_an_address` too), drop a * fragment, split off the query at the first `?`, split the path on `/`, the last segment at its first * `@`; then `segments`, `bad_world`, `unknown_type` / `uppercase`, `bad_id`, `bad_moment`, `bad_lens`. * * Another query key and a fragment are ignored and make the reading not canonical; nothing is * percent-decoded. The site's form takes a slug for the world (reported as `worldIsSlug`, never * canonical); the text forms take the id only. Ids are read in either case of hex and given lowercase. */ declare function parseOwLink(text: string): OwAddressReading; /** What `findOwLinks` answers for each address in a text: where it starts and ends, and what it reads. */ interface OwAddressFound { /** The index of the address's first character in the text. */ start: number; /** The index just past the address, as `readOwLinkAt` answers it. */ end: number; /** What `parseOwLink` answers for `text.slice(start, end)`. */ reading: OwAddressReading; } /** What `readOwLinkAt` answers: the address read, and the index just past it in the text. */ interface OwAddressAt { /** What `parseOwLink` answers for `text.slice(index, end)`. */ reading: OwAddressReading; /** The index just past the address: the text's first character that is not part of it, or its length. */ end: number; } /** * The address that starts exactly at `index` in a text, found in prose, and where it ends; null when the text there is * not an address. Both forms, `ow://` and `https://www.onlyworlds.com/w/`, the prefix as written (lowercase). In the * site's form the run after `/w/` is read whole, once, with no order between an id and a slug: it ends at the first * character outside the slug's alphabet (lowercase letters, digits, hyphens) or the id's (hex in either case); exactly * an id's form is the id, any other run `parseOwLink` reads as a slug is the slug (not a type word, no closing hyphen, * 3 to 40 characters), else no address; a run followed by a letter (any script), a combining mark or an underscore * is cut inside a word and is no address (`/w/mopPetopia.`, `/w/hyper_ion.`). After the world, or in the text form from the prefix, the path * is the longest one `parseOwLink` reads; after it the address continues only with `@` and a moment (the parser's step * grammar, its whole run of an optional minus and digits) and then `?lens=` and a lens (an id, which ends where its 36 * characters end). Any other query key or a fragment is not part of an address found in prose: the address ends * before its `?`, `&` or `#`, and a `@` or `?lens=` whose value does not read is not taken (the address ends before * it). What follows is prose, a full stop included (serial 123). An address begins at the start of the text or after * a character that does not glue it to a word: after a letter (any script), a combining mark or an underscore the * start is inside a word and this answers null (`elbow://object/`); a hyphen or a digit before it does not glue * (`x-ow://`, `3ow://`), the same set read from both ends. * * `end` is the index just past the address and `reading` what `parseOwLink` answers for `text.slice(index, end)`, * which `parseOwLink` itself still reads whole, unchanged: `ow://object/.` handed to it whole is refused. * `index` and `end` count JavaScript string indexes (UTF-16 code units), so they match `text.slice` and `indexOf`. A text that is not a string, or an index that is not a * whole number from 0, is a TypeError; an index past the end reads nothing. * * ```ts * const line = 'Built the gate: ow://object/01a1d4ef-0000-7000-8000-000000000084.'; * const found = readOwLinkAt(line, 16); * found?.end; // 64: line[64] is the full stop * found?.reading.id; // '01a1d4ef-0000-7000-8000-000000000084' * ``` */ declare function readOwLinkAt(text: string, index?: number): OwAddressAt | null; /** * Every address in a text, in order: each `{start, end, reading}`, read by `readOwLinkAt` at every place either * prefix (`ow://`, `https://www.onlyworlds.com/w/`) starts, so a start glued to a word is prose and what follows an * address is prose as `readOwLinkAt` says. The search goes on from the end of each address found, so no two overlap, * and from just past a start that reads nothing. Linear in the text: each prefix's next place is searched once, and * a start reads a bounded stretch. `start` and `end` count JavaScript string indexes, as `readOwLinkAt`'s do. A text * that is not a string is a TypeError. * * ```ts * findOwLinks('See ow://object/01a1d4ef-0000-7000-8000-000000000084, not elbow://object/01a1d4ef-0000-7000-8000-000000000084.'); * // [{ start: 4, end: 52, reading: { type: 'object', id: '01a1d4ef-…', … } }] * ``` */ declare function findOwLinks(text: string): OwAddressFound[]; /** What a report's parent is: none served, a report, a board entry, an id whose element is not held, another element, or the report itself. */ type OwReportParentKind = 'none' | 'report' | 'board' | 'missing' | 'other' | 'self'; /** One group: the parent's id, whether it is a report (a thread) or a board entry (the talks under it), and the reports that name it, in rule 9's order. */ interface OwReportGroup { parent: string; kind: 'report' | 'board'; /** The ids of the reports that name the parent, by `created_at` (equal times keep the list's order; unreadable times last). The parent is not among them. */ reports: string[]; } /** A lint: `chain` on a report whose parent is a report that itself names another report; `self` on a report that names itself. */ interface OwReportLint { kind: 'chain' | 'self'; report: string; } /** `reportThreadsOf`'s answer. */ interface OwReportThreads { /** For each report given, by its id, what its parent is. */ parents: Record; /** One per parent that is a report or a board entry and that some report names; in no rule order. */ groups: OwReportGroup[]; /** In no rule order. */ lints: OwReportLint[]; } /** * Reports grouped into threads (the report profile's rule 9). Give it the Narratives as the reader is served them, * in the order served. A report is a Narrative with supertype `Report` that carries the room's mark `x_room_of` * (`isRoomElement`); a board entry is one with supertype `Board` and the mark. Without the mark either is lore. * * Only reports are read as children: a message or any other element that names a report is in no part of the answer. * * `parents`: for each report, what its `parent_narrative` names: `none` (absent, null, not a string, or empty once * trimmed of White_Space, as the room profile trims; a parent with content is read as written, never trimmed), * `self`, `missing` (an id whose element is not in the list: a folder or an export without it, an id that dangles), * `report`, `board`, or `other` (any other element, a Narrative with supertype `Report` or `Board` and no mark * included; a stub is read as it is served: one without the mark reads `other`). `groups`: one per parent that is * a report or a board entry, the reports that name it ordered by `created_at` as an instant (equal times keep the * list's order; one that cannot be read as a date and time after every one that can), never by id or by the text * of the time. A report with no parent, or whose parent is missing, other or itself, is a thread of one and in no * group. * `lints`: `self` on a report that names itself; `chain` on a report whose parent is a report that itself names * another report the reader holds (with the mark). A report that names itself reads as naming no parent: it still * heads the group of the reports that name it, and none of them is a chain; nor is a report whose parent names an * id not held, or a Narrative with supertype `Report` and no mark. The reader never walks further up a chain: * such a report is shown under the parent it names. It never guesses a thread from names, days or text. * * Groups and lints come in no rule order (compare them as sets); the order inside a group is the rule's. Elements * that are not objects, or carry no non-empty string `id`, are skipped; of two with one id, the first is read. * A thread takes nothing away from where a report hangs: its `relations` and `events` still hold it. Pure. */ declare function reportThreadsOf(narratives: readonly object[]): OwReportThreads; /** * The talks a reader shows a report with (schema-dist profiles/report.md, serial 135): `{type: 'object', id}` for each id in * the report's `objects` and `{type: 'construct', id}` for each in its `constructs`, its entries read as the room profile reads * a line's (`talksOf`): an entry that is not a string, or is empty once trimmed of White_Space, names nothing, a field that is * not a list names nothing, and every other entry is an id as written, untrimmed and with its case; each once, in first * place, objects before constructs. A report is a Narrative with supertype `Report` and the room's mark `x_room_of`, both; * any other Narrative (a Report without the mark, a line in the room, a board entry) answers `[]`. * * These fields hold every Object and Construct the report touched or changed, so the answer is every talk it is shown with, * old reports included; none of them is named as the talk the report closed, which the report alone cannot tell. Pure. */ declare function reportTalksOf(narrative: unknown): OwTalk[]; /** What `readReportLine` answers for one line of a report's `consequences`. */ interface OwReportLine { /** The line as read. */ line: string; /** The words a reader shows: the line without its address where nothing the writer wrote is lost, else the whole line. */ words: string; /** The element the line names, written `ow:///` (the id lowercase), or null when no address in it names an element of this world. */ address: string | null; /** What `parseOwLink` reads in the address as written, or null. */ reading: OwAddressReading | null; /** Where the address stands in the line (JavaScript string indexes, as `findOwLinks` counts them), or null. */ start: number | null; end: number | null; } /** The options `readReportLine` and `readReportLines` take. */ interface OwReportLineOptions { /** This world's id, lowercase as the world holds it. An address's world is read lowercase (its hex in either case) and compared with this exactly; without it, only an address with no world names an element here. */ world?: string | null; } /** * One line of a report's `consequences`, read as the report profile reads it: the element it names and the words a * reader shows. The line's address is the last address in it (found as the address profile finds one in prose, by * `findOwLinks`) that names an element of this world: an `ow://` or site address, its ids' hex in either case (the * prefix, the host and the type word only in lowercase), whose world is `world` or is left out, and whose type and id * have an element's shape. An address of another world, a slug, a world * alone or a lens with no element is prose, and a line with only those has no address, which is no fault. The address * leaves the shown words only when nothing the writer wrote is lost: it is canonical, carries no moment and no lens, * and stands apart (before it the line's start, White_Space or one colon; after it the line's end, White_Space or a * closing mark, `. , ; : ! ) ] } ' " ’ ” »`), alone or in a matched pair (`()`, `[]`, `""`, `''`, `“”`, `‘’`, `«»`). * Then it goes with the White_Space on both sides and one colon before it, and the two halves join with one space, * or none when the second is empty or begins with a closing mark. In every other shape, and when nothing stands * before the address, the whole line stays, still naming its element. Whether that element exists is the caller's * to read. The line is read as given: `readReportLines` splits and trims a whole text. A line that is not a string, * options that are not an object, an unknown option or a `world` that is not a string or null is a TypeError. * * ```ts * readReportLine("Renamed the Consul's Steinway: ow://object/01a1d4ef-0000-7000-8000-000000000084."); * // { words: "Renamed the Consul's Steinway.", address: 'ow://object/01a1d4ef-0000-7000-8000-000000000084', … } * ``` */ declare function readReportLine(line: string, options?: OwReportLineOptions): OwReportLine; /** * Every line of a report's `consequences`, each read by `readReportLine`. The text is split at every carriage return * and every line feed (so CRLF is one break), each piece trimmed of Unicode White_Space at both ends, and a piece * empty after trimming is no line; U+2028 and U+0085 stay inside a line, and a byte order mark is no White_Space. * A text that is not a string is a TypeError. */ declare function readReportLines(text: string, options?: OwReportLineOptions): OwReportLine[]; /** A work item's state (rule 5): one of the four words, as the fold writes them. */ type OwWorkState = 'open' | 'taken' | 'done' | 'standing'; /** One entry of a work item's `x_packet_elements` (rule 1): the element's type slug, its id as written, and why it is in the packet. */ interface OwWorkElement { type: string; id: string; reason: string; } /** A world as `workOf` reads it: its Characters' ids and the ids of every other element of it the reader holds, each as written. */ interface OwWorkWorld { id?: string | null; /** The ids of the world's Characters the reader holds. */ characters?: readonly string[] | null; /** The ids of every other element of the world the reader holds. */ others?: readonly string[] | null; } /** A lint `workOf` reports: `asker` on a work item whose `x_packet_from` is no one id, or names an element the reader holds that is no Character of the world (rule 8). */ interface OwWorkLint { kind: 'asker'; item: string; } /** `workOf`'s answer. Every map is keyed by an id as written; no list of work items is in a rule order (compare them as sets) except `elements`. */ interface OwWork { /** For each work item, its state, or null for no state (rule 5). */ states: Record; /** Every work item, in the order given: no item is hidden for its state. */ shown: string[]; /** For each element any work item names in `x_packet_elements`, the open work that names it (state `open` or `taken`). */ openWork: Record; /** For each work item, its elements in `x_packet_elements`' order (rule 1), each `{type, id, reason}`. */ elements: Record; /** For each work item, the Character of the world that asked for it, or null (rule 8). */ askers: Record; /** One `asker` lint per work item whose key is no one id or names an element the reader holds that is no Character of the world. */ lints: OwWorkLint[]; /** For each Character of the world, the open work it asked for: what it is waiting on. */ waitingOn: Record; } /** * A work item's state (schema-dist profiles/packet.md, rule 5): its `subtype`, trimmed of White_Space and compared without * regard to case as the room profile defines it, when that is `open`, `taken`, `done` or `standing`; else null, no state * (a subtype that is missing, null, not a string, empty, White_Space alone or any other word). ` Standing` is `standing`, * `OPEN` is `open`; `open` after a byte order mark is no state, since U+FEFF is no White_Space. * * A work item is a Relation with supertype `Work item`, the type and supertype trimmed and folded the same way; the room * mark is not needed. Anything else answers null: its subtype is no work state. Pure. */ declare function workStateOf(item: unknown): OwWorkState | null; /** * True when the work item is open work (packet.md, rules 5 and 7): its state is `open` or `taken`. A `done` item, a * `standing` one (never done, a kept list) and one with no state are never open work, and anything that is no work item * is none. A reader offers to take a work item, or to set it done, only when this is true. Pure. */ declare function isOpenWork(item: unknown): boolean; /** * Who asked for a work item (schema-dist profiles/packet.md, rule 8): the id its `x_packet_from` writes, as written (never * trimmed, never folded), or null. Absent or null names no one; a value that is not a string, or a string empty once * trimmed of White_Space, is no id and names no one. The asker is never the maker (`created_by`, or the tool * `x_packet_producer` names) and never `actor`. * * With `world` (`{characters, others}`, as `workOf` takes it), the id counts only when it is, written exactly so, one of * the world's Characters; any other id is null (`workOf` says which of them is a lint). Without `world`, the answer is the * key's id unchecked: whether it names a Character the reader holds is the caller's to read. Anything that is no work item * answers null. Pure. */ declare function askerOf(item: unknown, world?: OwWorkWorld): string | null; /** * The work items one reader is given, read together (schema-dist profiles/packet.md, rules 1, 5, 7 and 8; the fixture's * parts). `items` are the work items in the order given; anything that is no work item (a Relation with supertype * `Work item`, trimmed and folded) or carries no non-empty string `id` is in no part of the answer, and of two with one * id the first is read. `world` is the world they sit in, `{id, characters, others}`: its Characters' ids and the ids of * every other element of it the reader holds, each as written. `sourceWorld`, in the same shape, is the world packets * about another world name, whose elements the reader holds too; its Characters are no Characters of `world`. * * - `states`: each item's state (`workStateOf`). `shown`: every item, whatever its state. * - `elements`: each item's `x_packet_elements`, in their order, each `{type, id, reason}`; an entry without the three * (strings, the id not blank) is ignored. * - `openWork`: for each element id any item names, the ids of the open work (`isOpenWork`) that names it; a standing * item is counted on none. * - `askers`: each item's asker, the Character of `world` its `x_packet_from` names written exactly so, else null. * - `lints`: `{kind: 'asker', item}` for a key that is no one id (not a string, or empty once trimmed of White_Space), or * that names, written exactly so, an element the reader holds that is no Character of `world` (an id in `others`, in * `sourceWorld`, or one of the items given). A key absent or null, and an id that names no element the reader holds in * any spelling, are no lint. * - `waitingOn`: for each Character of `world`, the open work whose asker it is. * * Only `elements` holds lists in a rule order; `shown`, every list in `openWork` and `waitingOn`, and `lints` are in the * order the items are given, and the page rules none: compare them as sets. Pure. */ declare function workOf(items: readonly object[], world: OwWorkWorld, sourceWorld?: OwWorkWorld | null): OwWork; /** * The review profile's proposed mark (schema-dist profiles/review.md): an element whose * `x_review_proposed` is an object was written as proposed (an AI seat's new element on a world * whose keeper reviews them) and is not canon until a keeper settles it: accept writes the mark * null, decline deletes the element. * * The mark is read by presence (rule 1, serial 87), as the room and charter profiles read theirs: * absent or null is settled, a string counts only when something is left after the White_Space trim, * and for this mark an empty list or an empty object is absent too, so an empty mark is settled, * never a doubt. Two readings of a present mark, as rule 1 and rule 4 give them. A reader that shows * a world to its people shows the mark when it is an object (`proposedMarkOf`); any other value is * not a mark and is reported by a lint, never repaired. A reader that hands a world on leaves out * every element whose mark is present (`handsOnAsProposed`), so a doubt never reaches an AI as canon. */ /** The review profile's proposed mark, an extension key. */ declare const PROPOSED_MARK = "x_review_proposed"; /** A proposed element's mark as a reader shows it. */ interface OwProposedMark { /** * Who made the mark, in the writer's own word: a claim, with no format to rely on, and never proof of who wrote the * mark or the element. Read as stored, never trimmed: a `by` that is not a string, or is White_Space alone, names * nobody (null); White_Space around a word or an id makes it neither. Show it as the mark's word (for example "the * mark names Ada"), in a form that keeps the name visibly the mark's, never as a fact ("proposed by Ada"). Put a * name in its place in two cases only: your platform resolves it to a member on its roster or to the world's owner, * comparing ids as ids, with the name it serves this reader (the id where it serves none) and the owner, an AI's seat * or a player's seat said beside it; otherwise, it is the id of a Character of the same world this reader is served, * said as that Character with its type, never as the member who plays it. Every other `by` is shown only as the raw * value, apart, never where a name stands. */ by: string | null; /** The day it lapses (YYYY-MM-DD), trimmed, when the mark gives one in that shape. */ expires: string | null; /** `expires` has come (on or before `today`): shown as lapsed, never deleted on its own (rule 2). */ lapsed: boolean; } /** * The proposed mark of an element as a reader that shows a world shows it, or null for a settled * element: `x_review_proposed` absent, null, empty (`""`, White_Space only, `[]`, `{}`), or a value * that is not an object (an array included). `today` is a day as the profile writes one * (YYYY-MM-DD), by default today in UTC; anything else is a TypeError. */ declare function proposedMarkOf(element: unknown, today?: string): OwProposedMark | null; /** * Whether a reader that hands a world on (a pack, a context packet, an AI's context) leaves this * element out as proposed: `x_review_proposed` present, a value that is not a proper mark included * (a doubt, counted with the proposed). An empty mark (`""`, White_Space only, `[]`, `{}`) is * settled, as absent and null are. */ declare function handsOnAsProposed(element: unknown): boolean; /** `worldGraph`'s options. Each flag is a boolean, false by default, and brings back one kind of element that is out by default. */ interface OwGraphOptions { /** 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. */ lens?: object | string | null; /** The lens's reading date (as `resolveLens` takes it); read only with a lens. */ asOf?: number | null; /** The lens's wall-clock time for its mail rule (as `resolveLens` takes it); read only with a lens. */ clock?: string | null; /** Bring back room elements. Refused for a public reader. */ rooms?: boolean | null; /** Bring back hidden elements. A keeper's alone (the owner or a co-builder): refused from any other rung. */ hidden?: boolean | null; /** Bring back elements written as proposed. A keeper's alone (the owner or a co-builder): refused from any other rung. */ proposed?: boolean | null; /** Bring back map space: Maps, Pins and Markers (a Zone is a node by default). Refused for a public reader. */ mapSpace?: boolean | null; /** 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. */ readingAids?: boolean | null; } /** Why a node that is out by default is in. */ type OwGraphMark = 'room' | 'hidden' | 'proposed' | 'reading_aid'; /** * Why an element is not a node, or an edge was left out: the lens's closed list, then the graph's own, in * this order: `room`, `hidden`, `proposed`, `map_space`, `reading_aid`, `outside_lens`. `outside_lens` (a link * to an element the reader sees that the lens neither kept nor cut) is only ever an edge's reason, and only * with a lens; it is never in a lens's cut. */ type OwGraphCutReason = OwLensCutReason | 'room' | 'hidden' | 'proposed' | 'map_space' | 'reading_aid' | 'outside_lens'; /** One element of the graph. */ interface OwGraphNode { id: string; /** The element's type, as its slug (`character`). */ type: string; /** The element's name as stored, or null when it has none; nothing invented. */ name: string | null; /** The type's colour group, its colour word (`blue`, `green`, `pink` or `amber`), from the distribution's * presentation defaults: a key for drawing the 22 types, never a classification and never shown as a label. */ family: ElementGroup; /** The type's icon name, from the distribution's presentation defaults. */ icon: string; /** The out-by-default kinds the element belongs to, in this order: `room`, `hidden`, `proposed`, `reading_aid`; absent when none. */ marks?: OwGraphMark[]; /** True on a guest's known-of element, a stub that has no edges out; absent otherwise. */ known_of?: true; } /** One link: one source, one field, one target, at its place in the field's list as served (0 for a single link); a target the list names twice is one edge, at its first place (since serial 128). */ interface OwGraphEdge { source: string; field: string; target: string; index: number; } /** What `worldGraph` answers. */ interface OwWorldGraph { /** The nodes, by id in code point order. */ nodes: OwGraphNode[]; /** The edges, by source id, then field name (both in code point order), then index. */ edges: OwGraphEdge[]; /** The links left out because their target is not a node, counted by the target's reason, in the reasons' one order. A reason with no count is absent; a reader that is not the owner never carries `anchor_not_visible` or `not_visible`, one below a keeper (the owner or a co-builder) never carries `hidden` or `proposed`, and every reader carries `outside_lens`. */ edgesCut: Partial>; /** With a lens, the lens's own cut, unchanged. Without one, the elements out by default, counted by reason (`room`, `hidden` and `proposed` for a keeper only, `map_space`, `reading_aid`). */ cut: Partial>; /** With a lens whose `x_lens` the lens reader cannot read, the key it names (as `resolveLens`'s `unreadable`), and the graph is empty. Null otherwise, and always null without a lens. */ unreadable: string | null; } /** * The extension fields a published profile reads as links, each a list of ids in this world: the lens profile's * closed table of declared links (`x_lens_leads_to`, and the spine profile's `x_spine_depends_on`). A reader reads each as * a multi-link (`worldGraph` draws its edges), and a writer that builds one names each element once, as the folder * format says of a multi-link. The same list as schema-dist's folder lint (`LINK_EXTENSIONS`). */ declare const DECLARED_LINKS: readonly string[]; /** * Read a world as a graph for one reader (the lens profile's graph section): the elements the reader sees * as nodes, the links between them as edges, and what was left out, counted by reason. Pure: it never * writes, and nothing in the world moves. * * `world` and `reader` are what `resolveLens` takes. Without `options.lens` the nodes are every element * the reader sees less what is out by default: room elements, hidden ones, proposed ones and map space * (Map, Pin, Marker; a Zone is content and a node like any other) and the reading aids (the charter, its guide, * its domains: `isCharterElement`), each brought back by its flag and then marked (map space carries no mark). With a lens the nodes are * exactly the lens's `kept`, its cut rides along unchanged, and a flag adds nothing. A lens whose `x_lens` * cannot be read gives an empty graph with `unreadable` naming the key, as `resolveLens` does. * * Each schema link field, and each extension field a profile declares a link (`x_lens_leads_to`, * `x_spine_depends_on`), gives one edge per target that is a node, with the target's place in the list as * the reader is served it (the owner's list as stored; any other reader's leaves out what it does not see * and keeps a proposed id its rung sees); a link held on both ends is two edges. A multi-link names each * element once: a list that names one element twice gives one edge, or one count in `edgesCut`, at its first * entry, and the entries after the repeat keep their own places (in `[c1, c1, c2]` the edge to `c1` has index 0 * and the edge to `c2` index 2); ids compare as written, so `a` and `A` are two (since serial 128). A Pin's generic pair * (`element_type`, `element_id`) is its placement, never an edge; its `map` link is. A guest's known-of * element has no edges out. A link to an element of another type than its field's target draws no edge and * is not counted. A link to an element that is not a node is counted in `edgesCut` by that element's reason: the * lens's cut reason, else, with a lens, `outside_lens` for one the reader sees that the lens neither kept * nor cut (counted for every rung); one of the kinds out by default without a lens; and `not_visible` for one the * reader does not see. A link to an id that is not in the world is left out and not counted. * * `hidden` or `proposed` from a reader below a keeper (the owner or a co-builder), or any flag from a public reader, is refused * by name before anything is read; of several, the first in the order `hidden`, `proposed`, `rooms`, `mapSpace`, * `readingAids`. An owner reading `as` another reader is judged by that reader's rung. */ declare function worldGraph(world: OwLensWorld, reader: OwLensReader, options?: OwGraphOptions): OwWorldGraph; /** * Each node's degree in a graph `worldGraph` answered: the number of its edges, in or out, each edge counted * once for every node it touches (a mirror pair is two edges, so each end counts 2; a link to itself counts * once). A list that names one element twice is one edge, so each end counts 1 (since serial 128). Every node is a key, 0 included, in the graph's node order. Edges join nodes only, so the count is * the reader's: what the reading left out (hidden, room, proposed, map space, past a lens) is never counted. * This is "most linked" for a finder: rank by it, highest first. A graph that is not one is a TypeError. */ declare function degreeOf(graph: OwWorldGraph): Record; /** * Each node's out-degree in a graph `worldGraph` answered: the number of distinct nodes its own link fields * point at. A target listed in two fields counts once, a link to itself does not count, and a mirror pair * (A lists B, B lists A) counts 1 at each end, since each counts its own list. Every node is a key, 0 * included, in the graph's node order. Like `degreeOf`, the count is the reader's: what the reading left out * is never counted. This is how far an element reaches out, apart from how often it is named. A graph that * is not one is a TypeError. */ declare function outDegreeOf(graph: OwWorldGraph): Record; /** Which part a door draws first: `gaps` under the size, `graph` at it and above. */ type OwLandingMode = 'gaps' | 'graph'; /** `heads` (default 5), `hops` (default 1) and `size` (default 24), each a whole number, 1 or more; null is the default. */ interface OwLandingOptions { heads?: number | null; hops?: number | null; size?: number | null; } interface OwLandingMember { id: string; /** Steps from the head: 0 for the head itself. */ hops: number; degree: number; } interface OwLandingCluster { head: string; /** The head first, then by hops, then by degree (highest first), then by id in code point order. */ members: OwLandingMember[]; } type OwLandingGapKind = 'orphan' | 'near_orphan' | 'no_place' | 'nobody_here'; interface OwLandingGap { kind: OwLandingGapKind; id: string; } interface OwLanding { mode: OwLandingMode; /** The size the mode was read at. */ size: number; clusters: OwLandingCluster[]; /** Every node no head reaches within `hops`, by degree (highest first), then by id. */ unclustered: { id: string; degree: number; }[]; /** In the kinds' order (orphan, near_orphan, no_place, nobody_here), then by id; a node can carry several. */ gaps: OwLandingGap[]; } /** * A world's first picture at a door, from the graph `worldGraph` answered for the visitor, so it holds exactly what * that reader may see. The mode is `gaps` when the graph has fewer nodes than `size`, else `graph`; both parts are * always read. Heads: the Characters with an edge, most linked first (`degreeOf`'s count), ties by id in code point * order, at most `heads`, never a known-of node. A node within `hops` steps of a head (either way along an edge) * joins the nearest head, a tie going to the higher-ranked one. Gaps: the links report's orphans (degree 0) and * near-orphans (degree 1), a Character whose `location` names no Location node (`no_place`), a Location no * Character's `location` names (`nobody_here`); a known-of node is never a gap. The same graph and options give the * same answer, byte for byte. An unknown option, or one that is not a whole number of 1 or more, is refused by name. */ declare function landingOf(graph: OwWorldGraph, options?: OwLandingOptions | null): OwLanding; /** `perType` (default 3), a whole number, 1 or more; null is the default. */ interface OwMostLinkedOptions { perType?: number | null; } /** One of the most linked: its id, its name as the graph holds it (null when none), its degree. */ interface OwLinked { id: string; name: string | null; degree: number; } interface OwMostLinked { /** The count per type it was read at. */ per_type: number; /** By type, the types in code point order; a type with nothing to pick is left out. */ by_type: Record; } /** * The most linked elements of each type, from the graph `worldGraph` answered for the asker, so it holds exactly what that * reader may see (map space, hidden, proposed and room elements are out unless the graph brought them in). For each * type, its most linked elements by the landing profile's degree (`degreeOf`'s count), highest first, ties by id in * code point order, at most `perType` of each: a few of every type, never one ranking. It is "the most linked", * never "where to start": where a world has a Guide, the Guide is the start, and a door says so. A node of degree 0 and a * known-of node are never picked. It reads the graph it is given and folds nothing: a node's type and name are * echoed as written. The same graph and options give the same answer, byte for byte. A draft reading, held to the * package's own fixture until the landing profile takes it. An unknown option, or one that is not a whole number * of 1 or more, is refused by name. */ declare function mostLinkedOf(graph: OwWorldGraph, options?: OwMostLinkedOptions | null): OwMostLinked; /** A point `[x, y, z]`, whole numbers in the Map's pixels; z counts upward and reads 0 when the row has none. */ type OwMapSpacePoint = [number, number, number]; interface OwMapSpaceMap { id: string; /** The Map's own `width` when it is a whole number, else the largest x among its own points; null with no point. */ width: number | null; height: number | null; /** The Map's `depth` when it is a whole number, else null. */ depth: number | null; /** The largest z among the Map's own outline and Pin points (kept as written, so it can pass `depth`); null with no point. */ z_max: number | null; /** Metres per pixel: `x_metres_per_pixel` when it is a positive number, else null. */ scale: number | null; location: string | null; parent_map: string | null; /** `points` when `width` or `height` was measured from the Map's own points; absent when both were written. */ extent?: 'points'; } interface OwMapSpaceOutline { zone: string; map: string; /** The Zone's own `shape` when it is `polygon` or `line`, else `polygon`. */ shape: 'polygon' | 'line'; points: OwMapSpacePoint[]; } interface OwMapSpacePin { pin: string; map: string; /** Both keys or neither: a Pin with one of the two reads both null. */ element_type: string | null; element_id: string | null; x: number; y: number; z: number; } type OwMapSpaceOutReason = 'no_point' | 'no_markers' | 'dangling' | 'no_map'; interface OwMapSpace { /** By id in code point order. */ maps: OwMapSpaceMap[]; /** By Zone id, then Map id. */ zones: OwMapSpaceOutline[]; /** By id in code point order. */ pins: OwMapSpacePin[]; /** What the reading left aside, by reason, in the order `no_point`, `no_markers`, `dangling`, `no_map`; a reason with nothing counted is absent. */ out: Partial>; } /** * A world's map space (the map-space profile): `{maps, zones, pins, out}`, all four keys always present, from * the elements as the reader is served them (so a Zone the reader may not see is not in the input, and not brought * back). Everything is keyed by id and holds whole numbers in the Map's pixels; ids sort by code point, so the same * input gives the same bytes. * * A Zone's outline is the Markers that name the Zone and one Map, by `order` ascending; a Marker without a whole * `order` sorts after every ordered one, then by id. A Marker whose Zone or Map is not served is counted `dangling` * (checked first), one without a whole `x` and `y` `no_point`; a Zone without a placed Marker `no_markers`; a Pin whose * Map is not served `no_map`, one without a whole `x` and `y` `no_point`. A `z` past a Map's `depth` is kept as written * and reported in the Map's `z_max`. A row without a non-empty string `id` is no element and is not counted; two rows * of one type with one id read as the last one served. */ declare function mapSpace(elements: readonly unknown[]): OwMapSpace; interface OwLayoutOf { /** The `x_layout.method` string when the Map is a layout map (`"hand"` for a board), else null. A method no page names answers itself. */ layout: string | null; /** When `layout` is not null: the id in `x_layout.settings.ground.map` when it names a served Map other than this one, else null. */ ground: string | null; /** The ids of this Map's Pins a new lay-out keeps where they are, by id in code point order. */ hand: string[]; } /** * One Map's layout reading: `{layout, ground, hand}`, all three keys always present. * * `map` is the Map read, `maps` the Maps the reader is served, `pins` every Pin the caller holds, of any Map, as * served: the reader keeps the Pins whose `map` names this Map's id. A row without a non-empty string `id` is no * element, and of two rows with one id the last served is read, as `mapSpace` reads them. * * The Map is a layout map when `x_layout` is an object whose `method` is a non-empty string; anything else is no * layout, and its ground and Pins are not read. On a board (`method` `"hand"`) every Pin of the Map is in `hand`, * marked or not; on any other layout map only the Pins whose `x_hand` is exactly `true`; on a plain Map `hand` is * empty whatever its Pins carry. A Pin whose element the reader cannot see is still a Pin. The method's own settings, * and the ground's size, are not returned: the caller holds the served Map. */ declare function layoutOf(map: unknown, maps: readonly unknown[], pins: readonly unknown[]): OwLayoutOf; /** * The map-space profile's frame reading (schema-dist profiles/map-space.md, rules 13 and 14): where a point on a child * Map lies on its parent, and on each Map above it. A child Map says where it lies on the Map its `parent_map` names * with `x_parent_frame`, a box `[x0, y0, x1, y1]` in the parent's pixels. The profile's `frame_cases` are the test. * The map-space reading (`mapSpace`) and the layout reading (`layoutOf`) do not read the key. */ /** Why the walk up `parent_map` ended (rule 14). */ type OwCarryStop = 'top' | 'dangling' | 'cycle' | 'no_frame' | 'no_carry'; /** What is wrong with a Map's own `x_parent_frame` (rule 13). */ type OwCarryLint = 'no_parent' | 'not_four_numbers' | 'not_a_box'; /** A point on one Map: its id and the point in its pixels, from its bottom left. */ interface OwCarryPoint { map: string; x: number; y: number; } interface OwCarryOf { /** The Map's `x_parent_frame` as written when it is a parent frame, else null. The Map's own: it does not depend on the point. */ parent_frame: number[] | null; /** `no_parent`, `not_four_numbers` or `not_a_box` when this Map's own key is one, else null. */ lint: OwCarryLint | null; /** The point on this Map as given, then the point on each Map it is carried to, up the `parent_map` chain. */ points: OwCarryPoint[]; /** Why the last point is carried no further; null only for a row that is no Map. */ stop: OwCarryStop | null; } /** * One Map's frame reading: `{parent_frame, lint, points, stop}`, every key always present. * * `map` is the Map read, `point` is `[x, y]` on it (two finite numbers in its pixels from its bottom left, as a Pin's * `x` and `y` or a tap gives them), and `maps` the Maps the reader is served: rows of any other type are skipped, a * row whose `type` is not exactly `map` or that has no non-empty string id is no Map, and of two rows with one id the * last served is read. A `map` that is no Map answers `{parent_frame: null, lint: null, points: [], stop: null}`. * * The point is carried one level at a time up `parent_map`, by each level's own frame, as * `x0 + ((x * (x1 - x0)) / width)` and `y0 + ((y * (y1 - y0)) / height)` in that order, never through one product * of the levels' ratios. The walk ends at a Map with no `parent_map` (`top`), one whose parent is not served * (`dangling`), one whose parent the walk has already reached, itself included (`cycle`), one with no parent frame * (`no_frame`), or one whose written `width` or `height` is not a whole number above 0 (`no_carry`). A point outside * the child is carried as written; `z` is not carried. Pure. */ declare function carryOf(map: unknown, point: readonly [number, number] | readonly number[], maps: readonly unknown[]): OwCarryOf; /** How the placed element reached the reader: whole, or as a stub it only knows of (`known_of: true`). */ type OwPinKnownHow = 'whole' | 'known_of'; interface OwPinKnown { pin: string; /** The Pin's `map` as written when it is a non-empty string, else null. Not checked against any Map. */ map: string | null; element_type: string; element_id: string; how: OwPinKnownHow; } interface OwPinsKnownTo { /** By Pin id in code point order. */ known: OwPinKnown[]; /** Pins that place an element the reader was not served. A count, never ids. */ unknown: number; /** Pins left aside: `no_link`, a Pin that places nothing. A reason with nothing counted is absent. */ out: { no_link?: number; }; } /** * Which of `pins` a reader knows, for a map drawn as one Character sees it: `{known, unknown, out}`, all three * keys always present. * * `pins` is a list of elements, of which the rows of type `pin` are read (so a whole world's list can be passed). * `served` is the list of elements as that reader was served them, stubs included: a list read with the reader's * own key, or the owner's read as that Character (`viewAs`). The function reads nothing else, so it cannot show a * reader more than the world told them. It does not ask whether a Pin has a point or its Map exists: that is * `mapSpace`'s reading, and a drawing keeps the Pins both name. * * A Pin is known when a row of `served` has the Pin's `element_type` as its `type` and the Pin's `element_id` as * its `id`, both as written (`Location` is no `location`, and the same id under another type is another element). * `how` is `known_of` when that row is a stub (`known_of: true`, see `isKnownOf`), else `whole`; of two served * rows with one type and id, the last one decides. A Pin with only one of `element_type` and `element_id` places * nothing: it is counted in `out.no_link` and never known. A row without a string `type` and a non-empty string * `id` is no element and is not counted; of two Pin rows with one id, the last one is read. * * The answer carries ids and the two words only, never an element's name or body. */ declare function pinsKnownTo(pins: readonly unknown[], served: readonly unknown[]): OwPinsKnownTo; /** A place on the route, in travel order. Exactly one of `pin`, `between` or `parent` says where it sits. */ interface OwTrailPlace { id: string; type: string; name: string; /** Its point on the ground map, `[x, y]` in the ground map's pixels (the margin is added). */ pin?: [number, number]; /** Two pinned places it sits between, evenly, with any others between the same two, in travel order. */ between?: [string, string]; /** A place it sits inside: on a ring round that place, siblings by id. */ parent?: string; /** The caller's words for why it sits there: a pinned place's whole `by` line; a `between` or `parent` place's reason. */ by?: string; } /** An element that hangs from one or more places: on the spiral round their point (the mean of their points). */ interface OwTrailHanger { id: string; type: string; name: string; /** The places it hangs from, by id; each must be one of `places`. */ at: string[]; /** The caller's words for why it hangs there; the method adds its tier and its place on the spiral. */ by?: string; } /** One floor of the layout: the kinds (element type words) that stand at this height. */ interface OwTrailTier { name: string; z: number; kinds: string[]; } interface OwTrailSpiral { /** The first member's distance from the place's point, in pixels; above 0, so nothing shares a place's own point. */ r0: number; /** The n-th member stands at `r0 + c * sqrt(n)`. */ c: number; /** The turn between members, in radians, `n * angle`. */ angle: number; } /** The method's settings: what a Map's recipe carries, so the layout can be run again from the Map alone. */ interface OwTrailSettings { /** * The ground map's own frame; the layout's frame is it plus `margin` on every side. `map` is the ground Map's element * id in the same world, so a tool reading the recipe finds its picture (left out when the caller gives none). */ ground: OwTrailGround; margin: number; depth: number; tiers: OwTrailTier[]; spiral: OwTrailSpiral; /** How far a place sits from the place it is inside. */ parentRing: number; } interface OwTrailGround { map?: string; width: number; height: number; } interface OwTrailInput extends Partial> { ground: OwTrailGround; depth: number; places: OwTrailPlace[]; hangers: OwTrailHanger[]; /** Stands first on its place's spiral. */ hero?: OwTrailHanger; } interface OwTrailPin { element_type: string; element_id: string; name: string; x: number; y: number; z: number; /** Why it stands there, in plain words. */ by: string; } interface OwTrailLayout { /** The layout Map's frame. */ map: { width: number; height: number; depth: number; }; /** One per place, hanger and hero, sorted by element id (code point order). */ pins: OwTrailPin[]; /** The places' points in travel order, `[x, y, 0]`, rounded and not moved. */ route: [number, number, number][]; /** The method and the settings it ran with, for the Map's recipe. */ recipe: { method: 'trail-by-place'; settings: OwTrailSettings; }; /** Points moved one pixel at a time off a point already taken, and points pulled back inside the frame. */ nudged: number; clamped: number; } /** The default floors, each named by its own kinds: location, object and zone on the ground; character, collective, creature and species at 240; event at 480; the other eleven kinds at 720. */ declare const TRAIL_TIERS: readonly OwTrailTier[]; /** Round half to even on the number's exact value (the rounding both packages use, so they agree to the pixel). */ declare function roundHalfEven(v: number): number; /** * Lay out a trail. Places first: a pinned place at its pin plus the margin; a place `between` two pinned places * evenly along the line between them, with the others between the same two, in travel order; a place inside a * `parent` on a ring round it. Then every hanger and the hero: grouped by the rounded mean of their places' points, * each group on one sunflower spiral round that point (the hero first, then by tier, then by id; the n-th member at * `r0 + c * sqrt(n)` and `n * angle`), at its tier's height. Last, every point is rounded half to even, kept inside * the frame, and, by element id order, a point already taken moves along x from its own point (one pixel right, one * left, two right, two left, and on), so no two Pins share a point. Throws a TypeError, naming what, on an input it cannot place: an unknown key, a place with no one rule, a * reference to a place it does not hold, a kind with no tier, an id twice, a row of the frame with no free point left. */ declare function trailByPlace(input: OwTrailInput): OwTrailLayout; /** A graph to lay out: `worldGraph`'s answer, or any graph of the same shape. */ interface OwLayoutGraph { /** The elements, each with its id, its type as a slug (`character`) and, for `layoutAround`, its name. */ nodes: ReadonlyArray<{ id: string; type: string; name?: string | null; }>; /** * The links, each from `source` to `target` by id, with the link field's name and the place in it as `worldGraph` * gives them. A link to an id that is not a node is passed over. */ edges: ReadonlyArray<{ source: string; target: string; field?: string; index?: number; }>; } /** One element's point, in a frame of -1 to 1 on the picture's longer axis, centred. */ interface OwLayoutPoint { id: string; x: number; y: number; } /** What `layoutByKind` answers: one point per node, in the graph's node order, and the method that made them. */ interface OwLayoutByKind { method: 'by-kind'; /** * Always 1. A method's word is its version: a method that changes takes a new word, so read `method`, never this number. * @deprecated The layout profile's mark carries no version key. Leaves in 5.0. */ version: 1; points: OwLayoutPoint[]; } /** One element's point round the focus: the focus at 0, 0, and how many links away from it the element is. */ interface OwLayoutAroundPoint { id: string; /** 0 for the focus, 1 for its neighbours, 2 for theirs. */ depth: number; x: number; y: number; } /** What `layoutAround` answers: the focus and every element within the steps, in the graph's node order. */ interface OwLayoutAround { method: 'around'; /** * Always 1. A method's word is its version: a method that changes takes a new word, so read `method`, never this number. * @deprecated The layout profile's mark carries no version key. Leaves in 5.0. */ version: 1; points: OwLayoutAroundPoint[]; } /** `layoutAround`'s options. */ interface OwLayoutAroundOptions { /** How many links out from the focus: 1 (the default) or 2. */ steps?: 1 | 2; } /** * Lay out a whole graph by kind. Each kind present gets an anchor on a circle, in colour group order (`GROUP_ORDER`) * and then by type word; every element starts near its kind's anchor, at a seeded jitter. Then, for 320 steps (160 * past 2,000 elements): elements closer than a few rest lengths push each other apart (a cell holding more than 12 * pushes with a rotating sample of 12, scaled up), every link pulls its two ends towards a rest length, every element * is drawn back towards its kind's anchor, and no element moves further in one step than a cap that shrinks as the * steps run out. Last, the points are fitted into a frame of -1 to 1 on the longer axis, centred, proportions kept. * * The graph is first put in one order (nodes by id; links by source, field, index, then target), so the order the * nodes and links are handed in moves nothing. Answers one point per node in the order the nodes were handed in, with * the method's name (`by-kind`; the word is the method's version, and `version` stays 1), so a saved layout can say what made it. An empty graph answers no points; a graph of one element answers 0, 0. * The same graph gives the same points to the last bit in every browser and language: the anchors are a baked * table of numbers, never computed, and the rest is arithmetic every runtime rounds alike. Self-links pull nothing; * a link to an id that is not a node is passed over. Throws a TypeError, naming what, on a graph it cannot read: * no nodes or edges list, a node with no id, a type that is not one of the 22, an id twice. */ declare function layoutByKind(graph: OwLayoutGraph): OwLayoutByKind; /** * Lay out one element and what is linked to it. The focus stands at 0, 0. Its neighbours (one link away, either * direction) stand on a ring round it, in colour group order, then by type word, then by name (code point order, the * same in every language and locale), up to 60 on the first ring and further rings beyond it. With `steps: 2`, each * neighbour's own neighbours stand on an outer ring, fanned out near the neighbour that reached them. * * The graph is first put in one order, as `layoutByKind` puts it, so the order the nodes and links are handed in * moves nothing. Answers the focus and every element within the steps, in the order the nodes were handed in, each * with its depth (0, 1 or 2), and the method's name (`around`; the word is the method's version, and `version` stays 1). Nothing iterates, so each point is one cosine and one sine of an * angle the method computes exactly; runtimes agree to within about 1e-12. Throws a TypeError on an unknown option * (before anything else), a `steps` that is not 1 or 2, a graph it cannot read (as `layoutByKind`), or a focus that * is not one of the graph's nodes. */ declare function layoutAround(graph: OwLayoutGraph, focus: string, options?: OwLayoutAroundOptions): OwLayoutAround; /** * What a saved `by-kind` layout map does not place (the default layouts' page, `unplaced`): the ids of the graph's * nodes that are not in `placed`, by id in code point order. `placed` is the ids of the elements the Map's Pins * stand for, a list or a Set: from `mapSpace`, the `element_id` of each pin whose `map` is this Map. A member that * is not a non-empty string (a Pin that stands for no element) is passed over, and an id that is no node of the * graph is no part of the answer. The answer's length is the count a tool shows; it does not say why an element has * no Pin, and reading or drawing a layout map never changes it (the map-space profile's rule 8). Throws a * TypeError on a graph it cannot read (as `layoutByKind`) or a `placed` that is not a list or a Set. */ declare function unplacedByKind(graph: OwLayoutGraph, placed: Iterable): string[]; /** * What a saved `around` layout map does not place: the ids of the focus and every node within the steps that are * not in `placed`, by id in code point order. `placed` is read as `unplacedByKind` reads it; an id in it that * `around` would not place (no node, or a node further out than the steps) is no part of the answer. Throws as * `layoutAround` does, and on a `placed` that is not a list or a Set. */ declare function unplacedAround(graph: OwLayoutGraph, focus: string, placed: Iterable, options?: OwLayoutAroundOptions): string[]; /** * A 3D layout method for a world nobody laid out, read from its graph and its Maps and Pins: `by-links-3d`. * * The parts live in src/layout3d/, one file a step (pieces.ts joins the runs), and the directions table is baked into * the package (layout-directions.generated.ts). The method is exact where it can be: everything but the cosine and * sine that place what hangs off the body, and the arcsine, cosine and sine that set the pieces on their ring, is * addition, subtraction, multiplication, division, square root and floor, which every runtime rounds alike. */ /** The rest length of the by-links-3d layout: a link's length at rest, and the unit of its answer's points. */ declare const BY_LINKS_3D_REST = 60; /** * The version of `layoutByLinks3d`'s answers: raised whenever the answer to any case of the method's fixture * changes (a constant, a rule, a fix that moves a point), and never for a release that moves none. A tool that keeps * a picture to hand back as `held` stores it beside the points and reads another value as no picture kept, so a * change to the method lays the world out fresh instead of holding points the method no longer gives. */ declare const BY_LINKS_3D_VERSION = 2; /** `layoutByLinks3d`'s options. */ interface OwLayoutByLinks3dOptions { /** * Points an earlier call answered, to keep a picture still as the world changes: element id to `[x, y, z]` (an * Array or a typed array of exactly three finite numbers; a slice of an earlier answer's `points` will do), as a * Map or a plain object. A held element that is still a node and is not pinned stands at its held point, and the * rest is laid out round the held ones: a group with held members starts from them, and when held elements on the * world's first map agree on where that map stood, the map is put back there. A piece with a held element is laid * out round it and not moved. A pinned element stands at its Pin whatever is held for it. An id that is no node is * passed over, and so is an element with no link that is not pinned: it is not placed. Absent, null or empty: the * method as it is. */ held?: ReadonlyMap> | Readonly>> | null; /** * The step the held points were rounded to, in the answer's units (a saver that keeps whole numbers: 1), so the * map's place is still found from rounded points. A finite number from 0 to an eighth of `BY_LINKS_3D_REST`; * absent or null: 0. */ heldUnit?: number | null; } /** * How `layoutByLinks3d` placed an element: `centre` (a group's centre), `with` (in a centre's group), `arm` (hanging * off the body, more than one link out or with links of its own), `link` (an element whose only link is to the body), * `map` (at its Pin on the world's map). An element of a piece other than the main one takes the word its own piece's * layout gives it. */ type OwLayout3dHow = 'centre' | 'with' | 'arm' | 'link' | 'map'; /** The part an element with no centre stands in: `map` (pinned) or `one-link` (`arm` or `link`). */ type OwLayout3dPart = 'map' | 'one-link'; /** * What `layoutByLinks3d` answers: one row per placed node, in the order the nodes were handed in, and the ids of the * nodes it does not place. */ interface OwLayoutByLinks3d { /** The method's word, `by-links-3d`, as the layout profile's page names it. */ method: 'by-links-3d'; /** The placed nodes' ids, in the order handed in (a node in `unplaced` is left out). */ ids: string[]; /** x, y, z of `ids[i]` at `3 * i`, in units where a link at rest is `BY_LINKS_3D_REST` long. */ points: Float64Array; /** How each element was placed. */ how: OwLayout3dHow[]; /** The id of the centre the element stands with (a centre's own id, a pinned centre's too), or null. */ group: Array; /** Null where `group` is an id; else the part the element stands in. */ part: Array; /** * The centres' ids: the main shape's in rank order, then each other piece's in its own rank order, the pieces by * size (most nodes first; among equals, the one holding the lowest id first). */ centres: string[]; /** * True where the point answered is the element's held point; false everywhere when nothing is held. A pinned element * stands at its Pin and is never held, so false does not mean new: what is new is every id that was not handed in. */ held: boolean[]; /** * The ids of the nodes not placed, by id in code point order: every node linked to no other node and pinned on no * map, a held one too. `unplacedByLinks3d` gives the same list for the Map this answer makes. */ unplaced: string[]; } /** * Lay out a whole graph in three dimensions by its links. * * The body of the graph (its largest piece that no single element's removal parts) is cut into groups round its * centres, the elements with most links (twelve at most, more when a group that holds over half the body is split); the groups are packed apart in directions read from a table baked * into the package, and for 300 seeded force steps links pull, near elements push apart and every element is held * to its group's point. What hangs off the body by one element is fanned out from it. When the world has a Map that holds three or more elements of the * graph by a Pin, the Map that holds the most (a tie to the greater id) is a flat plate, each of its pinned elements * at its Pin, the groups whose centre is pinned standing over it; a Map over a place on that plate is a small plate * a little above it. A Map whose width or height is not over 0 is no plate, and when it is the Map that holds the * most, the world is laid out by its links alone. A Pin's z is not read: the plate is flat. A layout map (a Map whose `x_layout` names a method, * the map-space profile's mark) is never the plate: a saved layout never stands in for the world's own space. * * Every other piece of linked elements (elements joined by a path of links) is laid out the same way on its own. A * piece with a pinned or held element stands where those points put it; every other one stands on a ring round the * main shape, in the plane of its middle, the largest pieces first, a ring holding as many as fit before the next * opens further out. An element linked to no other and pinned on no map is not placed: it is left out of the rows and * listed, by id, in `unplaced`. * * `graph` is `worldGraph`'s answer, or any graph of the same shape; `elements` the world's elements as served (only * Map and Pin elements are read, by `mapSpace` and `layoutOf`), or null or absent for none. The graph is first put in * one order (nodes by id in code point order; links by source, field, index, then target), so the order the nodes and * links are handed in moves no point. The same input gives the same points in every runtime: to the last bit for * every element placed `centre`, `with` or `map` off the ring, and within a billionth of a rest for the rest, which * are placed with the runtime's own cosine and sine (and, on the ring, its arcsine). * * `options.held` hands back points an earlier answer gave, so the picture keeps still as the world changes; with * `options.heldUnit` when they were rounded. A held element that is still a node and is not pinned stands at its held * point, and the answer's `held` says which. Refused before any step of the layout runs, each an error with a `code`: `held` that * is not a Map or a plain object, TypeError `held-not-object`; a held value that is not three finite numbers, * TypeError `held-not-point`; a `heldUnit` that is not null and not a finite number from 0 to an eighth of a rest, * RangeError `held-unit`; then, as each piece is laid out (the main one first, then the others by size), the held * points that piece holds (a pinned element's Pin among them in a piece other than the main one) spread wider than * 768 rests on any axis, RangeError `held-box`. An unknown option key is refused first, by name, with a TypeError. * Two nodes with one id throw. * * The method's word, `by-links-3d`, is the layout profile's: a change that moves any point is a new method with a * new word, and `BY_LINKS_3D_VERSION` is raised when a release moves an answer. */ declare function layoutByLinks3d(graph: OwLayoutGraph, elements?: readonly unknown[] | null, options?: OwLayoutByLinks3dOptions): OwLayoutByLinks3d; /** * What a saved `by-links-3d` layout map does not place: the ids of the graph's nodes that are not in `placed`, by id * in code point order. Every node counts, of any type, also one the method would not place (linked to no other and * pinned on no map), so for the Map an answer makes this is that answer's own `unplaced`. `placed` is the ids of the elements the Map's Pins stand for, a list or a Set: from `mapSpace`, * the `element_id` of each pin whose `map` is this Map. A member that is not a non-empty string (a Pin that stands * for no element) is passed over, and an id that is no node of the graph is no part of the answer. The answer's * length is the count a tool shows; reading or drawing a layout map never changes it. Throws a TypeError on a graph * that is not `{ nodes, edges }` or a `placed` that is not a list or a Set, and, as `layoutByLinks3d` does, when two * nodes share an id. */ declare function unplacedByLinks3d(graph: OwLayoutGraph, placed: Iterable): string[]; /** One word pair of a names map: `one` for a single thing, `many` for a plural (absent: `one`). */ interface OwWordPair { one: string; many?: string; } /** The World's `x_names` value, as the profile writes it. A reader takes any value and judges it. */ interface OwNamesMap { version: 1; /** A type slug (`character`) to its word pair. */ types?: Record; /** A type slug to a supertype to its word pair, for a finer word inside one type. */ supertypes?: Record>; [k: string]: unknown; } /** * The world's own word for a type, or null for the standard's name (print your usual label). * `world` is a `GET /world` body or a folder's `world.json` (its `x_names` is read); `type` a * type slug; `supertype` the element's, when there is one; `many` true for a plural (a list's * heading, a count). The order: the supertype's entry, matched trimmed and without regard to case, * then the type's entry, then null. A map that is not a names map (not an object, `version` not 1, * `types` or `supertypes` not objects, a `supertypes` value not an object) is null everywhere; a bad * entry or an unknown slug is ignored. The word is printed as written, never re-cased. */ declare function typeWord(world: object | null | undefined, type: string, opts?: { supertype?: string | null; many?: boolean; }): string | null; /** * Element names found in prose: `nameFinder` reads a world's names once and answers a function that finds them in * any text. It finds and never writes: what a tool does with a found name (a hover, a suggestion, a link a person * chooses to make) is the tool's. * * A rule of this package and the Python package's `name_finder`, not of the standard: both run one file of cases * (`test/fixtures/name-finder.cases.json`, the same bytes in both repositories). */ /** How a name is compared with the text: `'exact'` as written, `'folded'` by simple case folding (Unicode 15.1). */ type OwNameCase = 'exact' | 'folded'; /** What `nameFinder` reads beside the elements. */ interface OwNameFinderOptions { /** Required: `'exact'` or `'folded'`. There is no default, so a tool never gets the other rule by leaving it out. */ case: OwNameCase; /** The names one element is found by; by default its `name` alone. A value that is not a string is passed over. */ names?: (element: T) => Iterable; } /** One name found in a text. */ interface OwNameFound { /** The index of the name's first character in the text (a JavaScript string index, as `findOwLinks` counts). */ start: number; /** The index just past the name's last character. */ end: number; /** The element the name belongs to: the same object `nameFinder` was given. */ element: T; } /** A name two or more elements hold: `find` answers nothing for it, and this says that it is there. */ interface OwNameShared { /** The name as the finder compares it: trimmed of white space, and folded when `case` is `'folded'`. */ name: string; /** The elements that hold it, two at least, in the order they were given: the same objects `nameFinder` was given. */ elements: readonly T[]; } /** What `nameFinder` answers: a function over a text, with the names it holds as shared beside it. */ interface OwNameFinder { (text: string): OwNameFound[]; /** * Every name two or more elements hold, in the order each name was first met. `find` never answers one of * these, so a tool reads this list to say why a name stays plain. The list and its entries are frozen. */ readonly shared: readonly OwNameShared[]; } /** * A finder of a world's element names in prose: read the names once, then call the answer on each text. * * `elements` is any list of objects with a string `id` and a `name`; `options.case` must be `'exact'` (a name as * written) or `'folded'` (simple case folding, Unicode 15.1, the fold the `.owworld` reader uses), with no default. * `options.names` gives the names an element is found by, by default its `name` alone. * * The answer, `find(text)`, lists every `{ start, end, element }` in order, none overlapping: * * - A whole name only: the character on each side of it is not a letter, a combining mark, a decimal digit or an * underscore, in any script. So "Kira's" and "Kira-led" hold the name "Kira", and "Kiran" does not. * - A name is trimmed of white space and is three characters at least; a shorter one is never looked for. * - Where several names start at one place, the longest whole one is taken ("Iron Gate" over "Iron"). * - A name two elements share is never answered, and nothing inside it is: the text stays plain there. One element * listed twice, or found by two of its own names, is one element. * - Nothing is read inside an address (what `findOwLinks` finds) or a Markdown link `[label](target)`, and no name * is read across the edge of one. * - Text is compared as written: no Unicode normalisation, and a space in a name matches that one space. * * `find.shared` lists every name two or more elements hold, each as `{ name, elements }`: the name as it is * compared (trimmed, and folded when `case` is `'folded'`) and the elements that hold it, in the order given. A * name too short to be looked for is not on it. * * `element` in an answer is the object that was passed in. Nothing given is changed. The work for one text grows * with its length alone, whatever the names and however many: the text is read once, from its end to its start, * and no character is read again for another name. Reading the names grows with their total length. * `start` and `end` count JavaScript string indexes, as `findOwLinks` does. An unknown option, a `case` that is * neither word, an element without a string `id`, or a `text` that is not a string is a TypeError. * * ```ts * const find = nameFinder([{ id: 'a1', name: 'Iron Gate' }, { id: 'b2', name: 'Kira' }], { case: 'exact' }); * find("Kira's watch ends at the Iron Gate."); * // [{ start: 0, end: 4, element: { id: 'b2', … } }, { start: 25, end: 34, element: { id: 'a1', … } }] * find.shared; // [] here: no two elements hold one name * ``` */ declare function nameFinder(elements: Iterable, options: OwNameFinderOptions): OwNameFinder; /** One reason a lore view leaves an element out, as the graph section names it. */ type OwElementMark = 'room' | 'hidden' | 'proposed' | 'map_space' | 'reading_aid'; /** What `openersFor` takes beside the surface. */ interface OwOpenersOptions { /** The element the menu is for, as the surface was served it (the API's body, the mark flat on it): a row whose door skips what it carries is not there. Absent or null: every row, as before 4.126.0. */ element?: Record | null; } /** What a person must have before a tool's link works: signed in to the tool (`account`), or the world already in the tool on this device (`device`). */ type OwToolNeeds = 'account' | 'device'; /** A tool's `open` in the tools list: its link templates and what they need first. */ interface OwToolOpen { /** The link that opens a world, holding `{world}` (the world's id); null without one. */ world: string | null; /** The link that opens one element, holding `{id}` and, if it needs them, `{world}` and `{type}` (the type word); null without one. */ element: string | null; /** What the person needs first; null for nothing. A public page offers those rows, and an `account` row only as one that opens nothing ("Needs an account"). */ needs: OwToolNeeds | null; /** What the element door does not open, in the graph section's words; [] or absent: it opens every element (a list older than the key has none). */ element_skips?: readonly OwElementMark[]; /** The element types the element door opens, as type words (`character`); null or absent: every type (a list older than the key has none). */ element_types?: readonly string[] | null; /** True when the links open a public world for someone not signed in, though `needs` is `account` for a private one: a public page offers the row live. Only beside `needs: 'account'`; absent or false: as `needs` says. */ opens_public?: boolean; } /** The keys of one tools list row that `openersFor` reads; a row straight from `tools.json` carries more, and they are ignored. */ interface OwTool { /** The list's id for the tool, the row's `id` in the menu. */ id: string; name: string; url: string; /** The tool's client name (`X-OW-Client`), which a surface names itself by; null without one. */ client: string | null; /** `listed` rows are offered; `built` and `delisted` rows never are. */ rung: 'built' | 'listed' | 'delisted'; /** How a link opens a world or an element in the tool; null: never offered. */ open: OwToolOpen | null; } /** What the menu opens: a world, or one element of it. */ type OwOpenerKind = 'world' | 'element'; /** What the surface drawing the menu knows of itself and its reader. The function guesses none of it. */ interface OwOpenerSurface { /** The client name of the surface's own tool, when it is a listed tool; its row says "You are here". `onlyworlds` is the site itself: the site's own row says it. */ tool?: string | null; /** `member` (a seat in the world, a guest included) or `public` (the signed-out reader). Required. */ audience: 'member' | 'public'; /** Whether the reader is signed in; null or absent when the surface cannot know, and then no row says so. */ signedIn?: boolean | null; /** False in a desktop app, which cannot see the browser's sign-in. Default true. */ browser?: boolean; /** True on a phone. Default false. */ phone?: boolean; /** False when the device has no connection; then every row whose link is a web address says "Needs a connection". Default true. */ online?: boolean; } /** The word a row says when it cannot open now, or says where it lands. Sentence case, exactly. */ type OwOpenerState = 'You are here' | 'Needs a connection' | 'Needs an account' | `Sign in to ${string} first` | 'Opens in your browser' | 'Needs the world on this phone' | 'Opens the world'; /** One row of the menu. */ interface OwOpener { /** `onlyworlds` for the site's own row, else the tool's id in the list. */ id: string; /** `onlyworlds.com`, or the tool's name. */ name: string; href: string; /** Null when the row opens now and says nothing. */ state: OwOpenerState | null; } /** * The rows of the Open with menu for a world (`kind: 'world'`) or one element of it (`'element'`), in * order: first the site's own row (id `onlyworlds`, name `onlyworlds.com`, the world's or the element's * page on www.onlyworlds.com, for every audience, its one word "You are here" when `surface.tool` is * `onlyworlds` (the site itself), else "Needs a connection" when offline), then * one row per `tools` row, in the list's order, that is `listed` and has a door for this kind. `tools` * is the tools list's rows, `TOOLS` or the list as served; `address` is a reading from `parseOwLink` or * what `elementAddress` takes, with the world's id. A lens and a moment on it ride on no href. * * A row with `open: null`, or with no door for this kind, is not there. On an element, a tool with only * a world door is a row to its world door that says "Opens the world". On an element given as * `options.element`, a row whose `open.element_skips` names a mark the element carries (room, hidden, * proposed, map space, a reading aid, each read as `worldGraph` reads it) is not there: its door cannot * open it. A world door alone opens the world, so it stays. On an element's menu, a row whose * `open.element_types` is a list that does not hold the address's type word is not there either, world * door or not: the tool opens other kinds of element (read from the address, so no element body is needed; * a world's menu reads no element types). For the `public` audience (the signed-out * reader) a row whose `open.needs` is `device` is not there, since a visitor's device holds no world of * this one's, and a row whose `needs` is `account` is there and says it needs one, unless its * `open.opens_public` is true: its links open a public world with nothing signed in, so on a public page * it needs nothing and reads as a live row. Anywhere else the row reads as its `needs` says. * * Each row's `state`, the first that holds: "You are here" for the surface's own tool (its `client` is * `surface.tool`); then, when `surface.online` is false, "Needs a connection" for a row whose href is a * web address (scheme `http:` or `https:`; a row whose link opens an app on the device is unaffected, * and the href stays in the row either way); then, for the `public` audience, "Needs an account" for a * row whose `needs` is `account`, whatever `signedIn` says (the href stays in the row; a surface draws * it as a row that opens nothing); then what `needs` asks of this surface: `account` outside * a browser "Opens in your browser", in a browser signed out "Sign in to first" (none when * `signedIn` is null: a word shows only when the surface knows it is true), `device` on a phone "Needs * the world on this phone"; then * "Opens the world" (a world door on an element: a sign-in the row needs is the more urgent word); else null. * * Refuses with `OwAddressError` whatever `elementAddress` refuses of the whole address, in its own form * (the site's when it has none): a form, type, id, pairing, moment or lens (`bad_moment`, `bad_lens`), * and a slug or anything else for the world's id (`bad_world`); and an address without a world * (`no_world`), the text form inside a world included, since every row needs one. A TypeError names the * rest: a `kind` that is neither, an element's openers asked of an address with no element, an unknown * key on the address, the surface or the options, a missing or unknown `audience`, a surface value of the * wrong type, an element given for a world's menu or naming another element than the address, a tools row * that is not one (a `needs`, an `element_skips` or an `element_types` word outside the list's format, an * empty `element_types`, `element_types` on a row with no element door, or an `opens_public` that is * not true or false, or true beside a `needs` other than `account`, included). An element whose own id is held * in upper case, the address's lowercase id otherwise its own, is no refusal: no address can name it, so the * answer is no rows (serial 123's release), and a surface draws its mark with an empty menu. */ declare function openersFor(tools: readonly OwTool[], kind: OwOpenerKind, address: OwAddress | OwAddressReading, surface: OwOpenerSurface, options?: OwOpenersOptions): OwOpener[]; /** The OnlyWorlds tools list's rows (format 1), in the list's order, as of this release: the keys openersFor reads. */ declare const TOOLS: readonly OwTool[]; /** One tool that wrote an element, as `doorsOf` reads it. */ interface OwDoor { /** The key: the tool's client name (`X-OW-Client`), or the door word of a write that named no client (`site`, `api`, `mcp`, `seat`, `declared`, `v1`, `sync`, `server`). */ door: string; /** The time of this door's last write, exactly as served (ISO 8601 with an offset). */ at: string; /** The tools list's row whose `client` is `door`, as its `id` and `name`; null for a door word or a client the list does not hold. */ tool: { id: string; name: string; } | null; /** True on the one entry whose `at` is the element's `updated_at`: the door of its last write. */ last: boolean; /** `doors` when the entry comes from the `doors` field; `last-write` when it is read from `changed_client` or `changed_via` and `updated_at`, for an element without `doors`. */ from: 'doors' | 'last-write'; } /** * Which tools wrote `element`, newest first: one entry per key of its `doors` field, each `{ door, at, * tool, last, from }`. Returns data only, no words or formatted dates; a UI's "Last shaped in Atlas" line * reads the first entry, a trail reads them all. * * - From `doors`: every key that is a non-empty string, with a value that is a time, is an entry * (`from: 'doors'`, `at` the value as served). An entry that is not one is skipped, never thrown on. * - Order: newest first, times compared as instants at their full precision (an offset and the * microseconds count; never as strings). Entries at the same instant go by key, by Unicode code point. * - Without `doors`, or with no valid entry in it: one entry from the last write, its door * `changed_client` if that is a non-empty string, else `changed_via`; `at` is `updated_at`, `from` is * `last-write`. With neither door, or no valid `updated_at`, the result is empty: a public reader, * served none of these fields, gets `[]`. * - `tool`: the first row of `tools` whose `client` is the door, as `{ id, name }`; else null. * - `last`: true on the first entry whose `at` is the same instant as `updated_at`, false on the rest. * When no entry is `last`, the last write came through no door the field records: the server moves * `updated_at` on a restore or a scrub, which no door writes. Without a valid `updated_at`, no entry is * `last`. * * A time is `YYYY-MM-DDTHH:MM:SS`, an optional `.` and fraction digits, then `Z` or `+HH:MM`/`-HH:MM`, * with a real calendar date and clock; anything else is not one. Who wrote it is the caller's: compare * `changed_by` with the reader's membership for "by you" on the `last` entry. * * A TypeError when `element` is not an object (null, an array, a string) or `tools` is not an array; * nothing else throws. `tools` defaults to `TOOLS`, the tools list baked into this release. */ declare function doorsOf(element: object, tools?: readonly OwTool[]): OwDoor[]; /** * Where an entry of `doorsOf` wrote the element, as the words a UI shows after "Last shaped": the * where-phrase only. * * - A listed tool (`tool` not null): `in `, such as `in Atlas`. This comes first, so a door * word the case's tools list holds as a client reads as that tool. * - `site`: `on onlyworlds.com`. * - An agent's door (`isAgentDoor`: `seat`, `mcp`, `declared`): `with an AI`. * - `server`: `by OnlyWorlds`. * - Anything else (`sync`, `api`, `v1`, a client the tools list does not hold, such as `sdk`): `in code`. * * Nothing about the reader or the time: "by you" and when are the caller's. A TypeError when `door` is * not an object, its `door` is not a string, or its `tool` is neither null nor an object with a string * `name`. The Python package's `door_where` gives the same words on the shared fixture. */ declare function doorWhere(door: OwDoor): string; /** `dragField`'s answer: the link a drop between two types writes. */ interface OwDragField { /** The type that carries the field: one of the two. */ on: ElementType; /** The link field on `on` that the drop writes, naming the other element. */ field: string; /** True when the drop puts one element inside the other (one square under the other); false when it only draws a line. */ holds: boolean; } /** * The link a drag between an element of type `a` and one of type `b` writes, in either order, as the * distribution's `pairs.json` gives it: `{ on, field, holds }`, a fresh object each call. Null when * the pair offers no drag: the same type twice, a pair the table leaves out (same-kind pairs and * fields that name a role are absent by ruling), or anything that is not one of the 22 type slugs as * written (`'Character'` is not `'character'`). A tool that offers drags offers these and nothing * else, and a pair answered null draws no line. * * ```ts * dragField('location', 'character'); // { on: 'character', field: 'location', holds: true } * dragField('character', 'character'); // null * ``` */ declare function dragField(a: string, b: string): OwDragField | null; /** viewOf's answer for one element. */ interface OwView { /** The row that shows it, the table's own (frozen) row; null when no row matches and the element draws as its type. */ row: OwViewRow | null; /** The one sentence for a card, a list row or a hover; null when there is no row or no named field holds anything. */ sentence: string | null; /** The marks to show at the head of its page, in order: the table's banners the element carries, then the row's own. */ banners: string[]; /** * The fields its page draws, in the order drawn (the file's document layout): the row's `lead`, then the * rest of the type's section fields in the standard's section order, then each `fold`; each field once, * and only a field that holds something (not absent, null, a string with nothing after trimming, or an * empty list), so an empty lead field is skipped and an empty fold draws no fold. The base fields (name, * description, supertype, subtype, image_url) are the page's head and appear here only where the row * names one in `lead` or `fold`. With no row, the type's section fields. A conversation draws each line's * own fields this way. */ order: string[]; } /** views.json as baked at this release, without its `_meta`, frozen throughout. Read one element's view with viewOf. */ declare const VIEWS: OwViewsTable; /** * How an element is shown, by the views table baked at this release (`views.json`): the row that matches * it, its one sentence, the marks to show at the head of its page, and the fields its page draws in order. * * A row matches by its kind: a profile's pair only with that profile's mark, by the profile's own reader; * a type with a supertype; a type alone; types and supertypes trimmed and folded as the room profile * defines. The most specific row wins, and where two match on one rung the first in the table does: a * page is never refused over the table. The sentence is the first field the row names in `sentence` that * holds text after trimming, cut at its first line break and trimmed. Pass the element as the reader is * served it: the banners read what was served (a known-of stub, the hidden mark, a trimmed list). * * ```ts * viewOf({ type: 'narrative', supertype: 'Message', story: 'See you at the gate.\nBring the map.' }); * // { row: , sentence: 'See you at the gate.', banners: [], order: ['story'] } * viewOf({ type: 'character', name: 'Ilse' }); // { row: null, sentence: null, banners: [], order: [] } * ``` */ declare function viewOf(element: unknown): OwView; /** * The world file, `.owworld` (Folder Format spec §4.7; a `.zip` by another * name): one archive holding one whole world as a portable copy (§4.1), and * the reader that opens one back. Absorbed from Atlas's * `src/store/world-file.ts` (Atlas 1.17), so Atlas, Lantern and any * script read one file the same way; brought to §4.7's checks OW-1 to OW-22 * and their fixture set. * * THE READER takes bytes and returns bytes: no DOM, `File` or file system, so * it runs in a browser and in Node alike. It reads the central directory * itself (zip64 included) and runs every check on names, kinds, methods and * sizes before it inflates anything. Each refusal names one cause * (`OwWorldFileReason`), checked in the reference checker's order: * - `not_openable`: not a zip, a spanned one, a broken entry or CRC. * - `unsafe_path` (OW-16, OW-19): a name that is not a plain relative path * (`\`, an empty, `.` or `..` segment, absolute, a drive), or a path that is * both a file and a folder. * - `link` (OW-20): a Unix mode that is not a regular file or a directory. * - `method` (OW-21): encrypted, or a method other than stored or deflate. * - `name` (OW-22): a Windows device name, a trailing dot or space, one of * `<>:"|?*` or a control character, a non-ASCII name without the UTF-8 flag. * - `duplicate` (OW-17), `collision` (OW-18: NFC, then simple case folding, * both Unicode 15.1's from its own files, never the runtime's). * - `too_many`, `too_big` (OW-14, OW-15): past the budget by count or declared * size, or an entry that inflates past the size it declares. * - `name_case` (folder spec 4.8): `world.json`, `elements/` or `spatial/` held * only in another case, and not the name itself (one alone; two side by side are * `collision`). The cause is said, never read as a world with none. * - `marker` (OW-6): a root `mimetype` entry with other bytes than the media * type. A marker is never required. * - `not_a_world`, `more_than_one` (OW-2, OW-3, OW-5): no world, two worlds, a * second `world.json` inside the world (one under `records/` is a * producer's data; one under a dot-folder is a tool's, since a dot-folder is * never a world), a `world.json` that will not parse or has no string id. * Files beside the world's folder and archive junk (`__MACOSX`, `.DS_Store`, * `Thumbs.db`) are ignored (OW-4), still checked and counted. * * THE WRITER emits a portable copy (OW-7, OW-12, OW-13): the `mimetype` marker * first and stored, then only the folder's parts, every entry stamped * 1980-01-01 00:00, in the UTF-8 byte order of its name, JSON deflated and * everything else stored. `records/` travels whole and byte-exact, except the * producers `records/RECORDS.json` marks private, left out whole unless the * caller asks (OW-8, §4.5 rule 11). Element files marked hidden travel too, * unless the caller says the file is a share (`includeHidden: false`, §4.8). * Element files leave out the five author fields, which record which member * and which tool wrote each element, unless the caller asks * (`includeAuthorFields`). * * A tool's own `./` folder is the tool's (spec §4): the reader returns * it like any file (a caller leaves files out with `skip`), and the writer * carries one it is handed, which makes the file a private copy (OW-7, OW-9). */ /** The `mimetype` marker's exact bytes (spec §4.7, OW-6): ASCII, no newline. */ declare const WORLD_FILE_MEDIA_TYPE = "application/vnd.onlyworlds.world+zip"; /** The budget, uncompressed: the floor every reader accepts (spec §4.7, OW-15). */ declare const WORLD_FILE_MAX_BYTES: number; declare const WORLD_FILE_MAX_ENTRIES = 500000; type OwWorldFileReason = 'unsafe_path' | 'too_big' | 'too_many' | 'not_a_world' | 'more_than_one' | 'not_openable' | 'duplicate' | 'collision' | 'link' | 'method' | 'name' | 'marker' | 'name_case'; /** A world file was refused; nothing was returned. `reason` says why, for a tool to word its own message. */ declare class OwWorldFileError extends Error { readonly reason: OwWorldFileReason; constructor(reason: OwWorldFileReason, message?: string); } interface OwWorldFileEntry { /** Relative to the world's folder, `/`-separated. */ path: string; data: Uint8Array; } interface OwReadWorldFile { worldId: string; /** `world.json`'s `name` as the file has it; `''` when it has none. */ name: string; /** `world.json`, parsed, without `api`. */ world: Record; /** The world's files, relative to its folder, `world.json` included (without `api`), in code point order. */ files: OwWorldFileEntry[]; } interface OwReadWorldFileOptions { maxBytes?: number; maxEntries?: number; /** Leave a file out of `files` (a path relative to the world's folder). It is still checked and counted. */ skip?: (path: string) => boolean; } /** * Read a world file. Throws `OwWorldFileError` saying why, having returned * nothing; the caller writes only what this returns. An unknown option is a * `TypeError` before the bytes are looked at. */ declare function readWorldFile(bytes: Uint8Array, opts?: OwReadWorldFileOptions): OwReadWorldFile; interface OwWriteWorldFileOptions { /** * Carry the producers marked private in `records/RECORDS.json` (spec §4.5 * rule 11, OW-8). Left out or false, their directories are left out whole. */ includePrivateRecords?: boolean; /** * Carry element files marked hidden (spec §4.8). Left out or true, they * travel byte for byte: a world file is a copy. Pass false when the file is * a share, made to hand to someone else: then every element file whose JSON * carries the hidden mark is left out whole, and so is every other file * under `elements/` or `spatial/` that was not read as an element, and * `report` counts both. The default is the opposite of * `includePrivateRecords`'s on purpose. */ includeHidden?: boolean; /** * Carry the author fields of every element file: `created_by`, * `changed_by`, `changed_via`, `changed_client` and `doors`, which record * which member and which tool wrote it (a membership id, a door) and mean * nothing to someone the world is handed to. Left out or false, each * element file holding any of the five is rewritten without them * (two-space indent, a trailing newline, the other keys in their order), * and `report` counts them. Pass true for a byte copy of your own folder. */ includeAuthorFields?: boolean; /** Called once with what the write left out, after the archive is made and before it is returned; never on a refusal. */ report?: (report: OwWriteWorldFileReport) => void; } /** What `writeWorldFile` left out, handed to its `report` option. */ interface OwWriteWorldFileReport { /** Element files left out for the hidden mark (`includeHidden: false`); 0 otherwise. */ hiddenLeftOut: number; /** Files under `elements/` or `spatial/` written without their author fields (the default); 0 with `includeAuthorFields: true`. */ authorFieldsLeftOut: number; /** * Files under `elements/` or `spatial/` left out of a share (`includeHidden: false`) because the package's * folder reader does not serve them as an element, so their hidden mark could not be told: not UTF-8 JSON * (a write cut short, or text after the one JSON value), nested more than 200 deep, holding a number too * large for a double, not an object, without a non-empty string `id`, holding an id another file holds * too (neither travels), with another extension than `.json`, deeper than a type folder, or in a folder * that is no type. * 0 otherwise. Counted apart from `hiddenLeftOut`: these are files a person may want to mend or move. */ unreadLeftOut: number; /** Their paths, in code point order. */ unreadPaths: string[]; } /** * Write a world file under one top-level folder `topDir`: the `mimetype` * marker first and stored, then `world.json` (without `api`) and the folder's * parts, in UTF-8 byte order, every entry stamped 1980-01-01 00:00, JSON * deflated and everything else stored (spec §4.7, OW-6, OW-7, OW-12, OW-13). * Any other file is left out. A tool's dot-folder in `files` travels, and * makes the result a private copy, not a portable `.owworld` (OW-7): leave it * out of `files` for a portable one. * * `records/` travels byte-exact, except private records (OW-8, spec §4.5 rule * 11): every `records//` whose entry in `records/RECORDS.json` says * `"private": true` (the boolean; `"true"` is not private; the name matched by * OW-18's fold, so `Fold` names `records/fold/`) is left out whole, * and `RECORDS.json` itself travels byte-exact, its private entries kept, so a * reader learns a producer was left out. Pass `{ includePrivateRecords: true }` * to carry them; then the manifest is not read and every record travels. No * manifest, nothing is private. * * Element files marked hidden (spec §4.8) travel byte for byte by default: a * world file is a copy, also of a person's own world. A share is the offering * tool's question: pass `{ includeHidden: false }` for a file made to hand to * someone else, and every element file whose JSON carries a top-level * `hidden` (anything but absent, `null` or `false`) is left out whole. A * share carries a file under `elements/` or the legacy `spatial/` only when * it was read as an element and no mark was found, and "read as an element" * is the folder reader's own verdict (the reader behind * `@onlyworlds/sdk/folder`): a `.json` file directly in a type folder, one * JSON object with a non-empty string `id` that no other file holds. Every * other file there is left out too, counted apart, since its mark cannot be * told: one that is not UTF-8 JSON (a write cut short, or text after the one * JSON value), nested more than 200 deep, holding a number too large for a * double, not an object, without an id, holding an id another file holds * too (neither of the two travels: which mark is the element's cannot be * said), with another extension, deeper than a type folder (a hidden * element's file moved into `old/` by hand) or in a folder that is no type. * Versions before 4.197.0 carried a file with another extension, or one * not directly in a type folder, whatever it held, and judged a file of * the other kinds by its own mark alone, so a hidden element's second, * unmarked file travelled; versions before 4.196.0 carried one that was not * JSON, and 4.195.0 threw on one too deep. A copy carries every such file * byte for byte and never rewrites it, as it is how a person moves their own * world, broken file included. Nothing else is rewritten: a visible * element's link to a hidden one keeps its id, which then names no file. * Pass `report: r => …` to learn `r.hiddenLeftOut`, the count left out, and * `r.unreadLeftOut` with `r.unreadPaths`, the files not read as an element. * * The author fields, `created_by`, `changed_by`, `changed_via`, * `changed_client` and `doors`, record which member and which tool wrote * each element (a membership id, a door), which means nothing to someone the * world is handed to. So by default every carried file under `elements/` or * `spatial/` that holds one JSON object leaves them out, whether or not the * folder reader serves it as an element (a file it passes over can still hold * them); `created_at` and `updated_at` stay. A file holding any of them is * rewritten without them in the folder's own form (two-space indent, a * trailing newline, the other keys in their order); one holding none, one * that holds an array or is not JSON, and one whose JSON the folder reader * refuses (nested more than 200 deep, or a number a double cannot hold, which * a rewrite would change) travel byte for byte, and nothing outside those two * folders is touched. `r.authorFieldsLeftOut` counts the files rewritten. Pass `{ includeAuthorFields: true }` for a byte copy of your own * folder, as an archive of your own world. * * Throws a `TypeError`, having written nothing, for an unknown option, an * `includePrivateRecords`, `includeHidden` or `includeAuthorFields` that is * not a boolean, a `report` that is not a function, and (unless private * records are asked for) a `RECORDS.json` that is not a JSON array of objects or that * marks an entry private without a producer name. Refuses (`OwWorldFileError`) * an unsafe path or `topDir`, a duplicate path, a name some disk cannot hold, * two names that fold to one, and a world.json that is missing, will not parse * (it may hold a key, so it is never zipped raw) or has no `id`. */ declare function writeWorldFile(files: OwWorldFileEntry[], topDir: string, opts?: OwWriteWorldFileOptions): Uint8Array; /** * Normalization Form C as Unicode 15.1's files define it (UAX #15: * canonical decomposition, canonical ordering, canonical composition), the * NFC OW-18 folds names with before simple case folding. A code point 15.1 * leaves unassigned is left as it is, whatever the runtime's Unicode knows. * Lone surrogates pass through. */ declare function nfc(text: string): string; /** * Simple case folding (Unicode 15.1, CaseFolding.txt C and S), code point by * code point: what OW-18 applies after NFC. A code point the table does not * map folds to itself. */ declare function simpleCaseFold(text: string): string; /** * A world folder read as the Folder Format reads one (spec §3, §4): `world.json`, and every * `*.json` directly under `elements//` for the 22 types, plus the legacy * `spatial/{map,pin,zone,marker}/`. Identity is the `id` in the file, never its name; a file whose * body declares one of the 22 types is that type wherever it sits (the directory decides whether a * file is found, the body what it is). `elements/` wins over `spatial/` on a shared id, and within * one layout the first path in code point order wins (§4). Two ids are the same id when they are * written the same: one UUID in capitals in one file and in lower case in another is two elements. * Names are read as written: the extension is `.json` in lower case and a type folder is the type * word in lower case, so `M.JSON` is skipped by name and `elements/Character/` is no type folder. * A file that does not parse, or has no * non-empty string `id`, is skipped and counted, never fatal. So is a file this reader cannot * hold as written: one nested more than 200 deep, or holding a number too large for a double, * which would otherwise be served as `null`. Dot-prefixed folders and files are never read. * * Module-internal: not in the package's exports. */ /** * The first of the three fixed names (`world.json`, `elements/`, `spatial/`) that the paths hold only in * another case: the name as written and the name the format wants, or null. A name held as written is * never misnamed, whatever else sits beside it (two that fold to one are OW-18's, in a world file). * Names fold as OW-18 folds them, NFC and then simple case folding at Unicode 15.1, so `spatial/` written with a long s * (U+017F) first is `spatial/` in another case, as a world file's collision check reads it. */ declare function misnamedFixedName(paths: readonly string[]): { found: string; wanted: string; } | null; /** * World lookup: find the elements a plain-language question is about, in a * world held in memory, with no model and no network. Ported from the * Lantern Ask trial (round 2), with the * same ranking, so the trial's measurements on two real worlds describe this * code. Pure: runs in a browser and in Node alike. * * const index = buildWorldIndex(elements); // API elements or a world folder's files * const hits = lookupWorld(index, question); // ranked, best first, each with its reasons * const text = renderElement(hits[0].element, index); // a compact text card, links by name * * Each element needs `id` and `type` (a world folder's files may lack `type`: * set it from the folder name), and usually `name`. * * LINKS: a field is a link when `FIELD_SCHEMA` says so for the element's type, * or when its value is an id-shaped string or an array of them. The second * rule is the trial's own, and it is kept because real data links outside the * schema's names: a world folder's pins and markers carry `map_id` and * `zone_id`, and extension fields (`x_*`) hold references. A link to an id * outside the set is kept as unresolved, so a card can say a link exists. * * RANKING (higher score first; ties: shorter name, then id): * 0. Question and names are normalised: lower case, diacritics stripped, * possessive 's dropped, "7,875" read as 7875; letters and digits of any * script are kept, anything else is a space. A content word has 3+ * characters and is no English stopword; a word holding a non-Latin letter * always counts (a CJK name is often one or two characters). Words are * split on spaces and punctuation only, so a CJK name is found when the * question sets it apart that way. * 1. Name phrase: the whole name appears in the question -> 100 + 10 per word. * 2. Alias phrase: a short form appears -> 80 + 10 per word. Short forms: the * name without a leading "the"; the part before ":" or "("; for characters * also the part before " of " or "," and the first word. * 3. Name words: question words (3+ letters, not stopwords) equal to a name * word, or sharing a 5+ letter prefix with it -> 20 + 40 x the * rarity-weighted share of the name's words matched. Kept only when better * than 1-2. * 4. Kind: +15 when a question word matches the supertype or subtype (a word * the name already used does not count again). * 5. One link step from the 12 best direct hits, both directions: a linked-to * element scores 0.6 x the hit, a linking element 0.45 x; x1.5 when the * field fits a question word ("where" -> location fields, "rules" -> * primary_power, ...). Every reason is kept; the best score counts. * 6. Text: question words (and numbers) found in the element's other text and * number fields add 3 x their summed rarity. An element found only this * way scores under 19, so below every name hit. * 7. Map furniture (pin, marker, zone, map) x0.85, so a pin never outranks * its location; it carries no text. */ /** What the lookup reads from an element: `id`, `type`, `name`, and any other fields. `OwElement` fits. */ interface OwLookupElement { id: string; type: string; name?: string; [field: string]: unknown; } /** One link between two elements of the index, by field. */ interface OwLookupLink { field: string; id: string; } /** * The index `lookupWorld` and `renderElement` read, built once per world by * `buildWorldIndex`. `byId` is the elements by id; the other tables are the * lookup's working state: read them if useful, but their shape may change. */ interface OwWorldIndex { byId: ReadonlyMap; /** Links each element holds to elements in the set. */ out: ReadonlyMap; /** Links pointing at each element, with the holder's id. */ inn: ReadonlyMap; /** Links each element holds to ids not in the set. */ unresolved: ReadonlyMap; phrase: ReadonlyMap; tokenIds: ReadonlyMap>; nameWords: ReadonlyMap; idf: ReadonlyMap; textIds: ReadonlyMap>; textIdf: ReadonlyMap; } /** Why an element matched: by its name or a short form of it, by name words, by other text, or by one link. */ type OwLookupReason = { kind: 'name' | 'alias' | 'word' | 'text'; text: string; } | { kind: 'link'; dir: 'out' | 'in'; field: string; from: string | undefined; fromId: string; }; /** One ranked result. `dir: 'out'` on a link reason: the hit `from` links to this element; `'in'`: this element links to it. */ interface OwLookupHit { element: T; /** Rounded to one decimal; comparable within one lookup only. */ score: number; reasons: OwLookupReason[]; } interface OwLookupOptions { /** How many hits to return (default 8). */ limit?: number; } interface OwRenderOptions { /** Description characters kept (default 500). */ descMax?: number; /** Linked names listed per field (default 12). */ linkMax?: number; /** Incoming names listed per type and field (default 10). */ incomingMax?: number; } /** * Index a world's elements for `lookupWorld` and `renderElement`. Elements * without an `id` are left out; a repeated id keeps the last. Build it once * per world and again after the world changes. */ declare function buildWorldIndex(elements: Iterable): OwWorldIndex; /** * The elements a question is most likely about, best first (`limit`, default * 8). Names rank first, then elements one link away from a named one, then * elements whose other text holds the question's words. An empty question * returns no hits. */ declare function lookupWorld(index: OwWorldIndex, question: string, opts?: OwLookupOptions): OwLookupHit[]; /** * A compact text card for one element, for a person or a model: name, type, * kind, description, its fields, its links by name (or how many point outside * the data), and what links to it. */ declare function renderElement(element: T, index: OwWorldIndex, opts?: OwRenderOptions): string; /** * Context for keel's AI proxy (POST /api/v2/account/ask): the elements a * question is about, as text, within the proxy's limits. The caller passes the * elements it shows the user, in its own order, and gets back exactly which were sent: * the answer's sources are what the user saw, never a second lookup's. * * const hits = lookupWorld(index, question).slice(0, 8); // what the screen lists * const { context, kept, leftOut } = buildAskContext(hits, index); * const reply = await account.ai('ask', { world_id: worldId, question, context }); * * It is a reader that hands a world on, so three published rules hold here, not only in * the caller: an element marked proposed (the review profile, rules 1 and 4: an * `x_review_proposed` read as present, `handsOnAsProposed`, a doubt included), one marked hidden (folder * format §4.8: a `hidden` but absent, null or false) and a room element (the room * profile, rules 1 and 4: `isRoomElement`) are left out unless asked for, and listed in * `leftOut`. A kept proposed element carries REVIEW_PROPOSED_LABEL on its first line. A * kept element's link to one left out reads as not present, never by its name. * * The limits are keel's (accounts/ask.py), counted the way keel counts (characters, * not UTF-16 units): at most 8 items, 2,000 characters each, 12,000 in all. They apply * to what remains after the three rules. */ /** keel's limits on one ask. */ declare const ASK_LIMITS: { readonly questionMax: 500; readonly itemsMax: 8; readonly itemMax: 2000; readonly totalMax: 12000; }; interface OwAskContextOptions { /** * Send proposed elements: those whose `x_review_proposed` is present (the review profile; * absent, null and an empty mark, `""`, White_Space only, `[]` or `{}`, are settled; a present * value that is not a proper mark is a doubt, rule 4, and counts as proposed). Each one sent * carries REVIEW_PROPOSED_LABEL on its first line. Default false: * left out and listed in `leftOut.proposed`. */ includeProposed?: boolean; /** * Send elements marked hidden: a `hidden` that is anything but absent, null or false (folder * format §4.8, the same test as writeWorldFile's `includeHidden`). Default false: left out and * listed in `leftOut.hidden`. */ includeHidden?: boolean; /** Send room elements (`isRoomElement`, the room profile). Default false: left out and listed in `leftOut.room`. */ includeRoom?: boolean; } /** Ids left out by a mark, in the order given. An element carrying several marks is listed once, in the first of hidden, proposed, room whose `include*` is off. */ interface OwAskLeftOut { proposed: string[]; hidden: string[]; room: string[]; } interface OwAskContext { /** The texts to send as `context`, in the order given. */ context: string[]; /** Ids of the elements sent, in order (one per `context` item). */ kept: string[]; /** Ids of the elements the limits left out: past the 8th, or from the first one the 12,000 total could not hold. Never an element `leftOut` holds. */ dropped: string[]; /** Ids among `kept` whose text was cut to 2,000 characters. */ truncated: string[]; /** Ids of the elements a mark left out (proposed, hidden, room), before the limits were counted. */ leftOut: OwAskLeftOut; } /** * Turn the elements on screen into the proxy's `context`. Takes lookup hits or plain * elements and keeps their order. First the three marks: an element marked hidden * (§4.8), proposed (the review profile, a doubt included) or a room element (the room * profile) is left out unless its `include*` option is true, and its id goes to * `leftOut` (one bucket each, in the order hidden, proposed, room: a hidden proposed * element is listed under `hidden` only, since the owner's hide is the stronger * withholding and `includeProposed` alone never sends it). Then each remaining element * is rendered with `renderElement` (a proposed one with REVIEW_PROPOSED_LABEL on its * first line; a link to an element a mark leaves out, anywhere in the index, reads as * not present), a text over 2,000 characters is cut, and the list stops at the 8th or * at the first the 12,000 total cannot hold, so what is sent is always the top of the * list as shown. An unknown option, or one that is not a boolean, is a TypeError. */ declare function buildAskContext(items: Array | T>, index: OwWorldIndex, opts?: OwAskContextOptions): OwAskContext; /** * The draught as plain text: a `#` title, `##` sections and `- ` rows, LF line endings and one * newline at the end. The same read gives the same text served full or `compact`. * * The frame says what the packet does: the horizon (`as_of`), the world's now, and whose view it * was read through (`mode`). Her own element prints whole; every other row prints its name, type * and kind, how it reached her (`via`), its grade or date, the marks `hidden` and `proposed`, and * its description. The sections that hold nothing are named on one line; what the date horizon left * out is named (never counted: the packet carries no count), and what the budget left out (`cut`) is * always said. * * A draught that is not an object, or has no `world` object, is a TypeError. Takes no options. */ declare function draughtText(draught: OwDraught | OwDraughtCompact): string; /** * Photo preparation: make a picture from a phone's camera or files ready for * `uploadImage` (webp, png, jpeg or avif, at most 15 MB), in the browser, * before it leaves the device. Lifted from the upload page's converter * (upload.onlyworlds.com): canvas, webp at quality 0.82, alpha kept. * * Two traps it handles: * - A browser that cannot encode webp hands back a PNG instead (Safari has * long done this), and a PNG of a photo is huge. The result's real type is * checked; when webp did not come back, the result is PNG when the source * is PNG or when the picture as drawn on the (resized) canvas has any pixel * that is not fully opaque, read with one `getImageData` over that canvas * (pixels that cannot be read count as transparent), and JPEG at the same * quality otherwise. A JPEG source holds no alpha and is never read. * * Alpha is kept on every path: webp carries it, the fallback is PNG whenever * a pixel is not fully opaque, and a kept original is the input's own bytes. * - Re-encoding an already compressed file at the same size can make it * bigger: then the original is kept, if its type is one keel accepts. * * `planPhoto` is the pure part (sizes and types), so it is tested anywhere; * `preparePhoto` needs a browser (`createImageBitmap` and a canvas). */ /** The picture types keel's image upload accepts. */ declare const PHOTO_TYPES: readonly ["image/webp", "image/png", "image/jpeg", "image/avif"]; /** keel's limit for one picture. */ declare const PHOTO_MAX_BYTES: number; interface OwPhotoOptions { /** The longest side in pixels, after shrinking. Default 2048: a notebook page stays readable and a phone upload stays small. */ maxSide?: number; /** Encoder quality for webp and jpeg, 0 to 1. Default 0.82 (the media pipeline's q82). */ quality?: number; /** Refuse a result over this many bytes. Default 15 MB, keel's limit. */ maxBytes?: number; } interface OwPhotoPlan { width: number; height: number; /** 1 when no shrinking is needed. */ scale: number; /** * The types to try, in order; the first one the browser really produces wins. From sizes and * type alone: preparePhoto tries PNG in place of a JPEG fallback when the drawn picture has a * pixel that is not fully opaque. */ targets: string[]; } interface OwPreparedPhoto { blob: Blob; type: string; width: number; height: number; /** The input, for showing "4032×3024 · 3.1 MB → 2048×1536 webp · 410 KB". */ original: { width: number; height: number; type: string; size: number; }; /** True when the original bytes were kept unchanged. */ kept: boolean; } /** Sizes and types for one picture: pure, no browser needed. */ declare function planPhoto(source: { width: number; height: number; type: string; }, opts?: OwPhotoOptions): OwPhotoPlan; /** * Shrink and convert a picture for upload. Throws `TypeError`: * - for an unknown option, a `maxSide` or a `maxBytes` that is not a positive * number, or a `quality` that is not a finite number from 0 to 1 (all * before anything is decoded); * - outside a browser (no `createImageBitmap`, or no canvas); * - for a file the browser cannot decode, or one that decodes with no size; * - when the browser cannot encode the picture as any of the types it tries; * - when the result is over `maxBytes`. * * Whether a small original is kept or re-encoded can differ between browsers: * it is kept only when no shrinking was needed, its type is one keel accepts * and re-encoding did not make it smaller, and encoders differ. */ declare function preparePhoto(input: Blob, opts?: OwPhotoOptions): Promise; /** * Calendar kernel — pure arithmetic, formatting, and parsing over the world's * integer time line. * * The contract is the calendar design of 2026-07-14 (its §5 and §5b). The * binding rules, restated where they bite: * * - The number line is the only truth. A calendar names it; it never owns it. * - Absolute year index is ZERO-based: step 0 opens absolute year 0. All * division is Euclidean floor (negatives depend on it). * - format(step) is total and O(config) — it never walks history. * - Intercalary days belong to no month and render via `format_intercalary`. * - A KNOWN token with no applicable value renders empty (with separator * collapse); an UNKNOWN token renders literally. * - parse() matches calendar words case-insensitively; bare numbers are ALWAYS * the raw stored step. Guaranteed property: format(parse(format(n))) === * format(n). Exact integer recovery is NOT promised under lossy formats. * * Everything here is pure. No atlas imports beyond nothing — this module is * consumed by the charts room, popovers, and (via freeze) the publish path. */ interface CalendarEra { name: string; abbrev?: string; /** Up-era: domain start (inclusive). Down-era: the PIVOT (exclusive upper bound). */ start: number; /** Up-era: domain end (exclusive); defaults to the next era's start. Down-era: lower bound (inclusive); defaults to -infinity. */ end?: number; /** true (default): years number from `start`. false: pure label, {year} shows the absolute year index. */ restart?: boolean; /** First year number of a restart era: 0 or 1 (default 1). */ year_base?: 0 | 1; /** 'up' (default) or 'down' (BC / Dune B.G. — counts toward the pivot). */ direction?: 'up' | 'down'; /** Closed eras format old dates but are never offered at date entry. */ closed?: boolean; } interface CalendarMonths { names: string[]; /** Same length as names. */ lengths: number[]; } interface CalendarWeek { length: number; names: string[]; /** 'free' (default): runs across month boundaries, anchor step 0 = names[0]. * 'nested': weekday = (day_of_month - 1) mod length; ragged final week legal. */ mode?: 'free' | 'nested'; } interface CalendarIntercalary { name: string; /** 0 = before month 1; k = after month k. Requires months. */ after_month: number; /** Present only in years where floorMod(absYear + offset, N) === 0 (the leap rule). */ every_years?: number; /** Version 2: divisors that flip the rule in order, each a multiple of the one before * (`every_years: 4, except: [100, 400]`: every 4, not every 100, yet every 400). */ except?: number[]; /** Version 2: the rule reads year absYear + offset (default 0; 1 for a calendar with no year 0). */ offset?: number; /** Counts in the free-running week (default true). The Shire lock = opting * exactly Mid-year's Day + Overlithe out (364 = 52 × 7). */ in_week?: boolean; } interface CalendarConfig { version: number; /** Immutable sentinel: the world's time_basic_unit at creation. Machinery only. */ grain: string; /** The culture's display word for one step ("Sol"). Defaults to grain. */ step_name?: string; eras?: CalendarEra[]; bundles?: { /** Coarse-calendar year length. Legal ONLY when months are absent. */ year?: { steps: number; }; months?: CalendarMonths; week?: CalendarWeek; }; intercalary?: CalendarIntercalary[]; /** Regular-day template. Tokens: {day} {month} {weekday} {year} {era} {step}. */ format?: string; /** Intercalary-day template; may also use {intercalary}. */ format_intercalary?: string; } /** A step, taken apart. Fields are null when the structure doesn't exist. */ interface StepBreakdown { step: number; /** Absolute year index (zero-based from step 0). */ absYear: number; /** The era-local display year (restart arithmetic applied), or absYear when no era / restart:false. */ year: number; era: CalendarEra | null; /** 1-based month index, or null (intercalary day / no months). */ month: number | null; monthName: string | null; /** 1-based day within the month, or null. */ day: number | null; /** Intercalary day name when the step IS one, else null. */ intercalary: string | null; weekday: string | null; } interface ParseResult { step: number; } interface ParseError { error: string; } declare function floorDiv(a: number, b: number): number; declare function floorMod(a: number, b: number): number; declare function validateCalendarConfig(cfg: CalendarConfig): string[]; /** * Defensive reader for wild configs (hand-edited files, other tools). Returns * null when the value is not a structurally usable calendar — callers fall * back to bare numbers, never a broken axis. */ declare function readCalendarConfig(value: unknown): CalendarConfig | null; /** True when absolute year y contains a leap entry with period N (the version-1 rule). */ declare function isLeapYear(y: number, N: number): boolean; /** True when the intercalary day falls in absolute year y: always without `every_years`, else by its rule. */ declare function intercalaryInYear(cfg: CalendarConfig, ic: CalendarIntercalary, y: number): boolean; /** First step of absolute year y. yearStart(0) === 0 by construction. */ declare function yearStartStep(cfg: CalendarConfig, y: number): number; /** Length in steps of absolute year y. */ declare function yearLength(cfg: CalendarConfig, y: number): number; /** Absolute year index of a step. Zero-based; closed-form seed + bounded correction. */ declare function absoluteYear(cfg: CalendarConfig, step: number): number; interface EraDomain { era: CalendarEra; lo: number; hi: number; } declare function resolveEraDomains(eras: CalendarEra[]): EraDomain[]; /** * The era owning a step: domain containment; overlaps resolve to the latest start, then an * up era over a down one, then the later era in the list (the profile, calendar.md). The * comparator was `up ? -1 : 1` before 4.42.2: inconsistent for two eras of one direction, * so their order was the sort's, not the list's. */ declare function eraForStep(cfg: CalendarConfig, step: number): CalendarEra | null; /** The display year for a step under an era (or the absolute year without one). */ declare function displayYear(cfg: CalendarConfig, step: number, era: CalendarEra | null): number; interface DaySlot { kind: 'month' | 'intercalary'; month?: number; day?: number; intercalary?: CalendarIntercalary; } /** One year's slots, in yearSlots' order, asked the four questions its callers ask. */ declare class YearLayout { private readonly runs; private readonly list; readonly total: number; constructor(cfg: CalendarConfig, y: number); /** slots[i]: undefined unless i is a whole index inside the year. */ at(i: number): DaySlot | undefined; /** The intercalary days out of the week at the indexes 0, 1, ... below offset; reading past the year's last * slot throws, as the loop it replaces did. */ skippedBefore(offset: number): number; indexOfIntercalary(intercalary: CalendarIntercalary): number; indexOfDay(month: number, day: number): number; } /** Weekday name for a step, or null (no week / nested outside months / skipped intercalary day). */ declare function weekdayForStep(cfg: CalendarConfig, step: number, pre?: StepPosition): string | null; interface StepPosition { absYear: number; offset: number; slot: DaySlot | null; slots: YearLayout | null; } declare function breakdownStep(cfg: CalendarConfig, step: number): StepBreakdown; /** Format a step. Total: every integer formats to a string under every readable config. */ declare function formatStep(cfg: CalendarConfig, step: number): string; /** * Compact year-level label: "{year} {era-abbrev}" — the axis-tick wording when * zoomed wide (full formatStep at tick density would be a wall of month names). * Outside every era: the absolute year index alone. */ declare function formatYearLabel(cfg: CalendarConfig, step: number): string; /** * The base year length in steps (leap days excluded), or null when the * calendar has no year structure above the step. Consumers use it as a * zoom threshold (ticks tighter than a year → full dates, else year labels). */ declare function approxYearLength(cfg: CalendarConfig): number | null; /** * A duration in steps, spoken: "19 years" when the calendar has year * structure and the span reaches it, else "12 days" in the step word. Uses * the BASE year length (leap days are noise at duration granularity); one * decimal below 10 years, whole above. Pure. */ declare function formatDuration(cfg: CalendarConfig, steps: number): string; /** * The first step of each month in absolute year y, in order. O(config) — walks * month lengths + intercalary placement, never the year's days. Empty when the * calendar has no months. */ declare function monthStartSteps(cfg: CalendarConfig, y: number): { month: number; name: string; step: number; }[]; /** * Mid-rung label for dense axis ticks: "11 Greening 454" — day, month, display * year, NO era word (the era bands carry the era; a label wall repeating "FT" * is noise). Intercalary steps read "Hearthmoot 454". Monthless calendars fall * back to the year label. */ declare function formatMidLabel(cfg: CalendarConfig, step: number): string; interface ParseOptions { /** The world's now (used to default a missing year, per contract rule 9). */ now?: number | null; } /** Absolute year for an era-local display year (inverse of displayYear). */ declare function absYearForEraYear(cfg: CalendarConfig, era: CalendarEra, Y: number): number; /** * Parse a written date to a step. * * Accepted shapes (calendar words case-insensitive): * "-454" / "454" -> the raw stored step, always * "454 AE" / "Year 12 FT" -> year (+ era) * "Frostwane 454" / "12 Frostwane 454" (+ era) * "Shieldmeet 1372" (+ era) -> intercalary day * "Frostwane 12" (no year) -> resolved against the now's year * Partial dates snap to the period's first step. Missing year with no now = * error (never guess). p(f(n)) == n is NOT promised; f(p(f(n))) == f(n) is. */ declare function parseDate(cfg: CalendarConfig, input: string, opts?: ParseOptions): ParseResult | ParseError; declare function isParseError(r: ParseResult | ParseError): r is ParseError; /** * World calendars: the calendar kernel, and which calendars a world holds. * * `calendar.ts` beside this file came from Atlas's `src/core/calendar.ts` in 4.20.0, and is * the one copy since Atlas 245aad3 deleted its own and imports this one: * a kernel change is an SDK release, and Atlas's 48 kernel tests run against it there too. * Its contract is still Atlas's calendar design, §5 and §5b. This file adapts Atlas's * `src/core/calendar-lens.ts` (readCalendarValue, worldCalendars, and its resolveCalendarLens as resolveCalendar) to * any element shape, since the SDK has no Atlas `Element`. * * The field: a calendar is an element (a Construct by convention) carrying `atlas_calendar`. * Atlas owns the field, its meaning and its writes (its calendar design, §5 and §5b); every * other tool reads it and never writes it (a prefix names the owner, not * who may read). Detection keys on the field's presence, never on the supertype. * Everything degrades to bare numbers: a missing, dangling or malformed calendar is null, * never an error. */ /** The supertype Atlas gives a calendar Construct: convention and display only. */ declare const CALENDAR_SUPERTYPE = "calendar"; /** Atlas's field for a calendar's config (owned by Atlas: read it, never write it). */ declare const CALENDAR_FIELD = "atlas_calendar"; /** Any element: an id, a name, and the rest of its fields. */ interface OwCalendarElement { id: string; name?: string | null; [field: string]: unknown; } interface WorldCalendar { /** The calendar element's id. */ id: string; /** The element's name: the calendar's display name. */ name: string; config: CalendarConfig; } /** * The tolerant `atlas_calendar` read: an object or a JSON string (another tool may * serialize it; Atlas writes objects). Null for anything unusable. Read the field only * through this: a reader that took objects alone would blank a string config. */ declare function readCalendarValue(raw: unknown): CalendarConfig | null; /** * Every usable calendar in the world: the elements with a valid `atlas_calendar`. * A malformed config is skipped: a broken calendar is invisible, not an error. */ declare function worldCalendars(elements: Iterable): WorldCalendar[]; /** * Resolve a chosen calendar id against the elements. A null id, a dangling id or an * invalid config resolve to null: bare numbers. * * `fallbackToOnly`: when no calendar was ever chosen (`activeId` is `undefined`, not * `null`) and the world holds exactly one, use it. `null` is an explicit "no calendar" and * stays null. With several calendars and no choice, nothing is guessed. An unknown option is a * TypeError (the caller's bug, not the world's data). */ declare function resolveCalendar(elements: Iterable, activeId: string | null | undefined, opts?: { fallbackToOnly?: boolean; }): WorldCalendar | null; /** The World's key that names its calendar: the id of the element that carries it. */ declare const WORLD_CALENDAR_KEY = "x_calendar"; /** * The calendar the world's dates speak in, by the World's own choice (the calendar profile, * "Which calendar speaks"). `world` is the World's keys (the body `GET /world` returns, * `world.json` in a folder); `elements` are the world's elements. * * - The World names, in `x_calendar`, the id of an element among `elements` that carries a * calendar: that calendar speaks. The id is matched as written, letter case included. * - The World names anything else (an id no element has, an element with no calendar or one whose * value is not a calendar, an empty string, a value that is no string): none speaks, and the * dates stay bare numbers. Another calendar never speaks in its place. * - The World names none (the key absent or `null`): the only calendar among `elements` speaks; * with several, none. * * Pass the whole world's elements: a reader that holds part of a world can miss the named * element or a second calendar. A tool with a person in front of it may keep that person's own * pick over the World's ({@link resolveCalendar}). A `world` that is not an object is a TypeError. */ declare function speakingCalendar(world: Readonly>, elements: Iterable): WorldCalendar | null; /** * The old name of {@link resolveCalendar}, with the same answers: "lens" now names a cut of a * world, not a chosen calendar. * * @deprecated Since 4.85.0. Use `resolveCalendar`; this name leaves in 5.0. */ declare function resolveCalendarLens(elements: Iterable, activeId: string | null | undefined, opts?: { fallbackToOnly?: boolean; }): WorldCalendar | null; /** * OnlyWorlds Token Management API Types * * Types for the token rating system that provides daily token allowances * for API usage and AI integration features. */ /** * Current token status for the authenticated user */ interface TokenStatus { /** Remaining tokens available for today */ tokens_available_today: number; /** User's daily token allowance (default: 10000) */ token_rating: number; /** Tokens consumed so far today */ tokens_used_today: number; /** Date of last reset (ISO format) */ last_reset: string; /** Number of active token sessions */ sessions_active: number; } /** * Response from token consumption endpoint * * @deprecated Serves only a `TokenResource` method keel answers with 404 (production, * since 2026-10). Leaves in 5.0 with that method. */ interface TokenConsumeResponse { /** Whether the consumption was successful */ success: boolean; /** Actual tokens consumed */ tokens_consumed: number; /** Updated token balance */ tokens_remaining: number; /** User's daily allowance */ token_rating: number; /** Warning message if insufficient tokens (consumption still succeeds but tracks debt) */ error?: string | null; } /** * Parameters for consuming tokens * * @deprecated Serves only a `TokenResource` method keel answers with 404 (production, * since 2026-10). Leaves in 5.0 with that method. */ interface TokenConsumeParams { /** Number of tokens to consume (required) */ amount: number; /** Service identifier (default: "sdk_client") */ service?: string; /** Session ID from access key response (optional) */ sessionId?: string | null; /** Additional metadata for analytics (optional) */ metadata?: Record | null; } /** * Response from getting encrypted access key (advanced use case) * * @deprecated Serves only a `TokenResource` method keel answers with 404 (production, * since 2026-10). Leaves in 5.0 with that method. */ interface AccessKeyResponse { /** Base64 encoded encrypted OpenAI key */ encrypted_key: string; /** Key expiration timestamp (ISO format) */ expires_at: string; /** Session ID for tracking usage */ session_id: string; /** Current token balance */ tokens_available: number; /** User's token allowance */ token_rating: number; /** Encryption algorithm used */ encryption_method: string; } /** * Public encryption information for client-side decryption */ interface EncryptionInfo { /** Encryption algorithm (e.g., "Fernet") */ algorithm: string; /** Key derivation method (e.g., "SHA256") */ key_derivation: string; /** Public salt used in key derivation */ salt: string; /** Format description */ format: string; /** Human-readable description */ description: string; /** Example JavaScript implementation */ javascript_example: string; } /** * Response from session revocation * * @deprecated Serves only a `TokenResource` method keel answers with 404 (production, * since 2026-10). Leaves in 5.0 with that method. */ interface RevokeSessionResponse { /** Whether revocation was successful */ success: boolean; /** Status message */ message: string; } /** * Response from revoking all sessions * * @deprecated Serves only a `TokenResource` method keel answers with 404 (production, * since 2026-10). Leaves in 5.0 with that method. */ interface RevokeAllSessionsResponse { /** Whether revocation was successful */ success: boolean; /** Number of sessions revoked */ sessions_revoked: number; } /** * Game tier / subscription level * (affects future features, currently all tiers get same token rating) */ declare enum GameTier { FREE = "free", SILVER = "silver", GOLD = "gold", PLATINUM = "platinum", DIAMOND = "diamond", DELUXE = "deluxe" } /** * Token Management Resource * * Provides access to the OnlyWorlds token rating system API. * Based on the working implementation in base-tool/src/llm/token-service.ts */ /** * Minimal transport the token resource needs — structurally satisfied by * `OwV2Client` (its `request()` is public since 4.0): `new TokenResource(client)`. * Wire ruling (2026-07-23): keel keeps the /tokens/* economy long-term * (Tangle ratings write it, Council voting reads it) — port, don't delete. * Since then keel mounts only `status/` and `encryption-info/` under /tokens/ * (`accounts/token_api.py`; consume, access-key and both revokes answer 404 on * production, 2026-10-14), and spending moved server-side: the Council spends * through keel's council proxy (ruled 2026-10-14), and * `OwV2Client.allowance()` reads the token rating. The four dead methods are * deprecated in 4.23.0 and leave in 5.0. */ interface TokenTransport { request(method: string, path: string, opts?: { body?: unknown; }): Promise; } /** * Token Management Resource * * Handles token status checking, consumption tracking, and encrypted key access * for AI integration features. * * All endpoints require authentication (API-Key + API-Pin headers). * * Example usage: * ```typescript * const client = new OwV2Client({ apiKey: "ow_w_...", apiPin: "1234" }); * const tokens = new TokenResource(client); * * // Check token status * const status = await client.tokens.getStatus(); * console.log(`${status.tokens_available_today}/${status.token_rating} tokens available`); * * // Consume tokens * await client.tokens.consume({ * amount: 500, * service: 'my_tool', * metadata: { feature: 'chat', model: 'gpt-4' } * }); * ``` */ declare class TokenResource { private client; constructor(client: TokenTransport); /** * All token routes go through here: a 404 on /tokens/* means keel does not * serve that route, not "user has no tokens". Annotate so the failure reads * correctly. */ private req; /** * Get current token status for authenticated user * * Returns daily token allowance, usage, and availability. * Matches base-tool's checkStatus() pattern. * * @returns Current token status * @example * ```typescript * const status = await client.tokens.getStatus(); * console.log(`Available: ${status.tokens_available_today}/${status.token_rating}`); * console.log(`Used today: ${status.tokens_used_today}`); * console.log(`Active sessions: ${status.sessions_active}`); * ``` */ getStatus(): Promise; /** * Consume tokens for service usage * * @deprecated keel serves no consume route (404 on production since 2026-10; * no client decides what its act costs, ruled 2026-10-14): spending * happens server-side in the route that does the work. Removed in 5.0. * * Reports token consumption to track daily usage. Allows consumption even if * exceeds available tokens (tracks as debt), but warns via error field. * Matches base-tool's reportUsage() pattern. * * @param params - Token consumption parameters * @returns Consumption result with updated balance * @example * ```typescript * const result = await client.tokens.consume({ * amount: 500, * service: 'worldbuilding_tool', * metadata: { * feature: 'character_generation', * model: 'gpt-4', * prompt_tokens: 300, * completion_tokens: 200 * } * }); * * if (result.error) { * console.warn('Token warning:', result.error); * } * console.log(`${result.tokens_remaining} tokens remaining`); * ``` */ consume(params: TokenConsumeParams): Promise; /** * Get encrypted OpenAI API key (advanced use case) * * @deprecated keel serves no access-key route (404 on production since * 2026-10). AI answers come from keel's own proxy: `OwV2Client.ai('ask', ...)` * and `ai('sort', ...)`. Removed in 5.0. * * Requires minimum 100 tokens available. Creates a 1-hour session for tracking. * Returns encrypted key that must be decrypted client-side using Fernet. * * See base-tool/src/llm/token-service.ts:99-155 for full implementation example * including client-side decryption with the 'fernet' npm package. * * @returns Encrypted access key and session info * @throws Error if insufficient tokens (< 100) * @example * ```typescript * // Get encrypted key * const access = await client.tokens.getAccessKey(); * * // Decrypt using fernet library (see base-tool for full example) * // 1. Derive key from world ID using SHA-256 * // 2. Use 'fernet' npm package to decrypt * // 3. Use decrypted OpenAI key for direct API calls * // 4. Report usage with access.session_id * * console.log('Session:', access.session_id); * console.log('Expires:', access.expires_at); * ``` */ getAccessKey(): Promise; /** * Revoke a specific token session * * @deprecated keel serves no revoke-session route (404 on production since * 2026-10); sessions came from getAccessKey(), which is gone too. Removed in 5.0. * * Invalidates the session ID obtained from getAccessKey(). * Use when cleaning up or on logout. * * @param sessionId - Session ID to revoke * @returns Revocation result * @example * ```typescript * await client.tokens.revokeSession('session-id-here'); * ``` */ revokeSession(sessionId: string): Promise; /** * Revoke all active sessions (emergency use) * * @deprecated keel serves no revoke-all-sessions route (404 on production * since 2026-10). Removed in 5.0. * * Invalidates all token sessions for the authenticated user. * Use for security cleanup or when sessions are stuck. * * @returns Revocation result with count of revoked sessions * @example * ```typescript * const result = await client.tokens.revokeAllSessions(); * console.log(`Revoked ${result.sessions_revoked} sessions`); * ``` */ revokeAllSessions(): Promise; /** * Get public encryption info (no auth required) * * Returns algorithm details and example code for client-side decryption. * Public endpoint - can be called without authentication. * * @returns Encryption algorithm and implementation details * @example * ```typescript * const info = await client.tokens.getEncryptionInfo(); * console.log('Algorithm:', info.algorithm); * console.log('Key derivation:', info.key_derivation); * console.log(info.javascript_example); * ``` */ getEncryptionInfo(): Promise; } export { AGENT_DOORS, ASK_LIMITS, BY_LINKS_3D_REST, BY_LINKS_3D_VERSION, CALENDAR_FIELD, CALENDAR_SUPERTYPE, CHARTER_PAIRS, DATE_FIELD, DECLARED_LINKS, ELEMENT_FAMILIES, ELEMENT_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, GROUP_COLORS, GROUP_ORDER, GameTier, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, OwAddressError, OwApiError, OwNetworkError, OwPreconditionFailedError, OwProposedError, OwSignInError, OwStaleProposalError, OwV2Client, OwWorldFileError, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, RECORD_FIELD, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, SPATIAL_TYPES, STRAND_FIELD, TOOLS, TRAIL_TIERS, TokenResource, VIEWS, WORLD_CALENDAR_KEY, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, absYearForEraYear, absoluteYear, approxYearLength, askerOf, base64url, breakdownStep, buildAskContext, buildWorldIndex, byCodePoint, carryOf, charterOf, compareInstants, dateOf, degreeOf, designPartsOf, detectKeyKind, displayYear, domainsOf, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, findOwLinks, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, instantOf, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isOpenWork, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, landingOf, layoutAround, layoutByKind, layoutByLinks3d, layoutOf, lensesInUse, lookupWorld, mapSpace, misnamedFixedName, monthStartSteps, mostLinkedOf, nameFinder, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pinsKnownTo, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readOwLinkAt, readReportLine, readReportLines, readWorldFile, readingAidOf, recipientsOf, recordMarkOf, recordsOf, renderElement, reportTalksOf, reportThreadsOf, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, roundHalfEven, senderStatus, simpleCaseFold, speakingCalendar, strandOf, talksOf, threadOf, trailByPlace, trimAndFold, typeWord, unplacedAround, unplacedByKind, unplacedByLinks3d, unreadFor, validateCalendarConfig, viewOf, weekdayForStep, workOf, workStateOf, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep }; export type { AccessKeyResponse, CalendarConfig, CalendarEra, CalendarIntercalary, CalendarMonths, CalendarWeek, ElementFamily, ElementGroup, ElementType, EncryptionInfo, EraDomain, FieldInfo, FieldType, ListParams, OwAccountToken, OwAccountWorld, OwAddress, OwAddressAt, OwAddressForm, OwAddressFound, OwAddressReading, OwAddressReason, OwAddressingOptions, OwAgentJoined, OwAiAskAnswer, OwAiAskBody, OwAiMeter, OwAiRefusal, OwAiSortAnswer, OwAiSortBody, OwAiToken, OwAiUse, OwAllowance, OwAskAnswer, OwAskContext, OwAskContextOptions, OwAskLeftOut, OwAuthErrorCode, OwBulkItem, OwBulkItemResult, OwBulkResponse, OwCalendarElement, OwCarryLint, OwCarryOf, OwCarryPoint, OwCarryStop, OwChange, OwChangeDelete, OwChangeUpsert, OwChangesPage, OwCharterWorld, OwClientConfig, OwCreateAccountWorldInput, OwCreatedAccountWorld, OwCreatedWorldLink, OwDeleteReason, OwDesignPart, OwDoor, OwDragField, OwDraught, OwDraughtCompact, OwDraughtComponent, OwDraughtItem, OwDraughtLens, OwDraughtPolicy, OwEdited, OwElement, OwElementBase, OwElementMark, OwErrorBody, OwFieldsRefusal, OwFileAddedBy, OwFileDownload, OwFileKind, OwFileRow, OwFileTicket, OwFrontDoor, OwFrontDoorCharter, OwFrontDoorSkill, OwGraphCutReason, OwGraphEdge, OwGraphMark, OwGraphNode, OwGraphOptions, OwHiddenRow, OwInstant, OwJoinGlimpse, OwJoinGlimpseLink, OwJoinGlimpseThing, OwJoinPreview, OwJoined, OwJoinedMembership, OwKeyKind, OwLanding, OwLandingCluster, OwLandingGap, OwLandingGapKind, OwLandingMember, OwLandingMode, OwLandingOptions, OwLayout3dHow, OwLayout3dPart, OwLayoutAround, OwLayoutAroundOptions, OwLayoutAroundPoint, OwLayoutByKind, OwLayoutByLinks3d, OwLayoutByLinks3dOptions, OwLayoutGraph, OwLayoutOf, OwLayoutPoint, OwLensCutReason, OwLensMail, OwLensOptions, OwLensReader, OwLensReading, OwLensWorld, OwLinkEdit, OwLinked, OwLookupElement, OwLookupHit, OwLookupLink, OwLookupOptions, OwLookupReason, OwMapSpace, OwMapSpaceMap, OwMapSpaceOutReason, OwMapSpaceOutline, OwMapSpacePin, OwMapSpacePoint, OwMe, OwMediaTicket, OwMember, OwMemberLenses, OwMemberRole, OwMessageMember, OwMintedAiToken, OwMintedKey, OwMostLinked, OwMostLinkedOptions, OwMySeat, OwNameCase, OwNameFinder, OwNameFinderOptions, OwNameFound, OwNameShared, OwNamesMap, OwOpener, OwOpenerKind, OwOpenerState, OwOpenerSurface, OwOpenersOptions, OwPage, OwPaidBy, OwPhotoOptions, OwPhotoPlan, OwPinKnown, OwPinKnownHow, OwPinsKnownTo, OwPlayerJoined, OwPreparedPhoto, OwProposal, OwProposalAccepted, OwProposalConflict, OwProposalHouse, OwProposalList, OwProposalQuery, OwProposalState, OwProposeInput, OwProposed, OwProposedMark, OwProposedNewElement, OwReadWorldFile, OwReadWorldFileOptions, OwReadingAids, OwReadingAidsCharter, OwReadingAidsDomain, OwReadingAidsGuide, OwReadingAidsHub, OwRecord, OwRecordMark, OwRecordStory, OwRemovalTicket, OwRemovedImage, OwRenderOptions, OwReportGroup, OwReportLine, OwReportLineOptions, OwReportLint, OwReportParentKind, OwReportThreads, OwResyncReason, OwReviewInput, OwReviewed, OwSearchResult, OwSearchResults, OwSeat, OwSeatCreated, OwSender, OwSenderStatus, OwServedReadingAids, OwSignInBegin, OwSignInBegun, OwSignInComplete, OwSignInReason, OwSignInResult, OwSignInStorage, OwSignedIn, OwSortAddToRow, OwSortAnswer, OwSortAskRow, OwSortLinkRow, OwSortMakeRow, OwSortNote, OwSortRef, OwSortRow, OwStrand, OwStrandSlot, OwStrandWorld, OwTalk, OwTool, OwToolNeeds, OwToolOpen, OwTrailGround, OwTrailHanger, OwTrailInput, OwTrailLayout, OwTrailPin, OwTrailPlace, OwTrailSettings, OwTrailSpiral, OwTrailTier, OwUploadedFile, OwUploadedImage, OwView, OwViewRow, OwViewsTable, OwWordPair, OwWork, OwWorkElement, OwWorkLint, OwWorkState, OwWorkWorld, OwWorldFileEntry, OwWorldFileReason, OwWorldFileRow, OwWorldFiles, OwWorldGraph, OwWorldIndex, OwWorldKeyMember, OwWorldKeyRow, OwWorldLens, OwWorldLensReading, OwWorldLenses, OwWorldLink, OwWorldMeta, OwWorldOrigin, OwWorldProducer, OwWorldProposalList, OwWorldProposalQuery, OwWorldProposalRow, OwWorldPublicPage, OwWorldSource, OwWriteDoor, OwWriteWorldFileOptions, OwWriteWorldFileReport, ParseError, ParseOptions, ParseResult, RevokeAllSessionsResponse, RevokeSessionResponse, SectionInfo, StepBreakdown, TokenConsumeParams, TokenConsumeResponse, TokenStatus, TokenTransport, WorldCalendar };