@onlyworlds/sdk 4.21.0 → 4.23.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 +3 -0
- package/CHANGELOG.md +31 -0
- package/README.md +11 -2
- package/dist/index.d.ts +73 -8
- package/dist/index.js +43 -4
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -54,6 +54,9 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
|
|
|
54
54
|
allowance as ask.
|
|
55
55
|
- Allowance (since 4.21.0, account token): `account.allowance()` reads the daily AI allowance
|
|
56
56
|
without spending: `{ token_rating, tokens_used_today, tokens_remaining, resets_at }`.
|
|
57
|
+
- Who am I (since 4.22.0, a world key): `client.me()` is `{ world, scope, kind, role,
|
|
58
|
+
membership, character }` (`membership` is what `created_by` holds for what you create; null
|
|
59
|
+
for the owner); `client.members()` is the roster's rows. An account token is a TypeError.
|
|
57
60
|
- Invite links (since 4.12.0): `previewJoin(code)` (no credential sent) shows who invites, to
|
|
58
61
|
which world, in what role; `acceptJoin(code)` with an `ow_a_` account token joins. Bad code:
|
|
59
62
|
`err.isNotFound`; `err.isAlreadyMember`, `err.isPinRequired` for the two 409s.
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,37 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.23.0] — 2026-10-14
|
|
9
|
+
|
|
10
|
+
### Deprecated
|
|
11
|
+
- **`TokenResource.consume()`, `getAccessKey()`, `revokeSession()`, `revokeAllSessions()`**: keel
|
|
12
|
+
serves none of these routes (each answers 404 `not_found` on production; `accounts/token_api.py`
|
|
13
|
+
mounts only `status/` and `encryption-info/`). Spending is server-side, in the route that does the
|
|
14
|
+
work (the Council's acts through keel's council proxy, keel #274, Skeld's ruling h37 #4632), and
|
|
15
|
+
`OwV2Client.allowance()` reads the token rating. They stay callable and leave in 5.0. A 404 from
|
|
16
|
+
any token route now says what keel serves instead of "an older server". Found by Assembly's wire
|
|
17
|
+
gate, which until now never drove this class (its routes are not in keel's document).
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- README and docs: "token rating" is the one word for the account's daily budget (the Captain,
|
|
21
|
+
h37 #4642, OW Infra #273). Names in the API (`allowance()`, `/account/allowance`) are unchanged.
|
|
22
|
+
|
|
23
|
+
## [4.22.0] — 2026-10-14
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **`client.me()` and `client.members()`**: GET /me (who this world key is: world, scope, kind,
|
|
27
|
+
role, membership id, Character) and GET /members (the roster's rows, unwrapped from `{ data }`).
|
|
28
|
+
Lantern reads a player's role from /me by hand today. Types `OwMe`, `OwMember`, typed from
|
|
29
|
+
keel's declared schemas and held to them by Assembly's wire gate. An account token is a
|
|
30
|
+
TypeError before sending; the tests fail with that guard removed, or with the rows left
|
|
31
|
+
wrapped.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- The calendar kernel is the SDK's own: Atlas 245aad3 deleted its `core/calendar.ts` and imports
|
|
35
|
+
this one (Temper, h37 #4472), so the copy record (`src/calendar/SOURCES.json`) and the re-copy
|
|
36
|
+
script (`codegen/atlas-calendar.mjs`) are gone. A kernel change is an SDK release now. No code
|
|
37
|
+
change.
|
|
38
|
+
|
|
8
39
|
## [4.21.0] — 2026-10-14
|
|
9
40
|
|
|
10
41
|
### Added
|
package/README.md
CHANGED
|
@@ -121,6 +121,15 @@ const membership = await account.acceptJoin(code); // account = a client with an
|
|
|
121
121
|
|
|
122
122
|
A bad code (unknown, used, revoked, expired) is one 404 (`err.isNotFound`). Accepting can answer `err.isAlreadyMember` or `err.isPinRequired` (set a PIN first); a refusal never uses up the code.
|
|
123
123
|
|
|
124
|
+
Once in, a world key can ask who it is and who else is there (since 4.22.0):
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
const me = await client.me(); // { world, scope, kind, role, membership, character }
|
|
128
|
+
const roster = await client.members(); // [{ id, kind, role, character, status }], the owner's id is null
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`me.membership` is what `created_by` holds on the elements this key creates; `me.role` decides what it may change.
|
|
132
|
+
|
|
124
133
|
## Sync
|
|
125
134
|
|
|
126
135
|
```typescript
|
|
@@ -182,7 +191,7 @@ const { rows, not_proposed } = await account.sort({ worldId, notes: ['Mira moved
|
|
|
182
191
|
// rows: make (a new element), add_to (text for a field), link (one element to another), ask (which one?)
|
|
183
192
|
```
|
|
184
193
|
|
|
185
|
-
Asking and sorting spend tokens from the account's daily
|
|
194
|
+
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):
|
|
186
195
|
|
|
187
196
|
```typescript
|
|
188
197
|
const { token_rating, tokens_remaining, resets_at } = await account.allowance(); // resets_at: the next midnight UTC
|
|
@@ -245,7 +254,7 @@ The four colour families (agents, world, abstract, temporal) are checked for col
|
|
|
245
254
|
|
|
246
255
|
## Tokens
|
|
247
256
|
|
|
248
|
-
The account's token
|
|
257
|
+
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.
|
|
249
258
|
|
|
250
259
|
```typescript
|
|
251
260
|
import { TokenResource } from '@onlyworlds/sdk';
|
package/dist/index.d.ts
CHANGED
|
@@ -2104,6 +2104,37 @@ interface OwSortAnswer {
|
|
|
2104
2104
|
token_rating: number;
|
|
2105
2105
|
[k: string]: unknown;
|
|
2106
2106
|
}
|
|
2107
|
+
/** GET /me: who this world key is. */
|
|
2108
|
+
interface OwMe {
|
|
2109
|
+
world: {
|
|
2110
|
+
id: string;
|
|
2111
|
+
name: string;
|
|
2112
|
+
};
|
|
2113
|
+
scope: 'read' | 'write';
|
|
2114
|
+
kind: 'owner' | 'person' | 'agent';
|
|
2115
|
+
role: 'owner' | OwMemberRole;
|
|
2116
|
+
/** The membership id (what `created_by` holds for what this key creates), or null for the owner. */
|
|
2117
|
+
membership: string | null;
|
|
2118
|
+
/** The member's Character, or null. */
|
|
2119
|
+
character: string | null;
|
|
2120
|
+
/** Agent seats only: the agent's name. */
|
|
2121
|
+
name?: string;
|
|
2122
|
+
[k: string]: unknown;
|
|
2123
|
+
}
|
|
2124
|
+
/** One row of GET /members, the world's roster. */
|
|
2125
|
+
interface OwMember {
|
|
2126
|
+
/** The membership id (what `created_by` holds), or null for the owner. */
|
|
2127
|
+
id: string | null;
|
|
2128
|
+
kind: 'owner' | 'person' | 'agent';
|
|
2129
|
+
role: 'owner' | OwMemberRole;
|
|
2130
|
+
/** The Character that is this member, or null. */
|
|
2131
|
+
character: string | null;
|
|
2132
|
+
/** `removed` rows stay, so their elements keep `created_by`. */
|
|
2133
|
+
status: 'active' | 'removed';
|
|
2134
|
+
/** Agent rows only: the agent's name. */
|
|
2135
|
+
name?: string;
|
|
2136
|
+
[k: string]: unknown;
|
|
2137
|
+
}
|
|
2107
2138
|
/** GET /account/allowance: the account's daily AI allowance (keel 872431f, 2026-10-14). */
|
|
2108
2139
|
interface OwAllowance {
|
|
2109
2140
|
/** The account's daily allowance in tokens. */
|
|
@@ -2395,6 +2426,19 @@ declare class OwV2Client {
|
|
|
2395
2426
|
getWorld(): Promise<OwWorldMeta>;
|
|
2396
2427
|
/** PATCH /world -- partial world-meta update. */
|
|
2397
2428
|
patchWorld(partial: Record<string, unknown>): Promise<OwWorldMeta>;
|
|
2429
|
+
/**
|
|
2430
|
+
* GET /me -- who this world key is: the world, read or write scope, the kind (owner,
|
|
2431
|
+
* person, agent), the role, the membership id (what `created_by` holds for what this key
|
|
2432
|
+
* creates; null for the owner) and the member's Character. A world key's call; an account
|
|
2433
|
+
* token is a TypeError before sending.
|
|
2434
|
+
*/
|
|
2435
|
+
me(): Promise<OwMe>;
|
|
2436
|
+
/**
|
|
2437
|
+
* GET /members -- the world's roster: each member's id (null for the owner), kind, role,
|
|
2438
|
+
* Character and status (`removed` rows stay, so their elements keep `created_by`). Returns
|
|
2439
|
+
* the rows; keel sends them as `{ data }` with no paging. A world key's call.
|
|
2440
|
+
*/
|
|
2441
|
+
members(): Promise<OwMember[]>;
|
|
2398
2442
|
/** GET /{type}/ -- one cursor page. */
|
|
2399
2443
|
list(type: ElementType | string, params?: ListParams): Promise<OwPage>;
|
|
2400
2444
|
/** Cursor-walk every page of a type. Politeness: uses config pageSize. */
|
|
@@ -3212,11 +3256,12 @@ declare function parseDate(cfg: CalendarConfig, input: string, opts?: ParseOptio
|
|
|
3212
3256
|
declare function isParseError(r: ParseResult | ParseError): r is ParseError;
|
|
3213
3257
|
|
|
3214
3258
|
/**
|
|
3215
|
-
* World calendars:
|
|
3259
|
+
* World calendars: the calendar kernel, and which calendars a world holds.
|
|
3216
3260
|
*
|
|
3217
|
-
* `calendar.ts` beside this file
|
|
3218
|
-
*
|
|
3219
|
-
*
|
|
3261
|
+
* `calendar.ts` beside this file came from Atlas's `src/core/calendar.ts` in 4.20.0, and is
|
|
3262
|
+
* the one copy since Atlas 245aad3 deleted its own and imports this one (Temper, h37 #4472):
|
|
3263
|
+
* a kernel change is an SDK release, and Atlas's 48 kernel tests run against it there too.
|
|
3264
|
+
* Its contract is still Atlas's calendar design, §5 and §5b. This file adapts Atlas's
|
|
3220
3265
|
* `src/core/calendar-lens.ts` (readCalendarValue, worldCalendars, resolveCalendarLens) to
|
|
3221
3266
|
* any element shape, since the SDK has no Atlas `Element`.
|
|
3222
3267
|
*
|
|
@@ -3393,6 +3438,12 @@ declare enum GameTier {
|
|
|
3393
3438
|
* `OwV2Client` (its `request()` is public since 4.0): `new TokenResource(client)`.
|
|
3394
3439
|
* Wire ruling (2026-07-23): keel keeps the /tokens/* economy long-term
|
|
3395
3440
|
* (Tangle ratings write it, Council voting reads it) — port, don't delete.
|
|
3441
|
+
* Since then keel mounts only `status/` and `encryption-info/` under /tokens/
|
|
3442
|
+
* (`accounts/token_api.py`; consume, access-key and both revokes answer 404 on
|
|
3443
|
+
* production, 2026-10-14), and spending moved server-side: the Council spends
|
|
3444
|
+
* through keel's council proxy (keel #274, Skeld's ruling h37 #4632), and
|
|
3445
|
+
* `OwV2Client.allowance()` reads the token rating. The four dead methods are
|
|
3446
|
+
* deprecated in 4.23.0 and leave in 5.0.
|
|
3396
3447
|
*/
|
|
3397
3448
|
interface TokenTransport {
|
|
3398
3449
|
request<T>(method: string, path: string, opts?: {
|
|
@@ -3429,9 +3480,9 @@ declare class TokenResource {
|
|
|
3429
3480
|
private client;
|
|
3430
3481
|
constructor(client: TokenTransport);
|
|
3431
3482
|
/**
|
|
3432
|
-
* All token routes go through here: a 404 on /tokens/*
|
|
3433
|
-
*
|
|
3434
|
-
*
|
|
3483
|
+
* All token routes go through here: a 404 on /tokens/* means keel does not
|
|
3484
|
+
* serve that route, not "user has no tokens". Annotate so the failure reads
|
|
3485
|
+
* correctly.
|
|
3435
3486
|
*/
|
|
3436
3487
|
private req;
|
|
3437
3488
|
/**
|
|
@@ -3453,6 +3504,10 @@ declare class TokenResource {
|
|
|
3453
3504
|
/**
|
|
3454
3505
|
* Consume tokens for service usage
|
|
3455
3506
|
*
|
|
3507
|
+
* @deprecated keel serves no consume route (404 on production since 2026-10;
|
|
3508
|
+
* no client decides what its act costs, Skeld's ruling, keel #274): spending
|
|
3509
|
+
* happens server-side in the route that does the work. Removed in 5.0.
|
|
3510
|
+
*
|
|
3456
3511
|
* Reports token consumption to track daily usage. Allows consumption even if
|
|
3457
3512
|
* exceeds available tokens (tracks as debt), but warns via error field.
|
|
3458
3513
|
* Matches base-tool's reportUsage() pattern.
|
|
@@ -3482,6 +3537,10 @@ declare class TokenResource {
|
|
|
3482
3537
|
/**
|
|
3483
3538
|
* Get encrypted OpenAI API key (advanced use case)
|
|
3484
3539
|
*
|
|
3540
|
+
* @deprecated keel serves no access-key route (404 on production since
|
|
3541
|
+
* 2026-10). AI answers come from keel's own proxy: `OwV2Client.ask()` and
|
|
3542
|
+
* `sort()`. Removed in 5.0.
|
|
3543
|
+
*
|
|
3485
3544
|
* Requires minimum 100 tokens available. Creates a 1-hour session for tracking.
|
|
3486
3545
|
* Returns encrypted key that must be decrypted client-side using Fernet.
|
|
3487
3546
|
*
|
|
@@ -3509,6 +3568,9 @@ declare class TokenResource {
|
|
|
3509
3568
|
/**
|
|
3510
3569
|
* Revoke a specific token session
|
|
3511
3570
|
*
|
|
3571
|
+
* @deprecated keel serves no revoke-session route (404 on production since
|
|
3572
|
+
* 2026-10); sessions came from getAccessKey(), which is gone too. Removed in 5.0.
|
|
3573
|
+
*
|
|
3512
3574
|
* Invalidates the session ID obtained from getAccessKey().
|
|
3513
3575
|
* Use when cleaning up or on logout.
|
|
3514
3576
|
*
|
|
@@ -3523,6 +3585,9 @@ declare class TokenResource {
|
|
|
3523
3585
|
/**
|
|
3524
3586
|
* Revoke all active sessions (emergency use)
|
|
3525
3587
|
*
|
|
3588
|
+
* @deprecated keel serves no revoke-all-sessions route (404 on production
|
|
3589
|
+
* since 2026-10). Removed in 5.0.
|
|
3590
|
+
*
|
|
3526
3591
|
* Invalidates all token sessions for the authenticated user.
|
|
3527
3592
|
* Use for security cleanup or when sessions are stuck.
|
|
3528
3593
|
*
|
|
@@ -3552,4 +3617,4 @@ declare class TokenResource {
|
|
|
3552
3617
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
3553
3618
|
}
|
|
3554
3619
|
|
|
3555
|
-
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 OwMediaTicket, 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 };
|
|
3620
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -212,6 +212,31 @@ var OwV2Client = class {
|
|
|
212
212
|
async patchWorld(partial) {
|
|
213
213
|
return this.request("PATCH", "/world/", { body: sanitizePayload(partial) });
|
|
214
214
|
}
|
|
215
|
+
// -- Who am I, and who is here ---------------------------------------------
|
|
216
|
+
/**
|
|
217
|
+
* GET /me -- who this world key is: the world, read or write scope, the kind (owner,
|
|
218
|
+
* person, agent), the role, the membership id (what `created_by` holds for what this key
|
|
219
|
+
* creates; null for the owner) and the member's Character. A world key's call; an account
|
|
220
|
+
* token is a TypeError before sending.
|
|
221
|
+
*/
|
|
222
|
+
async me() {
|
|
223
|
+
if (this.keyKind === "account") {
|
|
224
|
+
throw new TypeError("me needs a world key: an account token is not a member of one world");
|
|
225
|
+
}
|
|
226
|
+
return this.request("GET", "/me/");
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* GET /members -- the world's roster: each member's id (null for the owner), kind, role,
|
|
230
|
+
* Character and status (`removed` rows stay, so their elements keep `created_by`). Returns
|
|
231
|
+
* the rows; keel sends them as `{ data }` with no paging. A world key's call.
|
|
232
|
+
*/
|
|
233
|
+
async members() {
|
|
234
|
+
if (this.keyKind === "account") {
|
|
235
|
+
throw new TypeError("members needs a world key: an account token is not a member of one world");
|
|
236
|
+
}
|
|
237
|
+
const page = await this.request("GET", "/members/");
|
|
238
|
+
return page.data ?? [];
|
|
239
|
+
}
|
|
215
240
|
// -- Element CRUD --------------------------------------------------------
|
|
216
241
|
/** GET /{type}/ -- one cursor page. */
|
|
217
242
|
async list(type, params = {}) {
|
|
@@ -2602,16 +2627,16 @@ var TokenResource = class {
|
|
|
2602
2627
|
this.client = client;
|
|
2603
2628
|
}
|
|
2604
2629
|
/**
|
|
2605
|
-
* All token routes go through here: a 404 on /tokens/*
|
|
2606
|
-
*
|
|
2607
|
-
*
|
|
2630
|
+
* All token routes go through here: a 404 on /tokens/* means keel does not
|
|
2631
|
+
* serve that route, not "user has no tokens". Annotate so the failure reads
|
|
2632
|
+
* correctly.
|
|
2608
2633
|
*/
|
|
2609
2634
|
async req(method, path, opts) {
|
|
2610
2635
|
try {
|
|
2611
2636
|
return await this.client.request(method, path, opts);
|
|
2612
2637
|
} catch (err) {
|
|
2613
2638
|
if (err && typeof err === "object" && err.status === 404) {
|
|
2614
|
-
err.message += " [
|
|
2639
|
+
err.message += " [keel serves only /tokens/status/ and /tokens/encryption-info/; this method is deprecated (4.23.0). The token rating: OwV2Client.allowance()]";
|
|
2615
2640
|
}
|
|
2616
2641
|
throw err;
|
|
2617
2642
|
}
|
|
@@ -2637,6 +2662,10 @@ var TokenResource = class {
|
|
|
2637
2662
|
/**
|
|
2638
2663
|
* Consume tokens for service usage
|
|
2639
2664
|
*
|
|
2665
|
+
* @deprecated keel serves no consume route (404 on production since 2026-10;
|
|
2666
|
+
* no client decides what its act costs, Skeld's ruling, keel #274): spending
|
|
2667
|
+
* happens server-side in the route that does the work. Removed in 5.0.
|
|
2668
|
+
*
|
|
2640
2669
|
* Reports token consumption to track daily usage. Allows consumption even if
|
|
2641
2670
|
* exceeds available tokens (tracks as debt), but warns via error field.
|
|
2642
2671
|
* Matches base-tool's reportUsage() pattern.
|
|
@@ -2675,6 +2704,10 @@ var TokenResource = class {
|
|
|
2675
2704
|
/**
|
|
2676
2705
|
* Get encrypted OpenAI API key (advanced use case)
|
|
2677
2706
|
*
|
|
2707
|
+
* @deprecated keel serves no access-key route (404 on production since
|
|
2708
|
+
* 2026-10). AI answers come from keel's own proxy: `OwV2Client.ask()` and
|
|
2709
|
+
* `sort()`. Removed in 5.0.
|
|
2710
|
+
*
|
|
2678
2711
|
* Requires minimum 100 tokens available. Creates a 1-hour session for tracking.
|
|
2679
2712
|
* Returns encrypted key that must be decrypted client-side using Fernet.
|
|
2680
2713
|
*
|
|
@@ -2704,6 +2737,9 @@ var TokenResource = class {
|
|
|
2704
2737
|
/**
|
|
2705
2738
|
* Revoke a specific token session
|
|
2706
2739
|
*
|
|
2740
|
+
* @deprecated keel serves no revoke-session route (404 on production since
|
|
2741
|
+
* 2026-10); sessions came from getAccessKey(), which is gone too. Removed in 5.0.
|
|
2742
|
+
*
|
|
2707
2743
|
* Invalidates the session ID obtained from getAccessKey().
|
|
2708
2744
|
* Use when cleaning up or on logout.
|
|
2709
2745
|
*
|
|
@@ -2723,6 +2759,9 @@ var TokenResource = class {
|
|
|
2723
2759
|
/**
|
|
2724
2760
|
* Revoke all active sessions (emergency use)
|
|
2725
2761
|
*
|
|
2762
|
+
* @deprecated keel serves no revoke-all-sessions route (404 on production
|
|
2763
|
+
* since 2026-10). Removed in 5.0.
|
|
2764
|
+
*
|
|
2726
2765
|
* Invalidates all token sessions for the authenticated user.
|
|
2727
2766
|
* Use for security cleanup or when sessions are stuck.
|
|
2728
2767
|
*
|