wontopos 2.2.5 → 2.2.7
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 +9 -4
- package/dist/wontopos.d.ts +8 -0
- package/dist/wontopos.js +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,21 +24,26 @@ const ctx = await mem.recall("what does alice drink?", "alice");
|
|
|
24
24
|
|
|
25
25
|
`add` · `addTurn` · `addBulk` · `update` · `search` · `recall` · `history` · `stats` · `delete` · `deleteAll`
|
|
26
26
|
|
|
27
|
-
All methods take `{ userId }
|
|
27
|
+
All methods take `{ userId }` — it names the **store**: one isolated memory space per end-user, agent, or topic, then per account. WHO said each memory inside a store is the `speaker` tag below — storing the assistant's own words never needs a separate id.
|
|
28
28
|
|
|
29
29
|
## Who said it (speakers)
|
|
30
30
|
|
|
31
31
|
Every memory can carry a speaker: `"me"` for the assistant's own words, or a
|
|
32
|
-
person's name.
|
|
32
|
+
person's name. Speakers are explicit, like stores: register a person once,
|
|
33
|
+
then store under their name — a typo can never silently become a new person.
|
|
34
|
+
Search accepts a speaker too, to recall one person's words only.
|
|
33
35
|
|
|
34
36
|
```ts
|
|
37
|
+
await mem.addSpeaker("Bob", "alice"); // once per person
|
|
35
38
|
await mem.add("I promised to send the report on Friday", "alice", { speaker: "me" });
|
|
36
39
|
await mem.add("Bob said the deadline moved to Tuesday", "alice", { speaker: "Bob" });
|
|
37
40
|
await mem.search("what did Bob say about deadlines?", "alice", 10, { speaker: "Bob" });
|
|
38
41
|
```
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
`
|
|
43
|
+
`listSpeakers()` shows the registered people with per-person memory counts;
|
|
44
|
+
`removeSpeaker()` unregisters (memories stay, the tag goes). A store registers
|
|
45
|
+
up to 50 people to start (a limit we plan to raise); `"me"` never needs
|
|
46
|
+
registration and never counts against it.
|
|
42
47
|
|
|
43
48
|
## Recall caching
|
|
44
49
|
|
package/dist/wontopos.d.ts
CHANGED
|
@@ -121,6 +121,14 @@ export declare class Client {
|
|
|
121
121
|
}>>;
|
|
122
122
|
/** Delete a store and ALL its memories. Returns `{ user_id, status }`. */
|
|
123
123
|
deleteStore(userId: string): Promise<any>;
|
|
124
|
+
/** Register a person for this store. Speakers are explicit: register once, then
|
|
125
|
+
* store with `{ speaker }`. `"me"` (the assistant itself) never needs
|
|
126
|
+
* registration. A store registers up to 50 people to start. */
|
|
127
|
+
addSpeaker(speaker: string, userId?: string): Promise<any>;
|
|
128
|
+
/** The store's registered people, each with its memory count. */
|
|
129
|
+
listSpeakers(userId?: string): Promise<any>;
|
|
130
|
+
/** Unregister a person. Their memories stay; the name tag goes. */
|
|
131
|
+
removeSpeaker(speaker: string, userId?: string): Promise<any>;
|
|
124
132
|
/** Delete a single memory by id. `userId` optional (uses the default store). */
|
|
125
133
|
delete(userId: string | undefined, memoryId: string): Promise<any>;
|
|
126
134
|
/** Delete ALL memories for a store (GDPR erase). `userId` is required on purpose -
|
package/dist/wontopos.js
CHANGED
|
@@ -146,6 +146,21 @@ export class Client {
|
|
|
146
146
|
deleteStore(userId) {
|
|
147
147
|
return this.request("DELETE", "/api/v1/memory/collection", { user_id: userId });
|
|
148
148
|
}
|
|
149
|
+
// ----- speakers (who said it) -----
|
|
150
|
+
/** Register a person for this store. Speakers are explicit: register once, then
|
|
151
|
+
* store with `{ speaker }`. `"me"` (the assistant itself) never needs
|
|
152
|
+
* registration. A store registers up to 50 people to start. */
|
|
153
|
+
addSpeaker(speaker, userId) {
|
|
154
|
+
return this.post("/api/v1/memory/speakers", { user_id: this.uid(userId), speaker });
|
|
155
|
+
}
|
|
156
|
+
/** The store's registered people, each with its memory count. */
|
|
157
|
+
listSpeakers(userId) {
|
|
158
|
+
return this.request("GET", `/api/v1/memory/speakers?user_id=${encodeURIComponent(this.uid(userId))}`);
|
|
159
|
+
}
|
|
160
|
+
/** Unregister a person. Their memories stay; the name tag goes. */
|
|
161
|
+
removeSpeaker(speaker, userId) {
|
|
162
|
+
return this.request("DELETE", "/api/v1/memory/speakers", { user_id: this.uid(userId), speaker });
|
|
163
|
+
}
|
|
149
164
|
// ----- delete -----
|
|
150
165
|
/** Delete a single memory by id. `userId` optional (uses the default store). */
|
|
151
166
|
delete(userId, memoryId) {
|
package/package.json
CHANGED