wontopos 2.2.42 → 2.2.44
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/README.md +4 -0
- package/dist/cjs/wontopos.d.cts +32 -11
- package/dist/cjs/wontopos.js +9 -2
- package/dist/wontopos.d.ts +32 -11
- package/dist/wontopos.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -180,6 +180,10 @@ try {
|
|
|
180
180
|
}
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
+
A retired model answers `410`, thrown as `GoneError`: retrying cannot succeed, so name a
|
|
184
|
+
live model (`listModels()` lists them, with `retires_at` on one that is scheduled to
|
|
185
|
+
retire). `deleteStore` still works under a retired model.
|
|
186
|
+
|
|
183
187
|
## A different API host
|
|
184
188
|
|
|
185
189
|
Point the client somewhere other than the default endpoint - a dedicated region,
|
package/dist/cjs/wontopos.d.cts
CHANGED
|
@@ -106,6 +106,11 @@ export declare class ConflictError extends WosError {
|
|
|
106
106
|
readonly conflictsWith?: string;
|
|
107
107
|
constructor(status: number, message: string, requestId?: string, init?: WosErrorInit);
|
|
108
108
|
}
|
|
109
|
+
/** 410 — the model this call named is retired. Retrying cannot succeed: name a live
|
|
110
|
+
* model instead (`listModels()` lists them). `deleteStore` still works under a
|
|
111
|
+
* retired model. */
|
|
112
|
+
export declare class GoneError extends WosError {
|
|
113
|
+
}
|
|
109
114
|
/** 429 — too many requests. Back off and retry (the client already retries these,
|
|
110
115
|
* unless `Retry-After` asks for more than 30 seconds). */
|
|
111
116
|
export declare class RateLimitError extends WosError {
|
|
@@ -156,13 +161,16 @@ export interface Memory {
|
|
|
156
161
|
speaker?: string;
|
|
157
162
|
[key: string]: unknown;
|
|
158
163
|
}
|
|
159
|
-
/** `add` / `store` → `{ id, status }
|
|
164
|
+
/** `add` / `store` → `{ id, status }`. `status` starts with `"stored"` (more text can
|
|
165
|
+
* follow) or is `"duplicate"`; match on the prefix. */
|
|
160
166
|
export interface StoreResult {
|
|
161
167
|
id?: string;
|
|
162
|
-
/** `"stored"`, or `"duplicate"` when nothing was saved. */
|
|
168
|
+
/** Starts with `"stored"`, or is `"duplicate"` when nothing was saved. */
|
|
163
169
|
status?: string;
|
|
164
170
|
/**
|
|
165
|
-
*
|
|
171
|
+
* On a duplicate, the id of the memory this write collided with, when the reply has
|
|
172
|
+
* it. A duplicate can arrive with an empty `id` and no `duplicate_of`; then search with
|
|
173
|
+
* the same text to find the memory it matched.
|
|
166
174
|
*
|
|
167
175
|
* A genuinely new fact that only varies a detail of one already stored ("no meetings
|
|
168
176
|
* before 10am" next to "no meetings on Fridays") can land here too, so a duplicate is
|
|
@@ -324,6 +332,8 @@ export interface SpeakerPage {
|
|
|
324
332
|
memories: Memory[];
|
|
325
333
|
chunks?: number;
|
|
326
334
|
/** The count to show before anyone confirms a delete of this speaker's memories. */
|
|
335
|
+
records_to_delete?: number;
|
|
336
|
+
/** @deprecated The same number as `records_to_delete`, under its old name. */
|
|
327
337
|
points_to_delete?: number;
|
|
328
338
|
returned?: number;
|
|
329
339
|
has_more?: boolean;
|
|
@@ -381,10 +391,16 @@ export interface EngramResult {
|
|
|
381
391
|
usage?: Usage;
|
|
382
392
|
[key: string]: unknown;
|
|
383
393
|
}
|
|
394
|
+
/** One turn of the short-term window, as `history()` returns it. */
|
|
384
395
|
export interface HistoryTurn {
|
|
396
|
+
/** `"user"` or `"assistant"`. */
|
|
397
|
+
role?: string;
|
|
398
|
+
content?: string;
|
|
399
|
+
timestamp?: string;
|
|
400
|
+
/** @deprecated Not sent: a turn comes back as `role` and `content`. */
|
|
385
401
|
user_msg?: string;
|
|
402
|
+
/** @deprecated Not sent: a turn comes back as `role` and `content`. */
|
|
386
403
|
assistant_msg?: string;
|
|
387
|
-
timestamp?: string;
|
|
388
404
|
[key: string]: unknown;
|
|
389
405
|
}
|
|
390
406
|
/** `usage` → what this key has spent, and what is left to spend. */
|
|
@@ -404,7 +420,7 @@ export interface UsageResult {
|
|
|
404
420
|
requests?: number;
|
|
405
421
|
cost_cents?: number;
|
|
406
422
|
};
|
|
407
|
-
/** Per-store spend over the window,
|
|
423
|
+
/** Per-store spend over the window, highest spend first, and at most 50 rows — a longer
|
|
408
424
|
* list is cut, so these need not sum to `workspace`. `other`, when present, is an
|
|
409
425
|
* overflow bucket rather than a store. */
|
|
410
426
|
stores?: {
|
|
@@ -464,6 +480,10 @@ export interface ModelInfo {
|
|
|
464
480
|
memory: "shared" | "isolated";
|
|
465
481
|
/** What this model can do. Check it before relying on a feature. */
|
|
466
482
|
capabilities?: ModelCapabilities;
|
|
483
|
+
/** Present on a live model that is scheduled to retire (RFC3339). From that instant
|
|
484
|
+
* the model leaves this list and calls naming it are refused. */
|
|
485
|
+
retires_at?: string;
|
|
486
|
+
[key: string]: unknown;
|
|
467
487
|
}
|
|
468
488
|
/** One entry of the engram / delivery-form catalogue (`listEngrams`). */
|
|
469
489
|
export interface EngramInfo {
|
|
@@ -931,9 +951,9 @@ export declare class Client {
|
|
|
931
951
|
get(userId: string | undefined, memoryId: string): Promise<Memory>;
|
|
932
952
|
/** List a store's stored memories — the text you stored, plus its metadata.
|
|
933
953
|
* Paginated: pass the returned `next_cursor` back as `cursor` for the next
|
|
934
|
-
* page, and only a cursor the service returned
|
|
935
|
-
* next page; a non-null one can still be followed by
|
|
936
|
-
* browse or export a store.
|
|
954
|
+
* page, and only a cursor the service returned, with the model that returned it. A
|
|
955
|
+
* `null` cursor means there is no next page; a non-null one can still be followed by
|
|
956
|
+
* an empty page. Use it to browse or export a store.
|
|
937
957
|
*
|
|
938
958
|
* `limit` is 1-500 (default 100); anything else is refused before the request.
|
|
939
959
|
*
|
|
@@ -1093,8 +1113,8 @@ export declare class Client {
|
|
|
1093
1113
|
* assistant's own words, otherwise a person's name. Same cursor paging as
|
|
1094
1114
|
* `listImages`; `limit` is 5-20.
|
|
1095
1115
|
*
|
|
1096
|
-
* `
|
|
1097
|
-
* speaker's memories.
|
|
1116
|
+
* `records_to_delete` is the count to show before anyone confirms a delete of this
|
|
1117
|
+
* speaker's memories; `points_to_delete` is the same number under its old name.
|
|
1098
1118
|
*/
|
|
1099
1119
|
bySpeaker(speaker: string, userId?: string, opts?: {
|
|
1100
1120
|
limit?: number;
|
|
@@ -1105,7 +1125,8 @@ export declare class Client {
|
|
|
1105
1125
|
* `AuthenticationError` (bad key), `PaymentRequiredError` (valid key but no card /
|
|
1106
1126
|
* depleted balance), or `APIConnectionError` (unreachable). Makes one metered request. */
|
|
1107
1127
|
ping(): Promise<boolean>;
|
|
1108
|
-
/** Available models: `[{ id, name, available, memory }, ...]`.
|
|
1128
|
+
/** Available models: `[{ id, name, available, memory, capabilities, retires_at? }, ...]`.
|
|
1129
|
+
* Needs no API key. */
|
|
1109
1130
|
listModels(): Promise<ModelInfo[]>;
|
|
1110
1131
|
/**
|
|
1111
1132
|
* The engrams (and delivery forms) the selected model can actually run.
|
package/dist/cjs/wontopos.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WME = exports.Client = exports.ServerError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.PermissionDeniedError = exports.PaymentRequiredError = exports.AuthenticationError = exports.BadRequestError = exports.APIConnectionError = exports.WosError = exports.CONTEXT_LIMIT_MAX = exports.CONTEXT_LIMIT_MIN = exports.SEARCH_LIMIT_MAX = exports.SEARCH_LIMIT_MIN = void 0;
|
|
3
|
+
exports.WME = exports.Client = exports.ServerError = exports.RateLimitError = exports.GoneError = exports.ConflictError = exports.NotFoundError = exports.PermissionDeniedError = exports.PaymentRequiredError = exports.AuthenticationError = exports.BadRequestError = exports.APIConnectionError = exports.WosError = exports.CONTEXT_LIMIT_MAX = exports.CONTEXT_LIMIT_MIN = exports.SEARCH_LIMIT_MAX = exports.SEARCH_LIMIT_MIN = void 0;
|
|
4
4
|
exports._resetStoreIdWarnings = _resetStoreIdWarnings;
|
|
5
5
|
exports._resetFilterWarnings = _resetFilterWarnings;
|
|
6
|
-
const VERSION = "2.2.
|
|
6
|
+
const VERSION = "2.2.44";
|
|
7
7
|
const RUNTIME = (() => {
|
|
8
8
|
const p = globalThis?.process;
|
|
9
9
|
return p?.version ? ` (node/${p.version}; ${p.platform}-${p.arch})` : "";
|
|
@@ -456,6 +456,9 @@ class ConflictError extends WosError {
|
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
458
|
exports.ConflictError = ConflictError;
|
|
459
|
+
class GoneError extends WosError {
|
|
460
|
+
}
|
|
461
|
+
exports.GoneError = GoneError;
|
|
459
462
|
class RateLimitError extends WosError {
|
|
460
463
|
retryAfter;
|
|
461
464
|
constructor(status, message, requestId, init) {
|
|
@@ -468,6 +471,7 @@ exports.RateLimitError = RateLimitError;
|
|
|
468
471
|
class ServerError extends WosError {
|
|
469
472
|
}
|
|
470
473
|
exports.ServerError = ServerError;
|
|
474
|
+
const GONE_HINT = "This model is retired; listModels() lists the ones you can use.";
|
|
471
475
|
const STATUS_ERRORS = {
|
|
472
476
|
400: BadRequestError,
|
|
473
477
|
401: AuthenticationError,
|
|
@@ -475,6 +479,7 @@ const STATUS_ERRORS = {
|
|
|
475
479
|
403: PermissionDeniedError,
|
|
476
480
|
404: NotFoundError,
|
|
477
481
|
409: ConflictError,
|
|
482
|
+
410: GoneError,
|
|
478
483
|
413: BadRequestError,
|
|
479
484
|
422: BadRequestError,
|
|
480
485
|
429: RateLimitError,
|
|
@@ -1072,6 +1077,8 @@ class Client {
|
|
|
1072
1077
|
errorFromAnswer(res, body, retryAfter, mayBeDeleted = false, unread) {
|
|
1073
1078
|
const e = parseErrorText(new TextDecoder().decode(body));
|
|
1074
1079
|
let msg = cleanServerText(e.message) || `HTTP ${res.status}`;
|
|
1080
|
+
if (res.status === 410)
|
|
1081
|
+
msg += ` ${GONE_HINT}`;
|
|
1075
1082
|
if (unread)
|
|
1076
1083
|
msg += ` (the error body could not be read: ${cleanServerText(unread, 512)})`;
|
|
1077
1084
|
const requestId = e.requestId === undefined ? undefined : cleanServerText(e.requestId, 256) || undefined;
|
package/dist/wontopos.d.ts
CHANGED
|
@@ -106,6 +106,11 @@ export declare class ConflictError extends WosError {
|
|
|
106
106
|
readonly conflictsWith?: string;
|
|
107
107
|
constructor(status: number, message: string, requestId?: string, init?: WosErrorInit);
|
|
108
108
|
}
|
|
109
|
+
/** 410 — the model this call named is retired. Retrying cannot succeed: name a live
|
|
110
|
+
* model instead (`listModels()` lists them). `deleteStore` still works under a
|
|
111
|
+
* retired model. */
|
|
112
|
+
export declare class GoneError extends WosError {
|
|
113
|
+
}
|
|
109
114
|
/** 429 — too many requests. Back off and retry (the client already retries these,
|
|
110
115
|
* unless `Retry-After` asks for more than 30 seconds). */
|
|
111
116
|
export declare class RateLimitError extends WosError {
|
|
@@ -156,13 +161,16 @@ export interface Memory {
|
|
|
156
161
|
speaker?: string;
|
|
157
162
|
[key: string]: unknown;
|
|
158
163
|
}
|
|
159
|
-
/** `add` / `store` → `{ id, status }
|
|
164
|
+
/** `add` / `store` → `{ id, status }`. `status` starts with `"stored"` (more text can
|
|
165
|
+
* follow) or is `"duplicate"`; match on the prefix. */
|
|
160
166
|
export interface StoreResult {
|
|
161
167
|
id?: string;
|
|
162
|
-
/** `"stored"`, or `"duplicate"` when nothing was saved. */
|
|
168
|
+
/** Starts with `"stored"`, or is `"duplicate"` when nothing was saved. */
|
|
163
169
|
status?: string;
|
|
164
170
|
/**
|
|
165
|
-
*
|
|
171
|
+
* On a duplicate, the id of the memory this write collided with, when the reply has
|
|
172
|
+
* it. A duplicate can arrive with an empty `id` and no `duplicate_of`; then search with
|
|
173
|
+
* the same text to find the memory it matched.
|
|
166
174
|
*
|
|
167
175
|
* A genuinely new fact that only varies a detail of one already stored ("no meetings
|
|
168
176
|
* before 10am" next to "no meetings on Fridays") can land here too, so a duplicate is
|
|
@@ -324,6 +332,8 @@ export interface SpeakerPage {
|
|
|
324
332
|
memories: Memory[];
|
|
325
333
|
chunks?: number;
|
|
326
334
|
/** The count to show before anyone confirms a delete of this speaker's memories. */
|
|
335
|
+
records_to_delete?: number;
|
|
336
|
+
/** @deprecated The same number as `records_to_delete`, under its old name. */
|
|
327
337
|
points_to_delete?: number;
|
|
328
338
|
returned?: number;
|
|
329
339
|
has_more?: boolean;
|
|
@@ -381,10 +391,16 @@ export interface EngramResult {
|
|
|
381
391
|
usage?: Usage;
|
|
382
392
|
[key: string]: unknown;
|
|
383
393
|
}
|
|
394
|
+
/** One turn of the short-term window, as `history()` returns it. */
|
|
384
395
|
export interface HistoryTurn {
|
|
396
|
+
/** `"user"` or `"assistant"`. */
|
|
397
|
+
role?: string;
|
|
398
|
+
content?: string;
|
|
399
|
+
timestamp?: string;
|
|
400
|
+
/** @deprecated Not sent: a turn comes back as `role` and `content`. */
|
|
385
401
|
user_msg?: string;
|
|
402
|
+
/** @deprecated Not sent: a turn comes back as `role` and `content`. */
|
|
386
403
|
assistant_msg?: string;
|
|
387
|
-
timestamp?: string;
|
|
388
404
|
[key: string]: unknown;
|
|
389
405
|
}
|
|
390
406
|
/** `usage` → what this key has spent, and what is left to spend. */
|
|
@@ -404,7 +420,7 @@ export interface UsageResult {
|
|
|
404
420
|
requests?: number;
|
|
405
421
|
cost_cents?: number;
|
|
406
422
|
};
|
|
407
|
-
/** Per-store spend over the window,
|
|
423
|
+
/** Per-store spend over the window, highest spend first, and at most 50 rows — a longer
|
|
408
424
|
* list is cut, so these need not sum to `workspace`. `other`, when present, is an
|
|
409
425
|
* overflow bucket rather than a store. */
|
|
410
426
|
stores?: {
|
|
@@ -464,6 +480,10 @@ export interface ModelInfo {
|
|
|
464
480
|
memory: "shared" | "isolated";
|
|
465
481
|
/** What this model can do. Check it before relying on a feature. */
|
|
466
482
|
capabilities?: ModelCapabilities;
|
|
483
|
+
/** Present on a live model that is scheduled to retire (RFC3339). From that instant
|
|
484
|
+
* the model leaves this list and calls naming it are refused. */
|
|
485
|
+
retires_at?: string;
|
|
486
|
+
[key: string]: unknown;
|
|
467
487
|
}
|
|
468
488
|
/** One entry of the engram / delivery-form catalogue (`listEngrams`). */
|
|
469
489
|
export interface EngramInfo {
|
|
@@ -931,9 +951,9 @@ export declare class Client {
|
|
|
931
951
|
get(userId: string | undefined, memoryId: string): Promise<Memory>;
|
|
932
952
|
/** List a store's stored memories — the text you stored, plus its metadata.
|
|
933
953
|
* Paginated: pass the returned `next_cursor` back as `cursor` for the next
|
|
934
|
-
* page, and only a cursor the service returned
|
|
935
|
-
* next page; a non-null one can still be followed by
|
|
936
|
-
* browse or export a store.
|
|
954
|
+
* page, and only a cursor the service returned, with the model that returned it. A
|
|
955
|
+
* `null` cursor means there is no next page; a non-null one can still be followed by
|
|
956
|
+
* an empty page. Use it to browse or export a store.
|
|
937
957
|
*
|
|
938
958
|
* `limit` is 1-500 (default 100); anything else is refused before the request.
|
|
939
959
|
*
|
|
@@ -1093,8 +1113,8 @@ export declare class Client {
|
|
|
1093
1113
|
* assistant's own words, otherwise a person's name. Same cursor paging as
|
|
1094
1114
|
* `listImages`; `limit` is 5-20.
|
|
1095
1115
|
*
|
|
1096
|
-
* `
|
|
1097
|
-
* speaker's memories.
|
|
1116
|
+
* `records_to_delete` is the count to show before anyone confirms a delete of this
|
|
1117
|
+
* speaker's memories; `points_to_delete` is the same number under its old name.
|
|
1098
1118
|
*/
|
|
1099
1119
|
bySpeaker(speaker: string, userId?: string, opts?: {
|
|
1100
1120
|
limit?: number;
|
|
@@ -1105,7 +1125,8 @@ export declare class Client {
|
|
|
1105
1125
|
* `AuthenticationError` (bad key), `PaymentRequiredError` (valid key but no card /
|
|
1106
1126
|
* depleted balance), or `APIConnectionError` (unreachable). Makes one metered request. */
|
|
1107
1127
|
ping(): Promise<boolean>;
|
|
1108
|
-
/** Available models: `[{ id, name, available, memory }, ...]`.
|
|
1128
|
+
/** Available models: `[{ id, name, available, memory, capabilities, retires_at? }, ...]`.
|
|
1129
|
+
* Needs no API key. */
|
|
1109
1130
|
listModels(): Promise<ModelInfo[]>;
|
|
1110
1131
|
/**
|
|
1111
1132
|
* The engrams (and delivery forms) the selected model can actually run.
|
package/dist/wontopos.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const VERSION = "2.2.
|
|
1
|
+
const VERSION = "2.2.44";
|
|
2
2
|
const RUNTIME = (() => {
|
|
3
3
|
const p = globalThis?.process;
|
|
4
4
|
return p?.version ? ` (node/${p.version}; ${p.platform}-${p.arch})` : "";
|
|
@@ -443,6 +443,8 @@ export class ConflictError extends WosError {
|
|
|
443
443
|
this.conflictsWith = typeof c === "string" ? c : undefined;
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
+
export class GoneError extends WosError {
|
|
447
|
+
}
|
|
446
448
|
export class RateLimitError extends WosError {
|
|
447
449
|
retryAfter;
|
|
448
450
|
constructor(status, message, requestId, init) {
|
|
@@ -453,6 +455,7 @@ export class RateLimitError extends WosError {
|
|
|
453
455
|
}
|
|
454
456
|
export class ServerError extends WosError {
|
|
455
457
|
}
|
|
458
|
+
const GONE_HINT = "This model is retired; listModels() lists the ones you can use.";
|
|
456
459
|
const STATUS_ERRORS = {
|
|
457
460
|
400: BadRequestError,
|
|
458
461
|
401: AuthenticationError,
|
|
@@ -460,6 +463,7 @@ const STATUS_ERRORS = {
|
|
|
460
463
|
403: PermissionDeniedError,
|
|
461
464
|
404: NotFoundError,
|
|
462
465
|
409: ConflictError,
|
|
466
|
+
410: GoneError,
|
|
463
467
|
413: BadRequestError,
|
|
464
468
|
422: BadRequestError,
|
|
465
469
|
429: RateLimitError,
|
|
@@ -1057,6 +1061,8 @@ export class Client {
|
|
|
1057
1061
|
errorFromAnswer(res, body, retryAfter, mayBeDeleted = false, unread) {
|
|
1058
1062
|
const e = parseErrorText(new TextDecoder().decode(body));
|
|
1059
1063
|
let msg = cleanServerText(e.message) || `HTTP ${res.status}`;
|
|
1064
|
+
if (res.status === 410)
|
|
1065
|
+
msg += ` ${GONE_HINT}`;
|
|
1060
1066
|
if (unread)
|
|
1061
1067
|
msg += ` (the error body could not be read: ${cleanServerText(unread, 512)})`;
|
|
1062
1068
|
const requestId = e.requestId === undefined ? undefined : cleanServerText(e.requestId, 256) || undefined;
|