@papr/memory 1.0.0

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.
Files changed (257) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +201 -0
  3. package/README.md +376 -0
  4. package/api-promise.d.ts +3 -0
  5. package/api-promise.d.ts.map +1 -0
  6. package/api-promise.js +19 -0
  7. package/api-promise.js.map +1 -0
  8. package/api-promise.mjs +2 -0
  9. package/api-promise.mjs.map +1 -0
  10. package/client.d.ts +192 -0
  11. package/client.d.ts.map +1 -0
  12. package/client.js +516 -0
  13. package/client.js.map +1 -0
  14. package/client.mjs +479 -0
  15. package/client.mjs.map +1 -0
  16. package/core/api-promise.d.ts +46 -0
  17. package/core/api-promise.d.ts.map +1 -0
  18. package/core/api-promise.js +84 -0
  19. package/core/api-promise.js.map +1 -0
  20. package/core/api-promise.mjs +80 -0
  21. package/core/api-promise.mjs.map +1 -0
  22. package/core/error.d.ts +46 -0
  23. package/core/error.d.ts.map +1 -0
  24. package/core/error.js +113 -0
  25. package/core/error.js.map +1 -0
  26. package/core/error.mjs +97 -0
  27. package/core/error.mjs.map +1 -0
  28. package/core/resource.d.ts +6 -0
  29. package/core/resource.d.ts.map +1 -0
  30. package/core/resource.js +11 -0
  31. package/core/resource.js.map +1 -0
  32. package/core/resource.mjs +7 -0
  33. package/core/resource.mjs.map +1 -0
  34. package/core/uploads.d.ts +3 -0
  35. package/core/uploads.d.ts.map +1 -0
  36. package/core/uploads.js +6 -0
  37. package/core/uploads.js.map +1 -0
  38. package/core/uploads.mjs +2 -0
  39. package/core/uploads.mjs.map +1 -0
  40. package/error.d.ts +3 -0
  41. package/error.d.ts.map +1 -0
  42. package/error.js +19 -0
  43. package/error.js.map +1 -0
  44. package/error.mjs +2 -0
  45. package/error.mjs.map +1 -0
  46. package/index.d.ts +6 -0
  47. package/index.d.ts.map +1 -0
  48. package/index.js +30 -0
  49. package/index.js.map +1 -0
  50. package/index.mjs +7 -0
  51. package/index.mjs.map +1 -0
  52. package/internal/builtin-types.d.ts +73 -0
  53. package/internal/builtin-types.d.ts.map +1 -0
  54. package/internal/builtin-types.js +4 -0
  55. package/internal/builtin-types.js.map +1 -0
  56. package/internal/builtin-types.mjs +3 -0
  57. package/internal/builtin-types.mjs.map +1 -0
  58. package/internal/detect-platform.d.ts +15 -0
  59. package/internal/detect-platform.d.ts.map +1 -0
  60. package/internal/detect-platform.js +162 -0
  61. package/internal/detect-platform.js.map +1 -0
  62. package/internal/detect-platform.mjs +157 -0
  63. package/internal/detect-platform.mjs.map +1 -0
  64. package/internal/errors.d.ts +3 -0
  65. package/internal/errors.d.ts.map +1 -0
  66. package/internal/errors.js +41 -0
  67. package/internal/errors.js.map +1 -0
  68. package/internal/errors.mjs +36 -0
  69. package/internal/errors.mjs.map +1 -0
  70. package/internal/headers.d.ts +20 -0
  71. package/internal/headers.d.ts.map +1 -0
  72. package/internal/headers.js +79 -0
  73. package/internal/headers.js.map +1 -0
  74. package/internal/headers.mjs +74 -0
  75. package/internal/headers.mjs.map +1 -0
  76. package/internal/parse.d.ts +12 -0
  77. package/internal/parse.d.ts.map +1 -0
  78. package/internal/parse.js +35 -0
  79. package/internal/parse.js.map +1 -0
  80. package/internal/parse.mjs +32 -0
  81. package/internal/parse.mjs.map +1 -0
  82. package/internal/request-options.d.ts +32 -0
  83. package/internal/request-options.d.ts.map +1 -0
  84. package/internal/request-options.js +14 -0
  85. package/internal/request-options.js.map +1 -0
  86. package/internal/request-options.mjs +10 -0
  87. package/internal/request-options.mjs.map +1 -0
  88. package/internal/shim-types.d.mts +28 -0
  89. package/internal/shim-types.d.ts +28 -0
  90. package/internal/shims.d.ts +26 -0
  91. package/internal/shims.d.ts.map +1 -0
  92. package/internal/shims.js +92 -0
  93. package/internal/shims.js.map +1 -0
  94. package/internal/shims.mjs +85 -0
  95. package/internal/shims.mjs.map +1 -0
  96. package/internal/to-file.d.ts +45 -0
  97. package/internal/to-file.d.ts.map +1 -0
  98. package/internal/to-file.js +91 -0
  99. package/internal/to-file.js.map +1 -0
  100. package/internal/to-file.mjs +88 -0
  101. package/internal/to-file.mjs.map +1 -0
  102. package/internal/types.d.ts +67 -0
  103. package/internal/types.d.ts.map +1 -0
  104. package/internal/types.js +4 -0
  105. package/internal/types.js.map +1 -0
  106. package/internal/types.mjs +3 -0
  107. package/internal/types.mjs.map +1 -0
  108. package/internal/uploads.d.ts +42 -0
  109. package/internal/uploads.d.ts.map +1 -0
  110. package/internal/uploads.js +141 -0
  111. package/internal/uploads.js.map +1 -0
  112. package/internal/uploads.mjs +131 -0
  113. package/internal/uploads.mjs.map +1 -0
  114. package/internal/utils/base64.d.ts +3 -0
  115. package/internal/utils/base64.d.ts.map +1 -0
  116. package/internal/utils/base64.js +38 -0
  117. package/internal/utils/base64.js.map +1 -0
  118. package/internal/utils/base64.mjs +33 -0
  119. package/internal/utils/base64.mjs.map +1 -0
  120. package/internal/utils/bytes.d.ts +4 -0
  121. package/internal/utils/bytes.d.ts.map +1 -0
  122. package/internal/utils/bytes.js +31 -0
  123. package/internal/utils/bytes.js.map +1 -0
  124. package/internal/utils/bytes.mjs +26 -0
  125. package/internal/utils/bytes.mjs.map +1 -0
  126. package/internal/utils/env.d.ts +9 -0
  127. package/internal/utils/env.d.ts.map +1 -0
  128. package/internal/utils/env.js +22 -0
  129. package/internal/utils/env.js.map +1 -0
  130. package/internal/utils/env.mjs +18 -0
  131. package/internal/utils/env.mjs.map +1 -0
  132. package/internal/utils/log.d.ts +37 -0
  133. package/internal/utils/log.d.ts.map +1 -0
  134. package/internal/utils/log.js +86 -0
  135. package/internal/utils/log.js.map +1 -0
  136. package/internal/utils/log.mjs +80 -0
  137. package/internal/utils/log.mjs.map +1 -0
  138. package/internal/utils/path.d.ts +15 -0
  139. package/internal/utils/path.d.ts.map +1 -0
  140. package/internal/utils/path.js +58 -0
  141. package/internal/utils/path.js.map +1 -0
  142. package/internal/utils/path.mjs +53 -0
  143. package/internal/utils/path.mjs.map +1 -0
  144. package/internal/utils/sleep.d.ts +2 -0
  145. package/internal/utils/sleep.d.ts.map +1 -0
  146. package/internal/utils/sleep.js +7 -0
  147. package/internal/utils/sleep.js.map +1 -0
  148. package/internal/utils/sleep.mjs +3 -0
  149. package/internal/utils/sleep.mjs.map +1 -0
  150. package/internal/utils/uuid.d.ts +5 -0
  151. package/internal/utils/uuid.d.ts.map +1 -0
  152. package/internal/utils/uuid.js +19 -0
  153. package/internal/utils/uuid.js.map +1 -0
  154. package/internal/utils/uuid.mjs +15 -0
  155. package/internal/utils/uuid.mjs.map +1 -0
  156. package/internal/utils/values.d.ts +16 -0
  157. package/internal/utils/values.d.ts.map +1 -0
  158. package/internal/utils/values.js +109 -0
  159. package/internal/utils/values.js.map +1 -0
  160. package/internal/utils/values.mjs +92 -0
  161. package/internal/utils/values.mjs.map +1 -0
  162. package/internal/utils.d.ts +7 -0
  163. package/internal/utils.d.ts.map +1 -0
  164. package/internal/utils.js +24 -0
  165. package/internal/utils.js.map +1 -0
  166. package/internal/utils.mjs +8 -0
  167. package/internal/utils.mjs.map +1 -0
  168. package/package.json +141 -0
  169. package/resource.d.ts +3 -0
  170. package/resource.d.ts.map +1 -0
  171. package/resource.js +19 -0
  172. package/resource.js.map +1 -0
  173. package/resource.mjs +2 -0
  174. package/resource.mjs.map +1 -0
  175. package/resources/document.d.ts +103 -0
  176. package/resources/document.d.ts.map +1 -0
  177. package/resources/document.js +33 -0
  178. package/resources/document.js.map +1 -0
  179. package/resources/document.mjs +29 -0
  180. package/resources/document.mjs.map +1 -0
  181. package/resources/index.d.ts +4 -0
  182. package/resources/index.d.ts.map +1 -0
  183. package/resources/index.js +11 -0
  184. package/resources/index.js.map +1 -0
  185. package/resources/index.mjs +5 -0
  186. package/resources/index.mjs.map +1 -0
  187. package/resources/memory.d.ts +763 -0
  188. package/resources/memory.d.ts.map +1 -0
  189. package/resources/memory.js +174 -0
  190. package/resources/memory.js.map +1 -0
  191. package/resources/memory.mjs +170 -0
  192. package/resources/memory.mjs.map +1 -0
  193. package/resources/user.d.ts +139 -0
  194. package/resources/user.d.ts.map +1 -0
  195. package/resources/user.js +68 -0
  196. package/resources/user.js.map +1 -0
  197. package/resources/user.mjs +64 -0
  198. package/resources/user.mjs.map +1 -0
  199. package/resources.d.ts +2 -0
  200. package/resources.d.ts.map +1 -0
  201. package/resources.js +18 -0
  202. package/resources.js.map +1 -0
  203. package/resources.mjs +2 -0
  204. package/resources.mjs.map +1 -0
  205. package/src/api-promise.ts +2 -0
  206. package/src/client.ts +792 -0
  207. package/src/core/README.md +3 -0
  208. package/src/core/api-promise.ts +92 -0
  209. package/src/core/error.ts +130 -0
  210. package/src/core/resource.ts +11 -0
  211. package/src/core/uploads.ts +2 -0
  212. package/src/error.ts +2 -0
  213. package/src/global.d.ts +5 -0
  214. package/src/index.ts +22 -0
  215. package/src/internal/README.md +3 -0
  216. package/src/internal/builtin-types.ts +93 -0
  217. package/src/internal/detect-platform.ts +196 -0
  218. package/src/internal/errors.ts +33 -0
  219. package/src/internal/headers.ts +97 -0
  220. package/src/internal/parse.ts +50 -0
  221. package/src/internal/request-options.ts +37 -0
  222. package/src/internal/shim-types.d.ts +28 -0
  223. package/src/internal/shims.ts +107 -0
  224. package/src/internal/to-file.ts +154 -0
  225. package/src/internal/types.ts +92 -0
  226. package/src/internal/uploads.ts +187 -0
  227. package/src/internal/utils/base64.ts +40 -0
  228. package/src/internal/utils/bytes.ts +32 -0
  229. package/src/internal/utils/env.ts +18 -0
  230. package/src/internal/utils/log.ts +127 -0
  231. package/src/internal/utils/path.ts +63 -0
  232. package/src/internal/utils/sleep.ts +3 -0
  233. package/src/internal/utils/uuid.ts +17 -0
  234. package/src/internal/utils/values.ts +102 -0
  235. package/src/internal/utils.ts +8 -0
  236. package/src/lib/.keep +4 -0
  237. package/src/resource.ts +2 -0
  238. package/src/resources/document.ts +140 -0
  239. package/src/resources/index.ts +36 -0
  240. package/src/resources/memory.ts +1157 -0
  241. package/src/resources/user.ts +205 -0
  242. package/src/resources.ts +1 -0
  243. package/src/tsconfig.json +11 -0
  244. package/src/uploads.ts +2 -0
  245. package/src/version.ts +1 -0
  246. package/uploads.d.ts +3 -0
  247. package/uploads.d.ts.map +1 -0
  248. package/uploads.js +19 -0
  249. package/uploads.js.map +1 -0
  250. package/uploads.mjs +2 -0
  251. package/uploads.mjs.map +1 -0
  252. package/version.d.ts +2 -0
  253. package/version.d.ts.map +1 -0
  254. package/version.js +5 -0
  255. package/version.js.map +1 -0
  256. package/version.mjs +2 -0
  257. package/version.mjs.map +1 -0
@@ -0,0 +1,1157 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as DocumentAPI from './document';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { buildHeaders } from '../internal/headers';
7
+ import { RequestOptions } from '../internal/request-options';
8
+ import { path } from '../internal/utils/path';
9
+
10
+ export class Memory extends APIResource {
11
+ /**
12
+ * Update an existing memory item by ID.
13
+ *
14
+ * **Authentication Required**:
15
+ * One of the following authentication methods must be used:
16
+ * - Bearer token in `Authorization` header
17
+ * - API Key in `X-API-Key` header
18
+ * - Session token in `X-Session-Token` header
19
+ *
20
+ * **Required Headers**:
21
+ * - Content-Type: application/json
22
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
23
+ *
24
+ * The API validates content size against MAX_CONTENT_LENGTH environment variable (defaults to 15000 bytes).
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const memory = await client.memory.update('memory_id');
29
+ * ```
30
+ */
31
+ update(
32
+ memoryID: string,
33
+ body: MemoryUpdateParams,
34
+ options?: RequestOptions,
35
+ ): APIPromise<MemoryUpdateResponse> {
36
+ return this._client.put(path`/v1/memory/${memoryID}`, { body, ...options });
37
+ }
38
+
39
+ /**
40
+ * Delete a memory item by ID.
41
+ *
42
+ * **Authentication Required**:
43
+ * One of the following authentication methods must be used:
44
+ * - Bearer token in `Authorization` header
45
+ * - API Key in `X-API-Key` header
46
+ * - Session token in `X-Session-Token` header
47
+ *
48
+ * **Required Headers**:
49
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const memory = await client.memory.delete('memory_id');
54
+ * ```
55
+ */
56
+ delete(
57
+ memoryID: string,
58
+ params: MemoryDeleteParams | null | undefined = {},
59
+ options?: RequestOptions,
60
+ ): APIPromise<MemoryDeleteResponse> {
61
+ const { skip_parse } = params ?? {};
62
+ return this._client.delete(path`/v1/memory/${memoryID}`, { query: { skip_parse }, ...options });
63
+ }
64
+
65
+ /**
66
+ * Add a new memory item to the system with size validation and background
67
+ * processing.
68
+ *
69
+ * **Authentication Required**:
70
+ * One of the following authentication methods must be used:
71
+ * - Bearer token in `Authorization` header
72
+ * - API Key in `X-API-Key` header
73
+ * - Session token in `X-Session-Token` header
74
+ *
75
+ * **Required Headers**:
76
+ * - Content-Type: application/json
77
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
78
+ *
79
+ * The API validates content size against MAX_CONTENT_LENGTH environment variable (defaults to 15000 bytes).
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const addMemoryResponse = await client.memory.add({
84
+ * content:
85
+ * 'Meeting notes from the product planning session',
86
+ * });
87
+ * ```
88
+ */
89
+ add(params: MemoryAddParams, options?: RequestOptions): APIPromise<AddMemoryResponse> {
90
+ const { skip_background_processing, ...body } = params;
91
+ return this._client.post('/v1/memory', { query: { skip_background_processing }, body, ...options });
92
+ }
93
+
94
+ /**
95
+ * Add multiple memory items in a batch with size validation and background
96
+ * processing.
97
+ *
98
+ * **Authentication Required**:
99
+ * One of the following authentication methods must be used:
100
+ * - Bearer token in `Authorization` header
101
+ * - API Key in `X-API-Key` header
102
+ * - Session token in `X-Session-Token` header
103
+ *
104
+ * **Required Headers**:
105
+ * - Content-Type: application/json
106
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
107
+ *
108
+ * The API validates individual memory content size against MAX_CONTENT_LENGTH environment variable (defaults to 15000 bytes).
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const response = await client.memory.addBatch({
113
+ * memories: [
114
+ * {
115
+ * content:
116
+ * 'Meeting notes from the product planning session',
117
+ * },
118
+ * {
119
+ * content: 'Follow-up tasks from the planning meeting',
120
+ * },
121
+ * ],
122
+ * });
123
+ * ```
124
+ */
125
+ addBatch(params: MemoryAddBatchParams, options?: RequestOptions): APIPromise<MemoryAddBatchResponse> {
126
+ const { skip_background_processing, ...body } = params;
127
+ return this._client.post('/v1/memory/batch', { query: { skip_background_processing }, body, ...options });
128
+ }
129
+
130
+ /**
131
+ * Retrieve a memory item by ID.
132
+ *
133
+ * **Authentication Required**:
134
+ * One of the following authentication methods must be used:
135
+ * - Bearer token in `Authorization` header
136
+ * - API Key in `X-API-Key` header
137
+ * - Session token in `X-Session-Token` header
138
+ *
139
+ * **Required Headers**:
140
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
141
+ *
142
+ * @example
143
+ * ```ts
144
+ * const searchResponse = await client.memory.get('memory_id');
145
+ * ```
146
+ */
147
+ get(memoryID: string, options?: RequestOptions): APIPromise<SearchResponse> {
148
+ return this._client.get(path`/v1/memory/${memoryID}`, options);
149
+ }
150
+
151
+ /**
152
+ * Search through memories with authentication required.
153
+ *
154
+ * **Authentication Required**:
155
+ * One of the following authentication methods must be used:
156
+ * - Bearer token in `Authorization` header
157
+ * - API Key in `X-API-Key` header
158
+ * - Session token in `X-Session-Token` header
159
+ *
160
+ * **Recommended Headers**:
161
+ * ```
162
+ * Accept-Encoding: gzip
163
+ * ```
164
+ *
165
+ * The API supports response compression for improved performance. Responses larger than 1KB will be automatically compressed when this header is present.
166
+ *
167
+ * @example
168
+ * ```ts
169
+ * const searchResponse = await client.memory.search({
170
+ * query:
171
+ * 'Find recurring customer complaints about API performance from the last month. Focus on issues where customers specifically mentioned timeout errors or slow response times in their conversations.',
172
+ * });
173
+ * ```
174
+ */
175
+ search(params: MemorySearchParams, options?: RequestOptions): APIPromise<SearchResponse> {
176
+ const { max_memories, max_nodes, 'Accept-Encoding': acceptEncoding, ...body } = params;
177
+ return this._client.post('/v1/memory/search', {
178
+ query: { max_memories, max_nodes },
179
+ body,
180
+ ...options,
181
+ headers: buildHeaders([
182
+ { ...(acceptEncoding != null ? { 'Accept-Encoding': acceptEncoding } : undefined) },
183
+ options?.headers,
184
+ ]),
185
+ });
186
+ }
187
+ }
188
+
189
+ /**
190
+ * Request model for adding a new memory
191
+ */
192
+ export interface AddMemory {
193
+ /**
194
+ * The content of the memory item you want to add to memory
195
+ */
196
+ content: string;
197
+
198
+ /**
199
+ * Context can be conversation history or any relevant context for a memory item
200
+ */
201
+ context?: Array<ContextItem> | null;
202
+
203
+ /**
204
+ * Metadata for memory request
205
+ */
206
+ metadata?: MemoryMetadata | null;
207
+
208
+ /**
209
+ * Array of relationships that we can use in Graph DB (neo4J)
210
+ */
211
+ relationships_json?: Array<RelationshipItem> | null;
212
+
213
+ /**
214
+ * Content type of the memory item
215
+ */
216
+ type?: MemoryType;
217
+ }
218
+
219
+ /**
220
+ * Unified response model for add_memory API endpoint (success or error).
221
+ */
222
+ export interface AddMemoryResponse {
223
+ /**
224
+ * HTTP status code
225
+ */
226
+ code?: number;
227
+
228
+ /**
229
+ * List of memory items if successful
230
+ */
231
+ data?: Array<DocumentAPI.AddMemoryItem> | null;
232
+
233
+ /**
234
+ * Additional error details or context
235
+ */
236
+ details?: unknown;
237
+
238
+ /**
239
+ * Error message if failed
240
+ */
241
+ error?: string | null;
242
+
243
+ /**
244
+ * 'success' or 'error'
245
+ */
246
+ status?: string;
247
+ }
248
+
249
+ /**
250
+ * Context item for memory request
251
+ */
252
+ export interface ContextItem {
253
+ content: string;
254
+
255
+ role: 'user' | 'assistant';
256
+ }
257
+
258
+ /**
259
+ * Metadata for memory request
260
+ */
261
+ export interface MemoryMetadata {
262
+ conversationId?: string | null;
263
+
264
+ createdAt?: string | null;
265
+
266
+ 'emoji tags'?: string | null;
267
+
268
+ 'emotion tags'?: string | null;
269
+
270
+ /**
271
+ * Hierarchical structures to enable navigation from broad topics to specific ones
272
+ */
273
+ hierarchical_structures?: string | null;
274
+
275
+ location?: string | null;
276
+
277
+ role_read_access?: Array<string> | null;
278
+
279
+ role_write_access?: Array<string> | null;
280
+
281
+ sourceUrl?: string | null;
282
+
283
+ topics?: string | null;
284
+
285
+ user_id?: string | null;
286
+
287
+ user_read_access?: Array<string> | null;
288
+
289
+ user_write_access?: Array<string> | null;
290
+
291
+ workspace_read_access?: Array<string> | null;
292
+
293
+ workspace_write_access?: Array<string> | null;
294
+
295
+ [k: string]: unknown;
296
+ }
297
+
298
+ /**
299
+ * Valid memory types
300
+ */
301
+ export type MemoryType = 'text' | 'code_snippet' | 'document';
302
+
303
+ /**
304
+ * Relationship item for memory request
305
+ */
306
+ export interface RelationshipItem {
307
+ related_item_id: 'TextMemoryItem' | 'previous_memory_item_id';
308
+
309
+ related_item_type: 'TextMemoryItem';
310
+
311
+ relation_type: string;
312
+
313
+ metadata?: unknown;
314
+ }
315
+
316
+ export interface SearchResponse {
317
+ /**
318
+ * HTTP status code
319
+ */
320
+ code?: number;
321
+
322
+ /**
323
+ * Return type for SearchResult
324
+ */
325
+ data?: SearchResponse.Data | null;
326
+
327
+ /**
328
+ * Additional error details or context
329
+ */
330
+ details?: unknown;
331
+
332
+ /**
333
+ * Error message if failed
334
+ */
335
+ error?: string | null;
336
+
337
+ /**
338
+ * 'success' or 'error'
339
+ */
340
+ status?: string;
341
+ }
342
+
343
+ export namespace SearchResponse {
344
+ /**
345
+ * Return type for SearchResult
346
+ */
347
+ export interface Data {
348
+ memories: Array<Data.Memory>;
349
+
350
+ nodes: Array<Data.Node>;
351
+ }
352
+
353
+ export namespace Data {
354
+ /**
355
+ * A memory item in the knowledge base
356
+ */
357
+ export interface Memory {
358
+ id: string;
359
+
360
+ acl: Record<string, Record<string, boolean>>;
361
+
362
+ content: string;
363
+
364
+ type: string;
365
+
366
+ user_id: string;
367
+
368
+ context?: string | null;
369
+
370
+ conversation_id?: string;
371
+
372
+ created_at?: string | null;
373
+
374
+ current_step?: string | null;
375
+
376
+ file_url?: string | null;
377
+
378
+ filename?: string | null;
379
+
380
+ hierarchical_structures?: string;
381
+
382
+ location?: string | null;
383
+
384
+ metadata?: string | unknown | null;
385
+
386
+ page?: string | null;
387
+
388
+ page_number?: number | null;
389
+
390
+ source_document_id?: string | null;
391
+
392
+ source_message_id?: string | null;
393
+
394
+ source_type?: string;
395
+
396
+ source_url?: string;
397
+
398
+ steps?: Array<string>;
399
+
400
+ tags?: Array<string>;
401
+
402
+ title?: string | null;
403
+
404
+ topics?: Array<string>;
405
+
406
+ total_pages?: number | null;
407
+
408
+ updated_at?: string | null;
409
+
410
+ workspace_id?: string | null;
411
+
412
+ [k: string]: unknown;
413
+ }
414
+
415
+ /**
416
+ * Public-facing node structure matching our internal representation
417
+ */
418
+ export interface Node {
419
+ label:
420
+ | 'Memory'
421
+ | 'Person'
422
+ | 'Company'
423
+ | 'Project'
424
+ | 'Task'
425
+ | 'Insight'
426
+ | 'Meeting'
427
+ | 'Opportunity'
428
+ | 'Code';
429
+
430
+ /**
431
+ * Memory node properties
432
+ */
433
+ properties:
434
+ | Node.PaprMemoryNodeProperties
435
+ | Node.PersonNodeProperties
436
+ | Node.CompanyNodeProperties
437
+ | Node.ProjectNodeProperties
438
+ | Node.TaskNodeProperties
439
+ | Node.InsightNodeProperties
440
+ | Node.MeetingNodeProperties
441
+ | Node.OpportunityNodeProperties
442
+ | Node.CodeNodeProperties;
443
+ }
444
+
445
+ export namespace Node {
446
+ /**
447
+ * Memory node properties
448
+ */
449
+ export interface PaprMemoryNodeProperties {
450
+ id: string;
451
+
452
+ content: string;
453
+
454
+ current_step: string;
455
+
456
+ emotion_tags: Array<string>;
457
+
458
+ steps: Array<string>;
459
+
460
+ topics: Array<string>;
461
+
462
+ type: string;
463
+
464
+ conversationId?: string | null;
465
+
466
+ createdAt?: string | null;
467
+
468
+ emoji_tags?: Array<string> | null;
469
+
470
+ hierarchical_structures?: string | null;
471
+
472
+ pageId?: string | null;
473
+
474
+ role_read_access?: Array<string> | null;
475
+
476
+ role_write_access?: Array<string> | null;
477
+
478
+ sourceType?: string | null;
479
+
480
+ sourceUrl?: string | null;
481
+
482
+ title?: string | null;
483
+
484
+ updatedAt?: string | null;
485
+
486
+ user_id?: string | null;
487
+
488
+ user_read_access?: Array<string> | null;
489
+
490
+ user_write_access?: Array<string> | null;
491
+
492
+ workspace_id?: string | null;
493
+
494
+ workspace_read_access?: Array<string> | null;
495
+
496
+ workspace_write_access?: Array<string> | null;
497
+ }
498
+
499
+ /**
500
+ * Person node properties
501
+ */
502
+ export interface PersonNodeProperties {
503
+ id: string;
504
+
505
+ description: string;
506
+
507
+ name: string;
508
+
509
+ role: string;
510
+
511
+ conversationId?: string | null;
512
+
513
+ createdAt?: string | null;
514
+
515
+ pageId?: string | null;
516
+
517
+ role_read_access?: Array<string> | null;
518
+
519
+ role_write_access?: Array<string> | null;
520
+
521
+ sourceType?: string | null;
522
+
523
+ sourceUrl?: string | null;
524
+
525
+ updatedAt?: string | null;
526
+
527
+ user_id?: string | null;
528
+
529
+ user_read_access?: Array<string> | null;
530
+
531
+ user_write_access?: Array<string> | null;
532
+
533
+ workspace_id?: string | null;
534
+
535
+ workspace_read_access?: Array<string> | null;
536
+
537
+ workspace_write_access?: Array<string> | null;
538
+ }
539
+
540
+ /**
541
+ * Company node properties
542
+ */
543
+ export interface CompanyNodeProperties {
544
+ id: string;
545
+
546
+ description: string;
547
+
548
+ name: string;
549
+
550
+ conversationId?: string | null;
551
+
552
+ createdAt?: string | null;
553
+
554
+ pageId?: string | null;
555
+
556
+ role_read_access?: Array<string> | null;
557
+
558
+ role_write_access?: Array<string> | null;
559
+
560
+ sourceType?: string | null;
561
+
562
+ sourceUrl?: string | null;
563
+
564
+ updatedAt?: string | null;
565
+
566
+ user_id?: string | null;
567
+
568
+ user_read_access?: Array<string> | null;
569
+
570
+ user_write_access?: Array<string> | null;
571
+
572
+ workspace_id?: string | null;
573
+
574
+ workspace_read_access?: Array<string> | null;
575
+
576
+ workspace_write_access?: Array<string> | null;
577
+ }
578
+
579
+ /**
580
+ * Project node properties
581
+ */
582
+ export interface ProjectNodeProperties {
583
+ id: string;
584
+
585
+ description: string;
586
+
587
+ name: string;
588
+
589
+ type: string;
590
+
591
+ conversationId?: string | null;
592
+
593
+ createdAt?: string | null;
594
+
595
+ pageId?: string | null;
596
+
597
+ role_read_access?: Array<string> | null;
598
+
599
+ role_write_access?: Array<string> | null;
600
+
601
+ sourceType?: string | null;
602
+
603
+ sourceUrl?: string | null;
604
+
605
+ updatedAt?: string | null;
606
+
607
+ user_id?: string | null;
608
+
609
+ user_read_access?: Array<string> | null;
610
+
611
+ user_write_access?: Array<string> | null;
612
+
613
+ workspace_id?: string | null;
614
+
615
+ workspace_read_access?: Array<string> | null;
616
+
617
+ workspace_write_access?: Array<string> | null;
618
+ }
619
+
620
+ /**
621
+ * Task node properties
622
+ */
623
+ export interface TaskNodeProperties {
624
+ id: string;
625
+
626
+ description: string;
627
+
628
+ status: 'new' | 'in_progress' | 'completed';
629
+
630
+ title: string;
631
+
632
+ type: 'task' | 'subtask' | 'bug' | 'feature_request' | 'epic' | 'support_ticket';
633
+
634
+ conversationId?: string | null;
635
+
636
+ createdAt?: string | null;
637
+
638
+ pageId?: string | null;
639
+
640
+ role_read_access?: Array<string> | null;
641
+
642
+ role_write_access?: Array<string> | null;
643
+
644
+ sourceType?: string | null;
645
+
646
+ sourceUrl?: string | null;
647
+
648
+ updatedAt?: string | null;
649
+
650
+ user_id?: string | null;
651
+
652
+ user_read_access?: Array<string> | null;
653
+
654
+ user_write_access?: Array<string> | null;
655
+
656
+ workspace_id?: string | null;
657
+
658
+ workspace_read_access?: Array<string> | null;
659
+
660
+ workspace_write_access?: Array<string> | null;
661
+ }
662
+
663
+ /**
664
+ * Insight node properties
665
+ */
666
+ export interface InsightNodeProperties {
667
+ id: string;
668
+
669
+ description: string;
670
+
671
+ source: string;
672
+
673
+ title: string;
674
+
675
+ type:
676
+ | 'customer_insight'
677
+ | 'product_insight'
678
+ | 'market_insight'
679
+ | 'competitive_insight'
680
+ | 'technical_insight'
681
+ | 'other';
682
+
683
+ conversationId?: string | null;
684
+
685
+ createdAt?: string | null;
686
+
687
+ pageId?: string | null;
688
+
689
+ role_read_access?: Array<string> | null;
690
+
691
+ role_write_access?: Array<string> | null;
692
+
693
+ sourceType?: string | null;
694
+
695
+ sourceUrl?: string | null;
696
+
697
+ updatedAt?: string | null;
698
+
699
+ user_id?: string | null;
700
+
701
+ user_read_access?: Array<string> | null;
702
+
703
+ user_write_access?: Array<string> | null;
704
+
705
+ workspace_id?: string | null;
706
+
707
+ workspace_read_access?: Array<string> | null;
708
+
709
+ workspace_write_access?: Array<string> | null;
710
+ }
711
+
712
+ /**
713
+ * Meeting node properties
714
+ */
715
+ export interface MeetingNodeProperties {
716
+ id: string;
717
+
718
+ action_items: Array<string>;
719
+
720
+ agenda: string;
721
+
722
+ date: string;
723
+
724
+ outcome: string;
725
+
726
+ participants: Array<string>;
727
+
728
+ summary: string;
729
+
730
+ time: string;
731
+
732
+ title: string;
733
+
734
+ type: string;
735
+
736
+ conversationId?: string | null;
737
+
738
+ createdAt?: string | null;
739
+
740
+ pageId?: string | null;
741
+
742
+ role_read_access?: Array<string> | null;
743
+
744
+ role_write_access?: Array<string> | null;
745
+
746
+ sourceType?: string | null;
747
+
748
+ sourceUrl?: string | null;
749
+
750
+ updatedAt?: string | null;
751
+
752
+ user_id?: string | null;
753
+
754
+ user_read_access?: Array<string> | null;
755
+
756
+ user_write_access?: Array<string> | null;
757
+
758
+ workspace_id?: string | null;
759
+
760
+ workspace_read_access?: Array<string> | null;
761
+
762
+ workspace_write_access?: Array<string> | null;
763
+ }
764
+
765
+ /**
766
+ * Opportunity node properties
767
+ */
768
+ export interface OpportunityNodeProperties {
769
+ id: string;
770
+
771
+ close_date: string;
772
+
773
+ description: string;
774
+
775
+ next_steps: Array<string>;
776
+
777
+ probability: number;
778
+
779
+ stage: 'prospect' | 'lead' | 'opportunity' | 'won' | 'lost';
780
+
781
+ title: string;
782
+
783
+ value: number;
784
+
785
+ conversationId?: string | null;
786
+
787
+ createdAt?: string | null;
788
+
789
+ pageId?: string | null;
790
+
791
+ role_read_access?: Array<string> | null;
792
+
793
+ role_write_access?: Array<string> | null;
794
+
795
+ sourceType?: string | null;
796
+
797
+ sourceUrl?: string | null;
798
+
799
+ updatedAt?: string | null;
800
+
801
+ user_id?: string | null;
802
+
803
+ user_read_access?: Array<string> | null;
804
+
805
+ user_write_access?: Array<string> | null;
806
+
807
+ workspace_id?: string | null;
808
+
809
+ workspace_read_access?: Array<string> | null;
810
+
811
+ workspace_write_access?: Array<string> | null;
812
+ }
813
+
814
+ /**
815
+ * Code node properties
816
+ */
817
+ export interface CodeNodeProperties {
818
+ id: string;
819
+
820
+ author: string;
821
+
822
+ language: string;
823
+
824
+ name: string;
825
+
826
+ conversationId?: string | null;
827
+
828
+ createdAt?: string | null;
829
+
830
+ pageId?: string | null;
831
+
832
+ role_read_access?: Array<string> | null;
833
+
834
+ role_write_access?: Array<string> | null;
835
+
836
+ sourceType?: string | null;
837
+
838
+ sourceUrl?: string | null;
839
+
840
+ updatedAt?: string | null;
841
+
842
+ user_id?: string | null;
843
+
844
+ user_read_access?: Array<string> | null;
845
+
846
+ user_write_access?: Array<string> | null;
847
+
848
+ workspace_id?: string | null;
849
+
850
+ workspace_read_access?: Array<string> | null;
851
+
852
+ workspace_write_access?: Array<string> | null;
853
+ }
854
+ }
855
+ }
856
+ }
857
+
858
+ /**
859
+ * Unified response model for update_memory API endpoint (success or error).
860
+ */
861
+ export interface MemoryUpdateResponse {
862
+ /**
863
+ * HTTP status code
864
+ */
865
+ code?: number;
866
+
867
+ /**
868
+ * Additional error details or context
869
+ */
870
+ details?: unknown;
871
+
872
+ /**
873
+ * Error message if failed
874
+ */
875
+ error?: string | null;
876
+
877
+ /**
878
+ * List of updated memory items if successful
879
+ */
880
+ memory_items?: Array<MemoryUpdateResponse.MemoryItem> | null;
881
+
882
+ /**
883
+ * Status message
884
+ */
885
+ message?: string | null;
886
+
887
+ /**
888
+ * 'success' or 'error'
889
+ */
890
+ status?: string;
891
+
892
+ /**
893
+ * Status of update operation for each system
894
+ */
895
+ status_obj?: MemoryUpdateResponse.StatusObj | null;
896
+ }
897
+
898
+ export namespace MemoryUpdateResponse {
899
+ /**
900
+ * Model for a single updated memory item
901
+ */
902
+ export interface MemoryItem {
903
+ memoryId: string;
904
+
905
+ objectId: string;
906
+
907
+ updatedAt: string;
908
+
909
+ content?: string | null;
910
+
911
+ memoryChunkIds?: Array<string> | null;
912
+ }
913
+
914
+ /**
915
+ * Status of update operation for each system
916
+ */
917
+ export interface StatusObj {
918
+ neo4j?: boolean;
919
+
920
+ parse?: boolean;
921
+
922
+ pinecone?: boolean;
923
+ }
924
+ }
925
+
926
+ export interface MemoryDeleteResponse {
927
+ /**
928
+ * HTTP status code
929
+ */
930
+ code?: number;
931
+
932
+ deletion_status?: MemoryDeleteResponse.DeletionStatus | null;
933
+
934
+ details?: unknown;
935
+
936
+ error?: string | null;
937
+
938
+ memoryId?: string;
939
+
940
+ message?: string | null;
941
+
942
+ objectId?: string;
943
+
944
+ /**
945
+ * 'success' or 'error'
946
+ */
947
+ status?: string;
948
+ }
949
+
950
+ export namespace MemoryDeleteResponse {
951
+ export interface DeletionStatus {
952
+ neo4j?: boolean;
953
+
954
+ parse?: boolean;
955
+
956
+ pinecone?: boolean;
957
+ }
958
+ }
959
+
960
+ export interface MemoryAddBatchResponse {
961
+ /**
962
+ * HTTP status code for the batch operation
963
+ */
964
+ code?: number;
965
+
966
+ /**
967
+ * Additional error details or context
968
+ */
969
+ details?: unknown;
970
+
971
+ /**
972
+ * Batch-level error message, if any
973
+ */
974
+ error?: string | null;
975
+
976
+ /**
977
+ * List of errors for failed items
978
+ */
979
+ errors?: Array<MemoryAddBatchResponse.Error>;
980
+
981
+ /**
982
+ * Human-readable status message
983
+ */
984
+ message?: string | null;
985
+
986
+ /**
987
+ * 'success', 'partial', or 'error'
988
+ */
989
+ status?: string;
990
+
991
+ /**
992
+ * List of successful add responses
993
+ */
994
+ successful?: Array<AddMemoryResponse>;
995
+
996
+ total_content_size?: number;
997
+
998
+ total_failed?: number;
999
+
1000
+ total_processed?: number;
1001
+
1002
+ total_storage_size?: number;
1003
+
1004
+ total_successful?: number;
1005
+ }
1006
+
1007
+ export namespace MemoryAddBatchResponse {
1008
+ export interface Error {
1009
+ error: string;
1010
+
1011
+ index: number;
1012
+
1013
+ code?: number | null;
1014
+
1015
+ details?: unknown;
1016
+
1017
+ status?: string | null;
1018
+ }
1019
+ }
1020
+
1021
+ export interface MemoryUpdateParams {
1022
+ /**
1023
+ * The new content of the memory item
1024
+ */
1025
+ content?: string | null;
1026
+
1027
+ /**
1028
+ * Updated context for the memory item
1029
+ */
1030
+ context?: Array<ContextItem> | null;
1031
+
1032
+ /**
1033
+ * Metadata for memory request
1034
+ */
1035
+ metadata?: MemoryMetadata | null;
1036
+
1037
+ /**
1038
+ * Updated relationships for Graph DB (neo4J)
1039
+ */
1040
+ relationships_json?: Array<RelationshipItem> | null;
1041
+
1042
+ /**
1043
+ * Valid memory types
1044
+ */
1045
+ type?: MemoryType | null;
1046
+ }
1047
+
1048
+ export interface MemoryDeleteParams {
1049
+ /**
1050
+ * Skip Parse Server deletion
1051
+ */
1052
+ skip_parse?: boolean;
1053
+ }
1054
+
1055
+ export interface MemoryAddParams {
1056
+ /**
1057
+ * Body param: The content of the memory item you want to add to memory
1058
+ */
1059
+ content: string;
1060
+
1061
+ /**
1062
+ * Query param: If True, skips adding background tasks for processing
1063
+ */
1064
+ skip_background_processing?: boolean;
1065
+
1066
+ /**
1067
+ * Body param: Context can be conversation history or any relevant context for a
1068
+ * memory item
1069
+ */
1070
+ context?: Array<ContextItem> | null;
1071
+
1072
+ /**
1073
+ * Body param: Metadata for memory request
1074
+ */
1075
+ metadata?: MemoryMetadata | null;
1076
+
1077
+ /**
1078
+ * Body param: Array of relationships that we can use in Graph DB (neo4J)
1079
+ */
1080
+ relationships_json?: Array<RelationshipItem> | null;
1081
+
1082
+ /**
1083
+ * Body param: Content type of the memory item
1084
+ */
1085
+ type?: MemoryType;
1086
+ }
1087
+
1088
+ export interface MemoryAddBatchParams {
1089
+ /**
1090
+ * Body param: List of memory items to add in batch
1091
+ */
1092
+ memories: Array<AddMemory>;
1093
+
1094
+ /**
1095
+ * Query param: If True, skips adding background tasks for processing
1096
+ */
1097
+ skip_background_processing?: boolean;
1098
+
1099
+ /**
1100
+ * Body param: Number of items to process in parallel
1101
+ */
1102
+ batch_size?: number | null;
1103
+ }
1104
+
1105
+ export interface MemorySearchParams {
1106
+ /**
1107
+ * Body param: Detailed search query describing what you're looking for. For best
1108
+ * results, write 2-3 sentences that include specific details, context, and time
1109
+ * frame. For example: 'Find recurring customer complaints about API performance
1110
+ * from the last month. Focus on issues where customers specifically mentioned
1111
+ * timeout errors or slow response times in their conversations.'
1112
+ */
1113
+ query: string;
1114
+
1115
+ /**
1116
+ * Query param: Maximum number of memories to return
1117
+ */
1118
+ max_memories?: number;
1119
+
1120
+ /**
1121
+ * Query param: Maximum number of neo nodes to return
1122
+ */
1123
+ max_nodes?: number;
1124
+
1125
+ /**
1126
+ * Body param: Whether to enable additional ranking of search results. Default is
1127
+ * false because results are already ranked when using an LLM for search
1128
+ * (recommended approach). Only enable this if you're not using an LLM in your
1129
+ * search pipeline and need additional result ranking.
1130
+ */
1131
+ rank_results?: boolean;
1132
+
1133
+ /**
1134
+ * Header param: Recommended to use 'gzip' for response compression
1135
+ */
1136
+ 'Accept-Encoding'?: string;
1137
+ }
1138
+
1139
+ export declare namespace Memory {
1140
+ export {
1141
+ type AddMemory as AddMemory,
1142
+ type AddMemoryResponse as AddMemoryResponse,
1143
+ type ContextItem as ContextItem,
1144
+ type MemoryMetadata as MemoryMetadata,
1145
+ type MemoryType as MemoryType,
1146
+ type RelationshipItem as RelationshipItem,
1147
+ type SearchResponse as SearchResponse,
1148
+ type MemoryUpdateResponse as MemoryUpdateResponse,
1149
+ type MemoryDeleteResponse as MemoryDeleteResponse,
1150
+ type MemoryAddBatchResponse as MemoryAddBatchResponse,
1151
+ type MemoryUpdateParams as MemoryUpdateParams,
1152
+ type MemoryDeleteParams as MemoryDeleteParams,
1153
+ type MemoryAddParams as MemoryAddParams,
1154
+ type MemoryAddBatchParams as MemoryAddBatchParams,
1155
+ type MemorySearchParams as MemorySearchParams,
1156
+ };
1157
+ }