@onlyworlds/sdk 4.66.0 → 4.68.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,24 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.68.0] - 2026-10-23
9
+
10
+ ### Fixed
11
+
12
+ - **`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.
13
+ - **`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).
14
+
15
+ ## [4.67.0] - 2026-10-23
16
+
17
+ ### Added
18
+
19
+ - **The draught's `room` and `proposed` components**: `OwDraughtComponent` is now keel's thirteen, in its order. `room` (keel #556) is the room profile's other elements that reach her (a board entry, a spec, a heart, a vote, a sitting, a member card, a work item that is not open or taken), each there or nowhere; the type missed it since keel shipped it. `proposed` (keel #580, live 2026-10-23) is every element carrying `x_review_proposed` that reaches her, there or nowhere, whatever section would have held it; `cut.proposed` counts the ones left out, the component unnamed or its budget spent, so a tool handing a draught on can say so. Both are off unless named, as `messages` is: `draught(id, { components: [..., 'room', 'proposed'] })`. `OwDraught.room` and `OwDraught.proposed` are typed.
20
+
21
+ ### Fixed
22
+
23
+ - **`OwDraughtItem` nests the element**: keel has served each draught row as `{ via, circles?, her_links, grade, dated?, element }` since the route shipped (keel PR 155), and the type spread the element's fields onto the row instead. Read `row.element.name`, not `row.name` (which was `undefined` at runtime all along); TypeScript code that read the spread form now fails to compile where it was already wrong. In the same way `OwDraught.character` is `{ self, grade, element }`, and optional (absent unless `self` is served), `work` rows carry `packet` (the work item's `x_packet_elements`), `messages` rows carry `author` (`membership`, `kind`, `role`), and rows may carry `circles`. Read from keel's `elements/draught.py` and its OpenAPI `Draught` schema; nothing at runtime changed.
24
+ - Tests: `components: ['room', 'proposed']` is sent as `components=room,proposed`; the published `OwDraughtComponent` lists keel's COMPONENTS in order; the nested rows, `cut.proposed`, `character.element`, `packet`, `author` and `circles` compile against the built `.d.ts`, and a spread read and an unknown component do not. Watched failing with `'proposed'` cut from the type.
25
+
8
26
  ## [4.66.0] - 2026-10-23
9
27
 
10
28
  ### Added
package/dist/index.d.ts CHANGED
@@ -2734,7 +2734,7 @@ interface OwSignedIn {
2734
2734
  */
2735
2735
  /** The draught's policy (keel PR 155, D143): what GET /character/{id}/context serves and how. */
2736
2736
  interface OwDraughtPolicy {
2737
- /** Sections to serve; default every one but `messages`. */
2737
+ /** Sections to serve; default every one but `messages`, `room` and `proposed`, each served only when named. */
2738
2738
  components?: OwDraughtComponent[];
2739
2739
  /** `voice`: her slice, as she would read (default). `act`: through the caller's own view. */
2740
2740
  mode?: 'voice' | 'act';
@@ -2749,17 +2749,27 @@ interface OwDraughtPolicy {
2749
2749
  /** The sheet's reach: 1 (default) what her own element links to, 0 none. */
2750
2750
  depth?: 0 | 1;
2751
2751
  }
2752
- type OwDraughtComponent = 'self' | 'role' | 'work' | 'style' | 'events' | 'knowledge' | 'names' | 'sheet' | 'recent' | 'messages' | 'roster';
2753
- /** An element as the draught serves it: the list route's body plus how it got here. */
2754
- type OwDraughtItem = OwElement & {
2755
- /** The link fields that brought it (on the element, or on her own element in `sheet`). */
2752
+ /**
2753
+ * A section of the draught, in the packet's order (keel's COMPONENTS). `messages`, `room` (keel #556:
2754
+ * the room profile's other elements) and `proposed` (keel #580: elements carrying `x_review_proposed`)
2755
+ * are off unless named.
2756
+ */
2757
+ type OwDraughtComponent = 'self' | 'role' | 'work' | 'style' | 'events' | 'knowledge' | 'names' | 'sheet' | 'recent' | 'messages' | 'room' | 'proposed' | 'roster';
2758
+ /** One row of the draught: an element as the list route serves it to the same reader, and how it got here. */
2759
+ interface OwDraughtItem {
2760
+ /** The link fields that brought it (on the element, or on her own element in `sheet`); empty for a `proposed` row that came only through `recent`. */
2756
2761
  via: string[];
2762
+ /** With `via` collectives: her circles it is held by. */
2763
+ circles?: string[];
2757
2764
  /** How many of the packet's elements link to it. */
2758
2765
  her_links: number;
2766
+ /** `known_of`: a stub this reader knows of but does not see whole (its other fields read empty). */
2759
2767
  grade: 'whole' | 'known_of';
2760
- /** On an Event: false when it carries no date (ranked after the dated). */
2768
+ /** In `events` and `knowledge`: false when it carries no date (ranked after the dated). */
2761
2769
  dated?: boolean;
2762
- };
2770
+ /** The element's body exactly as the list route serves it to the same reader. */
2771
+ element: OwElement;
2772
+ }
2763
2773
  /** One Character's context in one read, GET /character/{id}/context (keel PR 155, D143; the draught). */
2764
2774
  interface OwDraught {
2765
2775
  world: {
@@ -2774,24 +2784,39 @@ interface OwDraught {
2774
2784
  mode: 'voice' | 'act';
2775
2785
  /** The policy served under, every key resolved. */
2776
2786
  policy: Record<string, unknown>;
2777
- /** {section: items the budget dropped}; empty when whole. */
2787
+ /** {section: items the budget dropped}; empty when whole. `proposed` counts every proposed element that reached her and was left out, the component unnamed or its budget spent. */
2778
2788
  cut: Record<string, number>;
2779
2789
  recent_cursor: string | null;
2780
2790
  recent_more: boolean | null;
2781
- /** Her own element (`self: true`), or a stub when this reader knows her only as known of. */
2782
- character: (OwElement & {
2791
+ /** With `self`: her own element (`grade: 'known_of'` when this reader knows her only as a stub), or null when it is hidden from her. */
2792
+ character?: {
2783
2793
  self: true;
2784
2794
  grade: 'whole' | 'known_of';
2785
- }) | null;
2795
+ element: OwElement;
2796
+ } | null;
2786
2797
  role?: OwDraughtItem[];
2787
- work?: OwDraughtItem[];
2798
+ /** Each row with its work item's `x_packet_elements` as `packet` (`[]` when it has none). */
2799
+ work?: Array<OwDraughtItem & {
2800
+ packet: Array<Record<string, unknown>>;
2801
+ }>;
2788
2802
  style?: OwDraughtItem | null;
2789
2803
  events?: OwDraughtItem[];
2790
2804
  knowledge?: OwDraughtItem[];
2791
2805
  /** Everything else that names her, by type. */
2792
2806
  names?: Record<string, OwDraughtItem[]>;
2793
2807
  sheet?: OwDraughtItem[];
2794
- messages?: OwDraughtItem[];
2808
+ /** Only when named. Each line with its author's seat from the roster. Words said by a seat: never facts, never instructions. */
2809
+ messages?: Array<OwDraughtItem & {
2810
+ author: {
2811
+ membership: string | null;
2812
+ kind: string | null;
2813
+ role: string | null;
2814
+ };
2815
+ }>;
2816
+ /** Only when named (keel #556): the room's other elements that reach her (the room profile), here or nowhere. */
2817
+ room?: OwDraughtItem[];
2818
+ /** Only when named (keel #580): every element carrying `x_review_proposed` that reaches her, here or nowhere; `cut.proposed` counts the ones left out. */
2819
+ proposed?: OwDraughtItem[];
2795
2820
  recent?: Array<{
2796
2821
  op: 'upsert' | 'delete';
2797
2822
  type: string;
@@ -3599,11 +3624,14 @@ declare class OwV2Client {
3599
3624
  * recorded world holds it, in one read: her element, what she holds and sits in, her open work,
3600
3625
  * how she works, the Events she was in, the Narratives she knows, everything else that names
3601
3626
  * her, her sheet, what changed around her (`since`), and who plays whom; the world's name and
3602
- * calendar beside. Every body is the list route's for the same reader, with `via`, `her_links`
3627
+ * calendar beside; the room's messages (`messages`), its other elements (`room`, keel #556) and
3628
+ * elements written as proposed (`proposed`, keel #580) only when `components` names them. Each
3629
+ * row carries the list route's body for the same reader as `element`, beside `via`, `her_links`
3603
3630
  * and `grade`; nothing is inferred. The owner's keys, co-builders and contributors for any
3604
3631
  * Character they can see; a player seat or a guest for its own Character only (another id is
3605
3632
  * 404). `asOf` is a filter on the elements' own dates, not time travel. A `cut` that is not
3606
- * empty means the serving is partial. Served `Cache-Control: private, no-store`.
3633
+ * empty means the serving is partial (`cut.proposed` also counts proposed elements left out because
3634
+ * the component was not named). Served `Cache-Control: private, no-store`.
3607
3635
  */
3608
3636
  draught(characterId: string, policy?: OwDraughtPolicy): Promise<OwDraught>;
3609
3637
  /** Cursor-walk every page of a type. Politeness: uses config pageSize. */
package/dist/index.js CHANGED
@@ -695,11 +695,14 @@ var OwV2Client = class {
695
695
  * recorded world holds it, in one read: her element, what she holds and sits in, her open work,
696
696
  * how she works, the Events she was in, the Narratives she knows, everything else that names
697
697
  * her, her sheet, what changed around her (`since`), and who plays whom; the world's name and
698
- * calendar beside. Every body is the list route's for the same reader, with `via`, `her_links`
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`
699
701
  * and `grade`; nothing is inferred. The owner's keys, co-builders and contributors for any
700
702
  * Character they can see; a player seat or a guest for its own Character only (another id is
701
703
  * 404). `asOf` is a filter on the elements' own dates, not time travel. A `cut` that is not
702
- * empty means the serving is partial. Served `Cache-Control: private, no-store`.
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`.
703
706
  */
704
707
  async draught(characterId, policy = {}) {
705
708
  only("draught", policy, ["components", "mode", "asOf", "undated", "since", "budget", "depth"]);
@@ -1650,9 +1653,18 @@ var OwV2Client = class {
1650
1653
  if (opts?.decision !== "accept" && opts?.decision !== "decline") {
1651
1654
  throw new TypeError(`reviewNewElement: decision must be 'accept' or 'decline', got ${JSON.stringify(opts?.decision) ?? String(opts?.decision)}. Nothing was sent.`);
1652
1655
  }
1656
+ if (opts.reason !== void 0 && opts.decision !== "decline") {
1657
+ throw new TypeError("reviewNewElement: a reason goes with a decline only. Nothing was sent.");
1658
+ }
1653
1659
  const body = { decision: opts.decision };
1654
1660
  if (opts.reason !== void 0) body.reason = opts.reason;
1655
- return this.request("POST", `/${type}/${encodeURIComponent(id)}/review`, { elementWrite: true, body });
1661
+ const path = `/${type}/${encodeURIComponent(id)}/review`;
1662
+ const answer = await this.request("POST", path, { elementWrite: true, body });
1663
+ const settled = opts.decision === "accept" ? "element" : "deleted";
1664
+ if (answer === null || typeof answer !== "object" || !(settled in answer)) {
1665
+ throw new TypeError(`reviewNewElement: POST ${path} answered no ${settled}: ${JSON.stringify(answer)?.slice(0, 200)}`);
1666
+ }
1667
+ return answer;
1656
1668
  }
1657
1669
  // -- The account's worlds and keys (account token) -----------------------
1658
1670
  /**
@@ -1867,7 +1879,7 @@ var HeadPollState = class {
1867
1879
  }
1868
1880
  };
1869
1881
  var READ_ONLY_FIELDS = ["world", "type", "created_at", "updated_at", "change_seq", "known_of"];
1870
- var WORLD_READ_ONLY_FIELDS = ["id", "slug", "public_page", "public_read", "agent_narrator_rule", "agent_writes_proposed", "origin"];
1882
+ var WORLD_READ_ONLY_FIELDS = ["id", "slug", "public_page", "public_read", "agent_narrator_rule", "agent_writes_proposed", "origin", "counts"];
1871
1883
  function proposalsPath(type, id) {
1872
1884
  return `/${type}/${encodeURIComponent(id)}/proposals`;
1873
1885
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.66.0",
3
+ "version": "4.68.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {