wontopos 2.2.36 → 2.2.38
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 +5 -100
- package/dist/cjs/wontopos.d.cts +1048 -0
- package/dist/cjs/wontopos.js +106 -719
- package/dist/wontopos.d.ts +63 -3
- package/dist/wontopos.js +106 -719
- package/package.json +17 -7
package/dist/wontopos.d.ts
CHANGED
|
@@ -359,6 +359,36 @@ export interface HistoryTurn {
|
|
|
359
359
|
timestamp?: string;
|
|
360
360
|
[key: string]: unknown;
|
|
361
361
|
}
|
|
362
|
+
/** `usage` → what this key has spent, and what is left to spend. */
|
|
363
|
+
export interface UsageResult {
|
|
364
|
+
window_days?: number;
|
|
365
|
+
/** This API key's LIFETIME spend. Never another key's. */
|
|
366
|
+
key?: {
|
|
367
|
+
requests?: number;
|
|
368
|
+
cost_cents?: number;
|
|
369
|
+
input_tokens?: number;
|
|
370
|
+
output_tokens?: number;
|
|
371
|
+
since?: string;
|
|
372
|
+
};
|
|
373
|
+
/** The workspace this key belongs to, over the window. */
|
|
374
|
+
workspace?: {
|
|
375
|
+
workspace_id?: string | null;
|
|
376
|
+
requests?: number;
|
|
377
|
+
cost_cents?: number;
|
|
378
|
+
};
|
|
379
|
+
/** Per-store spend over the window, busiest first, and at most 50 rows — a longer
|
|
380
|
+
* list is cut, so these need not sum to `workspace`. `other`, when present, is an
|
|
381
|
+
* overflow bucket rather than a store. */
|
|
382
|
+
stores?: {
|
|
383
|
+
store?: string;
|
|
384
|
+
requests?: number;
|
|
385
|
+
cost_cents?: number;
|
|
386
|
+
}[];
|
|
387
|
+
/** Prepaid balance left on the ACCOUNT. Negative means overdrawn. */
|
|
388
|
+
balance_cents?: number;
|
|
389
|
+
expiring_soon_cents?: number;
|
|
390
|
+
[key: string]: unknown;
|
|
391
|
+
}
|
|
362
392
|
export interface StatsResult {
|
|
363
393
|
total_memories?: number;
|
|
364
394
|
short_term_turns?: number;
|
|
@@ -460,7 +490,10 @@ export interface SearchFilters {
|
|
|
460
490
|
}
|
|
461
491
|
/** Test hook — the warn-once set is process-global by design. */
|
|
462
492
|
export declare function _resetFilterWarnings(): void;
|
|
463
|
-
/** Known `search` options
|
|
493
|
+
/** Known `search` options. An unknown key is refused before anything is sent — the
|
|
494
|
+
* service drops keys it does not recognise and answers normally, so a misspelling
|
|
495
|
+
* could not be told from an option that worked. Put a genuinely new one under
|
|
496
|
+
* `extra`. */
|
|
464
497
|
export interface SearchOptions {
|
|
465
498
|
/** Recall caching. A hit inside the TTL bills at 0.1× — but the FIRST call
|
|
466
499
|
* writes the cache and bills the query tokens at 2× (`5m`) or 3× (`1h`), so
|
|
@@ -489,7 +522,9 @@ export interface SearchOptions {
|
|
|
489
522
|
*/
|
|
490
523
|
verify?: number;
|
|
491
524
|
/**
|
|
492
|
-
* How many image memories the answer may carry, 0–5.
|
|
525
|
+
* How many image memories the answer may carry, 0–5. Omit it and the service uses
|
|
526
|
+
* 1; `0` asks for none. The MCP server defaults its own tool to 0 instead, so most
|
|
527
|
+
* searches through it carry no image rows.
|
|
493
528
|
* Out of range is refused, not clamped — silently cutting 5 to 1 would leave you
|
|
494
529
|
* believing you got five.
|
|
495
530
|
*
|
|
@@ -497,7 +532,13 @@ export interface SearchOptions {
|
|
|
497
532
|
* than answering with no images.
|
|
498
533
|
*/
|
|
499
534
|
max_images?: number;
|
|
500
|
-
|
|
535
|
+
/**
|
|
536
|
+
* Fields the service accepts that this version does not know about, merged into the
|
|
537
|
+
* request as written. Every other key is refused, so a typo cannot reach the wire —
|
|
538
|
+
* `verfy: 3` used to be sent, dropped by the service, and answered normally, leaving
|
|
539
|
+
* a caller billed for one pass believing they had bought three.
|
|
540
|
+
*/
|
|
541
|
+
extra?: Record<string, unknown>;
|
|
501
542
|
}
|
|
502
543
|
/**
|
|
503
544
|
* Per-call options for a write.
|
|
@@ -660,6 +701,11 @@ export declare class Client {
|
|
|
660
701
|
/** Supersede an old memory with new content. Payload first, userId last — same shape as add/search. */
|
|
661
702
|
update(oldMemoryId: string, newContent: string, userId?: string, opts?: WriteOptions): Promise<UpdateResult>;
|
|
662
703
|
/** Search a store's memories. Returns them most relevant first.
|
|
704
|
+
*
|
|
705
|
+
* `limit` is 5-20, and out of range is refused rather than clamped: asking for 50
|
|
706
|
+
* and silently receiving 20 reads as "that is all there is". The default is 10, so
|
|
707
|
+
* a call that passes no count is unaffected. Before 2.2.35 the count was sent on
|
|
708
|
+
* unchecked.
|
|
663
709
|
*
|
|
664
710
|
* `limit` bounds `memories`, not the returned array. On a model that keeps the
|
|
665
711
|
* assistant's own words separate (Scroll 1.2+) those come back as well, so the
|
|
@@ -720,6 +766,20 @@ export declare class Client {
|
|
|
720
766
|
history(userId?: string): Promise<HistoryTurn[]>;
|
|
721
767
|
/** Memory counts for a store: { total_memories, short_term_turns }. */
|
|
722
768
|
stats(userId?: string): Promise<StatsResult>;
|
|
769
|
+
/**
|
|
770
|
+
* What this key has spent, and what is left — the numbers behind "can I keep going?".
|
|
771
|
+
*
|
|
772
|
+
* Free: it carries no charge and skips the balance gate, because an account at zero
|
|
773
|
+
* still has to be able to find out why. Rate-limited instead.
|
|
774
|
+
*
|
|
775
|
+
* Scoped to THIS key: its own lifetime spend, its workspace and stores over the
|
|
776
|
+
* window. It never returns another key's spend. `balance_cents` is account-wide,
|
|
777
|
+
* because that is what gates the next call whichever key makes it.
|
|
778
|
+
*
|
|
779
|
+
* const u = await mem.usage(7);
|
|
780
|
+
* if (u.balance_cents! < 100) stop();
|
|
781
|
+
*/
|
|
782
|
+
usage(days?: number): Promise<UsageResult>;
|
|
723
783
|
/** Fetch ONE memory by id — the text you stored, and its metadata.
|
|
724
784
|
* The id is what `add`/`store` or `listMemories` returned. Same visibility as
|
|
725
785
|
* `listMemories`: an id from another store, an internal record id, or an
|