@onlyworlds/sdk 4.22.0 → 4.24.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 +34 -0
- package/README.md +14 -3
- package/dist/index.d.ts +98 -17
- package/dist/index.js +68 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,40 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.24.0] — 2026-10-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **A world's invite links** (keel C1, 48c10d4), on the owner's account token (`ow_a_`):
|
|
12
|
+
`createWorldLink(worldId, { reader, role?, days?, inviterName?, withCharacter? })` answers the
|
|
13
|
+
new link with its `code`, `link` and the one `line` to send (the code is in this answer only:
|
|
14
|
+
keel keeps a hash); `listWorldLinks(worldId)` the links without codes, each with its `status`
|
|
15
|
+
and `uses`; `revokeWorldLink(worldId, linkId)`. Types `OwWorldLink`, `OwCreatedWorldLink`. A
|
|
16
|
+
non-owner, and a world that doesn't exist, get 404; a world key is a TypeError before sending.
|
|
17
|
+
For Lantern's Invite someone (Temper, h29 #5152).
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- `acceptJoin`'s doc comment and the README: accepting needs no account PIN for any role (keel
|
|
21
|
+
#297, ed73c90), so its refusals are 404 and 409 `already_member`; `pin_required` now belongs to
|
|
22
|
+
minting a write key for the membership. `isPinRequired` stays.
|
|
23
|
+
- Doc comments say "token rating" for the account's daily budget (`ask`, `sort`, `allowance`,
|
|
24
|
+
`OwAllowance`, the answers' `token_rating`), as the README did in 4.23.0; the docs site's
|
|
25
|
+
generated reference reads them. No code change.
|
|
26
|
+
|
|
27
|
+
## [4.23.0] — 2026-10-14
|
|
28
|
+
|
|
29
|
+
### Deprecated
|
|
30
|
+
- **`TokenResource.consume()`, `getAccessKey()`, `revokeSession()`, `revokeAllSessions()`**: keel
|
|
31
|
+
serves none of these routes (each answers 404 `not_found` on production; `accounts/token_api.py`
|
|
32
|
+
mounts only `status/` and `encryption-info/`). Spending is server-side, in the route that does the
|
|
33
|
+
work (the Council's acts through keel's council proxy, keel #274, Skeld's ruling h37 #4632), and
|
|
34
|
+
`OwV2Client.allowance()` reads the token rating. They stay callable and leave in 5.0. A 404 from
|
|
35
|
+
any token route now says what keel serves instead of "an older server". Found by Assembly's wire
|
|
36
|
+
gate, which until now never drove this class (its routes are not in keel's document).
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- README and docs: "token rating" is the one word for the account's daily budget (the Captain,
|
|
40
|
+
h37 #4642, OW Infra #273). Names in the API (`allowance()`, `/account/allowance`) are unchanged.
|
|
41
|
+
|
|
8
42
|
## [4.22.0] — 2026-10-14
|
|
9
43
|
|
|
10
44
|
### Added
|
package/README.md
CHANGED
|
@@ -119,7 +119,18 @@ const invite = await client.previewJoin(code); // who invites, which world, wh
|
|
|
119
119
|
const membership = await account.acceptJoin(code); // account = a client with an ow_a_ token
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
A bad code (unknown, used, revoked, expired) is one 404 (`err.isNotFound`). Accepting can answer `err.isAlreadyMember
|
|
122
|
+
A bad code (unknown, used, revoked, expired) is one 404 (`err.isNotFound`). Accepting can answer `err.isAlreadyMember`; it needs no account PIN, though a write key for the new membership waits for one. A refusal never uses up the code.
|
|
123
|
+
|
|
124
|
+
The owner makes, lists and revokes the links with the account token (since 4.24.0). The code comes back once, in the answer that makes it:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
const made = await account.createWorldLink(worldId, { reader: 'person', role: 'contributor', days: 7 });
|
|
128
|
+
// made.line: the one line to send (who invites, to which world, the link); made.code: the ow_j_ code
|
|
129
|
+
const links = await account.listWorldLinks(worldId); // no codes: status pending | used | revoked | expired
|
|
130
|
+
await account.revokeWorldLink(worldId, made.id);
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`reader: 'agent'` makes a link an AI agent redeems for a seat instead. Anyone but the owner gets a 404.
|
|
123
134
|
|
|
124
135
|
Once in, a world key can ask who it is and who else is there (since 4.22.0):
|
|
125
136
|
|
|
@@ -191,7 +202,7 @@ const { rows, not_proposed } = await account.sort({ worldId, notes: ['Mira moved
|
|
|
191
202
|
// rows: make (a new element), add_to (text for a field), link (one element to another), ask (which one?)
|
|
192
203
|
```
|
|
193
204
|
|
|
194
|
-
Asking and sorting spend tokens from the account's daily
|
|
205
|
+
Asking and sorting spend tokens from the account's token rating, its daily budget, the same meter the Council uses. Each answer carries `tokens_remaining` and `token_rating`; `allowance()` reads the meter without spending anything (since 4.21.0):
|
|
195
206
|
|
|
196
207
|
```typescript
|
|
197
208
|
const { token_rating, tokens_remaining, resets_at } = await account.allowance(); // resets_at: the next midnight UTC
|
|
@@ -254,7 +265,7 @@ The four colour families (agents, world, abstract, temporal) are checked for col
|
|
|
254
265
|
|
|
255
266
|
## Tokens
|
|
256
267
|
|
|
257
|
-
The account's token
|
|
268
|
+
The account's token rating, which some OnlyWorlds tools use. `getStatus()` and `getEncryptionInfo()` are what keel still serves under `/tokens/`; `consume()`, `getAccessKey()` and the two session revokes are deprecated (keel answers 404) and leave in 5.0. To read the token rating, prefer `account.allowance()` above.
|
|
258
269
|
|
|
259
270
|
```typescript
|
|
260
271
|
import { TokenResource } from '@onlyworlds/sdk';
|
package/dist/index.d.ts
CHANGED
|
@@ -2014,7 +2014,7 @@ interface OwAskAnswer {
|
|
|
2014
2014
|
remaining: number;
|
|
2015
2015
|
/** The account's tokens left today after this call (since keel a6244db, 2026-10-14). */
|
|
2016
2016
|
tokens_remaining: number;
|
|
2017
|
-
/** The account's daily
|
|
2017
|
+
/** The account's token rating: its daily budget in tokens, one meter with the Council (since keel a6244db). */
|
|
2018
2018
|
token_rating: number;
|
|
2019
2019
|
[k: string]: unknown;
|
|
2020
2020
|
}
|
|
@@ -2096,11 +2096,11 @@ interface OwSortAnswer {
|
|
|
2096
2096
|
output_tokens: number;
|
|
2097
2097
|
};
|
|
2098
2098
|
/** How many more calls of this one's size fit in what the account has left today; ask and
|
|
2099
|
-
* sort spend from one
|
|
2099
|
+
* sort spend from one token rating. */
|
|
2100
2100
|
remaining: number;
|
|
2101
2101
|
/** The account's tokens left today after this call (since keel a6244db, 2026-10-14). */
|
|
2102
2102
|
tokens_remaining: number;
|
|
2103
|
-
/** The account's daily
|
|
2103
|
+
/** The account's token rating: its daily budget in tokens, one meter with the Council (since keel a6244db). */
|
|
2104
2104
|
token_rating: number;
|
|
2105
2105
|
[k: string]: unknown;
|
|
2106
2106
|
}
|
|
@@ -2135,15 +2135,15 @@ interface OwMember {
|
|
|
2135
2135
|
name?: string;
|
|
2136
2136
|
[k: string]: unknown;
|
|
2137
2137
|
}
|
|
2138
|
-
/** GET /account/allowance: the account's
|
|
2138
|
+
/** GET /account/allowance: the account's token rating and what is left of it today (keel 872431f, 2026-10-14). */
|
|
2139
2139
|
interface OwAllowance {
|
|
2140
|
-
/** The account's daily
|
|
2140
|
+
/** The account's token rating: its daily budget in tokens. */
|
|
2141
2141
|
token_rating: number;
|
|
2142
2142
|
/** Tokens spent today (UTC); may pass the rating by the size of the last call. */
|
|
2143
2143
|
tokens_used_today: number;
|
|
2144
2144
|
/** Tokens left today, never below 0. */
|
|
2145
2145
|
tokens_remaining: number;
|
|
2146
|
-
/** When the
|
|
2146
|
+
/** When the day's tokens reset: the next midnight UTC (ISO 8601). */
|
|
2147
2147
|
resets_at: string;
|
|
2148
2148
|
[k: string]: unknown;
|
|
2149
2149
|
}
|
|
@@ -2166,6 +2166,39 @@ interface OwJoinPreview {
|
|
|
2166
2166
|
expires_at: string;
|
|
2167
2167
|
[k: string]: unknown;
|
|
2168
2168
|
}
|
|
2169
|
+
/** One of a world's invite links, as GET /account/worlds/{id}/links lists it (keel C1, 48c10d4). */
|
|
2170
|
+
interface OwWorldLink {
|
|
2171
|
+
/** The link's id: revokeWorldLink takes it. */
|
|
2172
|
+
id: string;
|
|
2173
|
+
/** `person`: accepted signed in, with acceptJoin. `agent`: redeemed by an AI agent at POST /join. */
|
|
2174
|
+
reader: 'person' | 'agent';
|
|
2175
|
+
role: OwMemberRole;
|
|
2176
|
+
/** The name the owner gave an agent link on the website, or empty. */
|
|
2177
|
+
label: string;
|
|
2178
|
+
/** The name the link is signed with, or empty (the invite line then reads "Someone"). */
|
|
2179
|
+
inviter_name: string;
|
|
2180
|
+
/** Whether redeeming gives the agent a Character of its own. Always false on a person link. */
|
|
2181
|
+
with_character: boolean;
|
|
2182
|
+
/** The code's last four characters, to tell links apart. */
|
|
2183
|
+
last4: string;
|
|
2184
|
+
/** ISO 8601, UTC. */
|
|
2185
|
+
created_at: string;
|
|
2186
|
+
/** ISO 8601, UTC. */
|
|
2187
|
+
expires_at: string;
|
|
2188
|
+
/** 0 or 1: a link works once. */
|
|
2189
|
+
uses: number;
|
|
2190
|
+
status: 'pending' | 'used' | 'revoked' | 'expired';
|
|
2191
|
+
[k: string]: unknown;
|
|
2192
|
+
}
|
|
2193
|
+
/** POST /account/worlds/{id}/links: the new link, with its code. The code is in this answer only: keel keeps a hash. */
|
|
2194
|
+
interface OwCreatedWorldLink extends OwWorldLink {
|
|
2195
|
+
/** The `ow_j_` join code. Shown once; it can never be read again. */
|
|
2196
|
+
code: string;
|
|
2197
|
+
/** The invite link: the /join page with the code after `#`. */
|
|
2198
|
+
link: string;
|
|
2199
|
+
/** The one line to send: who invites, to which world, and the link. */
|
|
2200
|
+
line: string;
|
|
2201
|
+
}
|
|
2169
2202
|
/** POST /account/join: the new membership (the same row as accepting an email invite). */
|
|
2170
2203
|
interface OwJoinedMembership {
|
|
2171
2204
|
/** The membership's id. */
|
|
@@ -2612,18 +2645,46 @@ declare class OwV2Client {
|
|
|
2612
2645
|
/**
|
|
2613
2646
|
* POST /account/join -- accept an invite link's code as the account this client's
|
|
2614
2647
|
* `ow_a_` token belongs to: 201 with the new membership. Refusals: 404 `not_found`
|
|
2615
|
-
* (every bad code, and a code made for an AI agent)
|
|
2616
|
-
* (`err.isAlreadyMember`)
|
|
2617
|
-
*
|
|
2618
|
-
* before anything is sent.
|
|
2648
|
+
* (every bad code, and a code made for an AI agent) and 409 `already_member`
|
|
2649
|
+
* (`err.isAlreadyMember`). Accepting needs no account PIN, for any role (keel #297,
|
|
2650
|
+
* ed73c90); a write key for the membership waits for one (`pin_required`). A refusal
|
|
2651
|
+
* never spends the code. A world key here is a TypeError before anything is sent.
|
|
2619
2652
|
*/
|
|
2620
2653
|
acceptJoin(code: string): Promise<OwJoinedMembership>;
|
|
2654
|
+
/**
|
|
2655
|
+
* POST /account/worlds/{worldId}/links -- a new invite link for a world this client's
|
|
2656
|
+
* `ow_a_` token owns (keel C1): `reader` is required (`person`, accepted with acceptJoin;
|
|
2657
|
+
* `agent`, redeemed at POST /join); `role` defaults to contributor, `days` (1, 7 or 30)
|
|
2658
|
+
* to 7; `withCharacter` (agent links only) to true. 201 with the code, shown in this
|
|
2659
|
+
* answer only. Owner only: anyone else, and a world that doesn't exist, gets 404
|
|
2660
|
+
* `not_found` (`err.isNotFound`). A world key is a TypeError before anything is sent.
|
|
2661
|
+
*/
|
|
2662
|
+
createWorldLink(worldId: string, opts: {
|
|
2663
|
+
reader: 'person' | 'agent';
|
|
2664
|
+
role?: OwMemberRole;
|
|
2665
|
+
days?: 1 | 7 | 30;
|
|
2666
|
+
inviterName?: string;
|
|
2667
|
+
withCharacter?: boolean;
|
|
2668
|
+
}): Promise<OwCreatedWorldLink>;
|
|
2669
|
+
/**
|
|
2670
|
+
* GET /account/worlds/{worldId}/links -- the world's invite links, without their codes:
|
|
2671
|
+
* each with its status (pending, used, revoked or expired) and uses. Owner only, as
|
|
2672
|
+
* createWorldLink. Needs the client's `ow_a_` token.
|
|
2673
|
+
*/
|
|
2674
|
+
listWorldLinks(worldId: string): Promise<OwWorldLink[]>;
|
|
2675
|
+
/**
|
|
2676
|
+
* DELETE /account/worlds/{worldId}/links/{linkId} -- revoke a link: its code no longer
|
|
2677
|
+
* works. A used, revoked or expired link answers the same and stays as it was; whoever
|
|
2678
|
+
* joined with it stays a member (remove them from the roster). Owner only, as
|
|
2679
|
+
* createWorldLink. Needs the client's `ow_a_` token.
|
|
2680
|
+
*/
|
|
2681
|
+
revokeWorldLink(worldId: string, linkId: string): Promise<void>;
|
|
2621
2682
|
/**
|
|
2622
2683
|
* POST /account/ask -- a question about a world the account owns or is in, answered by
|
|
2623
2684
|
* keel's AI proxy from `context` only (build it with buildAskContext from the elements
|
|
2624
2685
|
* the user sees). The answer is "The world doesn't say." when the context does not hold
|
|
2625
2686
|
* it. Needs the client's `ow_a_` token (a world key is a TypeError before sending).
|
|
2626
|
-
* Refusals: 429 `quota_exceeded` (`err.isQuotaExceeded`, the account's
|
|
2687
|
+
* Refusals: 429 `quota_exceeded` (`err.isQuotaExceeded`, the account's token rating used up for the day;
|
|
2627
2688
|
* Retry-After runs to midnight UTC), 503 `ask_unavailable` (`err.isAskUnavailable`:
|
|
2628
2689
|
* switched off, or paused for the day), 502 `ask_failed` (`err.isAskFailed`); none of
|
|
2629
2690
|
* them counts. 422 for a question over 500 characters or context past its limits.
|
|
@@ -2639,7 +2700,7 @@ declare class OwV2Client {
|
|
|
2639
2700
|
* lookupWorld's hits), sorted by the same proxy as ask into rows to review: `make`, `add_to`,
|
|
2640
2701
|
* `link`, `ask`. Nothing is written; the app applies what the user accepts. Every id in a
|
|
2641
2702
|
* row is from the slice; keel moves any other row to `not_proposed` with its reason.
|
|
2642
|
-
* The same account token,
|
|
2703
|
+
* The same account token, token rating (it spends the tokens it uses) and refusals as ask. 422
|
|
2643
2704
|
* names the param: notes 1 to 8, each up to 4,000 characters and 16,000 in all (text
|
|
2644
2705
|
* only), at most four pictures, each uploaded into this world; slice up to 100, names up
|
|
2645
2706
|
* to 200 characters, anchors up to 120.
|
|
@@ -2650,7 +2711,7 @@ declare class OwV2Client {
|
|
|
2650
2711
|
slice: OwSortRef[];
|
|
2651
2712
|
}): Promise<OwSortAnswer>;
|
|
2652
2713
|
/**
|
|
2653
|
-
* GET /account/allowance -- the account's
|
|
2714
|
+
* GET /account/allowance -- the account's token rating, the one daily meter ask, sort and
|
|
2654
2715
|
* the Council spend from (keel 872431f): the rating, what is used and left today, and
|
|
2655
2716
|
* when it resets (the next midnight UTC). Spends nothing. Needs the client's `ow_a_` token.
|
|
2656
2717
|
*/
|
|
@@ -3438,6 +3499,12 @@ declare enum GameTier {
|
|
|
3438
3499
|
* `OwV2Client` (its `request()` is public since 4.0): `new TokenResource(client)`.
|
|
3439
3500
|
* Wire ruling (2026-07-23): keel keeps the /tokens/* economy long-term
|
|
3440
3501
|
* (Tangle ratings write it, Council voting reads it) — port, don't delete.
|
|
3502
|
+
* Since then keel mounts only `status/` and `encryption-info/` under /tokens/
|
|
3503
|
+
* (`accounts/token_api.py`; consume, access-key and both revokes answer 404 on
|
|
3504
|
+
* production, 2026-10-14), and spending moved server-side: the Council spends
|
|
3505
|
+
* through keel's council proxy (keel #274, Skeld's ruling h37 #4632), and
|
|
3506
|
+
* `OwV2Client.allowance()` reads the token rating. The four dead methods are
|
|
3507
|
+
* deprecated in 4.23.0 and leave in 5.0.
|
|
3441
3508
|
*/
|
|
3442
3509
|
interface TokenTransport {
|
|
3443
3510
|
request<T>(method: string, path: string, opts?: {
|
|
@@ -3474,9 +3541,9 @@ declare class TokenResource {
|
|
|
3474
3541
|
private client;
|
|
3475
3542
|
constructor(client: TokenTransport);
|
|
3476
3543
|
/**
|
|
3477
|
-
* All token routes go through here: a 404 on /tokens/*
|
|
3478
|
-
*
|
|
3479
|
-
*
|
|
3544
|
+
* All token routes go through here: a 404 on /tokens/* means keel does not
|
|
3545
|
+
* serve that route, not "user has no tokens". Annotate so the failure reads
|
|
3546
|
+
* correctly.
|
|
3480
3547
|
*/
|
|
3481
3548
|
private req;
|
|
3482
3549
|
/**
|
|
@@ -3498,6 +3565,10 @@ declare class TokenResource {
|
|
|
3498
3565
|
/**
|
|
3499
3566
|
* Consume tokens for service usage
|
|
3500
3567
|
*
|
|
3568
|
+
* @deprecated keel serves no consume route (404 on production since 2026-10;
|
|
3569
|
+
* no client decides what its act costs, Skeld's ruling, keel #274): spending
|
|
3570
|
+
* happens server-side in the route that does the work. Removed in 5.0.
|
|
3571
|
+
*
|
|
3501
3572
|
* Reports token consumption to track daily usage. Allows consumption even if
|
|
3502
3573
|
* exceeds available tokens (tracks as debt), but warns via error field.
|
|
3503
3574
|
* Matches base-tool's reportUsage() pattern.
|
|
@@ -3527,6 +3598,10 @@ declare class TokenResource {
|
|
|
3527
3598
|
/**
|
|
3528
3599
|
* Get encrypted OpenAI API key (advanced use case)
|
|
3529
3600
|
*
|
|
3601
|
+
* @deprecated keel serves no access-key route (404 on production since
|
|
3602
|
+
* 2026-10). AI answers come from keel's own proxy: `OwV2Client.ask()` and
|
|
3603
|
+
* `sort()`. Removed in 5.0.
|
|
3604
|
+
*
|
|
3530
3605
|
* Requires minimum 100 tokens available. Creates a 1-hour session for tracking.
|
|
3531
3606
|
* Returns encrypted key that must be decrypted client-side using Fernet.
|
|
3532
3607
|
*
|
|
@@ -3554,6 +3629,9 @@ declare class TokenResource {
|
|
|
3554
3629
|
/**
|
|
3555
3630
|
* Revoke a specific token session
|
|
3556
3631
|
*
|
|
3632
|
+
* @deprecated keel serves no revoke-session route (404 on production since
|
|
3633
|
+
* 2026-10); sessions came from getAccessKey(), which is gone too. Removed in 5.0.
|
|
3634
|
+
*
|
|
3557
3635
|
* Invalidates the session ID obtained from getAccessKey().
|
|
3558
3636
|
* Use when cleaning up or on logout.
|
|
3559
3637
|
*
|
|
@@ -3568,6 +3646,9 @@ declare class TokenResource {
|
|
|
3568
3646
|
/**
|
|
3569
3647
|
* Revoke all active sessions (emergency use)
|
|
3570
3648
|
*
|
|
3649
|
+
* @deprecated keel serves no revoke-all-sessions route (404 on production
|
|
3650
|
+
* since 2026-10). Removed in 5.0.
|
|
3651
|
+
*
|
|
3571
3652
|
* Invalidates all token sessions for the authenticated user.
|
|
3572
3653
|
* Use for security cleanup or when sessions are stuck.
|
|
3573
3654
|
*
|
|
@@ -3597,4 +3678,4 @@ declare class TokenResource {
|
|
|
3597
3678
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
3598
3679
|
}
|
|
3599
3680
|
|
|
3600
|
-
export { 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_SCHEMA, type FieldInfo, type FieldType, GameTier, type ListParams, ONLYWORLDS_VERSION, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangesPage, type OwClientConfig, type OwElement, type OwElementBase, type OwErrorBody, type OwJoinPreview, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, OwPreconditionFailedError, type OwPreparedPhoto, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, type OwUploadedImage, OwV2Client, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldIndex, type OwWorldMeta, PHOTO_MAX_BYTES, PHOTO_TYPES, type ParseError, type ParseOptions, type ParseResult, 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, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, elementColor, eraForStep, errorFromResponse, familyOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, isDemoKey, isLeapYear, isParseError, kindCanWrite, lookupWorld, monthStartSteps, parseDate, parseErrorEnvelope, pinExpectation, planPhoto, preparePhoto, readCalendarConfig, readCalendarValue, readWorldFile, renderElement, resolveCalendarLens, resolveEraDomains, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
|
|
3681
|
+
export { 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_SCHEMA, type FieldInfo, type FieldType, GameTier, type ListParams, ONLYWORLDS_VERSION, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangesPage, type OwClientConfig, type OwCreatedWorldLink, type OwElement, type OwElementBase, type OwErrorBody, type OwJoinPreview, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, OwPreconditionFailedError, type OwPreparedPhoto, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, type OwUploadedImage, OwV2Client, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldIndex, type OwWorldLink, type OwWorldMeta, PHOTO_MAX_BYTES, PHOTO_TYPES, type ParseError, type ParseOptions, type ParseResult, 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, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, elementColor, eraForStep, errorFromResponse, familyOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, isDemoKey, isLeapYear, isParseError, kindCanWrite, lookupWorld, monthStartSteps, parseDate, parseErrorEnvelope, pinExpectation, planPhoto, preparePhoto, readCalendarConfig, readCalendarValue, readWorldFile, renderElement, resolveCalendarLens, resolveEraDomains, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
|
package/dist/index.js
CHANGED
|
@@ -489,10 +489,10 @@ var OwV2Client = class {
|
|
|
489
489
|
/**
|
|
490
490
|
* POST /account/join -- accept an invite link's code as the account this client's
|
|
491
491
|
* `ow_a_` token belongs to: 201 with the new membership. Refusals: 404 `not_found`
|
|
492
|
-
* (every bad code, and a code made for an AI agent)
|
|
493
|
-
* (`err.isAlreadyMember`)
|
|
494
|
-
*
|
|
495
|
-
* before anything is sent.
|
|
492
|
+
* (every bad code, and a code made for an AI agent) and 409 `already_member`
|
|
493
|
+
* (`err.isAlreadyMember`). Accepting needs no account PIN, for any role (keel #297,
|
|
494
|
+
* ed73c90); a write key for the membership waits for one (`pin_required`). A refusal
|
|
495
|
+
* never spends the code. A world key here is a TypeError before anything is sent.
|
|
496
496
|
*/
|
|
497
497
|
async acceptJoin(code) {
|
|
498
498
|
if (this.keyKind !== "account") {
|
|
@@ -500,13 +500,56 @@ var OwV2Client = class {
|
|
|
500
500
|
}
|
|
501
501
|
return this.request("POST", "/account/join", { body: { code } });
|
|
502
502
|
}
|
|
503
|
+
/**
|
|
504
|
+
* POST /account/worlds/{worldId}/links -- a new invite link for a world this client's
|
|
505
|
+
* `ow_a_` token owns (keel C1): `reader` is required (`person`, accepted with acceptJoin;
|
|
506
|
+
* `agent`, redeemed at POST /join); `role` defaults to contributor, `days` (1, 7 or 30)
|
|
507
|
+
* to 7; `withCharacter` (agent links only) to true. 201 with the code, shown in this
|
|
508
|
+
* answer only. Owner only: anyone else, and a world that doesn't exist, gets 404
|
|
509
|
+
* `not_found` (`err.isNotFound`). A world key is a TypeError before anything is sent.
|
|
510
|
+
*/
|
|
511
|
+
async createWorldLink(worldId, opts) {
|
|
512
|
+
if (this.keyKind !== "account") {
|
|
513
|
+
throw new TypeError("createWorldLink needs an account token (ow_a_): only the world's owner makes links");
|
|
514
|
+
}
|
|
515
|
+
const body = { reader: opts.reader };
|
|
516
|
+
if (opts.role !== void 0) body.role = opts.role;
|
|
517
|
+
if (opts.days !== void 0) body.days = opts.days;
|
|
518
|
+
if (opts.inviterName !== void 0) body.inviter_name = opts.inviterName;
|
|
519
|
+
if (opts.withCharacter !== void 0) body.with_character = opts.withCharacter;
|
|
520
|
+
return this.request("POST", `/account/worlds/${encodeURIComponent(worldId)}/links`, { body });
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* GET /account/worlds/{worldId}/links -- the world's invite links, without their codes:
|
|
524
|
+
* each with its status (pending, used, revoked or expired) and uses. Owner only, as
|
|
525
|
+
* createWorldLink. Needs the client's `ow_a_` token.
|
|
526
|
+
*/
|
|
527
|
+
async listWorldLinks(worldId) {
|
|
528
|
+
if (this.keyKind !== "account") {
|
|
529
|
+
throw new TypeError("listWorldLinks needs an account token (ow_a_): only the world's owner sees its links");
|
|
530
|
+
}
|
|
531
|
+
const page = await this.request("GET", `/account/worlds/${encodeURIComponent(worldId)}/links`);
|
|
532
|
+
return page.data;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* DELETE /account/worlds/{worldId}/links/{linkId} -- revoke a link: its code no longer
|
|
536
|
+
* works. A used, revoked or expired link answers the same and stays as it was; whoever
|
|
537
|
+
* joined with it stays a member (remove them from the roster). Owner only, as
|
|
538
|
+
* createWorldLink. Needs the client's `ow_a_` token.
|
|
539
|
+
*/
|
|
540
|
+
async revokeWorldLink(worldId, linkId) {
|
|
541
|
+
if (this.keyKind !== "account") {
|
|
542
|
+
throw new TypeError("revokeWorldLink needs an account token (ow_a_): only the world's owner revokes links");
|
|
543
|
+
}
|
|
544
|
+
await this.request("DELETE", `/account/worlds/${encodeURIComponent(worldId)}/links/${encodeURIComponent(linkId)}`);
|
|
545
|
+
}
|
|
503
546
|
// -- Ask your world (keel #159) -------------------------------------------
|
|
504
547
|
/**
|
|
505
548
|
* POST /account/ask -- a question about a world the account owns or is in, answered by
|
|
506
549
|
* keel's AI proxy from `context` only (build it with buildAskContext from the elements
|
|
507
550
|
* the user sees). The answer is "The world doesn't say." when the context does not hold
|
|
508
551
|
* it. Needs the client's `ow_a_` token (a world key is a TypeError before sending).
|
|
509
|
-
* Refusals: 429 `quota_exceeded` (`err.isQuotaExceeded`, the account's
|
|
552
|
+
* Refusals: 429 `quota_exceeded` (`err.isQuotaExceeded`, the account's token rating used up for the day;
|
|
510
553
|
* Retry-After runs to midnight UTC), 503 `ask_unavailable` (`err.isAskUnavailable`:
|
|
511
554
|
* switched off, or paused for the day), 502 `ask_failed` (`err.isAskFailed`); none of
|
|
512
555
|
* them counts. 422 for a question over 500 characters or context past its limits.
|
|
@@ -525,7 +568,7 @@ var OwV2Client = class {
|
|
|
525
568
|
* lookupWorld's hits), sorted by the same proxy as ask into rows to review: `make`, `add_to`,
|
|
526
569
|
* `link`, `ask`. Nothing is written; the app applies what the user accepts. Every id in a
|
|
527
570
|
* row is from the slice; keel moves any other row to `not_proposed` with its reason.
|
|
528
|
-
* The same account token,
|
|
571
|
+
* The same account token, token rating (it spends the tokens it uses) and refusals as ask. 422
|
|
529
572
|
* names the param: notes 1 to 8, each up to 4,000 characters and 16,000 in all (text
|
|
530
573
|
* only), at most four pictures, each uploaded into this world; slice up to 100, names up
|
|
531
574
|
* to 200 characters, anchors up to 120.
|
|
@@ -539,7 +582,7 @@ var OwV2Client = class {
|
|
|
539
582
|
});
|
|
540
583
|
}
|
|
541
584
|
/**
|
|
542
|
-
* GET /account/allowance -- the account's
|
|
585
|
+
* GET /account/allowance -- the account's token rating, the one daily meter ask, sort and
|
|
543
586
|
* the Council spend from (keel 872431f): the rating, what is used and left today, and
|
|
544
587
|
* when it resets (the next midnight UTC). Spends nothing. Needs the client's `ow_a_` token.
|
|
545
588
|
*/
|
|
@@ -2627,16 +2670,16 @@ var TokenResource = class {
|
|
|
2627
2670
|
this.client = client;
|
|
2628
2671
|
}
|
|
2629
2672
|
/**
|
|
2630
|
-
* All token routes go through here: a 404 on /tokens/*
|
|
2631
|
-
*
|
|
2632
|
-
*
|
|
2673
|
+
* All token routes go through here: a 404 on /tokens/* means keel does not
|
|
2674
|
+
* serve that route, not "user has no tokens". Annotate so the failure reads
|
|
2675
|
+
* correctly.
|
|
2633
2676
|
*/
|
|
2634
2677
|
async req(method, path, opts) {
|
|
2635
2678
|
try {
|
|
2636
2679
|
return await this.client.request(method, path, opts);
|
|
2637
2680
|
} catch (err) {
|
|
2638
2681
|
if (err && typeof err === "object" && err.status === 404) {
|
|
2639
|
-
err.message += " [
|
|
2682
|
+
err.message += " [keel serves only /tokens/status/ and /tokens/encryption-info/; this method is deprecated (4.23.0). The token rating: OwV2Client.allowance()]";
|
|
2640
2683
|
}
|
|
2641
2684
|
throw err;
|
|
2642
2685
|
}
|
|
@@ -2662,6 +2705,10 @@ var TokenResource = class {
|
|
|
2662
2705
|
/**
|
|
2663
2706
|
* Consume tokens for service usage
|
|
2664
2707
|
*
|
|
2708
|
+
* @deprecated keel serves no consume route (404 on production since 2026-10;
|
|
2709
|
+
* no client decides what its act costs, Skeld's ruling, keel #274): spending
|
|
2710
|
+
* happens server-side in the route that does the work. Removed in 5.0.
|
|
2711
|
+
*
|
|
2665
2712
|
* Reports token consumption to track daily usage. Allows consumption even if
|
|
2666
2713
|
* exceeds available tokens (tracks as debt), but warns via error field.
|
|
2667
2714
|
* Matches base-tool's reportUsage() pattern.
|
|
@@ -2700,6 +2747,10 @@ var TokenResource = class {
|
|
|
2700
2747
|
/**
|
|
2701
2748
|
* Get encrypted OpenAI API key (advanced use case)
|
|
2702
2749
|
*
|
|
2750
|
+
* @deprecated keel serves no access-key route (404 on production since
|
|
2751
|
+
* 2026-10). AI answers come from keel's own proxy: `OwV2Client.ask()` and
|
|
2752
|
+
* `sort()`. Removed in 5.0.
|
|
2753
|
+
*
|
|
2703
2754
|
* Requires minimum 100 tokens available. Creates a 1-hour session for tracking.
|
|
2704
2755
|
* Returns encrypted key that must be decrypted client-side using Fernet.
|
|
2705
2756
|
*
|
|
@@ -2729,6 +2780,9 @@ var TokenResource = class {
|
|
|
2729
2780
|
/**
|
|
2730
2781
|
* Revoke a specific token session
|
|
2731
2782
|
*
|
|
2783
|
+
* @deprecated keel serves no revoke-session route (404 on production since
|
|
2784
|
+
* 2026-10); sessions came from getAccessKey(), which is gone too. Removed in 5.0.
|
|
2785
|
+
*
|
|
2732
2786
|
* Invalidates the session ID obtained from getAccessKey().
|
|
2733
2787
|
* Use when cleaning up or on logout.
|
|
2734
2788
|
*
|
|
@@ -2748,6 +2802,9 @@ var TokenResource = class {
|
|
|
2748
2802
|
/**
|
|
2749
2803
|
* Revoke all active sessions (emergency use)
|
|
2750
2804
|
*
|
|
2805
|
+
* @deprecated keel serves no revoke-all-sessions route (404 on production
|
|
2806
|
+
* since 2026-10). Removed in 5.0.
|
|
2807
|
+
*
|
|
2751
2808
|
* Invalidates all token sessions for the authenticated user.
|
|
2752
2809
|
* Use for security cleanup or when sessions are stuck.
|
|
2753
2810
|
*
|