@sovant/sdk 1.4.2 → 1.4.4
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 +47 -2
- package/dist/index.cjs +35 -0
- package/dist/index.d.cts +69 -1
- package/dist/index.d.ts +69 -1
- package/dist/index.js +34 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,9 +199,51 @@ const recall = await sv.memory.recall({
|
|
|
199
199
|
console.log(recall.results);
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
+
## List Memories
|
|
203
|
+
|
|
204
|
+
Fetch memories with filtering and pagination. Use `list()` to retrieve recent memories or filter by criteria — it's more efficient than `search()` when you don't need vector similarity.
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
// List recent memories
|
|
208
|
+
const { memories, total, has_more } = await sv.memory.list({
|
|
209
|
+
limit: 20,
|
|
210
|
+
offset: 0
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// Filter by thread
|
|
214
|
+
const threadMemories = await sv.memory.list({
|
|
215
|
+
thread_id: "thread-uuid",
|
|
216
|
+
limit: 50
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Filter by type and tags
|
|
220
|
+
const preferences = await sv.memory.list({
|
|
221
|
+
type: "preference",
|
|
222
|
+
tags: ["settings"],
|
|
223
|
+
sort_by: "updated_at",
|
|
224
|
+
sort_order: "desc"
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
// Pinned memories only
|
|
228
|
+
const pinned = await sv.memory.list({
|
|
229
|
+
is_pinned: true
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Available parameters:**
|
|
234
|
+
- `limit` — max results (default: 20, max: 100)
|
|
235
|
+
- `offset` — pagination offset
|
|
236
|
+
- `thread_id` — filter by thread
|
|
237
|
+
- `type` — filter by memory type
|
|
238
|
+
- `tags` — filter by tags (must have all)
|
|
239
|
+
- `is_pinned` — filter by pinned status
|
|
240
|
+
- `is_archived` — filter by archived status
|
|
241
|
+
- `sort_by` — `created_at`, `updated_at`, `importance`, or `type`
|
|
242
|
+
- `sort_order` — `asc` or `desc`
|
|
243
|
+
|
|
202
244
|
## Features
|
|
203
245
|
|
|
204
|
-
- **Memory CRUD** — create, retrieve, update, delete memories
|
|
246
|
+
- **Memory CRUD** — create, list, retrieve, update, delete memories
|
|
205
247
|
- **Semantic Search** — query memories with filters and ranking
|
|
206
248
|
- **Threads** — organize memories into conversations or sessions (fully supported in SDK)
|
|
207
249
|
- **Batch Operations** — create multiple memories in one request
|
|
@@ -234,7 +276,10 @@ console.log(recall.results);
|
|
|
234
276
|
|
|
235
277
|
## Versioning & Changelog
|
|
236
278
|
|
|
237
|
-
- **Current release:** 1.4.
|
|
279
|
+
- **Current release:** 1.4.4
|
|
280
|
+
- Version 1.4.4 — add `X-Sovant-Client` header for SDK telemetry
|
|
281
|
+
- Version 1.4.3 — add `memory.list()` for filtered pagination
|
|
282
|
+
- Version 1.4.2 — README sync
|
|
238
283
|
- Version 1.4.1 — CJS export fix
|
|
239
284
|
- Version 1.4.0 — full threads support (create, list, get, update, delete)
|
|
240
285
|
- Version 1.3.0 — hybrid recall with profile awareness
|
package/dist/index.cjs
CHANGED
|
@@ -20,10 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
SDK_VERSION: () => SDK_VERSION,
|
|
23
24
|
Sovant: () => Sovant,
|
|
24
25
|
SovantError: () => SovantError
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
var SDK_VERSION = "1.4.4";
|
|
27
29
|
var Sovant = class {
|
|
28
30
|
apiKey;
|
|
29
31
|
baseUrl;
|
|
@@ -64,6 +66,7 @@ var Sovant = class {
|
|
|
64
66
|
headers: {
|
|
65
67
|
"content-type": "application/json",
|
|
66
68
|
authorization: `Bearer ${this.apiKey}`,
|
|
69
|
+
"x-sovant-client": `ts-sdk/${SDK_VERSION}`,
|
|
67
70
|
...init.headers || {}
|
|
68
71
|
},
|
|
69
72
|
signal: ctl.signal
|
|
@@ -207,6 +210,37 @@ var Sovant = class {
|
|
|
207
210
|
return this.req(`/api/v1/memory/recall?${params.toString()}`, {
|
|
208
211
|
method: "GET"
|
|
209
212
|
});
|
|
213
|
+
},
|
|
214
|
+
/**
|
|
215
|
+
* List memories with filtering and pagination
|
|
216
|
+
* Returns memories ordered by sort criteria (default: created_at desc)
|
|
217
|
+
*
|
|
218
|
+
* Use list() to fetch recent memories or filter by criteria.
|
|
219
|
+
* Use search() for semantic/vector-based queries.
|
|
220
|
+
* Use recall() for conversational AI queries.
|
|
221
|
+
*
|
|
222
|
+
* @param params - Optional filtering and pagination parameters
|
|
223
|
+
* @returns Paginated list of memories
|
|
224
|
+
*/
|
|
225
|
+
list: (params) => {
|
|
226
|
+
const query = new URLSearchParams();
|
|
227
|
+
if (params?.limit !== void 0)
|
|
228
|
+
query.append("limit", params.limit.toString());
|
|
229
|
+
if (params?.offset !== void 0)
|
|
230
|
+
query.append("offset", params.offset.toString());
|
|
231
|
+
if (params?.thread_id) query.append("thread_id", params.thread_id);
|
|
232
|
+
if (params?.type) query.append("type", params.type);
|
|
233
|
+
if (params?.tags) query.append("tags", params.tags.join(","));
|
|
234
|
+
if (params?.is_pinned !== void 0)
|
|
235
|
+
query.append("is_pinned", params.is_pinned.toString());
|
|
236
|
+
if (params?.is_archived !== void 0)
|
|
237
|
+
query.append("is_archived", params.is_archived.toString());
|
|
238
|
+
if (params?.sort_by) query.append("sort_by", params.sort_by);
|
|
239
|
+
if (params?.sort_order) query.append("sort_order", params.sort_order);
|
|
240
|
+
return this.req(
|
|
241
|
+
`/api/v1/memory?${query.toString()}`,
|
|
242
|
+
{ method: "GET" }
|
|
243
|
+
);
|
|
210
244
|
}
|
|
211
245
|
};
|
|
212
246
|
threads = {
|
|
@@ -296,6 +330,7 @@ var SovantError = class extends Error {
|
|
|
296
330
|
};
|
|
297
331
|
// Annotate the CommonJS export names for ESM import in node:
|
|
298
332
|
0 && (module.exports = {
|
|
333
|
+
SDK_VERSION,
|
|
299
334
|
Sovant,
|
|
300
335
|
SovantError
|
|
301
336
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** SDK version — used for X-Sovant-Client header */
|
|
2
|
+
declare const SDK_VERSION = "1.4.4";
|
|
1
3
|
type SovantClientOptions = {
|
|
2
4
|
apiKey: string;
|
|
3
5
|
baseUrl?: string;
|
|
@@ -17,6 +19,60 @@ type SovantClientOptions = {
|
|
|
17
19
|
}) => void;
|
|
18
20
|
onError?: (err: SovantError) => void;
|
|
19
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Parameters for listing memories
|
|
24
|
+
*/
|
|
25
|
+
type MemoryListParams = {
|
|
26
|
+
/** Maximum number of memories to return (default: 20, max: 100) */
|
|
27
|
+
limit?: number;
|
|
28
|
+
/** Number of memories to skip for pagination (default: 0) */
|
|
29
|
+
offset?: number;
|
|
30
|
+
/** Filter by thread ID */
|
|
31
|
+
thread_id?: string;
|
|
32
|
+
/** Filter by memory type */
|
|
33
|
+
type?: "journal" | "insight" | "observation" | "task" | "preference";
|
|
34
|
+
/** Filter by tags (memories must have all specified tags) */
|
|
35
|
+
tags?: string[];
|
|
36
|
+
/** Filter by pinned status */
|
|
37
|
+
is_pinned?: boolean;
|
|
38
|
+
/** Filter by archived status */
|
|
39
|
+
is_archived?: boolean;
|
|
40
|
+
/** Sort field (default: created_at) */
|
|
41
|
+
sort_by?: "created_at" | "updated_at" | "importance" | "type";
|
|
42
|
+
/** Sort direction (default: desc) */
|
|
43
|
+
sort_order?: "asc" | "desc";
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A memory object returned from the API
|
|
47
|
+
*/
|
|
48
|
+
type Memory = {
|
|
49
|
+
id: string;
|
|
50
|
+
content: string;
|
|
51
|
+
type: string;
|
|
52
|
+
tags: string[];
|
|
53
|
+
metadata?: Record<string, any>;
|
|
54
|
+
thread_id?: string;
|
|
55
|
+
importance?: number;
|
|
56
|
+
created_at: string;
|
|
57
|
+
updated_at: string;
|
|
58
|
+
is_pinned: boolean;
|
|
59
|
+
is_archived: boolean;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Response from memory.list()
|
|
63
|
+
*/
|
|
64
|
+
type MemoryListResponse = {
|
|
65
|
+
/** Array of memory objects */
|
|
66
|
+
memories: Memory[];
|
|
67
|
+
/** Total count of memories matching the filter */
|
|
68
|
+
total: number;
|
|
69
|
+
/** Limit used for this query */
|
|
70
|
+
limit: number;
|
|
71
|
+
/** Offset used for this query */
|
|
72
|
+
offset: number;
|
|
73
|
+
/** Whether more results are available */
|
|
74
|
+
has_more: boolean;
|
|
75
|
+
};
|
|
20
76
|
declare class Sovant {
|
|
21
77
|
private apiKey;
|
|
22
78
|
private baseUrl;
|
|
@@ -97,6 +153,18 @@ declare class Sovant {
|
|
|
97
153
|
thread_id?: string;
|
|
98
154
|
limit?: number;
|
|
99
155
|
}) => Promise<unknown>;
|
|
156
|
+
/**
|
|
157
|
+
* List memories with filtering and pagination
|
|
158
|
+
* Returns memories ordered by sort criteria (default: created_at desc)
|
|
159
|
+
*
|
|
160
|
+
* Use list() to fetch recent memories or filter by criteria.
|
|
161
|
+
* Use search() for semantic/vector-based queries.
|
|
162
|
+
* Use recall() for conversational AI queries.
|
|
163
|
+
*
|
|
164
|
+
* @param params - Optional filtering and pagination parameters
|
|
165
|
+
* @returns Paginated list of memories
|
|
166
|
+
*/
|
|
167
|
+
list: (params?: MemoryListParams) => Promise<MemoryListResponse>;
|
|
100
168
|
};
|
|
101
169
|
threads: {
|
|
102
170
|
/**
|
|
@@ -204,4 +272,4 @@ declare class SovantError extends Error {
|
|
|
204
272
|
constructor(message: string, code: string, status?: number, details?: any);
|
|
205
273
|
}
|
|
206
274
|
|
|
207
|
-
export { Sovant, type SovantClientOptions, SovantError };
|
|
275
|
+
export { type Memory, type MemoryListParams, type MemoryListResponse, SDK_VERSION, Sovant, type SovantClientOptions, SovantError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** SDK version — used for X-Sovant-Client header */
|
|
2
|
+
declare const SDK_VERSION = "1.4.4";
|
|
1
3
|
type SovantClientOptions = {
|
|
2
4
|
apiKey: string;
|
|
3
5
|
baseUrl?: string;
|
|
@@ -17,6 +19,60 @@ type SovantClientOptions = {
|
|
|
17
19
|
}) => void;
|
|
18
20
|
onError?: (err: SovantError) => void;
|
|
19
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Parameters for listing memories
|
|
24
|
+
*/
|
|
25
|
+
type MemoryListParams = {
|
|
26
|
+
/** Maximum number of memories to return (default: 20, max: 100) */
|
|
27
|
+
limit?: number;
|
|
28
|
+
/** Number of memories to skip for pagination (default: 0) */
|
|
29
|
+
offset?: number;
|
|
30
|
+
/** Filter by thread ID */
|
|
31
|
+
thread_id?: string;
|
|
32
|
+
/** Filter by memory type */
|
|
33
|
+
type?: "journal" | "insight" | "observation" | "task" | "preference";
|
|
34
|
+
/** Filter by tags (memories must have all specified tags) */
|
|
35
|
+
tags?: string[];
|
|
36
|
+
/** Filter by pinned status */
|
|
37
|
+
is_pinned?: boolean;
|
|
38
|
+
/** Filter by archived status */
|
|
39
|
+
is_archived?: boolean;
|
|
40
|
+
/** Sort field (default: created_at) */
|
|
41
|
+
sort_by?: "created_at" | "updated_at" | "importance" | "type";
|
|
42
|
+
/** Sort direction (default: desc) */
|
|
43
|
+
sort_order?: "asc" | "desc";
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A memory object returned from the API
|
|
47
|
+
*/
|
|
48
|
+
type Memory = {
|
|
49
|
+
id: string;
|
|
50
|
+
content: string;
|
|
51
|
+
type: string;
|
|
52
|
+
tags: string[];
|
|
53
|
+
metadata?: Record<string, any>;
|
|
54
|
+
thread_id?: string;
|
|
55
|
+
importance?: number;
|
|
56
|
+
created_at: string;
|
|
57
|
+
updated_at: string;
|
|
58
|
+
is_pinned: boolean;
|
|
59
|
+
is_archived: boolean;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Response from memory.list()
|
|
63
|
+
*/
|
|
64
|
+
type MemoryListResponse = {
|
|
65
|
+
/** Array of memory objects */
|
|
66
|
+
memories: Memory[];
|
|
67
|
+
/** Total count of memories matching the filter */
|
|
68
|
+
total: number;
|
|
69
|
+
/** Limit used for this query */
|
|
70
|
+
limit: number;
|
|
71
|
+
/** Offset used for this query */
|
|
72
|
+
offset: number;
|
|
73
|
+
/** Whether more results are available */
|
|
74
|
+
has_more: boolean;
|
|
75
|
+
};
|
|
20
76
|
declare class Sovant {
|
|
21
77
|
private apiKey;
|
|
22
78
|
private baseUrl;
|
|
@@ -97,6 +153,18 @@ declare class Sovant {
|
|
|
97
153
|
thread_id?: string;
|
|
98
154
|
limit?: number;
|
|
99
155
|
}) => Promise<unknown>;
|
|
156
|
+
/**
|
|
157
|
+
* List memories with filtering and pagination
|
|
158
|
+
* Returns memories ordered by sort criteria (default: created_at desc)
|
|
159
|
+
*
|
|
160
|
+
* Use list() to fetch recent memories or filter by criteria.
|
|
161
|
+
* Use search() for semantic/vector-based queries.
|
|
162
|
+
* Use recall() for conversational AI queries.
|
|
163
|
+
*
|
|
164
|
+
* @param params - Optional filtering and pagination parameters
|
|
165
|
+
* @returns Paginated list of memories
|
|
166
|
+
*/
|
|
167
|
+
list: (params?: MemoryListParams) => Promise<MemoryListResponse>;
|
|
100
168
|
};
|
|
101
169
|
threads: {
|
|
102
170
|
/**
|
|
@@ -204,4 +272,4 @@ declare class SovantError extends Error {
|
|
|
204
272
|
constructor(message: string, code: string, status?: number, details?: any);
|
|
205
273
|
}
|
|
206
274
|
|
|
207
|
-
export { Sovant, type SovantClientOptions, SovantError };
|
|
275
|
+
export { type Memory, type MemoryListParams, type MemoryListResponse, SDK_VERSION, Sovant, type SovantClientOptions, SovantError };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
var SDK_VERSION = "1.4.4";
|
|
2
3
|
var Sovant = class {
|
|
3
4
|
apiKey;
|
|
4
5
|
baseUrl;
|
|
@@ -39,6 +40,7 @@ var Sovant = class {
|
|
|
39
40
|
headers: {
|
|
40
41
|
"content-type": "application/json",
|
|
41
42
|
authorization: `Bearer ${this.apiKey}`,
|
|
43
|
+
"x-sovant-client": `ts-sdk/${SDK_VERSION}`,
|
|
42
44
|
...init.headers || {}
|
|
43
45
|
},
|
|
44
46
|
signal: ctl.signal
|
|
@@ -182,6 +184,37 @@ var Sovant = class {
|
|
|
182
184
|
return this.req(`/api/v1/memory/recall?${params.toString()}`, {
|
|
183
185
|
method: "GET"
|
|
184
186
|
});
|
|
187
|
+
},
|
|
188
|
+
/**
|
|
189
|
+
* List memories with filtering and pagination
|
|
190
|
+
* Returns memories ordered by sort criteria (default: created_at desc)
|
|
191
|
+
*
|
|
192
|
+
* Use list() to fetch recent memories or filter by criteria.
|
|
193
|
+
* Use search() for semantic/vector-based queries.
|
|
194
|
+
* Use recall() for conversational AI queries.
|
|
195
|
+
*
|
|
196
|
+
* @param params - Optional filtering and pagination parameters
|
|
197
|
+
* @returns Paginated list of memories
|
|
198
|
+
*/
|
|
199
|
+
list: (params) => {
|
|
200
|
+
const query = new URLSearchParams();
|
|
201
|
+
if (params?.limit !== void 0)
|
|
202
|
+
query.append("limit", params.limit.toString());
|
|
203
|
+
if (params?.offset !== void 0)
|
|
204
|
+
query.append("offset", params.offset.toString());
|
|
205
|
+
if (params?.thread_id) query.append("thread_id", params.thread_id);
|
|
206
|
+
if (params?.type) query.append("type", params.type);
|
|
207
|
+
if (params?.tags) query.append("tags", params.tags.join(","));
|
|
208
|
+
if (params?.is_pinned !== void 0)
|
|
209
|
+
query.append("is_pinned", params.is_pinned.toString());
|
|
210
|
+
if (params?.is_archived !== void 0)
|
|
211
|
+
query.append("is_archived", params.is_archived.toString());
|
|
212
|
+
if (params?.sort_by) query.append("sort_by", params.sort_by);
|
|
213
|
+
if (params?.sort_order) query.append("sort_order", params.sort_order);
|
|
214
|
+
return this.req(
|
|
215
|
+
`/api/v1/memory?${query.toString()}`,
|
|
216
|
+
{ method: "GET" }
|
|
217
|
+
);
|
|
185
218
|
}
|
|
186
219
|
};
|
|
187
220
|
threads = {
|
|
@@ -270,6 +303,7 @@ var SovantError = class extends Error {
|
|
|
270
303
|
}
|
|
271
304
|
};
|
|
272
305
|
export {
|
|
306
|
+
SDK_VERSION,
|
|
273
307
|
Sovant,
|
|
274
308
|
SovantError
|
|
275
309
|
};
|