wontopos 2.2.36 → 2.2.37
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/dist/cjs/wontopos.js +16 -698
- package/dist/wontopos.d.ts +44 -0
- package/dist/wontopos.js +16 -698
- package/package.json +2 -2
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;
|
|
@@ -720,6 +750,20 @@ export declare class Client {
|
|
|
720
750
|
history(userId?: string): Promise<HistoryTurn[]>;
|
|
721
751
|
/** Memory counts for a store: { total_memories, short_term_turns }. */
|
|
722
752
|
stats(userId?: string): Promise<StatsResult>;
|
|
753
|
+
/**
|
|
754
|
+
* What this key has spent, and what is left — the numbers behind "can I keep going?".
|
|
755
|
+
*
|
|
756
|
+
* Free: it carries no charge and skips the balance gate, because an account at zero
|
|
757
|
+
* still has to be able to find out why. Rate-limited instead.
|
|
758
|
+
*
|
|
759
|
+
* Scoped to THIS key: its own lifetime spend, its workspace and stores over the
|
|
760
|
+
* window. It never returns another key's spend. `balance_cents` is account-wide,
|
|
761
|
+
* because that is what gates the next call whichever key makes it.
|
|
762
|
+
*
|
|
763
|
+
* const u = await mem.usage(7);
|
|
764
|
+
* if (u.balance_cents! < 100) stop();
|
|
765
|
+
*/
|
|
766
|
+
usage(days?: number): Promise<UsageResult>;
|
|
723
767
|
/** Fetch ONE memory by id — the text you stored, and its metadata.
|
|
724
768
|
* The id is what `add`/`store` or `listMemories` returned. Same visibility as
|
|
725
769
|
* `listMemories`: an id from another store, an internal record id, or an
|