wontopos 2.2.9 → 2.2.11
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 +3 -0
- package/dist/wontopos.d.ts +39 -2
- package/dist/wontopos.js +19 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,6 +131,9 @@ const mem = new Client({ apiKey: "...", baseUrl: "https://wos.your-host.com" });
|
|
|
131
131
|
|
|
132
132
|
## Changelog
|
|
133
133
|
|
|
134
|
+
- **2.2.10** — `Memory` fix: the relevance field is `similarity` (not `score`,
|
|
135
|
+
which was never in the response); added typed `importance`, `category`,
|
|
136
|
+
`is_superseded`, `superseded_by`, `created_at`, `event_date`.
|
|
134
137
|
- **2.2.9** — typed responses for every method (index-signature friendly) +
|
|
135
138
|
typed `SearchOptions`; security round 2: 64MB response cap, key/model-name
|
|
136
139
|
hygiene, `Client.fromEnv()`.
|
package/dist/wontopos.d.ts
CHANGED
|
@@ -46,9 +46,22 @@ export interface Usage {
|
|
|
46
46
|
export interface Memory {
|
|
47
47
|
id?: string;
|
|
48
48
|
content?: string;
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
/** Cognitive category, e.g. "general". */
|
|
50
|
+
category?: string;
|
|
51
|
+
/** Semantic relevance to the query — higher is closer. This IS the relevance score; there is no `score` field. */
|
|
52
|
+
similarity?: number;
|
|
53
|
+
/** Learned importance weight of the memory. */
|
|
54
|
+
importance?: number;
|
|
55
|
+
/** Month bucket the memory belongs to (e.g. "2026-07"). Omitted when temporal fields are stripped. */
|
|
51
56
|
time_bucket?: string;
|
|
57
|
+
/** True if a later memory has superseded this one. */
|
|
58
|
+
is_superseded?: boolean;
|
|
59
|
+
/** Id of the memory that superseded this one, or null. */
|
|
60
|
+
superseded_by?: string | null;
|
|
61
|
+
/** When the memory was stored (RFC3339). Omitted when temporal fields are stripped. */
|
|
62
|
+
created_at?: string;
|
|
63
|
+
/** When the content actually happened (RFC3339), if known. */
|
|
64
|
+
event_date?: string;
|
|
52
65
|
/** WHO said it: "me" (the assistant) or a registered person's name. Absent = untagged. */
|
|
53
66
|
speaker?: string;
|
|
54
67
|
[key: string]: unknown;
|
|
@@ -110,6 +123,14 @@ export interface StatsResult {
|
|
|
110
123
|
short_term_turns?: number;
|
|
111
124
|
[key: string]: unknown;
|
|
112
125
|
}
|
|
126
|
+
/** `listMemories` → one page of a store's raw memories (original text + metadata, no vector). */
|
|
127
|
+
export interface MemoryPage {
|
|
128
|
+
memories: Memory[];
|
|
129
|
+
count: number;
|
|
130
|
+
/** Pass back as `cursor` for the next page; `null` on the last page. */
|
|
131
|
+
next_cursor: string | null;
|
|
132
|
+
[key: string]: unknown;
|
|
133
|
+
}
|
|
113
134
|
export interface ModelInfo {
|
|
114
135
|
id: string;
|
|
115
136
|
name: string;
|
|
@@ -222,6 +243,22 @@ export declare class Client {
|
|
|
222
243
|
history(userId?: string): Promise<HistoryTurn[]>;
|
|
223
244
|
/** Memory counts for a store: { total_memories, short_term_turns }. */
|
|
224
245
|
stats(userId?: string): Promise<StatsResult>;
|
|
246
|
+
/** List a store's stored memories — the original text plus metadata, never the
|
|
247
|
+
* vector. Paginated: pass the returned `next_cursor` back as `cursor` for the next
|
|
248
|
+
* page; a `null` cursor means the last page. Use it to browse or export a store.
|
|
249
|
+
*
|
|
250
|
+
* let cursor: string | null = null;
|
|
251
|
+
* const all: Memory[] = [];
|
|
252
|
+
* do {
|
|
253
|
+
* const page = await mem.listMemories(undefined, { cursor: cursor ?? undefined });
|
|
254
|
+
* all.push(...page.memories);
|
|
255
|
+
* cursor = page.next_cursor;
|
|
256
|
+
* } while (cursor);
|
|
257
|
+
*/
|
|
258
|
+
listMemories(userId?: string, opts?: {
|
|
259
|
+
limit?: number;
|
|
260
|
+
cursor?: string;
|
|
261
|
+
}): Promise<MemoryPage>;
|
|
225
262
|
/** Available models: `[{ id, name, available, memory }, ...]`. Needs no API key. */
|
|
226
263
|
listModels(): Promise<ModelInfo[]>;
|
|
227
264
|
/** Create a store — the `userId` you read and write under. Stores are explicit:
|
package/dist/wontopos.js
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* runtime's (never disabled by this SDK; Node 18+ floors TLS at 1.2). Prefer
|
|
33
33
|
* `Client.fromEnv()` over keys in source code.
|
|
34
34
|
*/
|
|
35
|
-
const VERSION = "2.2.
|
|
35
|
+
const VERSION = "2.2.11";
|
|
36
36
|
const USER_AGENT = `wontopos-node/${VERSION}`;
|
|
37
37
|
const DEFAULT_BASE_URL = "https://api.wontopos.com";
|
|
38
38
|
const DEFAULT_MODEL = "tablet-1";
|
|
@@ -197,6 +197,24 @@ export class Client {
|
|
|
197
197
|
stats(userId) {
|
|
198
198
|
return this.post("/api/v1/memory/stats", { user_id: this.uid(userId) });
|
|
199
199
|
}
|
|
200
|
+
/** List a store's stored memories — the original text plus metadata, never the
|
|
201
|
+
* vector. Paginated: pass the returned `next_cursor` back as `cursor` for the next
|
|
202
|
+
* page; a `null` cursor means the last page. Use it to browse or export a store.
|
|
203
|
+
*
|
|
204
|
+
* let cursor: string | null = null;
|
|
205
|
+
* const all: Memory[] = [];
|
|
206
|
+
* do {
|
|
207
|
+
* const page = await mem.listMemories(undefined, { cursor: cursor ?? undefined });
|
|
208
|
+
* all.push(...page.memories);
|
|
209
|
+
* cursor = page.next_cursor;
|
|
210
|
+
* } while (cursor);
|
|
211
|
+
*/
|
|
212
|
+
listMemories(userId, opts = {}) {
|
|
213
|
+
const body = { user_id: this.uid(userId), limit: opts.limit ?? 100 };
|
|
214
|
+
if (opts.cursor)
|
|
215
|
+
body.cursor = opts.cursor;
|
|
216
|
+
return this.post("/api/v1/memory/list", body);
|
|
217
|
+
}
|
|
200
218
|
// ----- models -----
|
|
201
219
|
/** Available models: `[{ id, name, available, memory }, ...]`. Needs no API key. */
|
|
202
220
|
async listModels() {
|
package/package.json
CHANGED