@onlyworlds/sdk 4.67.0 → 4.69.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/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.69.0] - 2026-10-23
9
+
10
+ ### Added
11
+
12
+ - **`draught(id, { compact: true })`** (keel #585, PR 198): the draught without its empty sections. Every empty array or object section and an empty `cut` are left out. The frame (`world`, `calendar`, `as_of`, `now`, `mode`, `policy`) and every null stay, so a null is still an answer: `character` null means she is hidden from this reader, `style` null that she has no style element, `recent_cursor` null that the read had no `since`. An absent section means nothing in it, never that it was not read (`policy.components` says what was). The answer is typed `OwDraughtCompact` (`cut` optional); without `compact`, or with `compact: false`, it is `OwDraught` as before, the fixed shape. A `compact` that is not a boolean is a TypeError before anything is sent. MCP's `get_draught` defaults to compact; this route defaults to the fixed shape.
13
+
14
+ ## [4.68.0] - 2026-10-23
15
+
16
+ ### Fixed
17
+
18
+ - **`patchWorld` strips `counts`**, which a keyless `GET /world` carries (keel #421 PR 4, the public reader on since 2026-10-23) and `PATCH` answers as an unknown key, so the body of a keyless read goes back too. Quillon's port found it (h29 #11241); the Python package's live wire test went red on the same key the same hour.
19
+ - **`reviewNewElement` refuses a reason with an accept** before sending (keel takes `{ decision: 'accept' }` alone; a reason was its 422), and **checks its answer**: an accept that answers no `element`, or a decline no `deleted`, is a `TypeError` naming the route. Both as the Python package does (Quillon, h29 #11241).
20
+
8
21
  ## [4.67.0] - 2026-10-23
9
22
 
10
23
  ### Added
package/dist/index.d.ts CHANGED
@@ -2748,6 +2748,15 @@ interface OwDraughtPolicy {
2748
2748
  budget?: number;
2749
2749
  /** The sheet's reach: 1 (default) what her own element links to, 0 none. */
2750
2750
  depth?: 0 | 1;
2751
+ /**
2752
+ * `true` (keel #585) leaves out every empty section (an empty array or object) and an empty `cut`;
2753
+ * the frame (`world`, `calendar`, `as_of`, `now`, `mode`, `policy`) and every null stay, so a null
2754
+ * is still an answer (`character`: she is hidden from this reader; `style`: she has no style
2755
+ * element; `recent_cursor`: this read had no `since`). An absent section means nothing in it, never
2756
+ * that it was not read (`policy.components` says what was read). Default `false`, the fixed shape;
2757
+ * with `compact` the answer is typed `OwDraughtCompact`.
2758
+ */
2759
+ compact?: boolean;
2751
2760
  }
2752
2761
  /**
2753
2762
  * A section of the draught, in the packet's order (keel's COMPONENTS). `messages`, `room` (keel #556:
@@ -2771,6 +2780,10 @@ interface OwDraughtItem {
2771
2780
  element: OwElement;
2772
2781
  }
2773
2782
  /** One Character's context in one read, GET /character/{id}/context (keel PR 155, D143; the draught). */
2783
+ /** The draught under `compact` (keel #585): every section may be absent, and so may `cut` (nothing was cut). */
2784
+ type OwDraughtCompact = Omit<OwDraught, 'cut'> & {
2785
+ cut?: Record<string, number>;
2786
+ };
2774
2787
  interface OwDraught {
2775
2788
  world: {
2776
2789
  id: string;
@@ -2862,8 +2875,8 @@ interface OwCreateAccountWorldInput {
2862
2875
  }
2863
2876
  /**
2864
2877
  * createAccountWorld's 201: the world's row as listAccountWorlds lists it, plus the full write key
2865
- * once in `key` (never shown again). keel's document gives this answer no schema; the keys are
2866
- * keel's handler's (`accounts/api.py`, `create_world`: the list row plus `key`).
2878
+ * once in `key` (never shown again). keel's document names it `AccountWorldCreated` (keel #579), and
2879
+ * Assembly's verify-sdk-wire holds this type to it key for key.
2867
2880
  */
2868
2881
  interface OwCreatedAccountWorld {
2869
2882
  id: string;
@@ -3633,7 +3646,10 @@ declare class OwV2Client {
3633
3646
  * empty means the serving is partial (`cut.proposed` also counts proposed elements left out because
3634
3647
  * the component was not named). Served `Cache-Control: private, no-store`.
3635
3648
  */
3636
- draught(characterId: string, policy?: OwDraughtPolicy): Promise<OwDraught>;
3649
+ draught(characterId: string, policy?: OwDraughtPolicy & {
3650
+ compact?: false;
3651
+ }): Promise<OwDraught>;
3652
+ draught(characterId: string, policy: OwDraughtPolicy): Promise<OwDraughtCompact>;
3637
3653
  /** Cursor-walk every page of a type. Politeness: uses config pageSize. */
3638
3654
  listAll(type: ElementType | string, params?: Omit<ListParams, 'cursor'>): AsyncGenerator<OwElement>;
3639
3655
  /**
@@ -5428,4 +5444,4 @@ declare class TokenResource {
5428
5444
  getEncryptionInfo(): Promise<EncryptionInfo>;
5429
5445
  }
5430
5446
 
5431
- 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 OwCreateAccountWorldInput, type OwCreatedAccountWorld, 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, 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 OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, 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 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, 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, typeWord, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
5447
+ 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 OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDraught, type OwDraughtCompact, 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, 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 OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, 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 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, 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, typeWord, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
package/dist/index.js CHANGED
@@ -690,22 +690,11 @@ var OwV2Client = class {
690
690
  });
691
691
  return this.request("GET", `/${type}/`, { query });
692
692
  }
693
- /**
694
- * GET /character/{id}/context -- the draught (keel PR 155, D143): what one Character knows, as the
695
- * recorded world holds it, in one read: her element, what she holds and sits in, her open work,
696
- * how she works, the Events she was in, the Narratives she knows, everything else that names
697
- * her, her sheet, what changed around her (`since`), and who plays whom; the world's name and
698
- * calendar beside; the room's messages (`messages`), its other elements (`room`, keel #556) and
699
- * elements written as proposed (`proposed`, keel #580) only when `components` names them. Each
700
- * row carries the list route's body for the same reader as `element`, beside `via`, `her_links`
701
- * and `grade`; nothing is inferred. The owner's keys, co-builders and contributors for any
702
- * Character they can see; a player seat or a guest for its own Character only (another id is
703
- * 404). `asOf` is a filter on the elements' own dates, not time travel. A `cut` that is not
704
- * empty means the serving is partial (`cut.proposed` also counts proposed elements left out because
705
- * the component was not named). Served `Cache-Control: private, no-store`.
706
- */
707
693
  async draught(characterId, policy = {}) {
708
- only("draught", policy, ["components", "mode", "asOf", "undated", "since", "budget", "depth"]);
694
+ only("draught", policy, ["components", "mode", "asOf", "undated", "since", "budget", "depth", "compact"]);
695
+ if (policy.compact !== void 0 && typeof policy.compact !== "boolean") {
696
+ throw new TypeError("draught: compact is true or false. Nothing was sent.");
697
+ }
709
698
  const query = buildQuery({
710
699
  components: policy.components?.join(","),
711
700
  mode: policy.mode,
@@ -713,7 +702,8 @@ var OwV2Client = class {
713
702
  undated: policy.undated,
714
703
  since: policy.since,
715
704
  budget: policy.budget,
716
- depth: policy.depth
705
+ depth: policy.depth,
706
+ compact: policy.compact
717
707
  });
718
708
  return this.request("GET", `/character/${characterId}/context`, { query });
719
709
  }
@@ -1653,9 +1643,18 @@ var OwV2Client = class {
1653
1643
  if (opts?.decision !== "accept" && opts?.decision !== "decline") {
1654
1644
  throw new TypeError(`reviewNewElement: decision must be 'accept' or 'decline', got ${JSON.stringify(opts?.decision) ?? String(opts?.decision)}. Nothing was sent.`);
1655
1645
  }
1646
+ if (opts.reason !== void 0 && opts.decision !== "decline") {
1647
+ throw new TypeError("reviewNewElement: a reason goes with a decline only. Nothing was sent.");
1648
+ }
1656
1649
  const body = { decision: opts.decision };
1657
1650
  if (opts.reason !== void 0) body.reason = opts.reason;
1658
- return this.request("POST", `/${type}/${encodeURIComponent(id)}/review`, { elementWrite: true, body });
1651
+ const path = `/${type}/${encodeURIComponent(id)}/review`;
1652
+ const answer = await this.request("POST", path, { elementWrite: true, body });
1653
+ const settled = opts.decision === "accept" ? "element" : "deleted";
1654
+ if (answer === null || typeof answer !== "object" || !(settled in answer)) {
1655
+ throw new TypeError(`reviewNewElement: POST ${path} answered no ${settled}: ${JSON.stringify(answer)?.slice(0, 200)}`);
1656
+ }
1657
+ return answer;
1659
1658
  }
1660
1659
  // -- The account's worlds and keys (account token) -----------------------
1661
1660
  /**
@@ -1870,7 +1869,7 @@ var HeadPollState = class {
1870
1869
  }
1871
1870
  };
1872
1871
  var READ_ONLY_FIELDS = ["world", "type", "created_at", "updated_at", "change_seq", "known_of"];
1873
- var WORLD_READ_ONLY_FIELDS = ["id", "slug", "public_page", "public_read", "agent_narrator_rule", "agent_writes_proposed", "origin"];
1872
+ var WORLD_READ_ONLY_FIELDS = ["id", "slug", "public_page", "public_read", "agent_narrator_rule", "agent_writes_proposed", "origin", "counts"];
1874
1873
  function proposalsPath(type, id) {
1875
1874
  return `/${type}/${encodeURIComponent(id)}/proposals`;
1876
1875
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.67.0",
3
+ "version": "4.69.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {