@onlyworlds/sdk 3.1.0 → 4.0.0-alpha.1
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 +34 -30
- package/CHANGELOG.md +103 -44
- package/README.md +144 -332
- package/SCHEMA.md +630 -0
- package/dist/index.d.ts +475 -1471
- package/dist/index.js +713 -1001
- package/package.json +61 -53
- package/dist/index.d.mts +0 -3517
- package/dist/index.mjs +0 -1576
package/AGENTS.md
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
|
-
# For AI agents using @onlyworlds/sdk
|
|
2
|
-
|
|
3
|
-
**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
# For AI agents using @onlyworlds/sdk
|
|
2
|
+
|
|
3
|
+
**Start with [SCHEMA.md](SCHEMA.md)** (in this package): the full generated schema reference —
|
|
4
|
+
every type, every field with its meaning, link directions, families, icons, display sections.
|
|
5
|
+
It is generated from the same canonical YAML as the types, so it cannot drift.
|
|
6
|
+
|
|
7
|
+
**What this package is**: the canonical typed TypeScript client for the OnlyWorlds v2 API,
|
|
8
|
+
plus the canonical constants (element types, icons, colour families, field schema).
|
|
9
|
+
OnlyWorlds is an open standard for portable world data — 22 element types, UUID-linked.
|
|
10
|
+
|
|
11
|
+
**Use the v2 surface.** `OwV2Client` + the `V2ElementType` slug union + the generated
|
|
12
|
+
interfaces in `types.generated.ts` (emitted from the canonical schema YAML, validated
|
|
13
|
+
against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum) is frozen
|
|
14
|
+
legacy — do not build new work on it.
|
|
15
|
+
|
|
16
|
+
**SDK vs MCP server — pick correctly**:
|
|
17
|
+
- Known, deterministic operations (CRUD, sync, bulk) → **this SDK**. Typed calls, typed
|
|
18
|
+
responses, far cheaper than tool-schema reasoning.
|
|
19
|
+
- Live exploration of a user's world from a chat/agent context → the **MCP server** at
|
|
20
|
+
`https://www.onlyworlds.com/mcp` (same `API-Key`/`API-Pin` headers, 11 tools).
|
|
21
|
+
|
|
22
|
+
**Wire facts that bite** (full details in README):
|
|
23
|
+
- Never send a `"world"` field in payloads — world identity comes from the API key (422 otherwise).
|
|
24
|
+
- v2 link fields use ONE name both directions (no `_ids` suffix — that is v1 dialect only).
|
|
25
|
+
- PATCH is destructive on sent fields; use `editLinks` (atomic add/remove) for relationships.
|
|
26
|
+
- World-meta changes do NOT appear in `/changes` — poll `GET /world` separately.
|
|
27
|
+
- Extension fields: `x_<toolname>_*` is the sanctioned namespace for tool-specific state;
|
|
28
|
+
unknown unprefixed fields 422.
|
|
29
|
+
- Colour carries the element's FAMILY (`elementColor(type, mode)`); the icon
|
|
30
|
+
(`ELEMENT_ICONS`) carries the TYPE. Icon + label are required alongside colour, not optional.
|
|
31
|
+
|
|
32
|
+
**Auth**: prefixed keys — `ow_w_` (read+write), `ow_r_` (read-only, no PIN — the share
|
|
33
|
+
primitive), `ow_a_` (account Bearer). Demo keys `0000000000`–`0000000009` are read-only
|
|
34
|
+
test credentials against real data.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,44 +1,103 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to `@onlyworlds/sdk`. Maintained from 3.1.0 onward (Kael, Assembly);
|
|
4
|
-
earlier history lives in git log only.
|
|
5
|
-
|
|
6
|
-
## [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@onlyworlds/sdk`. Maintained from 3.1.0 onward (Kael, Assembly);
|
|
4
|
+
earlier history lives in git log only.
|
|
5
|
+
|
|
6
|
+
## [4.0.0] — 2026-07-23
|
|
7
|
+
|
|
8
|
+
**v2-native only.** See `docs/migrating-3-to-4.md`. 3.x stays published forever for
|
|
9
|
+
pinned consumers.
|
|
10
|
+
|
|
11
|
+
### Removed (BREAKING)
|
|
12
|
+
- The v1 client (`OnlyWorldsClient`), the v1 `ElementType` enum, `icon-utils`.
|
|
13
|
+
`ElementType` at the root is now THE v2 slug union (was `V2ElementType` alias in 3.x).
|
|
14
|
+
- CJS build — the package is ESM-only with a sealed `exports` map (`"type": "module"`,
|
|
15
|
+
`sideEffects: false`).
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Metadata tables (`ELEMENT_ICONS`, `ELEMENT_LABELS`, `ELEMENT_SECTIONS`, `FIELD_SCHEMA`,
|
|
19
|
+
`getElementIcon`, `getElementLabel`) ported onto the v2 slug union — same export names,
|
|
20
|
+
same shapes, contents byte-identical EXCEPT: `FIELD_SCHEMA` `type: 'number'` →
|
|
21
|
+
`'integer'` (70 entries; 'number' dropped from `FieldType`). Migration: consumers
|
|
22
|
+
switching on `'number'` switch on `'integer'`.
|
|
23
|
+
- `TokenResource` now takes a structural `TokenTransport` (`{ request<T>(method, path,
|
|
24
|
+
body?) }`) instead of the removed v1 client. Token surface retained pending the
|
|
25
|
+
wire-fate ruling (RFC-001 §5) — may be removed in a later 4.x.
|
|
26
|
+
|
|
27
|
+
### Added (post-alpha.0, same night)
|
|
28
|
+
- **`ELEMENT_ICONS` GENERATED** from keel's `icon:` wrapper key (keel `56c124a`).
|
|
29
|
+
- **`ELEMENT_SECTIONS` DERIVED** from the canonical schema's own document structure
|
|
30
|
+
(Skeld's ruling: sections are the standard tier's property groups; document order is
|
|
31
|
+
display order). Divergence check vs the old hand table found and fixed three fossils:
|
|
32
|
+
creature "Behaviour"→"Behavior", pin's triple-listed generic link → `element`,
|
|
33
|
+
relation "Involves" listing a nonexistent `relations` field. Canonical is truth.
|
|
34
|
+
- **`SCHEMA.md`** — full generated schema reference (every field with its canonical
|
|
35
|
+
description, link directions, families, icons, sections), ships in the tarball;
|
|
36
|
+
covered by the codegen drift guard. AGENTS.md points agents at it first.
|
|
37
|
+
- **`OwV2Client.request()` is public** (typed escape hatch; does not sanitize) and
|
|
38
|
+
structurally satisfies `TokenTransport` — `new TokenResource(client)` just works.
|
|
39
|
+
Token ruling (Skeld): keel keeps `/tokens/*` long-term; ported, not deleted.
|
|
40
|
+
- README rewritten v2-native (v1 sections, branded types, and the encrypted-key
|
|
41
|
+
walkthrough removed; bulk partial-failure and idempotency-key hygiene promoted).
|
|
42
|
+
|
|
43
|
+
### alpha.1 — consumer-pin fixes (Temper's atlas review, same night)
|
|
44
|
+
- **`parseEnvelope` → `parseErrorEnvelope`** (it parses the platform *error* envelope;
|
|
45
|
+
renamed before the 4.0 name freeze to avoid collision with the world-export envelope).
|
|
46
|
+
- The never-whitelist LAW now lives as a comment on `READ_ONLY_FIELDS` itself.
|
|
47
|
+
- Stale v1 example in the shipped d.ts fixed (TokenResource JSDoc).
|
|
48
|
+
|
|
49
|
+
### Release gates — ALL GREEN (2026-07-23 night)
|
|
50
|
+
- **Gate 3 (wire-log v1-traffic query, Skeld)**: GREEN — no unknown v1-SDK consumer on
|
|
51
|
+
the wire; observed v1 traffic is pinned deployed builds (council proxy, legacy plugin
|
|
52
|
+
walks) that an npm major cannot touch. The v1 API dialect stays served regardless.
|
|
53
|
+
- **`/api/v2/tokens/` live on prod + staging** (keel `e181689`; three-base byte
|
|
54
|
+
agreement test-pinned). `TokenResource` annotates a 404 on token routes as
|
|
55
|
+
"older server", not "no tokens". Requirement noted in the migration guide.
|
|
56
|
+
- **`ONLYWORLDS_VERSION` now GENERATED** from canonical's `VERSION` file (carried
|
|
57
|
+
into keel `schema/` by the refresh script, keel `492168c`) — the last hand-synced
|
|
58
|
+
constant is dead. Consumer soak: Temper pinned the alpha against atlas's full
|
|
59
|
+
static surface — strict-clean compile, correct runtime, package shape approved.
|
|
60
|
+
- **No `npm deprecate` on 3.x** (landscape research; 3.x stays plainly supported).
|
|
61
|
+
- 4.x wishlist: account client (list/mint/create — atlas first consumer), world-export
|
|
62
|
+
envelope reader (§8c), per-status error classes, richer codegen JSDoc, retry/backoff
|
|
63
|
+
parity audit, FIELD_SCHEMA generation with `required:` from YAML.
|
|
64
|
+
|
|
65
|
+
## [3.1.0] — 2026-07-23
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
- **Canonical element colour palette** (`src/v2/palette.ts`, exported from root):
|
|
69
|
+
`ELEMENT_FAMILIES` (type → family), `FAMILY_COLORS` (family → `{light, dark}` hex),
|
|
70
|
+
`familyOf(type)`, `elementColor(type, mode)`, `FAMILY_ORDER`, type `ElementFamily`.
|
|
71
|
+
Four semantic families (agents / world / abstract / temporal) ruled 2026-07-22 after
|
|
72
|
+
CVD-validated measurement (Orrery `product/schema/element-palette-measurements.md`).
|
|
73
|
+
Colour carries the FAMILY; `ELEMENT_ICONS` carries the TYPE. Keyed on the v2 slug
|
|
74
|
+
union. First proven live in atlas and council, whose local copies become re-exports.
|
|
75
|
+
**`ELEMENT_FAMILIES` is GENERATED** from the `family:` key in keel's schema YAML
|
|
76
|
+
(keel `c69366b`, a keel presentation-wrapper key — not part of the council-governed
|
|
77
|
+
OnlyWorlds standard); hexes are hand-authored design constants beside it. Membership
|
|
78
|
+
and hex invariants test-gated (`test/palette.test.mjs`); light hexes render-proven on
|
|
79
|
+
the ruled OnlyWorlds light mode (ow-house-light) 2026-07-23.
|
|
80
|
+
- **Codegen drift guard**: `python codegen/generate_types.py --check` fails if
|
|
81
|
+
`types.generated.ts` doesn't match the schema YAMLs (release gate; mirrors keel's
|
|
82
|
+
schema CI job). Codegen also hard-fails on missing/invalid `family:` keys — the
|
|
83
|
+
canary for a canonical-refresh that overwrote keel's wrapper layer.
|
|
84
|
+
- **CI**: GitHub Action building + running the full suite against the compiled bundle.
|
|
85
|
+
- **AGENTS.md** shipped in the tarball — usage guide for AI agents reading the package
|
|
86
|
+
locally, including the SDK-vs-MCP division of labor and the wire gotchas.
|
|
87
|
+
- README: worked create→link→read-back round-trip, schema-verified field by field
|
|
88
|
+
(also fixes the old example patching `'character'` with a location's id); canonical
|
|
89
|
+
colour section; SDK-vs-MCP guidance.
|
|
90
|
+
- This CHANGELOG.
|
|
91
|
+
|
|
92
|
+
### Fixed
|
|
93
|
+
- `FieldType` union now includes `'number'` — the legacy alias that 70 `FIELD_SCHEMA`
|
|
94
|
+
entries actually carry (consumers switch on it; data normalization deferred to 4.0).
|
|
95
|
+
- `generate_types.py` exits with a clear message when the sibling keel checkout is
|
|
96
|
+
absent instead of a bare traceback.
|
|
97
|
+
|
|
98
|
+
## [3.0.0] — 2026-07-18
|
|
99
|
+
|
|
100
|
+
- v2-native client (`OwV2Client`) absorbed from Assembly's ow-v2-client v0.9.0 (Kael),
|
|
101
|
+
wire-corrected against live staging fixtures (S22). Generated element types from the
|
|
102
|
+
canonical keel schema YAML (`src/v2/types.generated.ts`), validated against all 1,086
|
|
103
|
+
live W11 elements. v1 surface unchanged and frozen.
|