@onlyworlds/sdk 4.123.5 → 4.124.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # For AI agents using @onlyworlds/sdk
2
2
 
3
- **Current as of**: SDK **4.x** · schema-dist **v0.33.0-dist.101** (canonical 00.33.00).
3
+ **Current as of**: SDK **4.x** · schema-dist **v0.33.0-dist.102** (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
 
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.124.0] - 2026-11-01
9
+
10
+ ### Added
11
+
12
+ - **`recordsOf(characterId, elements)`, `recordMarkOf(element)` and `RECORD_FIELD`: the record profile** (schema-dist `profiles/record.md`, serial 102). A game's run is kept in the world its Characters live in, as an Event carrying the mark `x_record`: `tool` and `played_at` required; `version`, `seed`, `outcome` and `seats` optional. `recordsOf` reads one Character's records from the elements as the reader is served them, newest first, each with that Character's stories of the run (a Narrative naming them as `protagonist`, `narrator` or both). Who took part is the Event's `characters` alone. A run or a story still proposed is not read. `played_at` must be a real calendar instant (checked part by part, never by `Date.parse`, which rolls February 30 into March), and records order by the instant to the millisecond. The fixture `profiles/record.fixture.json` (32 cases) is the test; the Python package's `records_of` gives the same answers.
13
+
14
+ ### Changed
15
+
16
+ - **Schema repinned to schema-dist `v0.33.0-dist.102`** (from dist.101; the same canonical 00.33.00, so `ONLYWORLDS_VERSION` stays `'00.33.00'`). Serial 102 adds the record profile; no schema file moved.
17
+
8
18
  ## [4.123.5] - 2026-11-01
9
19
 
10
20
  ### Changed
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.101** — canonical schema **00.33.00**, published 2026-10-31.
3
+ **Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.33.0-dist.102** — canonical schema **00.33.00**, published 2026-11-01.
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
@@ -5451,6 +5451,58 @@ declare function charterOf(world: OwCharterWorld, reader: OwLensReader): OwReadi
5451
5451
  /** The marked Domains alone, as `charterOf` lists them for the same reader. */
5452
5452
  declare function domainsOf(world: OwCharterWorld, reader: OwLensReader): OwReadingAidsDomain[];
5453
5453
 
5454
+ /** The Event's field that carries the record's mark. */
5455
+ declare const RECORD_FIELD = "x_record";
5456
+ /** A record's mark as read: the required two as written, each optional member null when unset, seats an object. */
5457
+ interface OwRecordMark {
5458
+ /** The game, in the tools list's id form (`[a-z0-9-]`, 1 to 32). */
5459
+ tool: string;
5460
+ /** When the run was played: RFC 3339 in UTC, real time (never world time). */
5461
+ played_at: string;
5462
+ /** The engine's version; with `seed`, the replay. */
5463
+ version: string | null;
5464
+ /** The run's seed, a string. */
5465
+ seed: string | null;
5466
+ /** One lowercase word the game chose (`won`, `lost`, `sunk`), 1 to 24 letters. */
5467
+ outcome: string | null;
5468
+ /** Character id to the seat in the game's own words; decoration, never who took part. */
5469
+ seats: Record<string, string>;
5470
+ }
5471
+ /** One Character's story of a record: about them (`protagonist`), told by them (`narrator`), or both. */
5472
+ interface OwRecordStory {
5473
+ id: string;
5474
+ name: string;
5475
+ as: 'protagonist' | 'narrator' | 'both';
5476
+ }
5477
+ /** One record of a Character, as `recordsOf` reads it. */
5478
+ interface OwRecord {
5479
+ event: {
5480
+ id: string;
5481
+ name: string;
5482
+ };
5483
+ tool: string;
5484
+ played_at: string;
5485
+ version: string | null;
5486
+ seed: string | null;
5487
+ outcome: string | null;
5488
+ /** This Character's seat, when the mark names one for them. */
5489
+ seat: string | null;
5490
+ /** Their stories of this run, in code point order of their ids. */
5491
+ stories: OwRecordStory[];
5492
+ }
5493
+ /**
5494
+ * The record's mark on an element, read: the mark when the element is an Event whose `x_record` has the profile's
5495
+ * shape, else null. A broken writer never shows as a record: a missing or malformed `tool` or `played_at`, or an
5496
+ * optional member that is anything but its kind, null or absent, is no mark.
5497
+ */
5498
+ declare function recordMarkOf(element: unknown): OwRecordMark | null;
5499
+ /**
5500
+ * A Character's records in a world: every Event with the record mark whose `characters` names them, newest first by
5501
+ * `played_at` (ties by the Event's id in code point order), each with the stories that are theirs. An id no record
5502
+ * names, or one in no element, reads an empty list. `elements` is the world as this reader is served it.
5503
+ */
5504
+ declare function recordsOf(characterId: string, elements: readonly unknown[]): OwRecord[];
5505
+
5454
5506
  /**
5455
5507
  * The review profile's proposed mark (schema-dist profiles/review.md): an element whose
5456
5508
  * `x_review_proposed` is an object was written as proposed (an AI seat's new element on a world
@@ -6934,4 +6986,4 @@ declare class TokenResource {
6934
6986
  getEncryptionInfo(): Promise<EncryptionInfo>;
6935
6987
  }
6936
6988
 
6937
- export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, CHARTER_PAIRS, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, ELEMENT_FAMILIES, ELEMENT_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementGroup, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GROUP_COLORS, GROUP_ORDER, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountToken, type OwAccountWorld, type OwAddress, OwAddressError, type OwAddressForm, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwCharterWorld, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDoor, type OwDragField, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwGraphCutReason, type OwGraphEdge, type OwGraphMark, type OwGraphNode, type OwGraphOptions, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLensCutReason, type OwLensMail, type OwLensOptions, type OwLensReader, type OwLensReading, type OwLensWorld, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberLenses, type OwMemberRole, type OwMessageMember, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwOpener, type OwOpenerKind, type OwOpenerState, type OwOpenerSurface, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwReadingAids, type OwReadingAidsCharter, type OwReadingAidsDomain, type OwReadingAidsGuide, type OwReadingAidsHub, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwServedReadingAids, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwStrand, type OwStrandSlot, type OwStrandWorld, type OwTool, type OwToolNeeds, type OwToolOpen, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldGraph, type OwWorldIndex, type OwWorldLens, type OwWorldLensReading, type OwWorldLenses, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, STRAND_FIELD, type SectionInfo, type StepBreakdown, TOOLS, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, charterOf, dateOf, degreeOf, detectKeyKind, displayYear, domainsOf, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, readingAidOf, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, strandOf, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
6989
+ export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, CHARTER_PAIRS, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, ELEMENT_FAMILIES, ELEMENT_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementGroup, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GROUP_COLORS, GROUP_ORDER, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountToken, type OwAccountWorld, type OwAddress, OwAddressError, type OwAddressForm, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwCharterWorld, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDoor, type OwDragField, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwGraphCutReason, type OwGraphEdge, type OwGraphMark, type OwGraphNode, type OwGraphOptions, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLensCutReason, type OwLensMail, type OwLensOptions, type OwLensReader, type OwLensReading, type OwLensWorld, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberLenses, type OwMemberRole, type OwMessageMember, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwOpener, type OwOpenerKind, type OwOpenerState, type OwOpenerSurface, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwReadingAids, type OwReadingAidsCharter, type OwReadingAidsDomain, type OwReadingAidsGuide, type OwReadingAidsHub, type OwRecord, type OwRecordMark, type OwRecordStory, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwServedReadingAids, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwStrand, type OwStrandSlot, type OwStrandWorld, type OwTool, type OwToolNeeds, type OwToolOpen, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldGraph, type OwWorldIndex, type OwWorldLens, type OwWorldLensReading, type OwWorldLenses, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, RECORD_FIELD, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, STRAND_FIELD, type SectionInfo, type StepBreakdown, TOOLS, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, charterOf, dateOf, degreeOf, detectKeyKind, displayYear, domainsOf, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, readingAidOf, recipientsOf, recordMarkOf, recordsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, strandOf, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
package/dist/index.js CHANGED
@@ -2595,20 +2595,20 @@ function isNote(element) {
2595
2595
  return matchesPair(element, NOTE_PAIR);
2596
2596
  }
2597
2597
  function recipientsOf(message) {
2598
- const list = isBody(message) && !isNote(message) ? message.characters : void 0;
2599
- return Array.isArray(list) ? list.filter((c) => typeof c === "string" && c !== "") : [];
2598
+ const list2 = isBody(message) && !isNote(message) ? message.characters : void 0;
2599
+ return Array.isArray(list2) ? list2.filter((c) => typeof c === "string" && c !== "") : [];
2600
2600
  }
2601
2601
  function isAddressedTo(message, characterId) {
2602
2602
  if (!isBody(message) || isNote(message) || typeof characterId !== "string" || characterId === "") return false;
2603
2603
  if (isToEveryone(message)) return true;
2604
- const list = message.characters;
2605
- return Array.isArray(list) && list.includes(characterId);
2604
+ const list2 = message.characters;
2605
+ return Array.isArray(list2) && list2.includes(characterId);
2606
2606
  }
2607
2607
  function isToEveryone(message, options) {
2608
2608
  const keyless = keylessOf("isToEveryone", options);
2609
2609
  if (!isBody(message) || isNote(message) || keyless || hasUnseenRecipients(message) === true) return false;
2610
- const list = message.characters;
2611
- return list === void 0 || list === null || Array.isArray(list) && list.length === 0;
2610
+ const list2 = message.characters;
2611
+ return list2 === void 0 || list2 === null || Array.isArray(list2) && list2.length === 0;
2612
2612
  }
2613
2613
  function hasUnseenRecipients(message, options) {
2614
2614
  const keyless = keylessOf("hasUnseenRecipients", options);
@@ -2842,10 +2842,10 @@ function isTemplate(element) {
2842
2842
  return isLens(element) && typeof element.subtype === "string" && fold(element.subtype) === fold("Template");
2843
2843
  }
2844
2844
  function lensesInUse(membership, xLensUses) {
2845
- const list = Array.isArray(membership) ? membership : xLensUses;
2846
- if (!Array.isArray(list)) return [];
2845
+ const list2 = Array.isArray(membership) ? membership : xLensUses;
2846
+ if (!Array.isArray(list2)) return [];
2847
2847
  const out = [];
2848
- for (const id of list) if (typeof id === "string" && id !== "" && !out.includes(id)) out.push(id);
2848
+ for (const id of list2) if (typeof id === "string" && id !== "" && !out.includes(id)) out.push(id);
2849
2849
  return out;
2850
2850
  }
2851
2851
  function readRecipe(raw) {
@@ -2952,8 +2952,8 @@ var Reading = class {
2952
2952
  const knownOf = listed(seen.known_of);
2953
2953
  for (const id of this.order) {
2954
2954
  const el = this.byId.get(id);
2955
- const proposed = handsOnAsProposed(el);
2956
- if (proposed) this.proposed.add(id);
2955
+ const proposed2 = handsOnAsProposed(el);
2956
+ if (proposed2) this.proposed.add(id);
2957
2957
  let sees;
2958
2958
  switch (seen.rung) {
2959
2959
  case "owner":
@@ -2963,18 +2963,18 @@ var Reading = class {
2963
2963
  sees = !hidden.has(id);
2964
2964
  break;
2965
2965
  case "public":
2966
- sees = !hidden.has(id) && !this.room.has(id) && !proposed;
2966
+ sees = !hidden.has(id) && !this.room.has(id) && !proposed2;
2967
2967
  break;
2968
2968
  // Hidden beats known_of: the hidden mark comes off the known-of grant too, so a hidden element the guest
2969
2969
  // knows of and did not make is not in its view at all; its own creations come in whole.
2970
2970
  default: {
2971
2971
  const stub = !wholeIds.has(id) && knownOf.has(id) && !hidden.has(id);
2972
2972
  sees = wholeIds.has(id) || stub;
2973
- if (stub && !proposed) this.stubs.add(id);
2973
+ if (stub && !proposed2) this.stubs.add(id);
2974
2974
  }
2975
2975
  }
2976
2976
  if (sees) this.linkable.add(id);
2977
- if (sees && !proposed) this.view.add(id);
2977
+ if (sees && !proposed2) this.view.add(id);
2978
2978
  }
2979
2979
  this.members = Array.isArray(world.members) ? world.members : null;
2980
2980
  this.asOf = asOf;
@@ -3242,7 +3242,7 @@ function resolveOne(lens, recipe, r, visited, wall) {
3242
3242
  };
3243
3243
  const { anchors, children, unseen, anchored } = anchorsOf(lens, r);
3244
3244
  const anchorSet = new Set(anchors);
3245
- let list = [];
3245
+ let list2 = [];
3246
3246
  const frontier = [];
3247
3247
  for (const id of anchors) {
3248
3248
  if (!r.view.has(id) || unseen.has(id)) {
@@ -3253,7 +3253,7 @@ function resolveOne(lens, recipe, r, visited, wall) {
3253
3253
  const why = r.fenceCut(id, recipe);
3254
3254
  if (why !== "after_as_of") frontier.push(id);
3255
3255
  if (why !== null) addCut(id, why);
3256
- else list.push(id);
3256
+ else list2.push(id);
3257
3257
  }
3258
3258
  const passes = (id) => {
3259
3259
  const why = r.fenceCut(id, recipe) ?? (r.kept(id, recipe) ? null : "types") ?? r.windowCut(id, recipe) ?? r.staleCut(id, recipe, wall);
@@ -3262,11 +3262,11 @@ function resolveOne(lens, recipe, r, visited, wall) {
3262
3262
  };
3263
3263
  if (!anchored) {
3264
3264
  const selected = r.order.filter((id) => r.view.has(id) && !visited.has(id) && r.kept(id, recipe));
3265
- list.push(...r.sort(selected.filter(passes)));
3265
+ list2.push(...r.sort(selected.filter(passes)));
3266
3266
  } else if (recipe.depth >= 1) {
3267
3267
  const excluded = (id) => anchorSet.has(id) || visited.has(id);
3268
3268
  const { reached: hop, edges } = r.reach(frontier, excluded);
3269
- list.push(...r.sort([...hop].filter(passes)));
3269
+ list2.push(...r.sort([...hop].filter(passes)));
3270
3270
  if (r.owner) for (const id of r.unseen(frontier, edges, excluded)) addCut(id, "not_visible");
3271
3271
  if (recipe.depth === 2) {
3272
3272
  const stops = (id) => r.stopsAt(id, recipe) || r.fenceCut(id, recipe) === "after_as_of";
@@ -3283,19 +3283,19 @@ function resolveOne(lens, recipe, r, visited, wall) {
3283
3283
  const read = readRecipe(body.x_lens);
3284
3284
  if (!("recipe" in read) || isTemplate(body)) continue;
3285
3285
  const sub = resolveOne(body, read.recipe, r, visited, wall);
3286
- const have = new Set(list);
3287
- list.push(...sub.list.filter((id) => !have.has(id)));
3286
+ const have = new Set(list2);
3287
+ list2.push(...sub.list.filter((id) => !have.has(id)));
3288
3288
  for (const [id, why] of sub.cut) addCut(id, why);
3289
3289
  }
3290
3290
  const mail = recipe.mail === "none" ? null : mailPart(r, recipe.mail, recipe.budget, wall);
3291
3291
  if (mail !== null) {
3292
3292
  const inMail = /* @__PURE__ */ new Set([...mail.unread, ...mail.read]);
3293
- list = list.filter((id) => !inMail.has(id));
3293
+ list2 = list2.filter((id) => !inMail.has(id));
3294
3294
  }
3295
- for (const id of list.slice(recipe.budget)) cut2.set(id, "budget");
3296
- list = list.slice(0, recipe.budget);
3297
- for (const id of list) cut2.delete(id);
3298
- return { list, cut: cut2, mail };
3295
+ for (const id of list2.slice(recipe.budget)) cut2.set(id, "budget");
3296
+ list2 = list2.slice(0, recipe.budget);
3297
+ for (const id of list2) cut2.delete(id);
3298
+ return { list: list2, cut: cut2, mail };
3299
3299
  }
3300
3300
  function mailPart(r, mode, budget, clock) {
3301
3301
  const empty = { unread: [], read: [], rows: [], cut: {}, totals: { unread: 0, read: 0 } };
@@ -3531,6 +3531,77 @@ function strandOf(world, reader) {
3531
3531
  return out;
3532
3532
  }
3533
3533
 
3534
+ // src/record.ts
3535
+ var RECORD_FIELD = "x_record";
3536
+ var TOOL = /^[a-z0-9-]{1,32}$/;
3537
+ var PLAYED_AT = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?Z$/;
3538
+ var OUTCOME = /^[a-z]{1,24}$/;
3539
+ var isObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
3540
+ var unsetOr = (v, test) => v === void 0 || v === null || test(v);
3541
+ var isString = (v) => typeof v === "string";
3542
+ var list = (v) => Array.isArray(v) ? v : [];
3543
+ var cp = (a, b) => a < b ? -1 : a > b ? 1 : 0;
3544
+ function isInstant(s) {
3545
+ const m = PLAYED_AT.exec(s);
3546
+ if (!m) return false;
3547
+ const [y, mo, d, h, mi, se] = [m[1], m[2], m[3], m[4], m[5], m[6] ?? "0"].map(Number);
3548
+ const leap = y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
3549
+ const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][mo - 1];
3550
+ return days !== void 0 && d >= 1 && d <= days && h <= 23 && mi <= 59 && se <= 59 && y >= 1;
3551
+ }
3552
+ var proposed = (el) => el.x_review_proposed !== void 0 && el.x_review_proposed !== null;
3553
+ function recordMarkOf(element) {
3554
+ if (!isObject(element) || element.type !== "event") return null;
3555
+ const m = element[RECORD_FIELD];
3556
+ if (!isObject(m)) return null;
3557
+ if (!isString(m.tool) || !TOOL.test(m.tool)) return null;
3558
+ if (!isString(m.played_at) || !isInstant(m.played_at)) return null;
3559
+ if (!unsetOr(m.version, isString)) return null;
3560
+ if (!unsetOr(m.seed, isString)) return null;
3561
+ if (!unsetOr(m.outcome, (v) => isString(v) && OUTCOME.test(v))) return null;
3562
+ if (!unsetOr(m.seats, (v) => isObject(v) && Object.values(v).every(isString))) return null;
3563
+ return {
3564
+ tool: m.tool,
3565
+ played_at: m.played_at,
3566
+ version: m.version ?? null,
3567
+ seed: m.seed ?? null,
3568
+ outcome: m.outcome ?? null,
3569
+ seats: m.seats ? { ...m.seats } : {}
3570
+ };
3571
+ }
3572
+ function recordsOf(characterId, elements) {
3573
+ if (typeof characterId !== "string") throw new TypeError("recordsOf: characterId must be a string");
3574
+ if (!Array.isArray(elements)) throw new TypeError("recordsOf: elements must be an array");
3575
+ const out = [];
3576
+ for (const ev of elements) {
3577
+ const mark = recordMarkOf(ev);
3578
+ if (!mark || proposed(ev) || !list(ev.characters).includes(characterId)) continue;
3579
+ const id = ev.id;
3580
+ const stories = [];
3581
+ for (const n of elements) {
3582
+ if (!isObject(n) || n.type !== "narrative" || proposed(n) || !list(n.events).includes(id)) continue;
3583
+ const p = n.protagonist === characterId;
3584
+ const r = n.narrator === characterId;
3585
+ if (!p && !r) continue;
3586
+ stories.push({ id: n.id, name: isString(n.name) ? n.name : "", as: p && r ? "both" : p ? "protagonist" : "narrator" });
3587
+ }
3588
+ stories.sort((a, b) => cp(a.id, b.id));
3589
+ const name = ev.name;
3590
+ out.push({
3591
+ event: { id, name: isString(name) ? name : "" },
3592
+ tool: mark.tool,
3593
+ played_at: mark.played_at,
3594
+ version: mark.version,
3595
+ seed: mark.seed,
3596
+ outcome: mark.outcome,
3597
+ seat: isString(mark.seats[characterId]) ? mark.seats[characterId] : null,
3598
+ stories
3599
+ });
3600
+ }
3601
+ out.sort((a, b) => Date.parse(b.played_at) - Date.parse(a.played_at) || cp(a.event.id, b.event.id));
3602
+ return out;
3603
+ }
3604
+
3534
3605
  // src/graph.ts
3535
3606
  var GRAPH_OPTION_KEYS = ["lens", "asOf", "clock", "rooms", "hidden", "proposed", "mapSpace"];
3536
3607
  var DECLARED_LINKS = ["x_lens_leads_to", "x_spine_depends_on"];
@@ -3639,10 +3710,10 @@ function worldGraph(world, reader, options) {
3639
3710
  if (target === "any") continue;
3640
3711
  const v = el[field];
3641
3712
  const to = linkTarget(el, field, target);
3642
- const list = many ? Array.isArray(v) ? v : [] : [v];
3713
+ const list2 = many ? Array.isArray(v) ? v : [] : [v];
3643
3714
  let served = 0;
3644
- for (let i = 0; i < list.length; i++) {
3645
- const t = list[i];
3715
+ for (let i = 0; i < list2.length; i++) {
3716
+ const t = list2[i];
3646
3717
  const typed = typeof t === "string" && r.typeOf.get(t) === to;
3647
3718
  if (typed) visit(source, field, t, seenOwner ? i : served);
3648
3719
  if (seenOwner || typed && r.linkable.has(t)) served++;
@@ -3731,11 +3802,11 @@ function load() {
3731
3802
  for (let k = 0; k < n; k++) ccc.set(s + k, c);
3732
3803
  }
3733
3804
  const raw = /* @__PURE__ */ new Map();
3734
- let cp = 0;
3805
+ let cp2 = 0;
3735
3806
  for (const entry of NFC_DECOMP.split(",")) {
3736
3807
  const [gap, ...to] = entry.split(".");
3737
- cp += parseInt(gap, 36);
3738
- raw.set(cp, to.map((t) => parseInt(t, 36)));
3808
+ cp2 += parseInt(gap, 36);
3809
+ raw.set(cp2, to.map((t) => parseInt(t, 36)));
3739
3810
  }
3740
3811
  const excluded = new Set(NFC_EXCLUDED.split(",").map((t) => parseInt(t, 36)));
3741
3812
  const compose = /* @__PURE__ */ new Map();
@@ -5258,7 +5329,7 @@ function readCalendarConfig(value) {
5258
5329
  const cfg = value;
5259
5330
  if (cfg.version !== 1 && cfg.version !== 2 || !hasGrain(cfg.grain)) return null;
5260
5331
  const months = cfg.bundles?.months;
5261
- if (months && (!Array.isArray(months.names) || !Array.isArray(months.lengths) || months.names.length !== months.lengths.length || months.names.length === 0 || !months.names.every(isString))) return null;
5332
+ if (months && (!Array.isArray(months.names) || !Array.isArray(months.lengths) || months.names.length !== months.lengths.length || months.names.length === 0 || !months.names.every(isString2))) return null;
5262
5333
  if (cfg.eras != null && !Array.isArray(cfg.eras)) return null;
5263
5334
  if (cfg.eras?.some((e) => typeof e?.name !== "string" || !Number.isSafeInteger(e?.start) || e.end != null && !Number.isSafeInteger(e.end) || e.year_base != null && e.year_base !== 0 && e.year_base !== 1)) return null;
5264
5335
  if (cfg.intercalary != null && (!Array.isArray(cfg.intercalary) || cfg.intercalary.some((i) => typeof i?.name !== "string" || !Number.isInteger(i?.after_month)))) return null;
@@ -5266,7 +5337,7 @@ function readCalendarConfig(value) {
5266
5337
  const year = cfg.bundles?.year;
5267
5338
  if (year != null && !isPositiveInt(year.steps)) return null;
5268
5339
  const week = cfg.bundles?.week;
5269
- if (week != null && (!isPositiveInt(week.length) || !Array.isArray(week.names) || !week.names.every(isString))) return null;
5340
+ if (week != null && (!isPositiveInt(week.length) || !Array.isArray(week.names) || !week.names.every(isString2))) return null;
5270
5341
  if (cfg.intercalary?.some((i) => i.every_years != null && !isPositiveInt(i.every_years))) return null;
5271
5342
  if (cfg.version === 2 && cfg.intercalary?.some((i) => leapRuleProblem(i) != null)) return null;
5272
5343
  if (!months && cfg.intercalary != null && cfg.intercalary.length > 0) return null;
@@ -5292,7 +5363,7 @@ function leapRuleProblem(ic) {
5292
5363
  }
5293
5364
  return null;
5294
5365
  }
5295
- function isString(s) {
5366
+ function isString2(s) {
5296
5367
  return typeof s === "string";
5297
5368
  }
5298
5369
  function isPositiveInt(n) {
@@ -5932,6 +6003,7 @@ export {
5932
6003
  PHOTO_TYPES,
5933
6004
  PROPOSED_MARK,
5934
6005
  PUBLIC_FIELDS,
6006
+ RECORD_FIELD,
5935
6007
  REVIEW_PROPOSED_LABEL,
5936
6008
  ROOM_PAIRS,
5937
6009
  SPATIAL_TYPES,
@@ -6014,6 +6086,8 @@ export {
6014
6086
  readWorldFile,
6015
6087
  readingAidOf,
6016
6088
  recipientsOf,
6089
+ recordMarkOf,
6090
+ recordsOf,
6017
6091
  renderElement,
6018
6092
  resolveCalendar,
6019
6093
  resolveCalendarLens,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.123.5",
3
+ "version": "4.124.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {