wontopos 2.2.45 → 2.2.47
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 +134 -21
- package/dist/cjs/wontopos.d.cts +117 -76
- package/dist/cjs/wontopos.js +98 -22
- package/dist/wontopos.d.ts +117 -76
- package/dist/wontopos.js +97 -22
- package/package.json +1 -1
package/dist/cjs/wontopos.d.cts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* (`createStore`) or calls return 404. Every account starts with a `default` store,
|
|
15
15
|
* so with no `userId` anywhere the zero-setup path just works.
|
|
16
16
|
*
|
|
17
|
-
* The API key picks *which memory* (your
|
|
17
|
+
* The API key picks *which memory* (your workspace); `model` picks *which engine*
|
|
18
18
|
* reads it. Models on the shared pool read the same memory, so you can store with
|
|
19
19
|
* one and recall with another; `listModels()` reports each model's `memory` as
|
|
20
20
|
* `"shared"` or `"isolated"`, and an isolated one starts empty. Set a default in
|
|
@@ -22,15 +22,16 @@
|
|
|
22
22
|
* `mem.withModel("tablet-1").recall(...)`.
|
|
23
23
|
*
|
|
24
24
|
* Recall quality does not depend on which language a memory was written in: a
|
|
25
|
-
* memory stored in one language is found by a question asked in another.
|
|
26
|
-
*
|
|
25
|
+
* memory stored in one language is found by a question asked in another. No language
|
|
26
|
+
* model reads your stored memories.
|
|
27
27
|
*
|
|
28
28
|
* Reliability: every call retries transient failures with exponential backoff +
|
|
29
29
|
* jitter, honoring `Retry-After` up to 30s — 429 and a 409 that says another write
|
|
30
30
|
* to the store was in flight, always; 408/502/503/504 and connection errors only when
|
|
31
|
-
* a retry can never double-process a write (
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* a retry can never double-process a write (reads, the DELETE calls, the memory writes,
|
|
32
|
+
* which carry an idempotency key, or a failure at connect time). Tune with `maxRetries`
|
|
33
|
+
* (0 disables) and `timeoutMs`, or per call site via the `withTimeout()` /
|
|
34
|
+
* `withRetries()` clones.
|
|
34
35
|
*
|
|
35
36
|
* Debugging: set `WONTOPOS_LOG=debug` to log method/path/status/timing/retries
|
|
36
37
|
* to stderr — never memory content, request bodies, or the API key.
|
|
@@ -48,6 +49,8 @@ export declare const SEARCH_LIMIT_MAX = 20;
|
|
|
48
49
|
/** `recall`'s surrounding-context count. 0 to 20 inclusive; 0 attaches none. */
|
|
49
50
|
export declare const CONTEXT_LIMIT_MIN = 0;
|
|
50
51
|
export declare const CONTEXT_LIMIT_MAX = 20;
|
|
52
|
+
/** @deprecated Test hook. The warn-once set is process-global by design. */
|
|
53
|
+
export declare function _resetRetirementWarnings(): void;
|
|
51
54
|
/** Quota from a response's `X-RateLimit-*` headers, or `null` if absent. */
|
|
52
55
|
export interface RateLimit {
|
|
53
56
|
limit: number | null;
|
|
@@ -89,7 +92,9 @@ export declare class BadRequestError extends WosError {
|
|
|
89
92
|
/** 401 — the API key is missing, wrong, or revoked. */
|
|
90
93
|
export declare class AuthenticationError extends WosError {
|
|
91
94
|
}
|
|
92
|
-
/** 402 — no card on file
|
|
95
|
+
/** 402 — no card on file, the balance is depleted, or the month's spend cap for the
|
|
96
|
+
* account's tier is reached (`details.reason` is `tier_cap_reached`). Top up to
|
|
97
|
+
* continue; a top-up also raises the tier. */
|
|
93
98
|
export declare class PaymentRequiredError extends WosError {
|
|
94
99
|
}
|
|
95
100
|
/** 403 — the key/model isn't allowed to do this. */
|
|
@@ -98,8 +103,11 @@ export declare class PermissionDeniedError extends WosError {
|
|
|
98
103
|
/** 404 — the store or resource doesn't exist. */
|
|
99
104
|
export declare class NotFoundError extends WosError {
|
|
100
105
|
}
|
|
101
|
-
/** 409: another write to this store was in flight
|
|
102
|
-
*
|
|
106
|
+
/** 409: another write to this store was in flight, or the first request under this
|
|
107
|
+
* write's idempotency key is still running (both retried automatically; nothing was
|
|
108
|
+
* stored); the store id collides with an existing one (not retried); or the first
|
|
109
|
+
* request under the key did not come back with an answer, so whether it was stored is
|
|
110
|
+
* not known (not retried: check before sending it again under a new key). */
|
|
103
111
|
export declare class ConflictError extends WosError {
|
|
104
112
|
/** The existing store id this one collides with. Set only on a collision, which
|
|
105
113
|
* retrying cannot fix. */
|
|
@@ -182,7 +190,9 @@ export interface StoreResult {
|
|
|
182
190
|
note?: string;
|
|
183
191
|
/** `true` when this response was REPLAYED from a previous request with the same
|
|
184
192
|
* `idempotencyKey` — nothing new was stored. Absent on a fresh write. Read it to
|
|
185
|
-
* tell "my retry landed" from "my retry was a no-op".
|
|
193
|
+
* tell "my retry landed" from "my retry was a no-op". This client sets it only for
|
|
194
|
+
* a key you passed, and then the earlier request can also be an attempt of this same
|
|
195
|
+
* call that the client sent again after an answer that left the outcome open. */
|
|
186
196
|
replayed?: boolean;
|
|
187
197
|
[key: string]: unknown;
|
|
188
198
|
}
|
|
@@ -194,8 +204,9 @@ export interface StatusResult {
|
|
|
194
204
|
/**
|
|
195
205
|
* An image attached to a memory, passed to `add`/`store` via `opts.image`.
|
|
196
206
|
*
|
|
197
|
-
* Both edges must be 700px or more
|
|
198
|
-
*
|
|
207
|
+
* Both edges must be 700px or more and the long edge at most 2500px, and the image
|
|
208
|
+
* file at most 7MB; anything else is refused (400) with the reason. A request body is
|
|
209
|
+
* capped at 10MB.
|
|
199
210
|
*
|
|
200
211
|
* What the service keeps is NOT your original. An image whose long edge is over
|
|
201
212
|
* 1568px is downscaled to 1568 before anything else happens, and that smaller
|
|
@@ -241,8 +252,9 @@ export interface ImageBytes {
|
|
|
241
252
|
* The image as stored. Write it to a file, or wrap it in a Blob to show it.
|
|
242
253
|
*
|
|
243
254
|
* This is the service's copy, not necessarily your upload: anything over 1568px
|
|
244
|
-
* on its long edge was downscaled on the way in, and re-encoded to
|
|
245
|
-
* was a JPEG (see `ImageInput`). Take the file extension from
|
|
255
|
+
* on its long edge (2500 at most) was downscaled on the way in, and re-encoded to
|
|
256
|
+
* WebP unless it was a JPEG (see `ImageInput`). Take the file extension from
|
|
257
|
+
* `contentType`.
|
|
246
258
|
*/
|
|
247
259
|
bytes: Uint8Array;
|
|
248
260
|
/** Sniffed from the BYTES, not from whatever the upload was named — e.g. `image/jpeg`. */
|
|
@@ -317,7 +329,8 @@ export interface LineageStep {
|
|
|
317
329
|
is_current?: boolean;
|
|
318
330
|
[key: string]: unknown;
|
|
319
331
|
}
|
|
320
|
-
/** `lineage` → the
|
|
332
|
+
/** `lineage` → the edits that followed one memory, from the id passed forward to the
|
|
333
|
+
* version in force, oldest first. */
|
|
321
334
|
export interface LineageResult {
|
|
322
335
|
memory_id?: string;
|
|
323
336
|
chain: LineageStep[];
|
|
@@ -360,23 +373,31 @@ export interface SearchResult {
|
|
|
360
373
|
/** Image memories the answer carried (one by default on an image-capable model,
|
|
361
374
|
* up to `max_images`); `[]` when there were none. */
|
|
362
375
|
images: Memory[];
|
|
363
|
-
/** Re-ask passes
|
|
364
|
-
* than you asked for means
|
|
376
|
+
/** Re-ask passes that added memories. Present only when `verify` above 0 was sent;
|
|
377
|
+
* lower than you asked for means a pass found nothing new, or could not run. */
|
|
365
378
|
verify_used?: number;
|
|
366
379
|
[key: string]: unknown;
|
|
367
380
|
}
|
|
368
381
|
export interface RecallResult {
|
|
382
|
+
/** The recent conversation, oldest first. */
|
|
369
383
|
short_term: {
|
|
370
|
-
turns:
|
|
384
|
+
turns: HistoryTurn[];
|
|
371
385
|
count: number;
|
|
386
|
+
[key: string]: unknown;
|
|
372
387
|
};
|
|
388
|
+
/** The stored memories that match the query, best first. */
|
|
373
389
|
long_term: {
|
|
374
390
|
memories: Memory[];
|
|
375
391
|
count: number;
|
|
392
|
+
[key: string]: unknown;
|
|
376
393
|
};
|
|
394
|
+
/** The conversation around the best memory, in the order it was said. Each row is
|
|
395
|
+
* text that starts with where it sits next to that memory: `[before] `, `[match] `
|
|
396
|
+
* or `[after] `. Empty when there is no best memory or `context_limit` is 0. */
|
|
377
397
|
context: {
|
|
378
|
-
around_top_memory:
|
|
398
|
+
around_top_memory: string[];
|
|
379
399
|
count: number;
|
|
400
|
+
[key: string]: unknown;
|
|
380
401
|
};
|
|
381
402
|
[key: string]: unknown;
|
|
382
403
|
}
|
|
@@ -391,7 +412,7 @@ export interface EngramResult {
|
|
|
391
412
|
usage?: Usage;
|
|
392
413
|
[key: string]: unknown;
|
|
393
414
|
}
|
|
394
|
-
/** One turn of the short-term window, as `history()`
|
|
415
|
+
/** One turn of the short-term window, as `history()` and `recall()` return it. */
|
|
395
416
|
export interface HistoryTurn {
|
|
396
417
|
/** `"user"` or `"assistant"`. */
|
|
397
418
|
role?: string;
|
|
@@ -414,7 +435,7 @@ export interface UsageResult {
|
|
|
414
435
|
output_tokens?: number;
|
|
415
436
|
since?: string;
|
|
416
437
|
};
|
|
417
|
-
/** The workspace this key belongs to, over the window. */
|
|
438
|
+
/** The workspace this key belongs to, over the window: every key in it, not only this one. */
|
|
418
439
|
workspace?: {
|
|
419
440
|
workspace_id?: string | null;
|
|
420
441
|
requests?: number;
|
|
@@ -542,9 +563,8 @@ export interface SpeakersList {
|
|
|
542
563
|
[key: string]: unknown;
|
|
543
564
|
}
|
|
544
565
|
/**
|
|
545
|
-
* Narrow a search to part of a store.
|
|
546
|
-
*
|
|
547
|
-
* many matches sit inside it.
|
|
566
|
+
* Narrow a search to part of a store. A narrow filter can return fewer than `limit`
|
|
567
|
+
* even when the store holds more inside it.
|
|
548
568
|
*
|
|
549
569
|
* Retrieval behaves the same in every language, so these behave
|
|
550
570
|
* identically in every language. Unlisted keys are dropped by the API rather than
|
|
@@ -565,7 +585,8 @@ export interface SearchFilters {
|
|
|
565
585
|
time_from?: string;
|
|
566
586
|
time_to?: string;
|
|
567
587
|
/** WHEN THE CONTENT HAPPENED (`metadata.event_date`), not when it was written —
|
|
568
|
-
* this is the one you usually want.
|
|
588
|
+
* this is the one you usually want. A memory stored without an `event_date` is
|
|
589
|
+
* matched by when it was stored. */
|
|
569
590
|
event_from?: string;
|
|
570
591
|
event_to?: string;
|
|
571
592
|
/** Drop matches the engine scored below this importance (0–1). */
|
|
@@ -578,9 +599,11 @@ export declare function _resetFilterWarnings(): void;
|
|
|
578
599
|
* could not be told from an option that worked. Put a genuinely new one under
|
|
579
600
|
* `extra`. */
|
|
580
601
|
export interface SearchOptions {
|
|
581
|
-
/** Recall caching.
|
|
582
|
-
*
|
|
583
|
-
*
|
|
602
|
+
/** Recall caching. The same query again inside the TTL bills at 0.1×; one that
|
|
603
|
+
* extends the cached query bills only its cached part at 0.1×, the new part at the
|
|
604
|
+
* write rate and its results at the normal rate. The FIRST call writes the cache
|
|
605
|
+
* and bills the query tokens at 2× (`5m`) or 3× (`1h`), so this only pays for a
|
|
606
|
+
* query you repeat or extend. Do not enable it globally. */
|
|
584
607
|
cache_control?: {
|
|
585
608
|
ttl: "5m" | "1h";
|
|
586
609
|
};
|
|
@@ -591,9 +614,9 @@ export interface SearchOptions {
|
|
|
591
614
|
/**
|
|
592
615
|
* Re-ask passes, 0–3. After the first retrieval the service asks the engine again up
|
|
593
616
|
* to this many times, each time telling it what was already returned so it skips
|
|
594
|
-
* those and reaches further back.
|
|
617
|
+
* those and reaches further back. Raising it adds no language model call at any
|
|
595
618
|
* value. Stops early when a pass finds nothing new; `verify_used` in the response
|
|
596
|
-
* says how many
|
|
619
|
+
* says how many passes added memories.
|
|
597
620
|
*
|
|
598
621
|
* Each pass is another engine call and can add up to `limit` more memories, so it
|
|
599
622
|
* costs more — you are billed for what is delivered. Default 0. Worth it on questions
|
|
@@ -629,25 +652,24 @@ export interface SearchOptions {
|
|
|
629
652
|
/**
|
|
630
653
|
* Per-call options for a write.
|
|
631
654
|
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
638
|
-
* on 408 / 502 / 503 / 504 or a dropped body, where the write may already have been
|
|
639
|
-
* applied — without a key the client cannot know whether it was.
|
|
655
|
+
* Every memory write (`add`, `addTurn`, `addBulk`, `update`) carries an idempotency key:
|
|
656
|
+
* `idempotencyKey` when you pass one, otherwise one this client makes for the call. With
|
|
657
|
+
* it the client retries the write on 408 / 502 / 503 / 504 and on a dropped connection,
|
|
658
|
+
* as it does a read: the service answers a repeat with the first attempt's result instead
|
|
659
|
+
* of storing again, and one that arrives while the first is still running with a 409 to
|
|
660
|
+
* wait, which is retried as well.
|
|
640
661
|
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
643
|
-
*
|
|
662
|
+
* Pass your own key when the retry is yours: a job that died and was re-run, a queue
|
|
663
|
+
* that redelivers. The service keeps a key for 24 hours and answers a repeat with the
|
|
664
|
+
* first successful response, marked `replayed: true`; the same key with a different body
|
|
665
|
+
* is refused (422). A first attempt that failed is not kept, so a repeat of it runs,
|
|
666
|
+
* unless it did not come back with an answer, so whether it was applied is not known:
|
|
667
|
+
* then the repeat is refused with a `ConflictError` (409) instead of storing it twice.
|
|
668
|
+
* Check before sending it again under a new key.
|
|
644
669
|
*
|
|
645
670
|
* The key must be UNIQUE PER LOGICAL WRITE — derive it from the thing being stored
|
|
646
671
|
* (`` `import:${row.id}` ``), never a constant, or the second write replays the first
|
|
647
672
|
* and is silently lost. Format: 1-128 chars of `[A-Za-z0-9._:-]`, checked locally.
|
|
648
|
-
*
|
|
649
|
-
* The window is best-effort and can be shorter than 10 minutes; it is not a durable
|
|
650
|
-
* de-duplication record.
|
|
651
673
|
*/
|
|
652
674
|
export interface WriteOptions {
|
|
653
675
|
idempotencyKey?: string;
|
|
@@ -775,6 +797,12 @@ export interface ClientOptions {
|
|
|
775
797
|
* (`res.redirected`) is refused. A fetch that sends the request to another URL
|
|
776
798
|
* on purpose, such as a proxy that rewrites it, is fine. */
|
|
777
799
|
fetch?: FetchLike;
|
|
800
|
+
/** Run in a browser page anyway. Off by default: an API key in a page is readable by
|
|
801
|
+
* everyone who opens it, and with it every memory in its workspace, so a client in a
|
|
802
|
+
* page that would send the key to the service itself is refused. A `baseUrl` of your
|
|
803
|
+
* own, a proxy that holds the real key, is not refused. Turn this on only for a local
|
|
804
|
+
* demo with a key you will revoke. */
|
|
805
|
+
dangerouslyAllowBrowser?: boolean;
|
|
778
806
|
}
|
|
779
807
|
/** Wontopos memory client. Store and recall memories, isolated per `userId`. */
|
|
780
808
|
export declare class Client {
|
|
@@ -796,6 +824,8 @@ export declare class Client {
|
|
|
796
824
|
private readonly pageRelative;
|
|
797
825
|
/** Whether the caller supplied `fetch`. */
|
|
798
826
|
private readonly customFetch;
|
|
827
|
+
/** Whether the caller asked to run in a browser page anyway. */
|
|
828
|
+
private readonly allowBrowser;
|
|
799
829
|
/** The store every call uses unless one passes `userId`. */
|
|
800
830
|
private readonly defaultUser;
|
|
801
831
|
private _rateLimit;
|
|
@@ -859,15 +889,16 @@ export declare class Client {
|
|
|
859
889
|
addBulk(content: string, userId?: string, category?: string, timestamp?: string, opts?: WriteOptions): Promise<StatusResult>;
|
|
860
890
|
/** Supersede an old memory with new content. Payload first, userId last — same shape as add/search. */
|
|
861
891
|
update(oldMemoryId: string, newContent: string, userId?: string, opts?: WriteOptions): Promise<UpdateResult>;
|
|
862
|
-
/** Search a store's memories.
|
|
892
|
+
/** Search a store's memories. They come most relevant first; the assistant's own
|
|
893
|
+
* words and image memories, when there are any, follow them in their own order.
|
|
863
894
|
*
|
|
864
895
|
* `limit` is 5-20, and out of range is refused rather than clamped: asking for 50
|
|
865
896
|
* and silently receiving 20 reads as "that is all there is". The default is 10.
|
|
866
897
|
*
|
|
867
|
-
* `limit` bounds `memories`, not the returned array
|
|
868
|
-
*
|
|
869
|
-
*
|
|
870
|
-
* it as well, so it can hold more than `limit`. They are billed either way. Size a
|
|
898
|
+
* `limit` bounds `memories`, not the returned array, and each `verify` pass can add
|
|
899
|
+
* up to `limit` more. The assistant's own words (on a model that lists
|
|
900
|
+
* `self_memories` in its capabilities) and image memories (one unless `max_images`
|
|
901
|
+
* says otherwise, on a model that lists `images`) come back after them in it as well, so it can hold more than `limit`. They are billed either way. Size a
|
|
871
902
|
* prompt window on the array you get back, not on `limit`. `searchFull()` hands the
|
|
872
903
|
* fields back apart.
|
|
873
904
|
*
|
|
@@ -891,7 +922,7 @@ export declare class Client {
|
|
|
891
922
|
* const r = await mem.searchFull("the day we moved", "alice", 10,
|
|
892
923
|
* { max_images: 3, verify: 2 });
|
|
893
924
|
* r.images.length; // the photos, apart from the text memories
|
|
894
|
-
* r.verify_used; //
|
|
925
|
+
* r.verify_used; // re-ask passes that added memories (each billed for what it added)
|
|
895
926
|
*
|
|
896
927
|
* Each option needs a model that lists it in its `listModels()` capabilities
|
|
897
928
|
* (`images`, `re_ask`) and is refused (403) on any other rather than accepted and
|
|
@@ -928,7 +959,8 @@ export declare class Client {
|
|
|
928
959
|
}): Promise<EngramResult>;
|
|
929
960
|
/** Recent conversation turns (short-term memory). */
|
|
930
961
|
history(userId?: string): Promise<HistoryTurn[]>;
|
|
931
|
-
/** Memory counts for a store: { total_memories, short_term_turns }.
|
|
962
|
+
/** Memory counts for a store: { total_memories, short_term_turns }. `total_memories`
|
|
963
|
+
* can be larger than the number `listMemories` lists. */
|
|
932
964
|
stats(userId?: string): Promise<StatsResult>;
|
|
933
965
|
/**
|
|
934
966
|
* What this key has spent, and what is left — the numbers behind "can I keep going?".
|
|
@@ -936,18 +968,17 @@ export declare class Client {
|
|
|
936
968
|
* Free: it carries no charge and skips the balance gate, because an account at zero
|
|
937
969
|
* still has to be able to find out why. Rate-limited instead.
|
|
938
970
|
*
|
|
939
|
-
*
|
|
940
|
-
*
|
|
941
|
-
* because that is what gates the next call whichever key makes it.
|
|
971
|
+
* `key` is THIS key's own lifetime spend. `workspace` and `stores` cover the window
|
|
972
|
+
* for the workspace this key belongs to, every key in it included. `balance_cents` is
|
|
973
|
+
* account-wide, because that is what gates the next call whichever key makes it.
|
|
942
974
|
*
|
|
943
975
|
* const u = await mem.usage(7);
|
|
944
976
|
* if (u.balance_cents! < 100) stop();
|
|
945
977
|
*/
|
|
946
978
|
usage(days?: number): Promise<UsageResult>;
|
|
947
979
|
/** Fetch ONE memory by id — the text you stored, and its metadata.
|
|
948
|
-
* The id is what `add`/`store` or `listMemories` returned.
|
|
949
|
-
*
|
|
950
|
-
* or an invalidated memory rejects with `NotFoundError`. Pass `undefined` as
|
|
980
|
+
* The id is what `add`/`store` or `listMemories` returned. An unknown id or one
|
|
981
|
+
* from another store rejects with `NotFoundError`. Pass `undefined` as
|
|
951
982
|
* `userId` for the default store — it is positional here. */
|
|
952
983
|
get(userId: string | undefined, memoryId: string): Promise<Memory>;
|
|
953
984
|
/** List a store's stored memories — the text you stored, plus its metadata.
|
|
@@ -993,9 +1024,10 @@ export declare class Client {
|
|
|
993
1024
|
* Fetch the bytes of an image memory — the picture the SERVICE holds.
|
|
994
1025
|
*
|
|
995
1026
|
* Not necessarily your upload, in size OR in format: an image whose long edge was
|
|
996
|
-
* over 1568px was downscaled to 1568 on the way in and re-encoded —
|
|
997
|
-
* formats as WebP, so a PNG comes back as `image/webp`; JPEG stays JPEG
|
|
998
|
-
*
|
|
1027
|
+
* over 1568px (2500 at most) was downscaled to 1568 on the way in and re-encoded —
|
|
1028
|
+
* lossless formats as WebP, so a PNG comes back as `image/webp`; JPEG stays JPEG;
|
|
1029
|
+
* kept as sent when the re-encode came out bigger — and that smaller picture is what
|
|
1030
|
+
* is stored and comes back here. Nothing on our side ever
|
|
999
1031
|
* uses more than 1568, so the extra pixels would be bytes nobody reads.
|
|
1000
1032
|
* Keep your own copy for the full-resolution file.
|
|
1001
1033
|
*
|
|
@@ -1013,10 +1045,10 @@ export declare class Client {
|
|
|
1013
1045
|
*/
|
|
1014
1046
|
getImage(userId: string | undefined, memoryId: string): Promise<ImageBytes>;
|
|
1015
1047
|
/**
|
|
1016
|
-
* Remove the PHOTO from a memory
|
|
1048
|
+
* Remove the PHOTO from a memory. It can take the whole memory with it.
|
|
1017
1049
|
*
|
|
1018
|
-
* `preview: true` reports what would happen, including `memory_kept
|
|
1019
|
-
* nothing. Retried like `deleteStore`; without `preview`, a 404 after an ambiguous
|
|
1050
|
+
* `preview: true` reports what would happen, including `memory_kept` (`false` when
|
|
1051
|
+
* the memory itself would go), and changes nothing. Retried like `deleteStore`; without `preview`, a 404 after an ambiguous
|
|
1020
1052
|
* failure carries the same note.
|
|
1021
1053
|
*
|
|
1022
1054
|
* const p = await mem.forgetImage(undefined, id, { preview: true });
|
|
@@ -1100,11 +1132,13 @@ export declare class Client {
|
|
|
1100
1132
|
skipIds?: string[];
|
|
1101
1133
|
}): Promise<RevisionsResult>;
|
|
1102
1134
|
/**
|
|
1103
|
-
* The
|
|
1135
|
+
* The edits that followed one memory: from the id you pass forward to the version in
|
|
1136
|
+
* force, oldest first.
|
|
1104
1137
|
*
|
|
1105
|
-
* `is_current` marks the version in force.
|
|
1106
|
-
* say, and when did it change"
|
|
1107
|
-
*
|
|
1138
|
+
* `is_current` marks the version in force. The chain runs forward only, so to answer
|
|
1139
|
+
* "what did this used to say, and when did it change" pass the first version's id;
|
|
1140
|
+
* the current version's id (what `search` returns) comes back alone. `revisions()`
|
|
1141
|
+
* tells you HOW MUCH a store moved, this tells you what happened to one fact.
|
|
1108
1142
|
*/
|
|
1109
1143
|
lineage(userId: string | undefined, memoryId: string): Promise<LineageResult>;
|
|
1110
1144
|
/**
|
|
@@ -1126,8 +1160,7 @@ export declare class Client {
|
|
|
1126
1160
|
* `AuthenticationError` (bad key), `PaymentRequiredError` (valid key but no card /
|
|
1127
1161
|
* depleted balance), or `APIConnectionError` (unreachable). Makes one metered request. */
|
|
1128
1162
|
ping(): Promise<boolean>;
|
|
1129
|
-
/** Available models: `[{ id, name, available, memory, capabilities, retires_at? }, ...]`.
|
|
1130
|
-
* Needs no API key. */
|
|
1163
|
+
/** Available models: `[{ id, name, available, memory, capabilities, retires_at? }, ...]`. */
|
|
1131
1164
|
listModels(): Promise<ModelInfo[]>;
|
|
1132
1165
|
/**
|
|
1133
1166
|
* The engrams (and delivery forms) the selected model can actually run.
|
|
@@ -1160,7 +1193,9 @@ export declare class Client {
|
|
|
1160
1193
|
addSpeaker(speaker: string, userId?: string): Promise<SpeakerOpResult>;
|
|
1161
1194
|
/** The store's registered people, each with its memory count. */
|
|
1162
1195
|
listSpeakers(userId?: string): Promise<SpeakersList>;
|
|
1163
|
-
/** Unregister a person. Their memories stay
|
|
1196
|
+
/** Unregister a person. Their memories stay, and the name can no longer tag a new
|
|
1197
|
+
* memory or filter a search. The tag goes from stored memories too, except on
|
|
1198
|
+
* `tablet-2`, which keeps it on memories already stored with it. Retried like
|
|
1164
1199
|
* `deleteStore`, with the same note on a 404 after an ambiguous failure. */
|
|
1165
1200
|
removeSpeaker(speaker: string, userId?: string): Promise<SpeakerOpResult>;
|
|
1166
1201
|
/** Delete a single memory by id. Pass `undefined` as `userId` for the default
|
|
@@ -1170,6 +1205,11 @@ export declare class Client {
|
|
|
1170
1205
|
* this is destructive, so it never falls back to the default store. */
|
|
1171
1206
|
deleteAll(userId: string): Promise<StatusResult>;
|
|
1172
1207
|
private post;
|
|
1208
|
+
/** A memory write. It always carries an `Idempotency-Key`, the caller's or one made
|
|
1209
|
+
* for this call, so an answer that leaves the outcome open (408/502/503/504, a
|
|
1210
|
+
* dropped connection) can be retried: the service answers the retry with the first
|
|
1211
|
+
* attempt's result instead of storing again. */
|
|
1212
|
+
private write;
|
|
1173
1213
|
/** A DELETE that removes something: a 404 after an ambiguous failure says an earlier
|
|
1174
1214
|
* attempt may already have removed it. */
|
|
1175
1215
|
private remove;
|
|
@@ -1210,12 +1250,13 @@ export declare class Client {
|
|
|
1210
1250
|
*
|
|
1211
1251
|
* Retried: 429, and a 409 whose error carries `retry_after_ms` (another write to the
|
|
1212
1252
|
* store was in flight; nothing was stored), on every method; 408/502/503/504 and
|
|
1213
|
-
* dropped connections on
|
|
1214
|
-
*
|
|
1215
|
-
*
|
|
1216
|
-
*
|
|
1217
|
-
*
|
|
1218
|
-
*
|
|
1253
|
+
* dropped connections on a call that only reads (an idempotent method, or a POST
|
|
1254
|
+
* that only reads) or a write that carries an idempotency key; connect failures on
|
|
1255
|
+
* every method. A retry whose wait is over the
|
|
1256
|
+
* cap, or does not fit the deadline, is not made: the call fails with the error of
|
|
1257
|
+
* the response it has. So does a retry the deadline leaves no time to send, and the
|
|
1258
|
+
* retry of a call that only reads that the deadline cuts short. Any other retry cut
|
|
1259
|
+
* short stays a status-0 deadline error: a write may have been applied.
|
|
1219
1260
|
*/
|
|
1220
1261
|
private send;
|
|
1221
1262
|
/**
|