@onlyworlds/sdk 4.21.0 → 4.22.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
@@ -54,6 +54,9 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
54
54
  allowance as ask.
55
55
  - Allowance (since 4.21.0, account token): `account.allowance()` reads the daily AI allowance
56
56
  without spending: `{ token_rating, tokens_used_today, tokens_remaining, resets_at }`.
57
+ - Who am I (since 4.22.0, a world key): `client.me()` is `{ world, scope, kind, role,
58
+ membership, character }` (`membership` is what `created_by` holds for what you create; null
59
+ for the owner); `client.members()` is the roster's rows. An account token is a TypeError.
57
60
  - Invite links (since 4.12.0): `previewJoin(code)` (no credential sent) shows who invites, to
58
61
  which world, in what role; `acceptJoin(code)` with an `ow_a_` account token joins. Bad code:
59
62
  `err.isNotFound`; `err.isAlreadyMember`, `err.isPinRequired` for the two 409s.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.22.0] — 2026-10-14
9
+
10
+ ### Added
11
+ - **`client.me()` and `client.members()`**: GET /me (who this world key is: world, scope, kind,
12
+ role, membership id, Character) and GET /members (the roster's rows, unwrapped from `{ data }`).
13
+ Lantern reads a player's role from /me by hand today. Types `OwMe`, `OwMember`, typed from
14
+ keel's declared schemas and held to them by Assembly's wire gate. An account token is a
15
+ TypeError before sending; the tests fail with that guard removed, or with the rows left
16
+ wrapped.
17
+
18
+ ### Changed
19
+ - The calendar kernel is the SDK's own: Atlas 245aad3 deleted its `core/calendar.ts` and imports
20
+ this one (Temper, h37 #4472), so the copy record (`src/calendar/SOURCES.json`) and the re-copy
21
+ script (`codegen/atlas-calendar.mjs`) are gone. A kernel change is an SDK release now. No code
22
+ change.
23
+
8
24
  ## [4.21.0] — 2026-10-14
9
25
 
10
26
  ### Added
package/README.md CHANGED
@@ -121,6 +121,15 @@ const membership = await account.acceptJoin(code); // account = a client with an
121
121
 
122
122
  A bad code (unknown, used, revoked, expired) is one 404 (`err.isNotFound`). Accepting can answer `err.isAlreadyMember` or `err.isPinRequired` (set a PIN first); a refusal never uses up the code.
123
123
 
124
+ Once in, a world key can ask who it is and who else is there (since 4.22.0):
125
+
126
+ ```typescript
127
+ const me = await client.me(); // { world, scope, kind, role, membership, character }
128
+ const roster = await client.members(); // [{ id, kind, role, character, status }], the owner's id is null
129
+ ```
130
+
131
+ `me.membership` is what `created_by` holds on the elements this key creates; `me.role` decides what it may change.
132
+
124
133
  ## Sync
125
134
 
126
135
  ```typescript
package/dist/index.d.ts CHANGED
@@ -2104,6 +2104,37 @@ interface OwSortAnswer {
2104
2104
  token_rating: number;
2105
2105
  [k: string]: unknown;
2106
2106
  }
2107
+ /** GET /me: who this world key is. */
2108
+ interface OwMe {
2109
+ world: {
2110
+ id: string;
2111
+ name: string;
2112
+ };
2113
+ scope: 'read' | 'write';
2114
+ kind: 'owner' | 'person' | 'agent';
2115
+ role: 'owner' | OwMemberRole;
2116
+ /** The membership id (what `created_by` holds for what this key creates), or null for the owner. */
2117
+ membership: string | null;
2118
+ /** The member's Character, or null. */
2119
+ character: string | null;
2120
+ /** Agent seats only: the agent's name. */
2121
+ name?: string;
2122
+ [k: string]: unknown;
2123
+ }
2124
+ /** One row of GET /members, the world's roster. */
2125
+ interface OwMember {
2126
+ /** The membership id (what `created_by` holds), or null for the owner. */
2127
+ id: string | null;
2128
+ kind: 'owner' | 'person' | 'agent';
2129
+ role: 'owner' | OwMemberRole;
2130
+ /** The Character that is this member, or null. */
2131
+ character: string | null;
2132
+ /** `removed` rows stay, so their elements keep `created_by`. */
2133
+ status: 'active' | 'removed';
2134
+ /** Agent rows only: the agent's name. */
2135
+ name?: string;
2136
+ [k: string]: unknown;
2137
+ }
2107
2138
  /** GET /account/allowance: the account's daily AI allowance (keel 872431f, 2026-10-14). */
2108
2139
  interface OwAllowance {
2109
2140
  /** The account's daily allowance in tokens. */
@@ -2395,6 +2426,19 @@ declare class OwV2Client {
2395
2426
  getWorld(): Promise<OwWorldMeta>;
2396
2427
  /** PATCH /world -- partial world-meta update. */
2397
2428
  patchWorld(partial: Record<string, unknown>): Promise<OwWorldMeta>;
2429
+ /**
2430
+ * GET /me -- who this world key is: the world, read or write scope, the kind (owner,
2431
+ * person, agent), the role, the membership id (what `created_by` holds for what this key
2432
+ * creates; null for the owner) and the member's Character. A world key's call; an account
2433
+ * token is a TypeError before sending.
2434
+ */
2435
+ me(): Promise<OwMe>;
2436
+ /**
2437
+ * GET /members -- the world's roster: each member's id (null for the owner), kind, role,
2438
+ * Character and status (`removed` rows stay, so their elements keep `created_by`). Returns
2439
+ * the rows; keel sends them as `{ data }` with no paging. A world key's call.
2440
+ */
2441
+ members(): Promise<OwMember[]>;
2398
2442
  /** GET /{type}/ -- one cursor page. */
2399
2443
  list(type: ElementType | string, params?: ListParams): Promise<OwPage>;
2400
2444
  /** Cursor-walk every page of a type. Politeness: uses config pageSize. */
@@ -3212,11 +3256,12 @@ declare function parseDate(cfg: CalendarConfig, input: string, opts?: ParseOptio
3212
3256
  declare function isParseError(r: ParseResult | ParseError): r is ParseError;
3213
3257
 
3214
3258
  /**
3215
- * World calendars: Atlas's calendar kernel, and which calendars a world holds.
3259
+ * World calendars: the calendar kernel, and which calendars a world holds.
3216
3260
  *
3217
- * `calendar.ts` beside this file is Atlas's `src/core/calendar.ts`, byte for byte
3218
- * (Forge/tools/atlas; recorded in `SOURCES.json`, checked with Assembly's copy-drift).
3219
- * Never edit it here: change Atlas's, then copy and re-record. This file adapts Atlas's
3261
+ * `calendar.ts` beside this file came from Atlas's `src/core/calendar.ts` in 4.20.0, and is
3262
+ * the one copy since Atlas 245aad3 deleted its own and imports this one (Temper, h37 #4472):
3263
+ * a kernel change is an SDK release, and Atlas's 48 kernel tests run against it there too.
3264
+ * Its contract is still Atlas's calendar design, §5 and §5b. This file adapts Atlas's
3220
3265
  * `src/core/calendar-lens.ts` (readCalendarValue, worldCalendars, resolveCalendarLens) to
3221
3266
  * any element shape, since the SDK has no Atlas `Element`.
3222
3267
  *
@@ -3552,4 +3597,4 @@ declare class TokenResource {
3552
3597
  getEncryptionInfo(): Promise<EncryptionInfo>;
3553
3598
  }
3554
3599
 
3555
- export { 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_SCHEMA, type FieldInfo, type FieldType, GameTier, type ListParams, ONLYWORLDS_VERSION, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangesPage, type OwClientConfig, type OwElement, type OwElementBase, type OwErrorBody, type OwJoinPreview, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMediaTicket, type OwMemberRole, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, OwPreconditionFailedError, type OwPreparedPhoto, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, type OwUploadedImage, OwV2Client, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldIndex, type OwWorldMeta, PHOTO_MAX_BYTES, PHOTO_TYPES, type ParseError, type ParseOptions, type ParseResult, 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, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, elementColor, eraForStep, errorFromResponse, familyOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, isDemoKey, isLeapYear, isParseError, kindCanWrite, lookupWorld, monthStartSteps, parseDate, parseErrorEnvelope, pinExpectation, planPhoto, preparePhoto, readCalendarConfig, readCalendarValue, readWorldFile, renderElement, resolveCalendarLens, resolveEraDomains, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
3600
+ export { 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_SCHEMA, type FieldInfo, type FieldType, GameTier, type ListParams, ONLYWORLDS_VERSION, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangesPage, type OwClientConfig, type OwElement, type OwElementBase, type OwErrorBody, type OwJoinPreview, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, OwPreconditionFailedError, type OwPreparedPhoto, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, type OwUploadedImage, OwV2Client, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldIndex, type OwWorldMeta, PHOTO_MAX_BYTES, PHOTO_TYPES, type ParseError, type ParseOptions, type ParseResult, 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, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, elementColor, eraForStep, errorFromResponse, familyOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, isDemoKey, isLeapYear, isParseError, kindCanWrite, lookupWorld, monthStartSteps, parseDate, parseErrorEnvelope, pinExpectation, planPhoto, preparePhoto, readCalendarConfig, readCalendarValue, readWorldFile, renderElement, resolveCalendarLens, resolveEraDomains, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
package/dist/index.js CHANGED
@@ -212,6 +212,31 @@ var OwV2Client = class {
212
212
  async patchWorld(partial) {
213
213
  return this.request("PATCH", "/world/", { body: sanitizePayload(partial) });
214
214
  }
215
+ // -- Who am I, and who is here ---------------------------------------------
216
+ /**
217
+ * GET /me -- who this world key is: the world, read or write scope, the kind (owner,
218
+ * person, agent), the role, the membership id (what `created_by` holds for what this key
219
+ * creates; null for the owner) and the member's Character. A world key's call; an account
220
+ * token is a TypeError before sending.
221
+ */
222
+ async me() {
223
+ if (this.keyKind === "account") {
224
+ throw new TypeError("me needs a world key: an account token is not a member of one world");
225
+ }
226
+ return this.request("GET", "/me/");
227
+ }
228
+ /**
229
+ * GET /members -- the world's roster: each member's id (null for the owner), kind, role,
230
+ * Character and status (`removed` rows stay, so their elements keep `created_by`). Returns
231
+ * the rows; keel sends them as `{ data }` with no paging. A world key's call.
232
+ */
233
+ async members() {
234
+ if (this.keyKind === "account") {
235
+ throw new TypeError("members needs a world key: an account token is not a member of one world");
236
+ }
237
+ const page = await this.request("GET", "/members/");
238
+ return page.data ?? [];
239
+ }
215
240
  // -- Element CRUD --------------------------------------------------------
216
241
  /** GET /{type}/ -- one cursor page. */
217
242
  async list(type, params = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.21.0",
3
+ "version": "4.22.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {