@onlyworlds/sdk 4.165.2 → 4.166.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.34.1-dist.127** (canonical 00.34.01).
3
+ **Current as of**: SDK **4.x** · schema-dist **v0.34.1-dist.128** (canonical 00.34.01).
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,18 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.166.0] - 2026-11-14
9
+
10
+ schema-dist v0.34.1-dist.128 (canonical 00.34.01 unchanged; `ONLYWORLDS_VERSION` unchanged, no schema file moved). The fixtures' new cases pass: the lens fixture's 235, the message fixture's 102 (its two `recipients` cases), the address fixture's two `prose-all` cases, the landing fixture's 33.
11
+
12
+ ### Changed
13
+
14
+ - `worldGraph` reads a multi-link that names one element twice once: one edge, at its first entry, whose `index` is that entry's place in the list as served; the entries after the repeat keep their own places (in `[c1, c1, c2]` the edge to `c1` has index 0 and the edge to `c2` index 2). Schema links and the declared extension links (`x_lens_leads_to`, `x_spine_depends_on`) alike; ids compare as written, so `a` and `A` are two.
15
+ - `worldGraph` counts a repeat to an element that is not a node once in `edgesCut`, not once per entry.
16
+ - `degreeOf` and `landingOf` follow the graph without a change of their own: a list naming one element twice counts 1 at each end, so an element linked only that way is a near orphan.
17
+ - `recipientsOf` answers each recipient once, in its first place; ids compare as written.
18
+ - `recipientsOf`, `isAddressedTo`, `isToEveryone` and `hasUnseenRecipients` answer for a message only: any other Narrative, a Story or a Note, has no recipients and is addressed to nobody, whatever its `characters` holds (a Story's `characters` are the people it is about).
19
+
8
20
  ## [4.165.2] - 2026-11-14
9
21
 
10
22
  ### Fixed
package/SCHEMA.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # OnlyWorlds Schema Reference
2
2
 
3
- **Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.34.1-dist.127** — canonical schema **00.34.01**, published 2026-11-14.
3
+ **Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.34.1-dist.128** — canonical schema **00.34.01**, published 2026-11-14.
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
@@ -2079,8 +2079,9 @@ declare function isNote(element: object | null | undefined): boolean;
2079
2079
  /**
2080
2080
  * The message's recipients: the Character ids in its `characters`, as written. An empty list
2081
2081
  * (the field absent, null or `[]`) means the message is addressed to every member of the world;
2082
- * use `isAddressedTo` for the question "is it for X". No other field addresses a message. A Note
2083
- * has no recipients: `[]`, whatever its `characters` holds.
2082
+ * use `isAddressedTo` for the question "is it for X". No other field addresses a message. A Note,
2083
+ * or any Narrative that is not a message, has no recipients: `[]`, whatever its `characters` holds (since serial 128). A list that names one Character twice
2084
+ * answers it once, in its first place; ids compare as written, so `a` and `A` are two (since serial 128).
2084
2085
  */
2085
2086
  declare function recipientsOf(message: object | null | undefined): string[];
2086
2087
  /**
@@ -2089,7 +2090,7 @@ declare function recipientsOf(message: object | null | undefined): string[];
2089
2090
  * An empty list whose `x_served_trimmed` names `characters` is to someone the reader cannot see and
2090
2091
  * addresses no Character the reader is given. Not `narrator`, not a name or an id in the text, not
2091
2092
  * any other link. A sender is not addressed by sending. An empty id (`""`) is no Character: nothing
2092
- * is addressed to it, not even a message to everyone. A Note is addressed to nobody.
2093
+ * is addressed to it, not even a message to everyone. A Note, or any Narrative that is not a message, is addressed to nobody (since serial 128).
2093
2094
  */
2094
2095
  declare function isAddressedTo(message: object | null | undefined, characterId: string): boolean;
2095
2096
  /**
@@ -2106,7 +2107,7 @@ declare function isToEveryone(message: object | null | undefined, options?: OwAd
2106
2107
  * `characters` trimmed (its `x_served_trimmed` list names `characters`), whatever is left in the
2107
2108
  * list. It says that such a recipient exists, never who or how many. Null for a body read keyless
2108
2109
  * (`{ keyless: true }`): it carries no mark, so the reader cannot say either way. False for a Note,
2109
- * which has no recipients.
2110
+ * or any Narrative that is not a message, which has no recipients (since serial 128).
2110
2111
  */
2111
2112
  declare function hasUnseenRecipients(message: object | null | undefined, options?: OwAddressingOptions): boolean | null;
2112
2113
  /**
@@ -6199,7 +6200,7 @@ interface OwGraphNode {
6199
6200
  /** True on a guest's known-of element, a stub that has no edges out; absent otherwise. */
6200
6201
  known_of?: true;
6201
6202
  }
6202
- /** One link: one source, one field, one target, at its place in the field's list (0 for a single link). */
6203
+ /** One link: one source, one field, one target, at its place in the field's list as served (0 for a single link); a target the list names twice is one edge, at its first place (since serial 128). */
6203
6204
  interface OwGraphEdge {
6204
6205
  source: string;
6205
6206
  field: string;
@@ -6234,7 +6235,10 @@ interface OwWorldGraph {
6234
6235
  * Each schema link field, and each extension field a profile declares a link (`x_lens_leads_to`,
6235
6236
  * `x_spine_depends_on`), gives one edge per target that is a node, with the target's place in the list as
6236
6237
  * the reader is served it (the owner's list as stored; any other reader's leaves out what it does not see
6237
- * and keeps a proposed id its rung sees); a link held on both ends is two edges. A Pin's generic pair
6238
+ * and keeps a proposed id its rung sees); a link held on both ends is two edges. A multi-link names each
6239
+ * element once: a list that names one element twice gives one edge, or one count in `edgesCut`, at its first
6240
+ * entry, and the entries after the repeat keep their own places (in `[c1, c1, c2]` the edge to `c1` has index 0
6241
+ * and the edge to `c2` index 2); ids compare as written, so `a` and `A` are two (since serial 128). A Pin's generic pair
6238
6242
  * (`element_type`, `element_id`) is its placement, never an edge; its `map` link is. A guest's known-of
6239
6243
  * element has no edges out. A link to an element of another type than its field's target draws no edge and
6240
6244
  * is not counted. A link to an element that is not a node is counted in `edgesCut` by that element's reason: the
@@ -6250,7 +6254,7 @@ declare function worldGraph(world: OwLensWorld, reader: OwLensReader, options?:
6250
6254
  /**
6251
6255
  * Each node's degree in a graph `worldGraph` answered: the number of its edges, in or out, each edge counted
6252
6256
  * once for every node it touches (a mirror pair is two edges, so each end counts 2; a link to itself counts
6253
- * once). Every node is a key, 0 included, in the graph's node order. Edges join nodes only, so the count is
6257
+ * once). A list that names one element twice is one edge, so each end counts 1 (since serial 128). Every node is a key, 0 included, in the graph's node order. Edges join nodes only, so the count is
6254
6258
  * the reader's: what the reading left out (hidden, room, proposed, map space, past a lens) is never counted.
6255
6259
  * This is "most linked" for a finder: rank by it, highest first. A graph that is not one is a TypeError.
6256
6260
  */
package/dist/index.js CHANGED
@@ -2880,24 +2880,25 @@ function isNote(element) {
2880
2880
  return matchesPair(element, NOTE_PAIR);
2881
2881
  }
2882
2882
  function recipientsOf(message) {
2883
- const list2 = isBody(message) && !isNote(message) ? message.characters : void 0;
2884
- return Array.isArray(list2) ? list2.filter((c) => typeof c === "string" && c !== "") : [];
2883
+ const list2 = isBody(message) && isMessage(message) ? message.characters : void 0;
2884
+ if (!Array.isArray(list2)) return [];
2885
+ return [...new Set(list2.filter((c) => typeof c === "string" && c !== ""))];
2885
2886
  }
2886
2887
  function isAddressedTo(message, characterId) {
2887
- if (!isBody(message) || isNote(message) || typeof characterId !== "string" || characterId === "") return false;
2888
+ if (!isBody(message) || !isMessage(message) || typeof characterId !== "string" || characterId === "") return false;
2888
2889
  if (isToEveryone(message)) return true;
2889
2890
  const list2 = message.characters;
2890
2891
  return Array.isArray(list2) && list2.includes(characterId);
2891
2892
  }
2892
2893
  function isToEveryone(message, options) {
2893
2894
  const keyless = keylessOf("isToEveryone", options);
2894
- if (!isBody(message) || isNote(message) || keyless || hasUnseenRecipients(message) === true) return false;
2895
+ if (!isBody(message) || !isMessage(message) || keyless || hasUnseenRecipients(message) === true) return false;
2895
2896
  const list2 = message.characters;
2896
2897
  return list2 === void 0 || list2 === null || Array.isArray(list2) && list2.length === 0;
2897
2898
  }
2898
2899
  function hasUnseenRecipients(message, options) {
2899
2900
  const keyless = keylessOf("hasUnseenRecipients", options);
2900
- if (!isBody(message) || isNote(message)) return false;
2901
+ if (!isBody(message) || !isMessage(message)) return false;
2901
2902
  if (keyless) return null;
2902
2903
  const mark = message.x_served_trimmed;
2903
2904
  return Array.isArray(mark) && mark.includes("characters");
@@ -4066,18 +4067,27 @@ function worldGraph(world, reader, options) {
4066
4067
  const v = el[field];
4067
4068
  const to = linkTarget(el, field, target);
4068
4069
  const list2 = many ? Array.isArray(v) ? v : [] : [v];
4070
+ const read = /* @__PURE__ */ new Set();
4069
4071
  let served = 0;
4070
4072
  for (let i = 0; i < list2.length; i++) {
4071
4073
  const t = list2[i];
4072
4074
  const typed = typeof t === "string" && r.typeOf.get(t) === to;
4073
- if (typed) visit(source, field, t, seenOwner ? i : served);
4075
+ if (typed && !read.has(t)) {
4076
+ read.add(t);
4077
+ visit(source, field, t, seenOwner ? i : served);
4078
+ }
4074
4079
  if (seenOwner || typed && r.linkable.has(t)) served++;
4075
4080
  }
4076
4081
  }
4077
4082
  for (const field of DECLARED_LINKS) {
4078
4083
  const v = el[field];
4079
4084
  if (!Array.isArray(v)) continue;
4080
- for (let i = 0; i < v.length; i++) visit(source, field, v[i], i);
4085
+ const read = /* @__PURE__ */ new Set();
4086
+ for (let i = 0; i < v.length; i++) {
4087
+ if (read.has(v[i])) continue;
4088
+ read.add(v[i]);
4089
+ visit(source, field, v[i], i);
4090
+ }
4081
4091
  }
4082
4092
  }
4083
4093
  edges.sort((a, b) => byCodePoint(a.source, b.source) || byCodePoint(a.field, b.field) || a.index - b.index);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.165.2",
3
+ "version": "4.166.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {