@onlyworlds/sdk 4.88.0 → 4.89.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # For AI agents using @onlyworlds/sdk
2
2
 
3
- **Current as of**: SDK **4.x** · schema-dist **v0.33.0-dist.76** (canonical 00.33.00).
3
+ **Current as of**: SDK **4.x** · schema-dist **v0.33.0-dist.77** (canonical 00.33.00).
4
4
  This line is asserted by `codegen:check` in CI — if the pin moves and this file is not
5
5
  re-read against it, the check fails rather than letting this document rot quietly.
6
6
 
@@ -185,6 +185,11 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
185
185
  standard's name). Print it as written; use it for what a person reads (headings, counts,
186
186
  labels), never for folder names, ids or API calls. For a reader who needs both: "Employees
187
187
  (Character)".
188
+ - To name an element in text or a link, write its address with `elementAddress({ form, world,
189
+ type, id, lens?, moment? })`: `ow://<type>/<id>` in a text field of the same world,
190
+ `ow://<world id>/<type>/<id>` for another world's, the site's address for a person. Read one
191
+ with `parseOwLink(text)`; a refusal throws `OwAddressError` with the profile's `reason`. An
192
+ address in a field is text: never fetch it to show what it names.
188
193
  - A string holding an unpaired surrogate (text cut mid-emoji) is a 422 naming the field.
189
194
  Slice strings by code point, not by UTF-16 unit.
190
195
  - Colour carries the element's FAMILY (`elementColor(type, mode)`); the icon
package/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.89.1] - 2026-10-27
9
+
10
+ ### Fixed
11
+
12
+ - **`noteOf` reads the hidden mark as every other reader in the package does**: any `hidden` but absent, null or false leaves a Note out (it read only `true`), so a doubt is left out, as the review and world-file readers already decide. The shared edge case moves with it, in both packages.
13
+
14
+ ## [4.89.0] - 2026-10-27
15
+
16
+ ### Added
17
+
18
+ - **The address profile's readers (schema-dist serial 77): `elementAddress(address)` and `parseOwLink(text)`.** One element is named by one triple, the world's id, the type word and the element's id, in three spellings: the site's address `https://www.onlyworlds.com/w/<world id>/<type>/<id>`, `ow://<type>/<id>` inside a world and `ow://<world id>/<type>/<id>` across worlds; a world by itself is `https://www.onlyworlds.com/w/<world id>` or `ow://<world id>`. Each may carry a moment (`@<step>`, one whole step of the world's time line) and a lens (`?lens=<id>`). `elementAddress` writes the canonical string: lowercase, the world's id and never its slug, the moment before the lens. `parseOwLink` reads one string whole and gives `{ form, world, worldIsSlug, type, id, lens, moment, canonical }`; a slug in the site's address reads, and is never canonical. Both refuse with `OwAddressError`, whose `reason` is one of the profile's ten names (`OwAddressReason`), the first check that fails in the profile's order. The parser is written out, not the runtime's URL class: nothing is percent-decoded and case is ASCII case. An address object with a key it does not know is a TypeError, so a misspelt `world` cannot write an address inside a world. The fixture's 133 cases are its test, and the Python package's `element_address` and `parse_ow_link` give the same answer on every input (compared on 54,018 random and adversarial inputs, no disagreement). Schema repinned to schema-dist v0.33.0-dist.77 (from dist.76; same canonical 00.33.00, no generated type changed).
19
+
8
20
  ## [4.88.0] - 2026-10-27
9
21
 
10
22
  ### Added
package/README.md CHANGED
@@ -406,6 +406,20 @@ const label = typeWord(world, el.type, { supertype: el.supertype }) ?? el.type;
406
406
 
407
407
  The word is printed as written, never re-cased; folder names are never translated. The profile: [`profiles/names.md`](https://github.com/OnlyWorlds/schema-dist/blob/main/profiles/names.md) in the schema distribution, with its 23-case fixture, which is this function's test.
408
408
 
409
+ ### Addresses
410
+
411
+ An element has one address in three spellings: the site's `https://www.onlyworlds.com/w/<world id>/<type>/<id>`, `ow://<type>/<id>` inside a world, and `ow://<world id>/<type>/<id>` across worlds. A world by itself is `https://www.onlyworlds.com/w/<world id>` or `ow://<world id>`. Any of them may carry a moment, `@<step>` on the world's time line, and a lens, `?lens=<id>`.
412
+
413
+ ```typescript
414
+ import { elementAddress, parseOwLink, OwAddressError } from '@onlyworlds/sdk';
415
+
416
+ const link = elementAddress({ form: 'human', world: worldId, type: 'character', id: el.id });
417
+ const r = parseOwLink(text); // { form, world, worldIsSlug, type, id, lens, moment, canonical }
418
+ // a refusal throws OwAddressError: err.reason is the profile's name ('bad_id', 'uppercase', ...)
419
+ ```
420
+
421
+ A field that holds an address is text: never fetch or resolve it on the server, and show one wording ("private or missing") for a world you cannot read and an element that is not there. `parseOwLink` reads one string whole; finding a link inside other text is yours. The profile: [`profiles/address.md`](https://github.com/OnlyWorlds/schema-dist/blob/main/profiles/address.md), with its 133-case fixture, which is these functions' test.
422
+
409
423
  ## Tokens
410
424
 
411
425
  The account's token rating, which some OnlyWorlds tools use. `getStatus()` and `getEncryptionInfo()` are what keel still serves under `/tokens/`; `consume()`, `getAccessKey()` and the two session revokes are deprecated (keel answers 404) and leave in 5.0. To read the token rating, prefer `account.allowance()` above.
package/SCHEMA.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # OnlyWorlds Schema Reference
2
2
 
3
- **Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.33.0-dist.76** — canonical schema **00.33.00**, published 2026-10-27.
3
+ **Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.33.0-dist.77** — canonical schema **00.33.00**, published 2026-10-27.
4
4
 
5
5
  GENERATED from the canonical schema YAML — do not hand-edit (regenerate: `python codegen/generate_types.py`).
6
6
  Written for both humans and AI agents reading this package locally.
package/dist/index.d.ts CHANGED
@@ -4791,17 +4791,6 @@ declare function unreadFor<T extends object>(messages: readonly T[], characterId
4791
4791
  * `parent_narrative` like any other (a reply to a Note that answers the root is in the thread).
4792
4792
  */
4793
4793
  declare function threadOf<T extends object>(messages: readonly T[], rootId: string): T[];
4794
- /**
4795
- * The Character's line: the id of the Character's newest own-hand Note among the given
4796
- * Narratives, or null when it has none (always null for an empty id). A Note (`isNote`) counts
4797
- * when its `narrator` is the Character, it is in its author's hand (no `created_by` key, a folder:
4798
- * the narrator is trusted; with `created_by`, the wire: `senderStatus` against `members` is
4799
- * `verified`, so a mismatch or an unverifiable Note is nobody's), it is not hidden
4800
- * (`hidden: true`) and not proposed (`x_review_proposed` an object, the review profile), and its
4801
- * id is a string. Of those, the newest by `created_at` (the last in `created_at` order among those
4802
- * whose time can be read; equal times: the later in the list), or the last in the list when none
4803
- * can be read. A Note is never a message: it is never unread and in no thread.
4804
- */
4805
4794
  declare function noteOf(narratives: readonly object[], characterId: string, members: Members): string | null;
4806
4795
 
4807
4796
  /**
@@ -4869,6 +4858,70 @@ declare function typeWord(world: object | null | undefined, type: string, opts?:
4869
4858
  many?: boolean;
4870
4859
  }): string | null;
4871
4860
 
4861
+ /** The two forms of an address: the site's (`human`) and the `ow://` text forms (`text`). */
4862
+ type OwAddressForm = 'human' | 'text';
4863
+ /** 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. */
4864
+ type OwAddressReason = 'not_an_address' | 'uppercase' | 'segments' | 'bad_world' | 'unknown_type' | 'bad_id' | 'bad_moment' | 'bad_lens' | 'no_world' | 'bad_form';
4865
+ /** What `elementAddress` writes from: a form and a triple, or a form and a world. Absent and null are the same. */
4866
+ interface OwAddress {
4867
+ form: OwAddressForm;
4868
+ /** The world's id; absent for the text form inside a world. Never a slug: a writer refuses one. */
4869
+ world?: string | null;
4870
+ /** The type word, lowercase (`character`); absent, with `id`, for a world's own address. */
4871
+ type?: string | null;
4872
+ /** The element's id; absent, with `type`, for a world's own address. */
4873
+ id?: string | null;
4874
+ /** A lens: an element's id, read through that lens. */
4875
+ lens?: string | null;
4876
+ /** A moment: one step of the world's time line, a whole number in the 32-bit range. */
4877
+ moment?: number | null;
4878
+ }
4879
+ /** What `parseOwLink` reads from a string. Hex is given lowercase; `type` and `id` are null for a world's own address. */
4880
+ interface OwAddressReading {
4881
+ form: OwAddressForm;
4882
+ /** The world's id or, in the site's form only, its slug; null in the text form inside a world. */
4883
+ world: string | null;
4884
+ /** True when `world` is a slug (the site's form only): never canonical, since a writer writes the id. */
4885
+ worldIsSlug: boolean;
4886
+ type: ElementType | null;
4887
+ id: string | null;
4888
+ lens: string | null;
4889
+ moment: number | null;
4890
+ /** True when the string as received is exactly what `elementAddress` writes for this reading. */
4891
+ canonical: boolean;
4892
+ }
4893
+ /** 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. */
4894
+ declare class OwAddressError extends Error {
4895
+ readonly reason: OwAddressReason;
4896
+ constructor(reason: OwAddressReason, message?: string);
4897
+ }
4898
+ /**
4899
+ * An address as the profile writes it: lowercase throughout, the world's id (never its slug), the
4900
+ * moment before the lens, nothing else. `address` is a form and a triple (`{ form: 'text', world,
4901
+ * type, id }`; no `world` for the text form inside a world), or a form and a world alone for the
4902
+ * world's own address; `lens` and `moment` optional. A reading from `parseOwLink` is taken as it
4903
+ * stands, so `elementAddress(parseOwLink(s))` is the canonical spelling of `s` (a slug refuses).
4904
+ *
4905
+ * Refuses with `OwAddressError` (`reason`): `bad_form`, `segments` (a type without an id or an id
4906
+ * without a type), `no_world` (the site's form, or a world's own text form, with no world),
4907
+ * `bad_world` (not an id: a slug too), `uppercase` / `unknown_type`, `bad_id`, `bad_moment` (not a
4908
+ * whole number in the 32-bit range), `bad_lens`, in that order. An unknown key is a TypeError.
4909
+ */
4910
+ declare function elementAddress(address: OwAddress | OwAddressReading): string;
4911
+ /**
4912
+ * One string read whole as an address (a link inside other text is the caller's to find first). The
4913
+ * checks run in the profile's order and the first that fails names the refusal, as an
4914
+ * `OwAddressError` with `reason`: trim (Unicode White_Space), the prefix (`uppercase` for one in
4915
+ * another case, else `not_an_address`; a value that is not a string is `not_an_address` too), drop a
4916
+ * fragment, split off the query at the first `?`, split the path on `/`, the last segment at its first
4917
+ * `@`; then `segments`, `bad_world`, `unknown_type` / `uppercase`, `bad_id`, `bad_moment`, `bad_lens`.
4918
+ *
4919
+ * Another query key and a fragment are ignored and make the reading not canonical; nothing is
4920
+ * percent-decoded. The site's form takes a slug for the world (reported as `worldIsSlug`, never
4921
+ * canonical); the text forms take the id only. Ids are read in either case of hex and given lowercase.
4922
+ */
4923
+ declare function parseOwLink(text: string): OwAddressReading;
4924
+
4872
4925
  /**
4873
4926
  * The world file, `.owworld` (Folder Format spec §4.7; a `.zip` by another
4874
4927
  * name): one archive holding one whole world as a portable copy (§4.1), and
@@ -5910,4 +5963,4 @@ declare class TokenResource {
5910
5963
  getEncryptionInfo(): Promise<EncryptionInfo>;
5911
5964
  }
5912
5965
 
5913
- export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAddressingOptions, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, type OwMessageMember, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldIndex, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, draughtText, editedBy, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isDemoKey, isKnownOf, isLeapYear, isMessage, isNote, isParseError, isRoomElement, isSentBy, isToEveryone, kindCanWrite, lookupWorld, monthStartSteps, nfc, noteOf, parseDate, parseErrorEnvelope, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, senderStatus, simpleCaseFold, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
5966
+ export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAddress, OwAddressError, type OwAddressForm, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, type OwMessageMember, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldIndex, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isDemoKey, isKnownOf, isLeapYear, isMessage, isNote, isParseError, isRoomElement, isSentBy, isToEveryone, kindCanWrite, lookupWorld, monthStartSteps, nfc, noteOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, senderStatus, simpleCaseFold, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
package/dist/index.js CHANGED
@@ -3925,6 +3925,7 @@ function threadOf(messages, rootId) {
3925
3925
  };
3926
3926
  return inCreatedOrder(messages.filter((m) => isBody(m) && !isNote(m) && reaches(m)));
3927
3927
  }
3928
+ var isHiddenMark = (value) => value !== void 0 && value !== null && value !== false;
3928
3929
  function noteOf(narratives, characterId, members) {
3929
3930
  if (!Array.isArray(narratives) || typeof characterId !== "string" || characterId === "") return null;
3930
3931
  let line = null;
@@ -3934,7 +3935,7 @@ function noteOf(narratives, characterId, members) {
3934
3935
  const note = el;
3935
3936
  const id = idOf(note);
3936
3937
  if (typeof id !== "string" || id === "" || note.narrator !== characterId) continue;
3937
- if (note.hidden === true || proposedMarkOf(note) !== null || !isOwnHand(note, characterId, members)) continue;
3938
+ if (isHiddenMark(note.hidden) || proposedMarkOf(note) !== null || !isOwnHand(note, characterId, members)) continue;
3938
3939
  const key = timeKey(note.created_at);
3939
3940
  if (line === null || (key !== null ? lineKey === null || compareKeys(key, lineKey) >= 0 : lineKey === null)) {
3940
3941
  line = id;
@@ -3979,6 +3980,165 @@ function typeWord(world, type, opts = {}) {
3979
3980
  return isObject(types) ? word(types[type], many) : null;
3980
3981
  }
3981
3982
 
3983
+ // src/address.ts
3984
+ var MESSAGES2 = {
3985
+ not_an_address: "not an address: it starts with neither https://www.onlyworlds.com/w/ nor ow://",
3986
+ uppercase: "an address is written in lowercase: the prefix or the type word is in another case",
3987
+ segments: "the wrong number of path segments, or an empty one: a type needs an id and an id a type",
3988
+ bad_world: "the world is not an id (or, in the site's address only, a slug)",
3989
+ unknown_type: "the type word is not one of the 22",
3990
+ bad_id: "the element id is not a UUID in the hyphenated 8-4-4-4-12 form",
3991
+ bad_moment: "the moment is not a whole step in decimal within the 32-bit range",
3992
+ bad_lens: "the lens is not one lowercase lens key holding an id",
3993
+ no_world: "this address needs a world",
3994
+ bad_form: "the form is neither human nor text"
3995
+ };
3996
+ var OwAddressError = class extends Error {
3997
+ constructor(reason, message = MESSAGES2[reason]) {
3998
+ super(message);
3999
+ this.name = "OwAddressError";
4000
+ this.reason = reason;
4001
+ }
4002
+ };
4003
+ var refuse2 = (reason) => {
4004
+ throw new OwAddressError(reason);
4005
+ };
4006
+ var HUMAN_PREFIX = "https://www.onlyworlds.com/w/";
4007
+ var TEXT_PREFIX = "ow://";
4008
+ var TYPES = new Set(ELEMENT_TYPES);
4009
+ var UUID = /^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/;
4010
+ var SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
4011
+ var STEP = /^(?:0|-?[1-9][0-9]*)$/;
4012
+ var STEP_MIN = -2147483648;
4013
+ var STEP_MAX = 2147483647;
4014
+ var ADDRESS_KEYS = ["form", "world", "type", "id", "lens", "moment", "worldIsSlug", "canonical"];
4015
+ var asciiLower = (s) => s.replace(/[A-Z]/g, (c) => String.fromCharCode(c.charCodeAt(0) + 32));
4016
+ var isUuid = (s) => UUID.test(s);
4017
+ var isSlug = (s) => s.length >= 3 && s.length <= 40 && SLUG.test(s);
4018
+ function checkType(word2) {
4019
+ if (TYPES.has(word2)) return word2;
4020
+ return refuse2(TYPES.has(asciiLower(word2)) ? "uppercase" : "unknown_type");
4021
+ }
4022
+ function write(form, world, type, id, moment, lens) {
4023
+ const parts = [];
4024
+ if (world !== null) parts.push(world);
4025
+ if (type !== null && id !== null) parts.push(type, id);
4026
+ let out = (form === "human" ? HUMAN_PREFIX : TEXT_PREFIX) + parts.join("/");
4027
+ if (moment !== null) out += `@${moment}`;
4028
+ if (lens !== null) out += `?lens=${lens}`;
4029
+ return out;
4030
+ }
4031
+ var given = (v) => v !== void 0 && v !== null;
4032
+ function elementAddress(address) {
4033
+ if (address === null || typeof address !== "object" || Array.isArray(address)) {
4034
+ throw new TypeError("elementAddress: the address is an object ({ form, world, type, id, lens, moment })");
4035
+ }
4036
+ refuseUnknownOptions("elementAddress", address, ADDRESS_KEYS);
4037
+ const a = address;
4038
+ const form = a.form;
4039
+ if (form !== "human" && form !== "text") return refuse2("bad_form");
4040
+ const hasType = given(a.type);
4041
+ const hasId = given(a.id);
4042
+ if (hasType !== hasId) return refuse2("segments");
4043
+ const hasWorld = given(a.world);
4044
+ if (!hasWorld && (form === "human" || !hasType)) return refuse2("no_world");
4045
+ let world = null;
4046
+ if (hasWorld) {
4047
+ if (typeof a.world !== "string" || !isUuid(a.world)) return refuse2("bad_world");
4048
+ world = a.world.toLowerCase();
4049
+ }
4050
+ let type = null;
4051
+ let id = null;
4052
+ if (hasType) {
4053
+ type = typeof a.type === "string" ? checkType(a.type) : refuse2("unknown_type");
4054
+ if (typeof a.id !== "string" || !isUuid(a.id)) return refuse2("bad_id");
4055
+ id = a.id.toLowerCase();
4056
+ }
4057
+ let moment = null;
4058
+ if (given(a.moment)) {
4059
+ const m = a.moment;
4060
+ if (typeof m !== "number" || !Number.isInteger(m) || m < STEP_MIN || m > STEP_MAX) return refuse2("bad_moment");
4061
+ moment = m === 0 ? 0 : m;
4062
+ }
4063
+ let lens = null;
4064
+ if (given(a.lens)) {
4065
+ if (typeof a.lens !== "string" || !isUuid(a.lens)) return refuse2("bad_lens");
4066
+ lens = a.lens.toLowerCase();
4067
+ }
4068
+ return write(form, world, type, id, moment, lens);
4069
+ }
4070
+ function readLens(query) {
4071
+ let lens = null;
4072
+ let seen = false;
4073
+ for (const part of query.split("&")) {
4074
+ const eq = part.indexOf("=");
4075
+ const key = eq === -1 ? part : part.slice(0, eq);
4076
+ if (asciiLower(key) !== "lens") continue;
4077
+ if (key !== "lens" || seen) return refuse2("bad_lens");
4078
+ seen = true;
4079
+ const value = eq === -1 ? "" : part.slice(eq + 1);
4080
+ if (!isUuid(value)) return refuse2("bad_lens");
4081
+ lens = value.toLowerCase();
4082
+ }
4083
+ return lens;
4084
+ }
4085
+ function parseOwLink(text2) {
4086
+ if (typeof text2 !== "string") return refuse2("not_an_address");
4087
+ const s = trimWhiteSpace(text2);
4088
+ let form;
4089
+ let rest;
4090
+ if (s.startsWith(HUMAN_PREFIX)) {
4091
+ form = "human";
4092
+ rest = s.slice(HUMAN_PREFIX.length);
4093
+ } else if (s.startsWith(TEXT_PREFIX)) {
4094
+ form = "text";
4095
+ rest = s.slice(TEXT_PREFIX.length);
4096
+ } else {
4097
+ const lowered = asciiLower(s);
4098
+ return refuse2(lowered.startsWith(HUMAN_PREFIX) || lowered.startsWith(TEXT_PREFIX) ? "uppercase" : "not_an_address");
4099
+ }
4100
+ const hash = rest.indexOf("#");
4101
+ if (hash !== -1) rest = rest.slice(0, hash);
4102
+ const q = rest.indexOf("?");
4103
+ const query = q === -1 ? null : rest.slice(q + 1);
4104
+ const segments = (q === -1 ? rest : rest.slice(0, q)).split("/");
4105
+ const last = segments[segments.length - 1];
4106
+ const at = last.indexOf("@");
4107
+ const step = at === -1 ? null : last.slice(at + 1);
4108
+ if (at !== -1) segments[segments.length - 1] = last.slice(0, at);
4109
+ const n = segments.length;
4110
+ if (form === "human" ? n !== 1 && n !== 3 : n < 1 || n > 3) return refuse2("segments");
4111
+ if (segments.some((seg) => seg === "")) return refuse2("segments");
4112
+ if (n === 1 && TYPES.has(segments[0])) return refuse2("segments");
4113
+ let world = null;
4114
+ let worldIsSlug = false;
4115
+ if (n !== 2) {
4116
+ const w = segments[0];
4117
+ if (isUuid(w)) world = w.toLowerCase();
4118
+ else if (form === "human" && isSlug(w) && !TYPES.has(w)) {
4119
+ world = w;
4120
+ worldIsSlug = true;
4121
+ } else return refuse2("bad_world");
4122
+ }
4123
+ let type = null;
4124
+ let id = null;
4125
+ if (n !== 1) {
4126
+ type = checkType(segments[n - 2]);
4127
+ if (!isUuid(segments[n - 1])) return refuse2("bad_id");
4128
+ id = segments[n - 1].toLowerCase();
4129
+ }
4130
+ let moment = null;
4131
+ if (step !== null) {
4132
+ if (!STEP.test(step) || step.length > 11) return refuse2("bad_moment");
4133
+ const m = Number(step);
4134
+ if (m < STEP_MIN || m > STEP_MAX) return refuse2("bad_moment");
4135
+ moment = m;
4136
+ }
4137
+ const lens = query === null ? null : readLens(query);
4138
+ const canonical = !worldIsSlug && text2 === write(form, world, type, id, moment, lens);
4139
+ return { form, world, worldIsSlug, type, id, lens, moment, canonical };
4140
+ }
4141
+
3982
4142
  // src/lookup.ts
3983
4143
  var LOOKUP_OPTION_KEYS = ["limit"];
3984
4144
  var RENDER_OPTION_KEYS = ["descMax", "linkMax", "incomingMax"];
@@ -5552,6 +5712,7 @@ export {
5552
5712
  MESSAGE_PAIR,
5553
5713
  NOTE_PAIR,
5554
5714
  ONLYWORLDS_VERSION,
5715
+ OwAddressError,
5555
5716
  OwApiError,
5556
5717
  OwNetworkError,
5557
5718
  OwPreconditionFailedError,
@@ -5582,6 +5743,7 @@ export {
5582
5743
  displayYear,
5583
5744
  draughtText,
5584
5745
  editedBy,
5746
+ elementAddress,
5585
5747
  elementColor,
5586
5748
  eraForStep,
5587
5749
  errorFromResponse,
@@ -5617,6 +5779,7 @@ export {
5617
5779
  noteOf,
5618
5780
  parseDate,
5619
5781
  parseErrorEnvelope,
5782
+ parseOwLink,
5620
5783
  pinExpectation,
5621
5784
  pkceChallenge,
5622
5785
  planPhoto,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.88.0",
3
+ "version": "4.89.1",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {