@onlyworlds/sdk 4.59.0 → 4.61.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
@@ -27,7 +27,7 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
27
27
  - Never send a `"world"` field in payloads — world identity comes from the API key (422 otherwise).
28
28
  - v2 link fields use ONE name both directions (no `_ids` suffix — that is v1 dialect only).
29
29
  - PATCH is destructive on sent fields; use `editLinks` (atomic add/remove) for relationships.
30
- - Offline or stale edits: pass `{ ifMatch: el.change_seq }` to `patch`/`editLinks` (since 4.9.0).
30
+ - Offline or stale edits: pass `{ ifMatch: el.change_seq }` to `patch`/`editLinks` (since 4.9.0) and `delete` (since 4.61.0, keel #563).
31
31
  If the element moved, nothing is written and `OwPreconditionFailedError` (412) carries
32
32
  `current`; the server never merges, the client decides.
33
33
  - Polling: `changesHead()` (since 4.15.0) gives `{head, cursor, epoch, unchanged}` without a
@@ -64,8 +64,11 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
64
64
  - Allowance (since 4.21.0, account token): `account.allowance()` reads the daily AI allowance
65
65
  without spending: `{ token_rating, tokens_used_today, tokens_remaining, resets_at }`.
66
66
  - Who am I (since 4.22.0, a world key): `client.me()` is `{ world, scope, kind, role,
67
- membership, character }` (`membership` is what `created_by` holds for what you create; null
68
- for the owner); `client.members()` is the roster's rows. An account token is a TypeError.
67
+ membership, character, front_door }` (`membership` is what `created_by` holds for what you
68
+ create; null for the owner); `front_door` (since 4.60.0, keel #558) names who answers for your
69
+ seat (`sponsor`, `sponsor_character`), your Character, and the world's Charter with up to five
70
+ skill Objects: an agent reads `charter` first. `client.members()` is the roster's rows. An
71
+ account token is a TypeError.
69
72
  - Signing in (no key needed): `new OwV2Client().signInWithPassword({ email, password,
70
73
  tokenName })` (or `username`) mints an `ow_a_` account token named for the device and ends
71
74
  the sign-in session; only the token comes back. Refusals: `OwSignInError` with `reason`
package/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.61.0] - 2026-10-22
9
+
10
+ ### Added
11
+
12
+ - **`delete(type, id, { ifMatch })`** (keel #563, PR 183, live 2026-10-22 21:3x): `DELETE` reads `If-Match` exactly as `PATCH` does. With the element's `change_seq` as you read it, a delete of an element someone changed since is refused, `OwPreconditionFailedError` (412) with `current`, nothing deleted; on an element already gone it is the idempotent 204. Under a world's proposals switch a delete is never a proposal. The options object refuses an unknown key like every other.
13
+ - Tests: the header sent and left out, the unknown option, the 412; each watched failing with the header dropped. The wire gate now reads from keel's document which Character operations take `If-Match` (it held a hand list of two and missed this one) and fails on 4.60.0.
14
+
15
+ ## [4.60.0] - 2026-10-22
16
+
17
+ ### Added
18
+
19
+ - **`OwFrontDoor`, and `front_door` on `OwMe` and `OwAgentJoined`** (keel #558, D152, live 2026-10-22 20:1x). `me()`, `setMyCharacter()` and an agent's `redeemJoin()` answer carry the world's front door for the key: `sponsor` (`{id, kind, name}` of the person who answers for a seat, or null), `sponsor_character`, `my_character`, `charter` (the world's Charter, every member's to read: read it first) and `charter_skill` (up to five Objects the Charter names). Every id is one the key may read; anything hidden is null or left out. Types only: the client already passed the body through. Required on both types, as keel's document declares it; a hand-built `OwMe` in a consumer's test needs the field.
20
+
8
21
  ## [4.59.0] - 2026-10-22
9
22
 
10
23
  ### Changed
package/README.md CHANGED
@@ -165,7 +165,7 @@ await account.revokeWorldLink(worldId, made.id);
165
165
  Once in, a world key can ask who it is and who else is there (since 4.22.0):
166
166
 
167
167
  ```typescript
168
- const me = await client.me(); // { world, scope, kind, role, membership, character }
168
+ const me = await client.me(); // { world, scope, kind, role, membership, character, front_door }: front_door.charter is the house rules, read first
169
169
  const roster = await client.members(); // [{ id, kind, role, character, status }], the owner's id is null
170
170
  ```
171
171
 
@@ -186,7 +186,7 @@ Edits to the world itself (its name, calendar, `public_read`) don't appear in th
186
186
 
187
187
  ### Only if unchanged
188
188
 
189
- A client that edits offline, or from a copy it has held a while, can ask for an update to land only if nobody changed the element since it was read: pass the `change_seq` you read as `ifMatch`, on `patch` or `editLinks`.
189
+ A client that edits offline, or from a copy it has held a while, can ask for an update to land only if nobody changed the element since it was read: pass the `change_seq` you read as `ifMatch`, on `patch`, `editLinks` or `delete` (since 4.61.0: a delete of an element someone changed since you read it is refused, nothing deleted).
190
190
 
191
191
  ```typescript
192
192
  try {
package/dist/index.d.ts CHANGED
@@ -2420,8 +2420,36 @@ interface OwMe {
2420
2420
  character: string | null;
2421
2421
  /** Agent seats only: the agent's name. */
2422
2422
  name?: string;
2423
+ /** Who you are here, who answers for you, and the house rules (keel #558). */
2424
+ front_door: OwFrontDoor;
2423
2425
  [k: string]: unknown;
2424
2426
  }
2427
+ /**
2428
+ * A world's front door for one key (keel #558, D152): on `GET /me`, `PUT /me/character` and an
2429
+ * agent's `POST /join` answer. Every id is one the key may read; anything hidden from it, or
2430
+ * outside what its role sees, is null or left out. Read `charter` first.
2431
+ */
2432
+ interface OwFrontDoor {
2433
+ /**
2434
+ * The person who answers for this seat (an AI or a player seat): `id` their membership id
2435
+ * (null for the world's owner), `kind`, and `name` their Character's name (null when they play
2436
+ * none this key can read). Null for the owner's keys, a person's own key, and a seat made from a
2437
+ * link for an email address (which never says whose account the address matched).
2438
+ */
2439
+ sponsor: {
2440
+ id: string | null;
2441
+ kind: 'owner' | 'person';
2442
+ name: string | null;
2443
+ } | null;
2444
+ /** The sponsor's Character, the one to address a message to, or null. */
2445
+ sponsor_character: string | null;
2446
+ /** Your own Character (the owner's: the world's `owner_character`), or null. */
2447
+ my_character: string | null;
2448
+ /** The world's Charter: the newest Law with supertype Charter made by the owner or a co-builder, or null. Every member may read it. */
2449
+ charter: string | null;
2450
+ /** The Objects the Charter's description names (by `ow://` link or id), in the order written, at most five; empty when none. */
2451
+ charter_skill: string[];
2452
+ }
2425
2453
  /** One row of GET /members, the world's roster. */
2426
2454
  interface OwMember {
2427
2455
  /** The membership id (what `created_by` holds), or null for the owner. */
@@ -2558,6 +2586,8 @@ interface OwAgentJoined {
2558
2586
  env: string;
2559
2587
  next: string[];
2560
2588
  members: Array<Record<string, unknown>>;
2589
+ /** The world's front door for the new seat: its sponsor, its Character, the Charter to read first (keel #558). */
2590
+ front_door: OwFrontDoor;
2561
2591
  [k: string]: unknown;
2562
2592
  }
2563
2593
  /** POST /join, a player's code: a read key for a friend with no account, reading as a guest (keel #353). Shown once. */
@@ -3480,8 +3510,15 @@ declare class OwV2Client {
3480
3510
  * DELETE /{type}/{id}/ -- idempotent (204 on absent). Server writes a
3481
3511
  * tombstone AND scrubs the id from every other element's links in the same
3482
3512
  * transaction -- no client-side unlink pass needed, ever.
3513
+ *
3514
+ * `ifMatch` (keel #563, as on patch()): the element's `change_seq` as you read it. The delete
3515
+ * lands only if nothing changed since; otherwise an OwPreconditionFailedError (412) whose
3516
+ * `current` is the element as it is now, and nothing is deleted. On an element already gone it
3517
+ * is the idempotent 204. Under a world's proposals switch a delete is never a proposal.
3483
3518
  */
3484
- delete(type: ElementType | string, id: string): Promise<void>;
3519
+ delete(type: ElementType | string, id: string, opts?: {
3520
+ ifMatch?: number;
3521
+ }): Promise<void>;
3485
3522
  /**
3486
3523
  * POST /{type}/{id}/links/{field} with {add, remove} -- atomic link merge.
3487
3524
  * Dedupes, tolerates already-present/already-absent ids. Returns the FULL
@@ -5130,4 +5167,4 @@ declare class TokenResource {
5130
5167
  getEncryptionInfo(): Promise<EncryptionInfo>;
5131
5168
  }
5132
5169
 
5133
- 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, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwClientConfig, type OwCreatedWorldLink, type OwDeleteReason, type OwDraught, type OwDraughtComponent, type OwDraughtItem, type OwDraughtPolicy, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, 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 OwMintedKey, 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 OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwSeat, type OwSeatCreated, 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 OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldIndex, type OwWorldLink, type OwWorldMeta, type OwWorldProposalQuery, type OwWorldPublicPage, type OwWriteDoor, PHOTO_MAX_BYTES, PHOTO_TYPES, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, 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, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, isAgentDoor, isDemoKey, isKnownOf, isLeapYear, isParseError, isRoomElement, kindCanWrite, lookupWorld, monthStartSteps, parseDate, parseErrorEnvelope, pinExpectation, pkceChallenge, planPhoto, preparePhoto, readCalendarConfig, readCalendarValue, readWorldFile, renderElement, resolveCalendarLens, resolveEraDomains, simpleCaseFold, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
5170
+ 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, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwClientConfig, type OwCreatedWorldLink, type OwDeleteReason, type OwDraught, type OwDraughtComponent, type OwDraughtItem, type OwDraughtPolicy, 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 OwMintedKey, 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 OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwSeat, type OwSeatCreated, 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 OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldIndex, type OwWorldLink, type OwWorldMeta, type OwWorldProposalQuery, type OwWorldPublicPage, type OwWriteDoor, PHOTO_MAX_BYTES, PHOTO_TYPES, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, 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, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, isAgentDoor, isDemoKey, isKnownOf, isLeapYear, isParseError, isRoomElement, kindCanWrite, lookupWorld, monthStartSteps, parseDate, parseErrorEnvelope, pinExpectation, pkceChallenge, planPhoto, preparePhoto, readCalendarConfig, readCalendarValue, readWorldFile, renderElement, resolveCalendarLens, resolveEraDomains, simpleCaseFold, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
package/dist/index.js CHANGED
@@ -766,9 +766,15 @@ var OwV2Client = class {
766
766
  * DELETE /{type}/{id}/ -- idempotent (204 on absent). Server writes a
767
767
  * tombstone AND scrubs the id from every other element's links in the same
768
768
  * transaction -- no client-side unlink pass needed, ever.
769
+ *
770
+ * `ifMatch` (keel #563, as on patch()): the element's `change_seq` as you read it. The delete
771
+ * lands only if nothing changed since; otherwise an OwPreconditionFailedError (412) whose
772
+ * `current` is the element as it is now, and nothing is deleted. On an element already gone it
773
+ * is the idempotent 204. Under a world's proposals switch a delete is never a proposal.
769
774
  */
770
- async delete(type, id) {
771
- await this.request("DELETE", `/${type}/${id}/`, { write: true, elementWrite: true, allowEmpty: true });
775
+ async delete(type, id, opts = {}) {
776
+ only("delete", opts, ["ifMatch"]);
777
+ await this.request("DELETE", `/${type}/${id}/`, { write: true, elementWrite: true, allowEmpty: true, ifMatch: opts.ifMatch });
772
778
  }
773
779
  /**
774
780
  * POST /{type}/{id}/links/{field} with {add, remove} -- atomic link merge.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.59.0",
3
+ "version": "4.61.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {