@onlyworlds/sdk 4.23.0 → 4.25.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 +31 -0
- package/README.md +12 -1
- package/dist/index.d.ts +109 -15
- package/dist/index.js +50 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,37 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.25.0] — 2026-10-15
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **`OwWorldMeta` types every field keel's `World` declares** (it named four): the description and
|
|
12
|
+
picture, the calendar (`time_format_names`, `time_format_equivalents`, `time_basic_unit`, the three
|
|
13
|
+
`time_range_*`), the three unit labels, `public_read`, `owner_character`, `created_at`, and new
|
|
14
|
+
**`agent_narrator_rule`** (keel #298, D103: whether a Narrative written through an agent seat is
|
|
15
|
+
narrated by that seat's own Character; read-only, set on the world page). Past `id` and `name`
|
|
16
|
+
they stay optional so code that builds a world meta keeps compiling; keel always sends all of them.
|
|
17
|
+
`updated_at` and `created_at` read `string | null`, as the document says. Assembly's wire gate now
|
|
18
|
+
holds this type to `World` (it had held only the PATCH body). Council and Lantern type-check on it.
|
|
19
|
+
|
|
20
|
+
## [4.24.0] — 2026-10-15
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- **A world's invite links** (keel C1, 48c10d4), on the owner's account token (`ow_a_`):
|
|
24
|
+
`createWorldLink(worldId, { reader, role?, days?, inviterName?, withCharacter? })` answers the
|
|
25
|
+
new link with its `code`, `link` and the one `line` to send (the code is in this answer only:
|
|
26
|
+
keel keeps a hash); `listWorldLinks(worldId)` the links without codes, each with its `status`
|
|
27
|
+
and `uses`; `revokeWorldLink(worldId, linkId)`. Types `OwWorldLink`, `OwCreatedWorldLink`. A
|
|
28
|
+
non-owner, and a world that doesn't exist, get 404; a world key is a TypeError before sending.
|
|
29
|
+
For Lantern's Invite someone (Temper, h29 #5152).
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
- `acceptJoin`'s doc comment and the README: accepting needs no account PIN for any role (keel
|
|
33
|
+
#297, ed73c90), so its refusals are 404 and 409 `already_member`; `pin_required` now belongs to
|
|
34
|
+
minting a write key for the membership. `isPinRequired` stays.
|
|
35
|
+
- Doc comments say "token rating" for the account's daily budget (`ask`, `sort`, `allowance`,
|
|
36
|
+
`OwAllowance`, the answers' `token_rating`), as the README did in 4.23.0; the docs site's
|
|
37
|
+
generated reference reads them. No code change.
|
|
38
|
+
|
|
8
39
|
## [4.23.0] — 2026-10-14
|
|
9
40
|
|
|
10
41
|
### Deprecated
|
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
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1858,11 +1858,44 @@ declare const FIELD_SCHEMA: {
|
|
|
1858
1858
|
type OwElement = OwElementBase;
|
|
1859
1859
|
/** Spatial types live under spatial/ in the OW Folder Format. */
|
|
1860
1860
|
declare const SPATIAL_TYPES: readonly ElementType[];
|
|
1861
|
+
/**
|
|
1862
|
+
* GET /world: the world's own fields, as keel's `World` component declares them (since 4.25.0
|
|
1863
|
+
* every one is typed). keel always sends all of them; past `id` and `name` they are optional
|
|
1864
|
+
* here only so that code building a world meta keeps compiling within 4.x. Dates and durations
|
|
1865
|
+
* count in `time_basic_unit`; the three units are free-text labels, nothing converts.
|
|
1866
|
+
*/
|
|
1861
1867
|
interface OwWorldMeta {
|
|
1862
1868
|
id: string;
|
|
1863
1869
|
name: string;
|
|
1864
|
-
|
|
1870
|
+
description?: string;
|
|
1871
|
+
image_url?: string;
|
|
1872
|
+
/** The names of the calendar's steps, e.g. ['Day', 'Week', 'Month', 'Year']. */
|
|
1873
|
+
time_format_names?: string[];
|
|
1874
|
+
/** How many time_basic_unit each step holds, in the same order. Whole numbers in the standard; an older world may read back strings. */
|
|
1875
|
+
time_format_equivalents?: Array<number | string>;
|
|
1876
|
+
/** The unit every element date and duration counts in (e.g. 'Year'). */
|
|
1877
|
+
time_basic_unit?: string;
|
|
1878
|
+
time_range_min?: number | null;
|
|
1879
|
+
time_range_max?: number | null;
|
|
1880
|
+
/** The world's present moment (in a world folder: `time_current`). */
|
|
1881
|
+
time_range_current?: number | null;
|
|
1882
|
+
length_unit?: string;
|
|
1883
|
+
mass_unit?: string;
|
|
1884
|
+
distance_unit?: string;
|
|
1885
|
+
/** Whether the world can be read without its PIN. Read-only on the wire. */
|
|
1865
1886
|
public_read?: boolean;
|
|
1887
|
+
/**
|
|
1888
|
+
* Whether a Narrative written through an agent seat is narrated by that seat's own Character,
|
|
1889
|
+
* as a guest's is (keel #298, D103): set by the owner on the world page; read-only on the wire.
|
|
1890
|
+
* With it on, an agent naming another narrator is a 422 (`param: narrator`), and a seat with no
|
|
1891
|
+
* Character a 403 `guest_not_supported`.
|
|
1892
|
+
*/
|
|
1893
|
+
agent_narrator_rule?: boolean;
|
|
1894
|
+
/** The owner's "this Character is me": a Character id in this world, or null. */
|
|
1895
|
+
owner_character?: string | null;
|
|
1896
|
+
created_at?: string | null;
|
|
1897
|
+
/** Moves when the world's own fields change, not on element writes. */
|
|
1898
|
+
updated_at?: string | null;
|
|
1866
1899
|
[field: string]: unknown;
|
|
1867
1900
|
}
|
|
1868
1901
|
/** List envelope: cursor-paginated. */
|
|
@@ -2014,7 +2047,7 @@ interface OwAskAnswer {
|
|
|
2014
2047
|
remaining: number;
|
|
2015
2048
|
/** The account's tokens left today after this call (since keel a6244db, 2026-10-14). */
|
|
2016
2049
|
tokens_remaining: number;
|
|
2017
|
-
/** The account's daily
|
|
2050
|
+
/** The account's token rating: its daily budget in tokens, one meter with the Council (since keel a6244db). */
|
|
2018
2051
|
token_rating: number;
|
|
2019
2052
|
[k: string]: unknown;
|
|
2020
2053
|
}
|
|
@@ -2096,11 +2129,11 @@ interface OwSortAnswer {
|
|
|
2096
2129
|
output_tokens: number;
|
|
2097
2130
|
};
|
|
2098
2131
|
/** How many more calls of this one's size fit in what the account has left today; ask and
|
|
2099
|
-
* sort spend from one
|
|
2132
|
+
* sort spend from one token rating. */
|
|
2100
2133
|
remaining: number;
|
|
2101
2134
|
/** The account's tokens left today after this call (since keel a6244db, 2026-10-14). */
|
|
2102
2135
|
tokens_remaining: number;
|
|
2103
|
-
/** The account's daily
|
|
2136
|
+
/** The account's token rating: its daily budget in tokens, one meter with the Council (since keel a6244db). */
|
|
2104
2137
|
token_rating: number;
|
|
2105
2138
|
[k: string]: unknown;
|
|
2106
2139
|
}
|
|
@@ -2135,15 +2168,15 @@ interface OwMember {
|
|
|
2135
2168
|
name?: string;
|
|
2136
2169
|
[k: string]: unknown;
|
|
2137
2170
|
}
|
|
2138
|
-
/** GET /account/allowance: the account's
|
|
2171
|
+
/** GET /account/allowance: the account's token rating and what is left of it today (keel 872431f, 2026-10-14). */
|
|
2139
2172
|
interface OwAllowance {
|
|
2140
|
-
/** The account's daily
|
|
2173
|
+
/** The account's token rating: its daily budget in tokens. */
|
|
2141
2174
|
token_rating: number;
|
|
2142
2175
|
/** Tokens spent today (UTC); may pass the rating by the size of the last call. */
|
|
2143
2176
|
tokens_used_today: number;
|
|
2144
2177
|
/** Tokens left today, never below 0. */
|
|
2145
2178
|
tokens_remaining: number;
|
|
2146
|
-
/** When the
|
|
2179
|
+
/** When the day's tokens reset: the next midnight UTC (ISO 8601). */
|
|
2147
2180
|
resets_at: string;
|
|
2148
2181
|
[k: string]: unknown;
|
|
2149
2182
|
}
|
|
@@ -2166,6 +2199,39 @@ interface OwJoinPreview {
|
|
|
2166
2199
|
expires_at: string;
|
|
2167
2200
|
[k: string]: unknown;
|
|
2168
2201
|
}
|
|
2202
|
+
/** One of a world's invite links, as GET /account/worlds/{id}/links lists it (keel C1, 48c10d4). */
|
|
2203
|
+
interface OwWorldLink {
|
|
2204
|
+
/** The link's id: revokeWorldLink takes it. */
|
|
2205
|
+
id: string;
|
|
2206
|
+
/** `person`: accepted signed in, with acceptJoin. `agent`: redeemed by an AI agent at POST /join. */
|
|
2207
|
+
reader: 'person' | 'agent';
|
|
2208
|
+
role: OwMemberRole;
|
|
2209
|
+
/** The name the owner gave an agent link on the website, or empty. */
|
|
2210
|
+
label: string;
|
|
2211
|
+
/** The name the link is signed with, or empty (the invite line then reads "Someone"). */
|
|
2212
|
+
inviter_name: string;
|
|
2213
|
+
/** Whether redeeming gives the agent a Character of its own. Always false on a person link. */
|
|
2214
|
+
with_character: boolean;
|
|
2215
|
+
/** The code's last four characters, to tell links apart. */
|
|
2216
|
+
last4: string;
|
|
2217
|
+
/** ISO 8601, UTC. */
|
|
2218
|
+
created_at: string;
|
|
2219
|
+
/** ISO 8601, UTC. */
|
|
2220
|
+
expires_at: string;
|
|
2221
|
+
/** 0 or 1: a link works once. */
|
|
2222
|
+
uses: number;
|
|
2223
|
+
status: 'pending' | 'used' | 'revoked' | 'expired';
|
|
2224
|
+
[k: string]: unknown;
|
|
2225
|
+
}
|
|
2226
|
+
/** POST /account/worlds/{id}/links: the new link, with its code. The code is in this answer only: keel keeps a hash. */
|
|
2227
|
+
interface OwCreatedWorldLink extends OwWorldLink {
|
|
2228
|
+
/** The `ow_j_` join code. Shown once; it can never be read again. */
|
|
2229
|
+
code: string;
|
|
2230
|
+
/** The invite link: the /join page with the code after `#`. */
|
|
2231
|
+
link: string;
|
|
2232
|
+
/** The one line to send: who invites, to which world, and the link. */
|
|
2233
|
+
line: string;
|
|
2234
|
+
}
|
|
2169
2235
|
/** POST /account/join: the new membership (the same row as accepting an email invite). */
|
|
2170
2236
|
interface OwJoinedMembership {
|
|
2171
2237
|
/** The membership's id. */
|
|
@@ -2612,18 +2678,46 @@ declare class OwV2Client {
|
|
|
2612
2678
|
/**
|
|
2613
2679
|
* POST /account/join -- accept an invite link's code as the account this client's
|
|
2614
2680
|
* `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.
|
|
2681
|
+
* (every bad code, and a code made for an AI agent) and 409 `already_member`
|
|
2682
|
+
* (`err.isAlreadyMember`). Accepting needs no account PIN, for any role (keel #297,
|
|
2683
|
+
* ed73c90); a write key for the membership waits for one (`pin_required`). A refusal
|
|
2684
|
+
* never spends the code. A world key here is a TypeError before anything is sent.
|
|
2619
2685
|
*/
|
|
2620
2686
|
acceptJoin(code: string): Promise<OwJoinedMembership>;
|
|
2687
|
+
/**
|
|
2688
|
+
* POST /account/worlds/{worldId}/links -- a new invite link for a world this client's
|
|
2689
|
+
* `ow_a_` token owns (keel C1): `reader` is required (`person`, accepted with acceptJoin;
|
|
2690
|
+
* `agent`, redeemed at POST /join); `role` defaults to contributor, `days` (1, 7 or 30)
|
|
2691
|
+
* to 7; `withCharacter` (agent links only) to true. 201 with the code, shown in this
|
|
2692
|
+
* answer only. Owner only: anyone else, and a world that doesn't exist, gets 404
|
|
2693
|
+
* `not_found` (`err.isNotFound`). A world key is a TypeError before anything is sent.
|
|
2694
|
+
*/
|
|
2695
|
+
createWorldLink(worldId: string, opts: {
|
|
2696
|
+
reader: 'person' | 'agent';
|
|
2697
|
+
role?: OwMemberRole;
|
|
2698
|
+
days?: 1 | 7 | 30;
|
|
2699
|
+
inviterName?: string;
|
|
2700
|
+
withCharacter?: boolean;
|
|
2701
|
+
}): Promise<OwCreatedWorldLink>;
|
|
2702
|
+
/**
|
|
2703
|
+
* GET /account/worlds/{worldId}/links -- the world's invite links, without their codes:
|
|
2704
|
+
* each with its status (pending, used, revoked or expired) and uses. Owner only, as
|
|
2705
|
+
* createWorldLink. Needs the client's `ow_a_` token.
|
|
2706
|
+
*/
|
|
2707
|
+
listWorldLinks(worldId: string): Promise<OwWorldLink[]>;
|
|
2708
|
+
/**
|
|
2709
|
+
* DELETE /account/worlds/{worldId}/links/{linkId} -- revoke a link: its code no longer
|
|
2710
|
+
* works. A used, revoked or expired link answers the same and stays as it was; whoever
|
|
2711
|
+
* joined with it stays a member (remove them from the roster). Owner only, as
|
|
2712
|
+
* createWorldLink. Needs the client's `ow_a_` token.
|
|
2713
|
+
*/
|
|
2714
|
+
revokeWorldLink(worldId: string, linkId: string): Promise<void>;
|
|
2621
2715
|
/**
|
|
2622
2716
|
* POST /account/ask -- a question about a world the account owns or is in, answered by
|
|
2623
2717
|
* keel's AI proxy from `context` only (build it with buildAskContext from the elements
|
|
2624
2718
|
* the user sees). The answer is "The world doesn't say." when the context does not hold
|
|
2625
2719
|
* 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
|
|
2720
|
+
* Refusals: 429 `quota_exceeded` (`err.isQuotaExceeded`, the account's token rating used up for the day;
|
|
2627
2721
|
* Retry-After runs to midnight UTC), 503 `ask_unavailable` (`err.isAskUnavailable`:
|
|
2628
2722
|
* switched off, or paused for the day), 502 `ask_failed` (`err.isAskFailed`); none of
|
|
2629
2723
|
* them counts. 422 for a question over 500 characters or context past its limits.
|
|
@@ -2639,7 +2733,7 @@ declare class OwV2Client {
|
|
|
2639
2733
|
* lookupWorld's hits), sorted by the same proxy as ask into rows to review: `make`, `add_to`,
|
|
2640
2734
|
* `link`, `ask`. Nothing is written; the app applies what the user accepts. Every id in a
|
|
2641
2735
|
* row is from the slice; keel moves any other row to `not_proposed` with its reason.
|
|
2642
|
-
* The same account token,
|
|
2736
|
+
* The same account token, token rating (it spends the tokens it uses) and refusals as ask. 422
|
|
2643
2737
|
* names the param: notes 1 to 8, each up to 4,000 characters and 16,000 in all (text
|
|
2644
2738
|
* only), at most four pictures, each uploaded into this world; slice up to 100, names up
|
|
2645
2739
|
* to 200 characters, anchors up to 120.
|
|
@@ -2650,7 +2744,7 @@ declare class OwV2Client {
|
|
|
2650
2744
|
slice: OwSortRef[];
|
|
2651
2745
|
}): Promise<OwSortAnswer>;
|
|
2652
2746
|
/**
|
|
2653
|
-
* GET /account/allowance -- the account's
|
|
2747
|
+
* GET /account/allowance -- the account's token rating, the one daily meter ask, sort and
|
|
2654
2748
|
* the Council spend from (keel 872431f): the rating, what is used and left today, and
|
|
2655
2749
|
* when it resets (the next midnight UTC). Spends nothing. Needs the client's `ow_a_` token.
|
|
2656
2750
|
*/
|
|
@@ -3617,4 +3711,4 @@ declare class TokenResource {
|
|
|
3617
3711
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
3618
3712
|
}
|
|
3619
3713
|
|
|
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 };
|
|
3714
|
+
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
|
*/
|