@onlyworlds/sdk 4.20.0 → 4.21.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 +4 -1
- package/CHANGELOG.md +13 -0
- package/README.md +7 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.js +12 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -50,7 +50,10 @@ against live data). The v1 surface (`OnlyWorldsClient`, the `ElementType` enum)
|
|
|
50
50
|
- Sort (since 4.18.0, account token): `account.sort({ worldId, notes, slice })` turns unsorted
|
|
51
51
|
notes (text, or a picture already uploaded into the world) into rows to review: `make`,
|
|
52
52
|
`add_to`, `link`, `ask`, plus `not_proposed` with reasons. Ids come only from your `slice`
|
|
53
|
-
(up to 100 elements your own lookup found); nothing is written.
|
|
53
|
+
(up to 100 elements your own lookup found); nothing is written. Spends from the same
|
|
54
|
+
allowance as ask.
|
|
55
|
+
- Allowance (since 4.21.0, account token): `account.allowance()` reads the daily AI allowance
|
|
56
|
+
without spending: `{ token_rating, tokens_used_today, tokens_remaining, resets_at }`.
|
|
54
57
|
- Invite links (since 4.12.0): `previewJoin(code)` (no credential sent) shows who invites, to
|
|
55
58
|
which world, in what role; `acceptJoin(code)` with an `ow_a_` account token joins. Bad code:
|
|
56
59
|
`err.isNotFound`; `err.isAlreadyMember`, `err.isPinRequired` for the two 409s.
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.21.0] — 2026-10-14
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **`client.allowance()`**: GET /account/allowance (keel 872431f, Skeld h37 #4308), the
|
|
12
|
+
account's daily AI allowance read without spending: `token_rating`, `tokens_used_today`,
|
|
13
|
+
`tokens_remaining`, `resets_at` (the next midnight UTC). Account token only, like ask and
|
|
14
|
+
sort. Type `OwAllowance`, held by Assembly's wire gate to the route's declared schema, as
|
|
15
|
+
`OwAskAnswer`, `OwSortAnswer` and `OwJoinPreview` now are to theirs.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- README and AGENTS.md no longer say a sort counts as one ask: since keel a6244db both spend
|
|
19
|
+
tokens from the allowance.
|
|
20
|
+
|
|
8
21
|
## [4.20.0] — 2026-10-14
|
|
9
22
|
|
|
10
23
|
### Added
|
package/README.md
CHANGED
|
@@ -174,7 +174,7 @@ const reply = await account.ask({ worldId, question, context }); // account: a c
|
|
|
174
174
|
reply.answer; // from those elements only, or "The world doesn't say."
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
The same proxy sorts loose notes into changes for the user to review. Send the elements your own lookup found for them as the `slice`; every id in a row comes from it, and nothing is written until your app applies what the user accepts.
|
|
177
|
+
The same proxy sorts loose notes into changes for the user to review. Send the elements your own lookup found for them as the `slice`; every id in a row comes from it, and nothing is written until your app applies what the user accepts.
|
|
178
178
|
|
|
179
179
|
```typescript
|
|
180
180
|
const slice = hits.slice(0, 100).map(({ element: e }) => ({ id: e.id, type: e.type, name: e.name }));
|
|
@@ -182,6 +182,12 @@ const { rows, not_proposed } = await account.sort({ worldId, notes: ['Mira moved
|
|
|
182
182
|
// rows: make (a new element), add_to (text for a field), link (one element to another), ask (which one?)
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
+
Asking and sorting spend tokens from the account's daily AI allowance, 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
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
const { token_rating, tokens_remaining, resets_at } = await account.allowance(); // resets_at: the next midnight UTC
|
|
189
|
+
```
|
|
190
|
+
|
|
185
191
|
## World files
|
|
186
192
|
|
|
187
193
|
A world file is one `.zip` holding a whole world folder (`world.json` and `elements/<type>/*.json`, as Atlas keeps a world on disk), the way Atlas downloads and opens one. It needs no account and works in the browser and in Node.
|
package/dist/index.d.ts
CHANGED
|
@@ -2104,6 +2104,18 @@ interface OwSortAnswer {
|
|
|
2104
2104
|
token_rating: number;
|
|
2105
2105
|
[k: string]: unknown;
|
|
2106
2106
|
}
|
|
2107
|
+
/** GET /account/allowance: the account's daily AI allowance (keel 872431f, 2026-10-14). */
|
|
2108
|
+
interface OwAllowance {
|
|
2109
|
+
/** The account's daily allowance in tokens. */
|
|
2110
|
+
token_rating: number;
|
|
2111
|
+
/** Tokens spent today (UTC); may pass the rating by the size of the last call. */
|
|
2112
|
+
tokens_used_today: number;
|
|
2113
|
+
/** Tokens left today, never below 0. */
|
|
2114
|
+
tokens_remaining: number;
|
|
2115
|
+
/** When the allowance resets: the next midnight UTC (ISO 8601). */
|
|
2116
|
+
resets_at: string;
|
|
2117
|
+
[k: string]: unknown;
|
|
2118
|
+
}
|
|
2107
2119
|
/** POST /join/preview: what a join code holds, read without using it (keel #212). */
|
|
2108
2120
|
interface OwJoinPreview {
|
|
2109
2121
|
/** `person`: an invite link, accepted with acceptJoin. `agent`: redeemed by an AI agent at POST /join. */
|
|
@@ -2583,7 +2595,7 @@ declare class OwV2Client {
|
|
|
2583
2595
|
* lookupWorld's hits), sorted by the same proxy as ask into rows to review: `make`, `add_to`,
|
|
2584
2596
|
* `link`, `ask`. Nothing is written; the app applies what the user accepts. Every id in a
|
|
2585
2597
|
* row is from the slice; keel moves any other row to `not_proposed` with its reason.
|
|
2586
|
-
*
|
|
2598
|
+
* The same account token, allowance (it spends the tokens it uses) and refusals as ask. 422
|
|
2587
2599
|
* names the param: notes 1 to 8, each up to 4,000 characters and 16,000 in all (text
|
|
2588
2600
|
* only), at most four pictures, each uploaded into this world; slice up to 100, names up
|
|
2589
2601
|
* to 200 characters, anchors up to 120.
|
|
@@ -2593,6 +2605,12 @@ declare class OwV2Client {
|
|
|
2593
2605
|
notes: OwSortNote[];
|
|
2594
2606
|
slice: OwSortRef[];
|
|
2595
2607
|
}): Promise<OwSortAnswer>;
|
|
2608
|
+
/**
|
|
2609
|
+
* GET /account/allowance -- the account's daily AI allowance, the one meter ask, sort and
|
|
2610
|
+
* the Council spend from (keel 872431f): the rating, what is used and left today, and
|
|
2611
|
+
* when it resets (the next midnight UTC). Spends nothing. Needs the client's `ow_a_` token.
|
|
2612
|
+
*/
|
|
2613
|
+
allowance(): Promise<OwAllowance>;
|
|
2596
2614
|
/**
|
|
2597
2615
|
* Raw authenticated request against this client's baseUrl. Public since 4.0
|
|
2598
2616
|
* so auxiliary resources can ride the same transport — it structurally
|
|
@@ -3534,4 +3552,4 @@ declare class TokenResource {
|
|
|
3534
3552
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
3535
3553
|
}
|
|
3536
3554
|
|
|
3537
|
-
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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -500,7 +500,7 @@ var OwV2Client = class {
|
|
|
500
500
|
* lookupWorld's hits), sorted by the same proxy as ask into rows to review: `make`, `add_to`,
|
|
501
501
|
* `link`, `ask`. Nothing is written; the app applies what the user accepts. Every id in a
|
|
502
502
|
* row is from the slice; keel moves any other row to `not_proposed` with its reason.
|
|
503
|
-
*
|
|
503
|
+
* The same account token, allowance (it spends the tokens it uses) and refusals as ask. 422
|
|
504
504
|
* names the param: notes 1 to 8, each up to 4,000 characters and 16,000 in all (text
|
|
505
505
|
* only), at most four pictures, each uploaded into this world; slice up to 100, names up
|
|
506
506
|
* to 200 characters, anchors up to 120.
|
|
@@ -513,6 +513,17 @@ var OwV2Client = class {
|
|
|
513
513
|
body: { world_id: req.worldId, notes: req.notes, slice: req.slice }
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
|
+
/**
|
|
517
|
+
* GET /account/allowance -- the account's daily AI allowance, the one meter ask, sort and
|
|
518
|
+
* the Council spend from (keel 872431f): the rating, what is used and left today, and
|
|
519
|
+
* when it resets (the next midnight UTC). Spends nothing. Needs the client's `ow_a_` token.
|
|
520
|
+
*/
|
|
521
|
+
async allowance() {
|
|
522
|
+
if (this.keyKind !== "account") {
|
|
523
|
+
throw new TypeError("allowance needs an account token (ow_a_): the allowance is per account");
|
|
524
|
+
}
|
|
525
|
+
return this.request("GET", "/account/allowance");
|
|
526
|
+
}
|
|
516
527
|
// -- Core request machinery ----------------------------------------------
|
|
517
528
|
/**
|
|
518
529
|
* Raw authenticated request against this client's baseUrl. Public since 4.0
|