@memnexus-ai/typescript-sdk 1.14.12 → 1.14.18
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/index.cjs +4438 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4476 -0
- package/package.json +10 -4
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,4438 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
ApiKeysService: () => ApiKeysService,
|
|
24
|
+
ArtifactsService: () => ArtifactsService,
|
|
25
|
+
BehaviorService: () => BehaviorService,
|
|
26
|
+
CommunitiesService: () => CommunitiesService,
|
|
27
|
+
ContentType: () => ContentType,
|
|
28
|
+
ConversationsService: () => ConversationsService,
|
|
29
|
+
Environment: () => Environment,
|
|
30
|
+
FactsService: () => FactsService,
|
|
31
|
+
GraphragService: () => GraphragService,
|
|
32
|
+
HealthService: () => HealthService,
|
|
33
|
+
Memnexus: () => Memnexus,
|
|
34
|
+
MemoriesService: () => MemoriesService,
|
|
35
|
+
NarrativesService: () => NarrativesService,
|
|
36
|
+
PatternsService: () => PatternsService,
|
|
37
|
+
SerializationStyle: () => SerializationStyle,
|
|
38
|
+
SystemService: () => SystemService,
|
|
39
|
+
TopicsService: () => TopicsService,
|
|
40
|
+
UsersService: () => UsersService,
|
|
41
|
+
addMemoryToNarrativeRequest: () => addMemoryToNarrativeRequest,
|
|
42
|
+
apiKey: () => apiKey,
|
|
43
|
+
artifact: () => artifact,
|
|
44
|
+
community: () => community,
|
|
45
|
+
conversation: () => conversation,
|
|
46
|
+
createArtifactRequest: () => createArtifactRequest,
|
|
47
|
+
createConversationRequest: () => createConversationRequest,
|
|
48
|
+
createFactRequest: () => createFactRequest,
|
|
49
|
+
createMemoryRelationshipRequest: () => createMemoryRelationshipRequest,
|
|
50
|
+
createMemoryRequest: () => createMemoryRequest,
|
|
51
|
+
createMemoryResponse: () => createMemoryResponse,
|
|
52
|
+
createMemoryResponseMeta: () => createMemoryResponseMeta,
|
|
53
|
+
createNarrativeRequest: () => createNarrativeRequest,
|
|
54
|
+
default: () => index_default,
|
|
55
|
+
entity: () => entity,
|
|
56
|
+
error: () => error,
|
|
57
|
+
fact: () => fact,
|
|
58
|
+
factSearchRequest: () => factSearchRequest,
|
|
59
|
+
getMemoryResponse: () => getMemoryResponse,
|
|
60
|
+
getNarrativeResponse: () => getNarrativeResponse,
|
|
61
|
+
graphRAGQueryRequest: () => graphRAGQueryRequest,
|
|
62
|
+
graphRAGQueryResponse: () => graphRAGQueryResponse,
|
|
63
|
+
healthCheck: () => healthCheck,
|
|
64
|
+
listNarrativesResponse: () => listNarrativesResponse,
|
|
65
|
+
memory: () => memory,
|
|
66
|
+
memoryRelationship: () => memoryRelationship,
|
|
67
|
+
memoryRelationshipsResponse: () => memoryRelationshipsResponse,
|
|
68
|
+
mergeCommunitiesRequest: () => mergeCommunitiesRequest,
|
|
69
|
+
narrativeMemory: () => narrativeMemory,
|
|
70
|
+
narrativeThread: () => narrativeThread,
|
|
71
|
+
narrativeTimelineResponse: () => narrativeTimelineResponse,
|
|
72
|
+
pagination: () => pagination,
|
|
73
|
+
pattern: () => pattern,
|
|
74
|
+
relatedMemoryResult: () => relatedMemoryResult,
|
|
75
|
+
searchRequest: () => searchRequest,
|
|
76
|
+
searchResponse: () => searchResponse,
|
|
77
|
+
searchResult: () => searchResult,
|
|
78
|
+
serviceCheck: () => serviceCheck,
|
|
79
|
+
temporalMetadata: () => temporalMetadata,
|
|
80
|
+
topic: () => topic,
|
|
81
|
+
topicReference: () => topicReference,
|
|
82
|
+
updateArtifactRequest: () => updateArtifactRequest,
|
|
83
|
+
updateFactRequest: () => updateFactRequest,
|
|
84
|
+
updateMemoryRequest: () => updateMemoryRequest,
|
|
85
|
+
updateNarrativeRequest: () => updateNarrativeRequest,
|
|
86
|
+
user: () => user,
|
|
87
|
+
userUsage: () => userUsage
|
|
88
|
+
});
|
|
89
|
+
module.exports = __toCommonJS(index_exports);
|
|
90
|
+
|
|
91
|
+
// src/http/handlers.ts
|
|
92
|
+
var BaseHandler = class {
|
|
93
|
+
nextHandler;
|
|
94
|
+
setNext(handler) {
|
|
95
|
+
this.nextHandler = handler;
|
|
96
|
+
return handler;
|
|
97
|
+
}
|
|
98
|
+
async callNext(request) {
|
|
99
|
+
if (!this.nextHandler) {
|
|
100
|
+
throw new Error("No next handler in chain");
|
|
101
|
+
}
|
|
102
|
+
return this.nextHandler.handle(request);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var RetryHandler = class extends BaseHandler {
|
|
106
|
+
maxAttempts;
|
|
107
|
+
delayMs;
|
|
108
|
+
maxDelayMs;
|
|
109
|
+
jitterMs;
|
|
110
|
+
backoffFactor;
|
|
111
|
+
httpCodesToRetry;
|
|
112
|
+
httpMethodsToRetry;
|
|
113
|
+
constructor(options) {
|
|
114
|
+
super();
|
|
115
|
+
this.maxAttempts = options?.attempts ?? 3;
|
|
116
|
+
this.delayMs = options?.delayMs ?? 150;
|
|
117
|
+
this.maxDelayMs = options?.maxDelayMs ?? 5e3;
|
|
118
|
+
this.jitterMs = options?.jitterMs ?? 50;
|
|
119
|
+
this.backoffFactor = options?.backoffFactor ?? 2;
|
|
120
|
+
this.httpCodesToRetry = new Set(options?.httpCodesToRetry ?? [408, 429, 500, 502, 503, 504]);
|
|
121
|
+
this.httpMethodsToRetry = new Set(options?.httpMethodsToRetry ?? ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]);
|
|
122
|
+
}
|
|
123
|
+
async handle(request) {
|
|
124
|
+
let lastError;
|
|
125
|
+
let attempt = 0;
|
|
126
|
+
while (attempt < this.maxAttempts) {
|
|
127
|
+
try {
|
|
128
|
+
const response = await this.callNext(request);
|
|
129
|
+
if (this.shouldRetry(request.method, response.metadata.status)) {
|
|
130
|
+
lastError = new Error(`HTTP ${response.metadata.status}`);
|
|
131
|
+
attempt++;
|
|
132
|
+
await this.delay(attempt);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
return response;
|
|
136
|
+
} catch (error2) {
|
|
137
|
+
lastError = error2;
|
|
138
|
+
attempt++;
|
|
139
|
+
if (attempt >= this.maxAttempts) {
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
await this.delay(attempt);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
throw lastError || new Error("Max retry attempts reached");
|
|
146
|
+
}
|
|
147
|
+
shouldRetry(method, status) {
|
|
148
|
+
return this.httpMethodsToRetry.has(method) && this.httpCodesToRetry.has(status);
|
|
149
|
+
}
|
|
150
|
+
async delay(attempt) {
|
|
151
|
+
const exponentialDelay = this.delayMs * Math.pow(this.backoffFactor, attempt - 1);
|
|
152
|
+
const jitter = Math.random() * this.jitterMs;
|
|
153
|
+
const delay = Math.min(exponentialDelay + jitter, this.maxDelayMs);
|
|
154
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var ValidationHandler = class extends BaseHandler {
|
|
158
|
+
async handle(request) {
|
|
159
|
+
if (request.requestSchema && request.body) {
|
|
160
|
+
const result = request.requestSchema.safeParse(request.body);
|
|
161
|
+
if (!result.success) {
|
|
162
|
+
throw new Error(`Request validation failed: ${result.error.message}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const response = await this.callNext(request);
|
|
166
|
+
if (request.validation?.responseValidation && response.data) {
|
|
167
|
+
const matchingResponse = request.responses.find(
|
|
168
|
+
(r) => r.status === response.metadata.status
|
|
169
|
+
);
|
|
170
|
+
if (matchingResponse) {
|
|
171
|
+
const result = matchingResponse.schema.safeParse(response.data);
|
|
172
|
+
if (!result.success) {
|
|
173
|
+
throw new Error(`Response validation failed: ${result.error.message}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return response;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
var HookHandler = class extends BaseHandler {
|
|
181
|
+
hook;
|
|
182
|
+
constructor(hook) {
|
|
183
|
+
super();
|
|
184
|
+
this.hook = hook;
|
|
185
|
+
}
|
|
186
|
+
async handle(request) {
|
|
187
|
+
const httpRequest = {
|
|
188
|
+
baseUrl: request.baseUrl,
|
|
189
|
+
method: request.method,
|
|
190
|
+
path: request.path,
|
|
191
|
+
headers: new Map(Object.entries(request.getHeaders())),
|
|
192
|
+
queryParams: /* @__PURE__ */ new Map(),
|
|
193
|
+
pathParams: /* @__PURE__ */ new Map(),
|
|
194
|
+
body: request.body
|
|
195
|
+
};
|
|
196
|
+
const modifiedRequest = await this.hook.beforeRequest(httpRequest, /* @__PURE__ */ new Map());
|
|
197
|
+
const response = await this.callNext(request);
|
|
198
|
+
const modifiedResponse = await this.hook.afterResponse(modifiedRequest, response, /* @__PURE__ */ new Map());
|
|
199
|
+
return modifiedResponse;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
var ExecuteHandler = class extends BaseHandler {
|
|
203
|
+
async handle(request) {
|
|
204
|
+
const url = request.constructFullUrl();
|
|
205
|
+
const headers = request.getHeaders();
|
|
206
|
+
if (request.body && typeof request.body === "object") {
|
|
207
|
+
headers["Content-Type"] = "application/json";
|
|
208
|
+
}
|
|
209
|
+
if (request.config.token) {
|
|
210
|
+
headers["Authorization"] = `Bearer ${request.config.token}`;
|
|
211
|
+
}
|
|
212
|
+
const fetchOptions = {
|
|
213
|
+
method: request.method,
|
|
214
|
+
headers
|
|
215
|
+
};
|
|
216
|
+
if (request.body && request.method !== "GET") {
|
|
217
|
+
fetchOptions.body = typeof request.body === "string" ? request.body : JSON.stringify(request.body);
|
|
218
|
+
}
|
|
219
|
+
if (request.config.timeoutMs) {
|
|
220
|
+
const controller = new AbortController();
|
|
221
|
+
setTimeout(() => controller.abort(), request.config.timeoutMs);
|
|
222
|
+
fetchOptions.signal = controller.signal;
|
|
223
|
+
}
|
|
224
|
+
const response = await fetch(url, fetchOptions);
|
|
225
|
+
const responseHeaders = {};
|
|
226
|
+
response.headers.forEach((value, key) => {
|
|
227
|
+
responseHeaders[key] = value;
|
|
228
|
+
});
|
|
229
|
+
const raw = await response.arrayBuffer();
|
|
230
|
+
let data;
|
|
231
|
+
const contentType = response.headers.get("content-type") || "";
|
|
232
|
+
if (contentType.includes("application/json") && raw.byteLength > 0) {
|
|
233
|
+
const text = new TextDecoder().decode(raw);
|
|
234
|
+
try {
|
|
235
|
+
data = JSON.parse(text);
|
|
236
|
+
} catch {
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const httpResponse = {
|
|
240
|
+
data,
|
|
241
|
+
metadata: {
|
|
242
|
+
status: response.status,
|
|
243
|
+
statusText: response.statusText,
|
|
244
|
+
headers: responseHeaders
|
|
245
|
+
},
|
|
246
|
+
raw
|
|
247
|
+
};
|
|
248
|
+
if (!response.ok) {
|
|
249
|
+
const error2 = new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
250
|
+
error2.response = httpResponse;
|
|
251
|
+
throw error2;
|
|
252
|
+
}
|
|
253
|
+
return httpResponse;
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
var CustomHook = class {
|
|
257
|
+
async beforeRequest(request, params) {
|
|
258
|
+
return request;
|
|
259
|
+
}
|
|
260
|
+
async afterResponse(request, response, params) {
|
|
261
|
+
return response;
|
|
262
|
+
}
|
|
263
|
+
async onError(request, response, params) {
|
|
264
|
+
return {
|
|
265
|
+
error: response.metadata.statusText,
|
|
266
|
+
metadata: response.metadata
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// src/http/http-client.ts
|
|
272
|
+
var HttpClient = class {
|
|
273
|
+
config;
|
|
274
|
+
requestHandlerChain;
|
|
275
|
+
constructor(config, hook) {
|
|
276
|
+
this.config = config;
|
|
277
|
+
const executeHandler = new ExecuteHandler();
|
|
278
|
+
const hookHandler = new HookHandler(hook || new CustomHook());
|
|
279
|
+
const validationHandler = new ValidationHandler();
|
|
280
|
+
const retryHandler = new RetryHandler(config.retry);
|
|
281
|
+
retryHandler.setNext(validationHandler);
|
|
282
|
+
validationHandler.setNext(hookHandler);
|
|
283
|
+
hookHandler.setNext(executeHandler);
|
|
284
|
+
this.requestHandlerChain = retryHandler;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Execute an HTTP request
|
|
288
|
+
*/
|
|
289
|
+
async call(request) {
|
|
290
|
+
return this.requestHandlerChain.handle(request);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Update base URL
|
|
294
|
+
*/
|
|
295
|
+
setBaseUrl(url) {
|
|
296
|
+
this.config.baseUrl = url;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Update config
|
|
300
|
+
*/
|
|
301
|
+
setConfig(config) {
|
|
302
|
+
this.config = config;
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// src/http/base-service.ts
|
|
307
|
+
var BaseService = class {
|
|
308
|
+
config;
|
|
309
|
+
client;
|
|
310
|
+
constructor(config) {
|
|
311
|
+
this.config = config;
|
|
312
|
+
this.client = new HttpClient(config);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Set the base URL for API requests
|
|
316
|
+
*/
|
|
317
|
+
set baseUrl(baseUrl) {
|
|
318
|
+
this.config.baseUrl = baseUrl;
|
|
319
|
+
this.client.setBaseUrl(baseUrl);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Set the environment
|
|
323
|
+
*/
|
|
324
|
+
set environment(environment) {
|
|
325
|
+
this.config.environment = environment;
|
|
326
|
+
this.client.setBaseUrl(environment);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Set the request timeout in milliseconds
|
|
330
|
+
*/
|
|
331
|
+
set timeoutMs(timeoutMs) {
|
|
332
|
+
this.config.timeoutMs = timeoutMs;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Set the bearer token for authentication
|
|
336
|
+
*/
|
|
337
|
+
set token(token) {
|
|
338
|
+
this.config.token = token;
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
// src/http/serialization.ts
|
|
343
|
+
function serializeParameter(param) {
|
|
344
|
+
const { value, style, explode } = param;
|
|
345
|
+
if (value === void 0 || value === null) {
|
|
346
|
+
return void 0;
|
|
347
|
+
}
|
|
348
|
+
if (typeof value !== "object") {
|
|
349
|
+
return value;
|
|
350
|
+
}
|
|
351
|
+
if (Array.isArray(value)) {
|
|
352
|
+
return serializeArray(value, style, explode);
|
|
353
|
+
}
|
|
354
|
+
return serializeObject(value, style, explode);
|
|
355
|
+
}
|
|
356
|
+
function serializeArray(value, style, explode) {
|
|
357
|
+
if (explode) {
|
|
358
|
+
return value.map(String);
|
|
359
|
+
}
|
|
360
|
+
switch (style) {
|
|
361
|
+
case "simple":
|
|
362
|
+
return value.join(",");
|
|
363
|
+
case "label":
|
|
364
|
+
return "." + value.join(".");
|
|
365
|
+
case "matrix":
|
|
366
|
+
return ";" + value.join(";");
|
|
367
|
+
case "form":
|
|
368
|
+
return value.join(",");
|
|
369
|
+
case "space_delimited":
|
|
370
|
+
return value.join(" ");
|
|
371
|
+
case "pipe_delimited":
|
|
372
|
+
return value.join("|");
|
|
373
|
+
default:
|
|
374
|
+
return value.join(",");
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function serializeObject(value, style, explode) {
|
|
378
|
+
const entries = Object.entries(value).filter(([_, v]) => v !== void 0);
|
|
379
|
+
if (style === "deep_object") {
|
|
380
|
+
return Object.fromEntries(entries.map(([k, v]) => [k, String(v)]));
|
|
381
|
+
}
|
|
382
|
+
if (explode) {
|
|
383
|
+
return Object.fromEntries(entries.map(([k, v]) => [k, String(v)]));
|
|
384
|
+
}
|
|
385
|
+
const pairs = entries.flatMap(([k, v]) => [k, String(v)]);
|
|
386
|
+
switch (style) {
|
|
387
|
+
case "simple":
|
|
388
|
+
return pairs.join(",");
|
|
389
|
+
case "label":
|
|
390
|
+
return "." + pairs.join(".");
|
|
391
|
+
case "matrix":
|
|
392
|
+
return ";" + pairs.join(";");
|
|
393
|
+
case "form":
|
|
394
|
+
return pairs.join(",");
|
|
395
|
+
default:
|
|
396
|
+
return pairs.join(",");
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// src/http/request-builder.ts
|
|
401
|
+
var Request = class {
|
|
402
|
+
baseUrl;
|
|
403
|
+
method;
|
|
404
|
+
path;
|
|
405
|
+
config;
|
|
406
|
+
headers;
|
|
407
|
+
queryParams;
|
|
408
|
+
pathParams;
|
|
409
|
+
body;
|
|
410
|
+
responses;
|
|
411
|
+
errors;
|
|
412
|
+
requestSchema;
|
|
413
|
+
requestContentType;
|
|
414
|
+
validation;
|
|
415
|
+
retry;
|
|
416
|
+
constructor(params) {
|
|
417
|
+
this.baseUrl = params.baseUrl;
|
|
418
|
+
this.method = params.method;
|
|
419
|
+
this.path = params.path;
|
|
420
|
+
this.config = params.config;
|
|
421
|
+
this.headers = params.headers || /* @__PURE__ */ new Map();
|
|
422
|
+
this.queryParams = params.queryParams || /* @__PURE__ */ new Map();
|
|
423
|
+
this.pathParams = params.pathParams || /* @__PURE__ */ new Map();
|
|
424
|
+
this.body = params.body;
|
|
425
|
+
this.responses = params.responses || [];
|
|
426
|
+
this.errors = params.errors || [];
|
|
427
|
+
this.requestSchema = params.requestSchema;
|
|
428
|
+
this.requestContentType = params.requestContentType;
|
|
429
|
+
this.validation = params.validation || {};
|
|
430
|
+
this.retry = params.retry || { attempts: 1 };
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Add a header parameter
|
|
434
|
+
*/
|
|
435
|
+
addHeaderParam(key, param) {
|
|
436
|
+
this.headers.set(key, param);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Add a query parameter
|
|
440
|
+
*/
|
|
441
|
+
addQueryParam(key, param) {
|
|
442
|
+
this.queryParams.set(key, param);
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Add a path parameter
|
|
446
|
+
*/
|
|
447
|
+
addPathParam(key, param) {
|
|
448
|
+
this.pathParams.set(key, param);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Set the request body
|
|
452
|
+
*/
|
|
453
|
+
addBody(body) {
|
|
454
|
+
this.body = body;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Construct the full URL with path and query parameters
|
|
458
|
+
*/
|
|
459
|
+
constructFullUrl() {
|
|
460
|
+
let url = this.path;
|
|
461
|
+
for (const [key, param] of this.pathParams) {
|
|
462
|
+
const value = serializeParameter(param);
|
|
463
|
+
url = url.replace(`{${key}}`, encodeURIComponent(String(value)));
|
|
464
|
+
}
|
|
465
|
+
const queryString = this.buildQueryString();
|
|
466
|
+
if (queryString) {
|
|
467
|
+
url += `?${queryString}`;
|
|
468
|
+
}
|
|
469
|
+
return `${this.baseUrl}${url}`;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Get serialized headers
|
|
473
|
+
*/
|
|
474
|
+
getHeaders() {
|
|
475
|
+
const headers = {};
|
|
476
|
+
for (const [key, param] of this.headers) {
|
|
477
|
+
const value = serializeParameter(param);
|
|
478
|
+
if (value !== void 0 && value !== null) {
|
|
479
|
+
headers[key] = String(value);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return headers;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Build query string from parameters
|
|
486
|
+
*/
|
|
487
|
+
buildQueryString() {
|
|
488
|
+
const parts = [];
|
|
489
|
+
for (const [key, param] of this.queryParams) {
|
|
490
|
+
const serialized = serializeQueryParam(key, param);
|
|
491
|
+
if (serialized) {
|
|
492
|
+
parts.push(serialized);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return parts.join("&");
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
function serializeQueryParam(key, param) {
|
|
499
|
+
const value = param.value;
|
|
500
|
+
if (value === void 0 || value === null) {
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
if (Array.isArray(value)) {
|
|
504
|
+
if (param.explode) {
|
|
505
|
+
return value.map((v) => `${encodeURIComponent(key)}=${encodeURIComponent(String(v))}`).join("&");
|
|
506
|
+
}
|
|
507
|
+
return `${encodeURIComponent(key)}=${value.map((v) => encodeURIComponent(String(v))).join(",")}`;
|
|
508
|
+
}
|
|
509
|
+
if (typeof value === "object") {
|
|
510
|
+
if (param.style === "deep_object") {
|
|
511
|
+
return Object.entries(value).map(([k, v]) => `${encodeURIComponent(key)}[${encodeURIComponent(k)}]=${encodeURIComponent(String(v))}`).join("&");
|
|
512
|
+
}
|
|
513
|
+
return Object.entries(value).map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`).join("&");
|
|
514
|
+
}
|
|
515
|
+
return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// src/services/api-keys-service.ts
|
|
519
|
+
var ApiKeysService = class extends BaseService {
|
|
520
|
+
/**
|
|
521
|
+
* Get user information for current API key
|
|
522
|
+
* Debug endpoint to retrieve user ID and authentication method from the current API key
|
|
523
|
+
*/
|
|
524
|
+
async debugUser() {
|
|
525
|
+
const request = new Request({
|
|
526
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
527
|
+
method: "GET",
|
|
528
|
+
path: "/api/apikeys/debug-user",
|
|
529
|
+
config: this.config,
|
|
530
|
+
retry: {
|
|
531
|
+
attempts: 3,
|
|
532
|
+
delayMs: 150,
|
|
533
|
+
maxDelayMs: 5e3,
|
|
534
|
+
jitterMs: 50,
|
|
535
|
+
backoffFactor: 2
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
return this.client.call(request);
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* List API keys
|
|
542
|
+
* List all API keys for the authenticated user
|
|
543
|
+
*/
|
|
544
|
+
async listApiKeys() {
|
|
545
|
+
const request = new Request({
|
|
546
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
547
|
+
method: "GET",
|
|
548
|
+
path: "/api/apikeys",
|
|
549
|
+
config: this.config,
|
|
550
|
+
retry: {
|
|
551
|
+
attempts: 3,
|
|
552
|
+
delayMs: 150,
|
|
553
|
+
maxDelayMs: 5e3,
|
|
554
|
+
jitterMs: 50,
|
|
555
|
+
backoffFactor: 2
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
return this.client.call(request);
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Create API key
|
|
562
|
+
* Create a new API key for the authenticated user
|
|
563
|
+
* @param body - Request body
|
|
564
|
+
*/
|
|
565
|
+
async createApiKey(options) {
|
|
566
|
+
const request = new Request({
|
|
567
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
568
|
+
method: "POST",
|
|
569
|
+
path: "/api/apikeys",
|
|
570
|
+
config: this.config,
|
|
571
|
+
retry: {
|
|
572
|
+
attempts: 3,
|
|
573
|
+
delayMs: 150,
|
|
574
|
+
maxDelayMs: 5e3,
|
|
575
|
+
jitterMs: 50,
|
|
576
|
+
backoffFactor: 2
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
if (options?.body !== void 0) {
|
|
580
|
+
request.addBody(options?.body);
|
|
581
|
+
}
|
|
582
|
+
return this.client.call(request);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Delete API key
|
|
586
|
+
* Delete (revoke) an API key by its ID
|
|
587
|
+
* @param id - The API key ID
|
|
588
|
+
*/
|
|
589
|
+
async deleteApiKey(id) {
|
|
590
|
+
const request = new Request({
|
|
591
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
592
|
+
method: "DELETE",
|
|
593
|
+
path: "/api/apikeys/{id}",
|
|
594
|
+
config: this.config,
|
|
595
|
+
retry: {
|
|
596
|
+
attempts: 3,
|
|
597
|
+
delayMs: 150,
|
|
598
|
+
maxDelayMs: 5e3,
|
|
599
|
+
jitterMs: 50,
|
|
600
|
+
backoffFactor: 2
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
request.addPathParam("id", {
|
|
604
|
+
key: "id",
|
|
605
|
+
value: id,
|
|
606
|
+
explode: false,
|
|
607
|
+
encode: true,
|
|
608
|
+
style: "simple",
|
|
609
|
+
isLimit: false,
|
|
610
|
+
isOffset: false,
|
|
611
|
+
isCursor: false
|
|
612
|
+
});
|
|
613
|
+
return this.client.call(request);
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
// src/services/artifacts-service.ts
|
|
618
|
+
var ArtifactsService = class extends BaseService {
|
|
619
|
+
/**
|
|
620
|
+
* List artifacts
|
|
621
|
+
* List all artifacts for the authenticated user with optional filters
|
|
622
|
+
* @param limit - Maximum number of artifacts to return
|
|
623
|
+
* @param offset - Number of artifacts to skip
|
|
624
|
+
* @param memoryId - Filter by memory ID
|
|
625
|
+
* @param conversationId - Filter by conversation ID
|
|
626
|
+
* @param type - Filter by artifact type
|
|
627
|
+
*/
|
|
628
|
+
async listArtifacts(options) {
|
|
629
|
+
const request = new Request({
|
|
630
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
631
|
+
method: "GET",
|
|
632
|
+
path: "/api/artifacts",
|
|
633
|
+
config: this.config,
|
|
634
|
+
retry: {
|
|
635
|
+
attempts: 3,
|
|
636
|
+
delayMs: 150,
|
|
637
|
+
maxDelayMs: 5e3,
|
|
638
|
+
jitterMs: 50,
|
|
639
|
+
backoffFactor: 2
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
if (options?.limit !== void 0) {
|
|
643
|
+
request.addQueryParam("limit", {
|
|
644
|
+
key: "limit",
|
|
645
|
+
value: options.limit,
|
|
646
|
+
explode: false,
|
|
647
|
+
encode: true,
|
|
648
|
+
style: "form",
|
|
649
|
+
isLimit: true,
|
|
650
|
+
isOffset: false,
|
|
651
|
+
isCursor: false
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
if (options?.offset !== void 0) {
|
|
655
|
+
request.addQueryParam("offset", {
|
|
656
|
+
key: "offset",
|
|
657
|
+
value: options.offset,
|
|
658
|
+
explode: false,
|
|
659
|
+
encode: true,
|
|
660
|
+
style: "form",
|
|
661
|
+
isLimit: false,
|
|
662
|
+
isOffset: true,
|
|
663
|
+
isCursor: false
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
if (options?.memoryId !== void 0) {
|
|
667
|
+
request.addQueryParam("memoryId", {
|
|
668
|
+
key: "memoryId",
|
|
669
|
+
value: options.memoryId,
|
|
670
|
+
explode: false,
|
|
671
|
+
encode: true,
|
|
672
|
+
style: "form",
|
|
673
|
+
isLimit: false,
|
|
674
|
+
isOffset: false,
|
|
675
|
+
isCursor: false
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
if (options?.conversationId !== void 0) {
|
|
679
|
+
request.addQueryParam("conversationId", {
|
|
680
|
+
key: "conversationId",
|
|
681
|
+
value: options.conversationId,
|
|
682
|
+
explode: false,
|
|
683
|
+
encode: true,
|
|
684
|
+
style: "form",
|
|
685
|
+
isLimit: false,
|
|
686
|
+
isOffset: false,
|
|
687
|
+
isCursor: false
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
if (options?.type !== void 0) {
|
|
691
|
+
request.addQueryParam("type", {
|
|
692
|
+
key: "type",
|
|
693
|
+
value: options.type,
|
|
694
|
+
explode: false,
|
|
695
|
+
encode: true,
|
|
696
|
+
style: "form",
|
|
697
|
+
isLimit: false,
|
|
698
|
+
isOffset: false,
|
|
699
|
+
isCursor: false
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
return this.client.call(request);
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Create artifact
|
|
706
|
+
* Create a new artifact for the authenticated user
|
|
707
|
+
* @param body - Request body
|
|
708
|
+
*/
|
|
709
|
+
async createArtifact(body) {
|
|
710
|
+
const request = new Request({
|
|
711
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
712
|
+
method: "POST",
|
|
713
|
+
path: "/api/artifacts",
|
|
714
|
+
config: this.config,
|
|
715
|
+
retry: {
|
|
716
|
+
attempts: 3,
|
|
717
|
+
delayMs: 150,
|
|
718
|
+
maxDelayMs: 5e3,
|
|
719
|
+
jitterMs: 50,
|
|
720
|
+
backoffFactor: 2
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
if (body !== void 0) {
|
|
724
|
+
request.addBody(body);
|
|
725
|
+
}
|
|
726
|
+
return this.client.call(request);
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* Get artifact by ID
|
|
730
|
+
* Retrieve a specific artifact by its ID
|
|
731
|
+
* @param id - The artifact ID
|
|
732
|
+
*/
|
|
733
|
+
async getArtifactById(id) {
|
|
734
|
+
const request = new Request({
|
|
735
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
736
|
+
method: "GET",
|
|
737
|
+
path: "/api/artifacts/{id}",
|
|
738
|
+
config: this.config,
|
|
739
|
+
retry: {
|
|
740
|
+
attempts: 3,
|
|
741
|
+
delayMs: 150,
|
|
742
|
+
maxDelayMs: 5e3,
|
|
743
|
+
jitterMs: 50,
|
|
744
|
+
backoffFactor: 2
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
request.addPathParam("id", {
|
|
748
|
+
key: "id",
|
|
749
|
+
value: id,
|
|
750
|
+
explode: false,
|
|
751
|
+
encode: true,
|
|
752
|
+
style: "simple",
|
|
753
|
+
isLimit: false,
|
|
754
|
+
isOffset: false,
|
|
755
|
+
isCursor: false
|
|
756
|
+
});
|
|
757
|
+
return this.client.call(request);
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Delete artifact
|
|
761
|
+
* Delete an artifact by its ID
|
|
762
|
+
* @param id - The artifact ID
|
|
763
|
+
*/
|
|
764
|
+
async deleteArtifact(id) {
|
|
765
|
+
const request = new Request({
|
|
766
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
767
|
+
method: "DELETE",
|
|
768
|
+
path: "/api/artifacts/{id}",
|
|
769
|
+
config: this.config,
|
|
770
|
+
retry: {
|
|
771
|
+
attempts: 3,
|
|
772
|
+
delayMs: 150,
|
|
773
|
+
maxDelayMs: 5e3,
|
|
774
|
+
jitterMs: 50,
|
|
775
|
+
backoffFactor: 2
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
request.addPathParam("id", {
|
|
779
|
+
key: "id",
|
|
780
|
+
value: id,
|
|
781
|
+
explode: false,
|
|
782
|
+
encode: true,
|
|
783
|
+
style: "simple",
|
|
784
|
+
isLimit: false,
|
|
785
|
+
isOffset: false,
|
|
786
|
+
isCursor: false
|
|
787
|
+
});
|
|
788
|
+
return this.client.call(request);
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Update artifact
|
|
792
|
+
* Update an existing artifact with partial data
|
|
793
|
+
* @param id - The artifact ID
|
|
794
|
+
* @param body - Request body
|
|
795
|
+
*/
|
|
796
|
+
async updateArtifact(id, body) {
|
|
797
|
+
const request = new Request({
|
|
798
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
799
|
+
method: "PATCH",
|
|
800
|
+
path: "/api/artifacts/{id}",
|
|
801
|
+
config: this.config,
|
|
802
|
+
retry: {
|
|
803
|
+
attempts: 3,
|
|
804
|
+
delayMs: 150,
|
|
805
|
+
maxDelayMs: 5e3,
|
|
806
|
+
jitterMs: 50,
|
|
807
|
+
backoffFactor: 2
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
request.addPathParam("id", {
|
|
811
|
+
key: "id",
|
|
812
|
+
value: id,
|
|
813
|
+
explode: false,
|
|
814
|
+
encode: true,
|
|
815
|
+
style: "simple",
|
|
816
|
+
isLimit: false,
|
|
817
|
+
isOffset: false,
|
|
818
|
+
isCursor: false
|
|
819
|
+
});
|
|
820
|
+
if (body !== void 0) {
|
|
821
|
+
request.addBody(body);
|
|
822
|
+
}
|
|
823
|
+
return this.client.call(request);
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
// src/services/conversations-service.ts
|
|
828
|
+
var ConversationsService = class extends BaseService {
|
|
829
|
+
/**
|
|
830
|
+
* List conversations
|
|
831
|
+
* List all conversations for the authenticated user with pagination
|
|
832
|
+
* @param limit - Maximum number of conversations to return
|
|
833
|
+
* @param offset - Number of conversations to skip
|
|
834
|
+
*/
|
|
835
|
+
async listConversations(options) {
|
|
836
|
+
const request = new Request({
|
|
837
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
838
|
+
method: "GET",
|
|
839
|
+
path: "/api/conversations",
|
|
840
|
+
config: this.config,
|
|
841
|
+
retry: {
|
|
842
|
+
attempts: 3,
|
|
843
|
+
delayMs: 150,
|
|
844
|
+
maxDelayMs: 5e3,
|
|
845
|
+
jitterMs: 50,
|
|
846
|
+
backoffFactor: 2
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
if (options?.limit !== void 0) {
|
|
850
|
+
request.addQueryParam("limit", {
|
|
851
|
+
key: "limit",
|
|
852
|
+
value: options.limit,
|
|
853
|
+
explode: false,
|
|
854
|
+
encode: true,
|
|
855
|
+
style: "form",
|
|
856
|
+
isLimit: true,
|
|
857
|
+
isOffset: false,
|
|
858
|
+
isCursor: false
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
if (options?.offset !== void 0) {
|
|
862
|
+
request.addQueryParam("offset", {
|
|
863
|
+
key: "offset",
|
|
864
|
+
value: options.offset,
|
|
865
|
+
explode: false,
|
|
866
|
+
encode: true,
|
|
867
|
+
style: "form",
|
|
868
|
+
isLimit: false,
|
|
869
|
+
isOffset: true,
|
|
870
|
+
isCursor: false
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
return this.client.call(request);
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Create conversation
|
|
877
|
+
* Create a new conversation for the authenticated user
|
|
878
|
+
* @param body - Request body
|
|
879
|
+
*/
|
|
880
|
+
async createConversation(body) {
|
|
881
|
+
const request = new Request({
|
|
882
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
883
|
+
method: "POST",
|
|
884
|
+
path: "/api/conversations",
|
|
885
|
+
config: this.config,
|
|
886
|
+
retry: {
|
|
887
|
+
attempts: 3,
|
|
888
|
+
delayMs: 150,
|
|
889
|
+
maxDelayMs: 5e3,
|
|
890
|
+
jitterMs: 50,
|
|
891
|
+
backoffFactor: 2
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
if (body !== void 0) {
|
|
895
|
+
request.addBody(body);
|
|
896
|
+
}
|
|
897
|
+
return this.client.call(request);
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Get conversation summary
|
|
901
|
+
* Retrieve a conversation summary by its ID
|
|
902
|
+
* @param conversationId - The conversation ID
|
|
903
|
+
*/
|
|
904
|
+
async getConversationSummary(conversationId) {
|
|
905
|
+
const request = new Request({
|
|
906
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
907
|
+
method: "GET",
|
|
908
|
+
path: "/api/conversations/{conversationId}",
|
|
909
|
+
config: this.config,
|
|
910
|
+
retry: {
|
|
911
|
+
attempts: 3,
|
|
912
|
+
delayMs: 150,
|
|
913
|
+
maxDelayMs: 5e3,
|
|
914
|
+
jitterMs: 50,
|
|
915
|
+
backoffFactor: 2
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
request.addPathParam("conversationId", {
|
|
919
|
+
key: "conversationId",
|
|
920
|
+
value: conversationId,
|
|
921
|
+
explode: false,
|
|
922
|
+
encode: true,
|
|
923
|
+
style: "simple",
|
|
924
|
+
isLimit: false,
|
|
925
|
+
isOffset: false,
|
|
926
|
+
isCursor: false
|
|
927
|
+
});
|
|
928
|
+
return this.client.call(request);
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Delete conversation
|
|
932
|
+
* Delete a conversation and soft-delete all associated memories
|
|
933
|
+
* @param conversationId - The conversation ID
|
|
934
|
+
*/
|
|
935
|
+
async deleteConversation(conversationId) {
|
|
936
|
+
const request = new Request({
|
|
937
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
938
|
+
method: "DELETE",
|
|
939
|
+
path: "/api/conversations/{conversationId}",
|
|
940
|
+
config: this.config,
|
|
941
|
+
retry: {
|
|
942
|
+
attempts: 3,
|
|
943
|
+
delayMs: 150,
|
|
944
|
+
maxDelayMs: 5e3,
|
|
945
|
+
jitterMs: 50,
|
|
946
|
+
backoffFactor: 2
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
request.addPathParam("conversationId", {
|
|
950
|
+
key: "conversationId",
|
|
951
|
+
value: conversationId,
|
|
952
|
+
explode: false,
|
|
953
|
+
encode: true,
|
|
954
|
+
style: "simple",
|
|
955
|
+
isLimit: false,
|
|
956
|
+
isOffset: false,
|
|
957
|
+
isCursor: false
|
|
958
|
+
});
|
|
959
|
+
return this.client.call(request);
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Get conversation timeline
|
|
963
|
+
* Get all memories in a conversation in chronological order
|
|
964
|
+
* @param conversationId - The conversation ID
|
|
965
|
+
*/
|
|
966
|
+
async getConversationTimeline(conversationId) {
|
|
967
|
+
const request = new Request({
|
|
968
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
969
|
+
method: "GET",
|
|
970
|
+
path: "/api/conversations/{conversationId}/timeline",
|
|
971
|
+
config: this.config,
|
|
972
|
+
retry: {
|
|
973
|
+
attempts: 3,
|
|
974
|
+
delayMs: 150,
|
|
975
|
+
maxDelayMs: 5e3,
|
|
976
|
+
jitterMs: 50,
|
|
977
|
+
backoffFactor: 2
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
request.addPathParam("conversationId", {
|
|
981
|
+
key: "conversationId",
|
|
982
|
+
value: conversationId,
|
|
983
|
+
explode: false,
|
|
984
|
+
encode: true,
|
|
985
|
+
style: "simple",
|
|
986
|
+
isLimit: false,
|
|
987
|
+
isOffset: false,
|
|
988
|
+
isCursor: false
|
|
989
|
+
});
|
|
990
|
+
return this.client.call(request);
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Search conversations
|
|
994
|
+
* Search conversations by query string
|
|
995
|
+
* @param body - Request body
|
|
996
|
+
*/
|
|
997
|
+
async searchConversations(body) {
|
|
998
|
+
const request = new Request({
|
|
999
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1000
|
+
method: "POST",
|
|
1001
|
+
path: "/api/conversations/search",
|
|
1002
|
+
config: this.config,
|
|
1003
|
+
retry: {
|
|
1004
|
+
attempts: 3,
|
|
1005
|
+
delayMs: 150,
|
|
1006
|
+
maxDelayMs: 5e3,
|
|
1007
|
+
jitterMs: 50,
|
|
1008
|
+
backoffFactor: 2
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1011
|
+
if (body !== void 0) {
|
|
1012
|
+
request.addBody(body);
|
|
1013
|
+
}
|
|
1014
|
+
return this.client.call(request);
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Find conversations by topic
|
|
1018
|
+
* Find conversations that contain a specific topic
|
|
1019
|
+
* @param body - Request body
|
|
1020
|
+
*/
|
|
1021
|
+
async findConversationsByTopic(body) {
|
|
1022
|
+
const request = new Request({
|
|
1023
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1024
|
+
method: "POST",
|
|
1025
|
+
path: "/api/conversations/by-topic",
|
|
1026
|
+
config: this.config,
|
|
1027
|
+
retry: {
|
|
1028
|
+
attempts: 3,
|
|
1029
|
+
delayMs: 150,
|
|
1030
|
+
maxDelayMs: 5e3,
|
|
1031
|
+
jitterMs: 50,
|
|
1032
|
+
backoffFactor: 2
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
if (body !== void 0) {
|
|
1036
|
+
request.addBody(body);
|
|
1037
|
+
}
|
|
1038
|
+
return this.client.call(request);
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
// src/services/facts-service.ts
|
|
1043
|
+
var FactsService = class extends BaseService {
|
|
1044
|
+
/**
|
|
1045
|
+
* List facts
|
|
1046
|
+
* List all facts for the authenticated user
|
|
1047
|
+
* @param limit - Maximum number of facts to return
|
|
1048
|
+
* @param offset - Number of facts to skip
|
|
1049
|
+
*/
|
|
1050
|
+
async listFacts(options) {
|
|
1051
|
+
const request = new Request({
|
|
1052
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1053
|
+
method: "GET",
|
|
1054
|
+
path: "/api/facts",
|
|
1055
|
+
config: this.config,
|
|
1056
|
+
retry: {
|
|
1057
|
+
attempts: 3,
|
|
1058
|
+
delayMs: 150,
|
|
1059
|
+
maxDelayMs: 5e3,
|
|
1060
|
+
jitterMs: 50,
|
|
1061
|
+
backoffFactor: 2
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
if (options?.limit !== void 0) {
|
|
1065
|
+
request.addQueryParam("limit", {
|
|
1066
|
+
key: "limit",
|
|
1067
|
+
value: options.limit,
|
|
1068
|
+
explode: false,
|
|
1069
|
+
encode: true,
|
|
1070
|
+
style: "form",
|
|
1071
|
+
isLimit: true,
|
|
1072
|
+
isOffset: false,
|
|
1073
|
+
isCursor: false
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
if (options?.offset !== void 0) {
|
|
1077
|
+
request.addQueryParam("offset", {
|
|
1078
|
+
key: "offset",
|
|
1079
|
+
value: options.offset,
|
|
1080
|
+
explode: false,
|
|
1081
|
+
encode: true,
|
|
1082
|
+
style: "form",
|
|
1083
|
+
isLimit: false,
|
|
1084
|
+
isOffset: true,
|
|
1085
|
+
isCursor: false
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
return this.client.call(request);
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Create fact
|
|
1092
|
+
* Create a new semantic fact
|
|
1093
|
+
* @param body - Request body
|
|
1094
|
+
*/
|
|
1095
|
+
async createFact(body) {
|
|
1096
|
+
const request = new Request({
|
|
1097
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1098
|
+
method: "POST",
|
|
1099
|
+
path: "/api/facts",
|
|
1100
|
+
config: this.config,
|
|
1101
|
+
retry: {
|
|
1102
|
+
attempts: 3,
|
|
1103
|
+
delayMs: 150,
|
|
1104
|
+
maxDelayMs: 5e3,
|
|
1105
|
+
jitterMs: 50,
|
|
1106
|
+
backoffFactor: 2
|
|
1107
|
+
}
|
|
1108
|
+
});
|
|
1109
|
+
if (body !== void 0) {
|
|
1110
|
+
request.addBody(body);
|
|
1111
|
+
}
|
|
1112
|
+
return this.client.call(request);
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Get fact by ID
|
|
1116
|
+
* Retrieve a specific fact by its ID
|
|
1117
|
+
* @param id - The fact ID
|
|
1118
|
+
*/
|
|
1119
|
+
async getFactById(id) {
|
|
1120
|
+
const request = new Request({
|
|
1121
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1122
|
+
method: "GET",
|
|
1123
|
+
path: "/api/facts/{id}",
|
|
1124
|
+
config: this.config,
|
|
1125
|
+
retry: {
|
|
1126
|
+
attempts: 3,
|
|
1127
|
+
delayMs: 150,
|
|
1128
|
+
maxDelayMs: 5e3,
|
|
1129
|
+
jitterMs: 50,
|
|
1130
|
+
backoffFactor: 2
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
request.addPathParam("id", {
|
|
1134
|
+
key: "id",
|
|
1135
|
+
value: id,
|
|
1136
|
+
explode: false,
|
|
1137
|
+
encode: true,
|
|
1138
|
+
style: "simple",
|
|
1139
|
+
isLimit: false,
|
|
1140
|
+
isOffset: false,
|
|
1141
|
+
isCursor: false
|
|
1142
|
+
});
|
|
1143
|
+
return this.client.call(request);
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Update fact
|
|
1147
|
+
* Update an existing fact completely
|
|
1148
|
+
* @param id - The fact ID
|
|
1149
|
+
* @param body - Request body
|
|
1150
|
+
*/
|
|
1151
|
+
async updateFact(id, body) {
|
|
1152
|
+
const request = new Request({
|
|
1153
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1154
|
+
method: "PUT",
|
|
1155
|
+
path: "/api/facts/{id}",
|
|
1156
|
+
config: this.config,
|
|
1157
|
+
retry: {
|
|
1158
|
+
attempts: 3,
|
|
1159
|
+
delayMs: 150,
|
|
1160
|
+
maxDelayMs: 5e3,
|
|
1161
|
+
jitterMs: 50,
|
|
1162
|
+
backoffFactor: 2
|
|
1163
|
+
}
|
|
1164
|
+
});
|
|
1165
|
+
request.addPathParam("id", {
|
|
1166
|
+
key: "id",
|
|
1167
|
+
value: id,
|
|
1168
|
+
explode: false,
|
|
1169
|
+
encode: true,
|
|
1170
|
+
style: "simple",
|
|
1171
|
+
isLimit: false,
|
|
1172
|
+
isOffset: false,
|
|
1173
|
+
isCursor: false
|
|
1174
|
+
});
|
|
1175
|
+
if (body !== void 0) {
|
|
1176
|
+
request.addBody(body);
|
|
1177
|
+
}
|
|
1178
|
+
return this.client.call(request);
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Delete fact
|
|
1182
|
+
* Delete a fact by its ID
|
|
1183
|
+
* @param id - The fact ID
|
|
1184
|
+
*/
|
|
1185
|
+
async deleteFact(id) {
|
|
1186
|
+
const request = new Request({
|
|
1187
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1188
|
+
method: "DELETE",
|
|
1189
|
+
path: "/api/facts/{id}",
|
|
1190
|
+
config: this.config,
|
|
1191
|
+
retry: {
|
|
1192
|
+
attempts: 3,
|
|
1193
|
+
delayMs: 150,
|
|
1194
|
+
maxDelayMs: 5e3,
|
|
1195
|
+
jitterMs: 50,
|
|
1196
|
+
backoffFactor: 2
|
|
1197
|
+
}
|
|
1198
|
+
});
|
|
1199
|
+
request.addPathParam("id", {
|
|
1200
|
+
key: "id",
|
|
1201
|
+
value: id,
|
|
1202
|
+
explode: false,
|
|
1203
|
+
encode: true,
|
|
1204
|
+
style: "simple",
|
|
1205
|
+
isLimit: false,
|
|
1206
|
+
isOffset: false,
|
|
1207
|
+
isCursor: false
|
|
1208
|
+
});
|
|
1209
|
+
return this.client.call(request);
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Search facts
|
|
1213
|
+
* Search semantic facts by query string
|
|
1214
|
+
* @param body - Request body
|
|
1215
|
+
*/
|
|
1216
|
+
async searchFacts(body) {
|
|
1217
|
+
const request = new Request({
|
|
1218
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1219
|
+
method: "POST",
|
|
1220
|
+
path: "/api/facts/search",
|
|
1221
|
+
config: this.config,
|
|
1222
|
+
retry: {
|
|
1223
|
+
attempts: 3,
|
|
1224
|
+
delayMs: 150,
|
|
1225
|
+
maxDelayMs: 5e3,
|
|
1226
|
+
jitterMs: 50,
|
|
1227
|
+
backoffFactor: 2
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
if (body !== void 0) {
|
|
1231
|
+
request.addBody(body);
|
|
1232
|
+
}
|
|
1233
|
+
return this.client.call(request);
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1236
|
+
|
|
1237
|
+
// src/services/graphrag-service.ts
|
|
1238
|
+
var GraphragService = class extends BaseService {
|
|
1239
|
+
/**
|
|
1240
|
+
* Explain a GraphRAG query
|
|
1241
|
+
* Get explanation for a previously executed GraphRAG query result
|
|
1242
|
+
* @param queryId - The query ID to explain
|
|
1243
|
+
*/
|
|
1244
|
+
async explainGraphRAGQuery(options) {
|
|
1245
|
+
const request = new Request({
|
|
1246
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1247
|
+
method: "GET",
|
|
1248
|
+
path: "/api/graphrag/explain",
|
|
1249
|
+
config: this.config,
|
|
1250
|
+
retry: {
|
|
1251
|
+
attempts: 3,
|
|
1252
|
+
delayMs: 150,
|
|
1253
|
+
maxDelayMs: 5e3,
|
|
1254
|
+
jitterMs: 50,
|
|
1255
|
+
backoffFactor: 2
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1258
|
+
if (options?.queryId !== void 0) {
|
|
1259
|
+
request.addQueryParam("queryId", {
|
|
1260
|
+
key: "queryId",
|
|
1261
|
+
value: options.queryId,
|
|
1262
|
+
explode: false,
|
|
1263
|
+
encode: true,
|
|
1264
|
+
style: "form",
|
|
1265
|
+
isLimit: false,
|
|
1266
|
+
isOffset: false,
|
|
1267
|
+
isCursor: false
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
return this.client.call(request);
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Query communities
|
|
1274
|
+
* Query communities for relevant information using semantic search
|
|
1275
|
+
* @param body - Request body
|
|
1276
|
+
*/
|
|
1277
|
+
async queryCommunities(body) {
|
|
1278
|
+
const request = new Request({
|
|
1279
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1280
|
+
method: "POST",
|
|
1281
|
+
path: "/api/graphrag/query-communities",
|
|
1282
|
+
config: this.config,
|
|
1283
|
+
retry: {
|
|
1284
|
+
attempts: 3,
|
|
1285
|
+
delayMs: 150,
|
|
1286
|
+
maxDelayMs: 5e3,
|
|
1287
|
+
jitterMs: 50,
|
|
1288
|
+
backoffFactor: 2
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
if (body !== void 0) {
|
|
1292
|
+
request.addBody(body);
|
|
1293
|
+
}
|
|
1294
|
+
return this.client.call(request);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Execute a GraphRAG query
|
|
1298
|
+
* Execute a graph-based retrieval augmented generation query
|
|
1299
|
+
* @param body - Request body
|
|
1300
|
+
*/
|
|
1301
|
+
async executeGraphRAGQuery(body) {
|
|
1302
|
+
const request = new Request({
|
|
1303
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1304
|
+
method: "POST",
|
|
1305
|
+
path: "/api/graphrag/query",
|
|
1306
|
+
config: this.config,
|
|
1307
|
+
retry: {
|
|
1308
|
+
attempts: 3,
|
|
1309
|
+
delayMs: 150,
|
|
1310
|
+
maxDelayMs: 5e3,
|
|
1311
|
+
jitterMs: 50,
|
|
1312
|
+
backoffFactor: 2
|
|
1313
|
+
}
|
|
1314
|
+
});
|
|
1315
|
+
if (body !== void 0) {
|
|
1316
|
+
request.addBody(body);
|
|
1317
|
+
}
|
|
1318
|
+
return this.client.call(request);
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
|
|
1322
|
+
// src/services/health-service.ts
|
|
1323
|
+
var HealthService = class extends BaseService {
|
|
1324
|
+
/**
|
|
1325
|
+
* API health check endpoint
|
|
1326
|
+
* Returns the health status and uptime of the API service.
|
|
1327
|
+
This endpoint is public and requires no authentication.
|
|
1328
|
+
Use this endpoint for monitoring, health checks, and service availability verification.
|
|
1329
|
+
|
|
1330
|
+
*/
|
|
1331
|
+
async healthCheck() {
|
|
1332
|
+
const request = new Request({
|
|
1333
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1334
|
+
method: "GET",
|
|
1335
|
+
path: "/health",
|
|
1336
|
+
config: this.config,
|
|
1337
|
+
retry: {
|
|
1338
|
+
attempts: 3,
|
|
1339
|
+
delayMs: 150,
|
|
1340
|
+
maxDelayMs: 5e3,
|
|
1341
|
+
jitterMs: 50,
|
|
1342
|
+
backoffFactor: 2
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
return this.client.call(request);
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
|
|
1349
|
+
// src/services/memories-service.ts
|
|
1350
|
+
var MemoriesService = class extends BaseService {
|
|
1351
|
+
/**
|
|
1352
|
+
* Get memory by ID
|
|
1353
|
+
* Retrieve a specific memory by its ID
|
|
1354
|
+
* @param id - The memory ID
|
|
1355
|
+
*/
|
|
1356
|
+
async getMemoryById(id) {
|
|
1357
|
+
const request = new Request({
|
|
1358
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1359
|
+
method: "GET",
|
|
1360
|
+
path: "/api/memories/{id}",
|
|
1361
|
+
config: this.config,
|
|
1362
|
+
retry: {
|
|
1363
|
+
attempts: 3,
|
|
1364
|
+
delayMs: 150,
|
|
1365
|
+
maxDelayMs: 5e3,
|
|
1366
|
+
jitterMs: 50,
|
|
1367
|
+
backoffFactor: 2
|
|
1368
|
+
}
|
|
1369
|
+
});
|
|
1370
|
+
request.addPathParam("id", {
|
|
1371
|
+
key: "id",
|
|
1372
|
+
value: id,
|
|
1373
|
+
explode: false,
|
|
1374
|
+
encode: true,
|
|
1375
|
+
style: "simple",
|
|
1376
|
+
isLimit: false,
|
|
1377
|
+
isOffset: false,
|
|
1378
|
+
isCursor: false
|
|
1379
|
+
});
|
|
1380
|
+
return this.client.call(request);
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* Update a memory
|
|
1384
|
+
* Update an existing memory for the authenticated user
|
|
1385
|
+
* @param id - Memory ID
|
|
1386
|
+
* @param body - Request body
|
|
1387
|
+
*/
|
|
1388
|
+
async updateMemory(id, body) {
|
|
1389
|
+
const request = new Request({
|
|
1390
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1391
|
+
method: "PUT",
|
|
1392
|
+
path: "/api/memories/{id}",
|
|
1393
|
+
config: this.config,
|
|
1394
|
+
retry: {
|
|
1395
|
+
attempts: 3,
|
|
1396
|
+
delayMs: 150,
|
|
1397
|
+
maxDelayMs: 5e3,
|
|
1398
|
+
jitterMs: 50,
|
|
1399
|
+
backoffFactor: 2
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1402
|
+
request.addPathParam("id", {
|
|
1403
|
+
key: "id",
|
|
1404
|
+
value: id,
|
|
1405
|
+
explode: false,
|
|
1406
|
+
encode: true,
|
|
1407
|
+
style: "simple",
|
|
1408
|
+
isLimit: false,
|
|
1409
|
+
isOffset: false,
|
|
1410
|
+
isCursor: false
|
|
1411
|
+
});
|
|
1412
|
+
if (body !== void 0) {
|
|
1413
|
+
request.addBody(body);
|
|
1414
|
+
}
|
|
1415
|
+
return this.client.call(request);
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Delete memory
|
|
1419
|
+
* Delete a memory by its ID
|
|
1420
|
+
* @param id - The memory ID
|
|
1421
|
+
*/
|
|
1422
|
+
async deleteMemory(id) {
|
|
1423
|
+
const request = new Request({
|
|
1424
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1425
|
+
method: "DELETE",
|
|
1426
|
+
path: "/api/memories/{id}",
|
|
1427
|
+
config: this.config,
|
|
1428
|
+
retry: {
|
|
1429
|
+
attempts: 3,
|
|
1430
|
+
delayMs: 150,
|
|
1431
|
+
maxDelayMs: 5e3,
|
|
1432
|
+
jitterMs: 50,
|
|
1433
|
+
backoffFactor: 2
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
request.addPathParam("id", {
|
|
1437
|
+
key: "id",
|
|
1438
|
+
value: id,
|
|
1439
|
+
explode: false,
|
|
1440
|
+
encode: true,
|
|
1441
|
+
style: "simple",
|
|
1442
|
+
isLimit: false,
|
|
1443
|
+
isOffset: false,
|
|
1444
|
+
isCursor: false
|
|
1445
|
+
});
|
|
1446
|
+
return this.client.call(request);
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* List memories
|
|
1450
|
+
* List all memories for the authenticated user with pagination.
|
|
1451
|
+
|
|
1452
|
+
**ID Prefix Search:**
|
|
1453
|
+
Use the `idPrefix` parameter for git-style short ID lookup. This enables efficient
|
|
1454
|
+
server-side filtering instead of fetching all memories and filtering client-side.
|
|
1455
|
+
- Minimum 6 characters required for `idPrefix`
|
|
1456
|
+
- Returns matching memories directly (no need for secondary fetch)
|
|
1457
|
+
- Example: `?idPrefix=2d09116a` finds memories starting with that prefix
|
|
1458
|
+
|
|
1459
|
+
* @param idPrefix - Filter memories by ID prefix (git-style short ID lookup). Minimum 6 characters.
|
|
1460
|
+
* @param limit - Maximum number of memories to return
|
|
1461
|
+
* @param offset - Number of memories to skip
|
|
1462
|
+
* @param page - Page number (alternative to offset)
|
|
1463
|
+
*/
|
|
1464
|
+
async listMemories(options) {
|
|
1465
|
+
const request = new Request({
|
|
1466
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1467
|
+
method: "GET",
|
|
1468
|
+
path: "/api/memories",
|
|
1469
|
+
config: this.config,
|
|
1470
|
+
retry: {
|
|
1471
|
+
attempts: 3,
|
|
1472
|
+
delayMs: 150,
|
|
1473
|
+
maxDelayMs: 5e3,
|
|
1474
|
+
jitterMs: 50,
|
|
1475
|
+
backoffFactor: 2
|
|
1476
|
+
}
|
|
1477
|
+
});
|
|
1478
|
+
if (options?.idPrefix !== void 0) {
|
|
1479
|
+
request.addQueryParam("idPrefix", {
|
|
1480
|
+
key: "idPrefix",
|
|
1481
|
+
value: options.idPrefix,
|
|
1482
|
+
explode: false,
|
|
1483
|
+
encode: true,
|
|
1484
|
+
style: "form",
|
|
1485
|
+
isLimit: false,
|
|
1486
|
+
isOffset: false,
|
|
1487
|
+
isCursor: false
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
if (options?.limit !== void 0) {
|
|
1491
|
+
request.addQueryParam("limit", {
|
|
1492
|
+
key: "limit",
|
|
1493
|
+
value: options.limit,
|
|
1494
|
+
explode: false,
|
|
1495
|
+
encode: true,
|
|
1496
|
+
style: "form",
|
|
1497
|
+
isLimit: true,
|
|
1498
|
+
isOffset: false,
|
|
1499
|
+
isCursor: false
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
if (options?.offset !== void 0) {
|
|
1503
|
+
request.addQueryParam("offset", {
|
|
1504
|
+
key: "offset",
|
|
1505
|
+
value: options.offset,
|
|
1506
|
+
explode: false,
|
|
1507
|
+
encode: true,
|
|
1508
|
+
style: "form",
|
|
1509
|
+
isLimit: false,
|
|
1510
|
+
isOffset: true,
|
|
1511
|
+
isCursor: false
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
if (options?.page !== void 0) {
|
|
1515
|
+
request.addQueryParam("page", {
|
|
1516
|
+
key: "page",
|
|
1517
|
+
value: options.page,
|
|
1518
|
+
explode: false,
|
|
1519
|
+
encode: true,
|
|
1520
|
+
style: "form",
|
|
1521
|
+
isLimit: false,
|
|
1522
|
+
isOffset: false,
|
|
1523
|
+
isCursor: false
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
return this.client.call(request);
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* Create a memory
|
|
1530
|
+
* Create a new memory for the authenticated user.
|
|
1531
|
+
|
|
1532
|
+
**Conversation Management:**
|
|
1533
|
+
- Use `conversationId: "NEW"` to create a new conversation automatically
|
|
1534
|
+
- Provide an existing conversation ID to add to that conversation
|
|
1535
|
+
|
|
1536
|
+
**Session Management:**
|
|
1537
|
+
- Sessions are automatically assigned based on 90-minute gap detection
|
|
1538
|
+
- If the last memory in the conversation was within 90 minutes, the same session is reused
|
|
1539
|
+
- If the gap exceeds 90 minutes, a new session is created
|
|
1540
|
+
|
|
1541
|
+
**Response:**
|
|
1542
|
+
- Returns the created memory in `data` field
|
|
1543
|
+
- Returns session/conversation metadata in `meta` field
|
|
1544
|
+
|
|
1545
|
+
* @param body - Request body
|
|
1546
|
+
*/
|
|
1547
|
+
async createMemory(body) {
|
|
1548
|
+
const request = new Request({
|
|
1549
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1550
|
+
method: "POST",
|
|
1551
|
+
path: "/api/memories",
|
|
1552
|
+
config: this.config,
|
|
1553
|
+
retry: {
|
|
1554
|
+
attempts: 3,
|
|
1555
|
+
delayMs: 150,
|
|
1556
|
+
maxDelayMs: 5e3,
|
|
1557
|
+
jitterMs: 50,
|
|
1558
|
+
backoffFactor: 2
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
if (body !== void 0) {
|
|
1562
|
+
request.addBody(body);
|
|
1563
|
+
}
|
|
1564
|
+
return this.client.call(request);
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* Search memories (GET)
|
|
1568
|
+
* Search memories using query parameters. Provides the same functionality as
|
|
1569
|
+
POST /api/memories/search but accepts parameters via query string.
|
|
1570
|
+
|
|
1571
|
+
**Benefits of GET:**
|
|
1572
|
+
- Faster response times (~3x improvement)
|
|
1573
|
+
- Browser/CDN caching support
|
|
1574
|
+
- Simpler integration for read-only clients
|
|
1575
|
+
|
|
1576
|
+
**Search Methods:**
|
|
1577
|
+
- **hybrid** (default): Combines semantic and keyword search with Reciprocal Rank Fusion
|
|
1578
|
+
- **semantic**: Vector-based semantic search using OpenAI embeddings
|
|
1579
|
+
- **keyword**: Traditional fulltext search using Lucene
|
|
1580
|
+
|
|
1581
|
+
**Array Parameters:**
|
|
1582
|
+
- `topics`: Provide as comma-separated values (e.g., `topics=typescript,api-design`)
|
|
1583
|
+
|
|
1584
|
+
* @param q - Search query string
|
|
1585
|
+
* @param searchMethod - Search algorithm to use
|
|
1586
|
+
* @param limit - Maximum number of results to return
|
|
1587
|
+
* @param offset - Number of results to skip for pagination
|
|
1588
|
+
* @param threshold - Minimum similarity threshold for semantic search
|
|
1589
|
+
* @param mode - Content filtering mode
|
|
1590
|
+
* @param vectorWeight - Weight for vector similarity in hybrid search
|
|
1591
|
+
* @param fulltextWeight - Weight for fulltext matching in hybrid search
|
|
1592
|
+
* @param topics - Comma-separated list of topics to filter by
|
|
1593
|
+
* @param memoryType - Filter by memory type
|
|
1594
|
+
* @param conversationId - Filter by conversation ID
|
|
1595
|
+
* @param explain - Include detailed match explanations in results
|
|
1596
|
+
* @param includeTopics - Include associated topics in results
|
|
1597
|
+
* @param includeEntities - Include mentioned entities in results
|
|
1598
|
+
* @param asOfTime - Point-in-time query (ISO 8601 datetime)
|
|
1599
|
+
* @param validAtTime - Filter by validity time (ISO 8601 datetime)
|
|
1600
|
+
* @param eventTimeFrom - Event time range start (ISO 8601 datetime)
|
|
1601
|
+
* @param eventTimeTo - Event time range end (ISO 8601 datetime)
|
|
1602
|
+
* @param ingestionTimeFrom - Ingestion time range start (ISO 8601 datetime)
|
|
1603
|
+
* @param ingestionTimeTo - Ingestion time range end (ISO 8601 datetime)
|
|
1604
|
+
* @param includeExpired - Include expired memories in results
|
|
1605
|
+
* @param temporalMode - Temporal query mode
|
|
1606
|
+
*/
|
|
1607
|
+
async searchMemoriesGet(options) {
|
|
1608
|
+
const request = new Request({
|
|
1609
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1610
|
+
method: "GET",
|
|
1611
|
+
path: "/api/memories/search",
|
|
1612
|
+
config: this.config,
|
|
1613
|
+
retry: {
|
|
1614
|
+
attempts: 3,
|
|
1615
|
+
delayMs: 150,
|
|
1616
|
+
maxDelayMs: 5e3,
|
|
1617
|
+
jitterMs: 50,
|
|
1618
|
+
backoffFactor: 2
|
|
1619
|
+
}
|
|
1620
|
+
});
|
|
1621
|
+
if (options?.q !== void 0) {
|
|
1622
|
+
request.addQueryParam("q", {
|
|
1623
|
+
key: "q",
|
|
1624
|
+
value: options.q,
|
|
1625
|
+
explode: false,
|
|
1626
|
+
encode: true,
|
|
1627
|
+
style: "form",
|
|
1628
|
+
isLimit: false,
|
|
1629
|
+
isOffset: false,
|
|
1630
|
+
isCursor: false
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
if (options?.searchMethod !== void 0) {
|
|
1634
|
+
request.addQueryParam("searchMethod", {
|
|
1635
|
+
key: "searchMethod",
|
|
1636
|
+
value: options.searchMethod,
|
|
1637
|
+
explode: false,
|
|
1638
|
+
encode: true,
|
|
1639
|
+
style: "form",
|
|
1640
|
+
isLimit: false,
|
|
1641
|
+
isOffset: false,
|
|
1642
|
+
isCursor: false
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
if (options?.limit !== void 0) {
|
|
1646
|
+
request.addQueryParam("limit", {
|
|
1647
|
+
key: "limit",
|
|
1648
|
+
value: options.limit,
|
|
1649
|
+
explode: false,
|
|
1650
|
+
encode: true,
|
|
1651
|
+
style: "form",
|
|
1652
|
+
isLimit: true,
|
|
1653
|
+
isOffset: false,
|
|
1654
|
+
isCursor: false
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
if (options?.offset !== void 0) {
|
|
1658
|
+
request.addQueryParam("offset", {
|
|
1659
|
+
key: "offset",
|
|
1660
|
+
value: options.offset,
|
|
1661
|
+
explode: false,
|
|
1662
|
+
encode: true,
|
|
1663
|
+
style: "form",
|
|
1664
|
+
isLimit: false,
|
|
1665
|
+
isOffset: true,
|
|
1666
|
+
isCursor: false
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
if (options?.threshold !== void 0) {
|
|
1670
|
+
request.addQueryParam("threshold", {
|
|
1671
|
+
key: "threshold",
|
|
1672
|
+
value: options.threshold,
|
|
1673
|
+
explode: false,
|
|
1674
|
+
encode: true,
|
|
1675
|
+
style: "form",
|
|
1676
|
+
isLimit: false,
|
|
1677
|
+
isOffset: false,
|
|
1678
|
+
isCursor: false
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
if (options?.mode !== void 0) {
|
|
1682
|
+
request.addQueryParam("mode", {
|
|
1683
|
+
key: "mode",
|
|
1684
|
+
value: options.mode,
|
|
1685
|
+
explode: false,
|
|
1686
|
+
encode: true,
|
|
1687
|
+
style: "form",
|
|
1688
|
+
isLimit: false,
|
|
1689
|
+
isOffset: false,
|
|
1690
|
+
isCursor: false
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
if (options?.vectorWeight !== void 0) {
|
|
1694
|
+
request.addQueryParam("vectorWeight", {
|
|
1695
|
+
key: "vectorWeight",
|
|
1696
|
+
value: options.vectorWeight,
|
|
1697
|
+
explode: false,
|
|
1698
|
+
encode: true,
|
|
1699
|
+
style: "form",
|
|
1700
|
+
isLimit: false,
|
|
1701
|
+
isOffset: false,
|
|
1702
|
+
isCursor: false
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
if (options?.fulltextWeight !== void 0) {
|
|
1706
|
+
request.addQueryParam("fulltextWeight", {
|
|
1707
|
+
key: "fulltextWeight",
|
|
1708
|
+
value: options.fulltextWeight,
|
|
1709
|
+
explode: false,
|
|
1710
|
+
encode: true,
|
|
1711
|
+
style: "form",
|
|
1712
|
+
isLimit: false,
|
|
1713
|
+
isOffset: false,
|
|
1714
|
+
isCursor: false
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
if (options?.topics !== void 0) {
|
|
1718
|
+
request.addQueryParam("topics", {
|
|
1719
|
+
key: "topics",
|
|
1720
|
+
value: options.topics,
|
|
1721
|
+
explode: false,
|
|
1722
|
+
encode: true,
|
|
1723
|
+
style: "form",
|
|
1724
|
+
isLimit: false,
|
|
1725
|
+
isOffset: false,
|
|
1726
|
+
isCursor: false
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
if (options?.memoryType !== void 0) {
|
|
1730
|
+
request.addQueryParam("memoryType", {
|
|
1731
|
+
key: "memoryType",
|
|
1732
|
+
value: options.memoryType,
|
|
1733
|
+
explode: false,
|
|
1734
|
+
encode: true,
|
|
1735
|
+
style: "form",
|
|
1736
|
+
isLimit: false,
|
|
1737
|
+
isOffset: false,
|
|
1738
|
+
isCursor: false
|
|
1739
|
+
});
|
|
1740
|
+
}
|
|
1741
|
+
if (options?.conversationId !== void 0) {
|
|
1742
|
+
request.addQueryParam("conversationId", {
|
|
1743
|
+
key: "conversationId",
|
|
1744
|
+
value: options.conversationId,
|
|
1745
|
+
explode: false,
|
|
1746
|
+
encode: true,
|
|
1747
|
+
style: "form",
|
|
1748
|
+
isLimit: false,
|
|
1749
|
+
isOffset: false,
|
|
1750
|
+
isCursor: false
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
if (options?.explain !== void 0) {
|
|
1754
|
+
request.addQueryParam("explain", {
|
|
1755
|
+
key: "explain",
|
|
1756
|
+
value: options.explain,
|
|
1757
|
+
explode: false,
|
|
1758
|
+
encode: true,
|
|
1759
|
+
style: "form",
|
|
1760
|
+
isLimit: false,
|
|
1761
|
+
isOffset: false,
|
|
1762
|
+
isCursor: false
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
if (options?.includeTopics !== void 0) {
|
|
1766
|
+
request.addQueryParam("includeTopics", {
|
|
1767
|
+
key: "includeTopics",
|
|
1768
|
+
value: options.includeTopics,
|
|
1769
|
+
explode: false,
|
|
1770
|
+
encode: true,
|
|
1771
|
+
style: "form",
|
|
1772
|
+
isLimit: false,
|
|
1773
|
+
isOffset: false,
|
|
1774
|
+
isCursor: false
|
|
1775
|
+
});
|
|
1776
|
+
}
|
|
1777
|
+
if (options?.includeEntities !== void 0) {
|
|
1778
|
+
request.addQueryParam("includeEntities", {
|
|
1779
|
+
key: "includeEntities",
|
|
1780
|
+
value: options.includeEntities,
|
|
1781
|
+
explode: false,
|
|
1782
|
+
encode: true,
|
|
1783
|
+
style: "form",
|
|
1784
|
+
isLimit: false,
|
|
1785
|
+
isOffset: false,
|
|
1786
|
+
isCursor: false
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
if (options?.asOfTime !== void 0) {
|
|
1790
|
+
request.addQueryParam("asOfTime", {
|
|
1791
|
+
key: "asOfTime",
|
|
1792
|
+
value: options.asOfTime,
|
|
1793
|
+
explode: false,
|
|
1794
|
+
encode: true,
|
|
1795
|
+
style: "form",
|
|
1796
|
+
isLimit: false,
|
|
1797
|
+
isOffset: false,
|
|
1798
|
+
isCursor: false
|
|
1799
|
+
});
|
|
1800
|
+
}
|
|
1801
|
+
if (options?.validAtTime !== void 0) {
|
|
1802
|
+
request.addQueryParam("validAtTime", {
|
|
1803
|
+
key: "validAtTime",
|
|
1804
|
+
value: options.validAtTime,
|
|
1805
|
+
explode: false,
|
|
1806
|
+
encode: true,
|
|
1807
|
+
style: "form",
|
|
1808
|
+
isLimit: false,
|
|
1809
|
+
isOffset: false,
|
|
1810
|
+
isCursor: false
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
if (options?.eventTimeFrom !== void 0) {
|
|
1814
|
+
request.addQueryParam("eventTimeFrom", {
|
|
1815
|
+
key: "eventTimeFrom",
|
|
1816
|
+
value: options.eventTimeFrom,
|
|
1817
|
+
explode: false,
|
|
1818
|
+
encode: true,
|
|
1819
|
+
style: "form",
|
|
1820
|
+
isLimit: false,
|
|
1821
|
+
isOffset: false,
|
|
1822
|
+
isCursor: false
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
if (options?.eventTimeTo !== void 0) {
|
|
1826
|
+
request.addQueryParam("eventTimeTo", {
|
|
1827
|
+
key: "eventTimeTo",
|
|
1828
|
+
value: options.eventTimeTo,
|
|
1829
|
+
explode: false,
|
|
1830
|
+
encode: true,
|
|
1831
|
+
style: "form",
|
|
1832
|
+
isLimit: false,
|
|
1833
|
+
isOffset: false,
|
|
1834
|
+
isCursor: false
|
|
1835
|
+
});
|
|
1836
|
+
}
|
|
1837
|
+
if (options?.ingestionTimeFrom !== void 0) {
|
|
1838
|
+
request.addQueryParam("ingestionTimeFrom", {
|
|
1839
|
+
key: "ingestionTimeFrom",
|
|
1840
|
+
value: options.ingestionTimeFrom,
|
|
1841
|
+
explode: false,
|
|
1842
|
+
encode: true,
|
|
1843
|
+
style: "form",
|
|
1844
|
+
isLimit: false,
|
|
1845
|
+
isOffset: false,
|
|
1846
|
+
isCursor: false
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1849
|
+
if (options?.ingestionTimeTo !== void 0) {
|
|
1850
|
+
request.addQueryParam("ingestionTimeTo", {
|
|
1851
|
+
key: "ingestionTimeTo",
|
|
1852
|
+
value: options.ingestionTimeTo,
|
|
1853
|
+
explode: false,
|
|
1854
|
+
encode: true,
|
|
1855
|
+
style: "form",
|
|
1856
|
+
isLimit: false,
|
|
1857
|
+
isOffset: false,
|
|
1858
|
+
isCursor: false
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
if (options?.includeExpired !== void 0) {
|
|
1862
|
+
request.addQueryParam("includeExpired", {
|
|
1863
|
+
key: "includeExpired",
|
|
1864
|
+
value: options.includeExpired,
|
|
1865
|
+
explode: false,
|
|
1866
|
+
encode: true,
|
|
1867
|
+
style: "form",
|
|
1868
|
+
isLimit: false,
|
|
1869
|
+
isOffset: false,
|
|
1870
|
+
isCursor: false
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
if (options?.temporalMode !== void 0) {
|
|
1874
|
+
request.addQueryParam("temporalMode", {
|
|
1875
|
+
key: "temporalMode",
|
|
1876
|
+
value: options.temporalMode,
|
|
1877
|
+
explode: false,
|
|
1878
|
+
encode: true,
|
|
1879
|
+
style: "form",
|
|
1880
|
+
isLimit: false,
|
|
1881
|
+
isOffset: false,
|
|
1882
|
+
isCursor: false
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
return this.client.call(request);
|
|
1886
|
+
}
|
|
1887
|
+
/**
|
|
1888
|
+
* Search all memories
|
|
1889
|
+
* Search memories using different search methods:
|
|
1890
|
+
- **hybrid** (default): Combines semantic and keyword search with Reciprocal Rank Fusion
|
|
1891
|
+
- **semantic**: Vector-based semantic search using OpenAI embeddings
|
|
1892
|
+
- **keyword**: Traditional fulltext search using Lucene
|
|
1893
|
+
|
|
1894
|
+
The `mode` parameter controls content filtering (unified, content, facts).
|
|
1895
|
+
The `searchMethod` parameter controls the search algorithm.
|
|
1896
|
+
|
|
1897
|
+
* @param body - Request body
|
|
1898
|
+
*/
|
|
1899
|
+
async searchMemories(body) {
|
|
1900
|
+
const request = new Request({
|
|
1901
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1902
|
+
method: "POST",
|
|
1903
|
+
path: "/api/memories/search",
|
|
1904
|
+
config: this.config,
|
|
1905
|
+
retry: {
|
|
1906
|
+
attempts: 3,
|
|
1907
|
+
delayMs: 150,
|
|
1908
|
+
maxDelayMs: 5e3,
|
|
1909
|
+
jitterMs: 50,
|
|
1910
|
+
backoffFactor: 2
|
|
1911
|
+
}
|
|
1912
|
+
});
|
|
1913
|
+
if (body !== void 0) {
|
|
1914
|
+
request.addBody(body);
|
|
1915
|
+
}
|
|
1916
|
+
return this.client.call(request);
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Find similar memories
|
|
1920
|
+
* Find memories that are semantically similar to the given memory.
|
|
1921
|
+
|
|
1922
|
+
Uses vector similarity search if embeddings are available for the memory.
|
|
1923
|
+
Falls back to topic-based similarity if embeddings are not available.
|
|
1924
|
+
|
|
1925
|
+
The `relationship` field in results indicates the method used:
|
|
1926
|
+
- `similar` - Found via vector/semantic similarity
|
|
1927
|
+
- `similar-by-topic` - Fallback using shared topics
|
|
1928
|
+
|
|
1929
|
+
* @param id - The source memory ID
|
|
1930
|
+
* @param limit - Maximum number of similar memories to return
|
|
1931
|
+
*/
|
|
1932
|
+
async getSimilarMemories(id, options) {
|
|
1933
|
+
const request = new Request({
|
|
1934
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1935
|
+
method: "GET",
|
|
1936
|
+
path: "/api/memories/{id}/similar",
|
|
1937
|
+
config: this.config,
|
|
1938
|
+
retry: {
|
|
1939
|
+
attempts: 3,
|
|
1940
|
+
delayMs: 150,
|
|
1941
|
+
maxDelayMs: 5e3,
|
|
1942
|
+
jitterMs: 50,
|
|
1943
|
+
backoffFactor: 2
|
|
1944
|
+
}
|
|
1945
|
+
});
|
|
1946
|
+
request.addPathParam("id", {
|
|
1947
|
+
key: "id",
|
|
1948
|
+
value: id,
|
|
1949
|
+
explode: false,
|
|
1950
|
+
encode: true,
|
|
1951
|
+
style: "simple",
|
|
1952
|
+
isLimit: false,
|
|
1953
|
+
isOffset: false,
|
|
1954
|
+
isCursor: false
|
|
1955
|
+
});
|
|
1956
|
+
if (options?.limit !== void 0) {
|
|
1957
|
+
request.addQueryParam("limit", {
|
|
1958
|
+
key: "limit",
|
|
1959
|
+
value: options.limit,
|
|
1960
|
+
explode: false,
|
|
1961
|
+
encode: true,
|
|
1962
|
+
style: "form",
|
|
1963
|
+
isLimit: true,
|
|
1964
|
+
isOffset: false,
|
|
1965
|
+
isCursor: false
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1968
|
+
return this.client.call(request);
|
|
1969
|
+
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Find memories from same conversation
|
|
1972
|
+
* Find other memories that belong to the same conversation as the given memory.
|
|
1973
|
+
|
|
1974
|
+
Returns memories sorted chronologically (oldest first) to show the conversation flow.
|
|
1975
|
+
If the memory doesn't belong to a conversation, returns an empty array.
|
|
1976
|
+
|
|
1977
|
+
* @param id - The source memory ID
|
|
1978
|
+
* @param limit - Maximum number of conversation memories to return
|
|
1979
|
+
*/
|
|
1980
|
+
async getConversationMemories(id, options) {
|
|
1981
|
+
const request = new Request({
|
|
1982
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1983
|
+
method: "GET",
|
|
1984
|
+
path: "/api/memories/{id}/conversation-memories",
|
|
1985
|
+
config: this.config,
|
|
1986
|
+
retry: {
|
|
1987
|
+
attempts: 3,
|
|
1988
|
+
delayMs: 150,
|
|
1989
|
+
maxDelayMs: 5e3,
|
|
1990
|
+
jitterMs: 50,
|
|
1991
|
+
backoffFactor: 2
|
|
1992
|
+
}
|
|
1993
|
+
});
|
|
1994
|
+
request.addPathParam("id", {
|
|
1995
|
+
key: "id",
|
|
1996
|
+
value: id,
|
|
1997
|
+
explode: false,
|
|
1998
|
+
encode: true,
|
|
1999
|
+
style: "simple",
|
|
2000
|
+
isLimit: false,
|
|
2001
|
+
isOffset: false,
|
|
2002
|
+
isCursor: false
|
|
2003
|
+
});
|
|
2004
|
+
if (options?.limit !== void 0) {
|
|
2005
|
+
request.addQueryParam("limit", {
|
|
2006
|
+
key: "limit",
|
|
2007
|
+
value: options.limit,
|
|
2008
|
+
explode: false,
|
|
2009
|
+
encode: true,
|
|
2010
|
+
style: "form",
|
|
2011
|
+
isLimit: true,
|
|
2012
|
+
isOffset: false,
|
|
2013
|
+
isCursor: false
|
|
2014
|
+
});
|
|
2015
|
+
}
|
|
2016
|
+
return this.client.call(request);
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* Find related memories by topics
|
|
2020
|
+
* Find memories that share topics with the given memory.
|
|
2021
|
+
|
|
2022
|
+
The score indicates the ratio of shared topics (1.0 = all topics match).
|
|
2023
|
+
Results are sorted by score (most related first), then by timestamp.
|
|
2024
|
+
|
|
2025
|
+
If the source memory has no topics, returns an empty array.
|
|
2026
|
+
|
|
2027
|
+
* @param id - The source memory ID
|
|
2028
|
+
* @param limit - Maximum number of related memories to return
|
|
2029
|
+
*/
|
|
2030
|
+
async getRelatedMemories(id, options) {
|
|
2031
|
+
const request = new Request({
|
|
2032
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2033
|
+
method: "GET",
|
|
2034
|
+
path: "/api/memories/{id}/related",
|
|
2035
|
+
config: this.config,
|
|
2036
|
+
retry: {
|
|
2037
|
+
attempts: 3,
|
|
2038
|
+
delayMs: 150,
|
|
2039
|
+
maxDelayMs: 5e3,
|
|
2040
|
+
jitterMs: 50,
|
|
2041
|
+
backoffFactor: 2
|
|
2042
|
+
}
|
|
2043
|
+
});
|
|
2044
|
+
request.addPathParam("id", {
|
|
2045
|
+
key: "id",
|
|
2046
|
+
value: id,
|
|
2047
|
+
explode: false,
|
|
2048
|
+
encode: true,
|
|
2049
|
+
style: "simple",
|
|
2050
|
+
isLimit: false,
|
|
2051
|
+
isOffset: false,
|
|
2052
|
+
isCursor: false
|
|
2053
|
+
});
|
|
2054
|
+
if (options?.limit !== void 0) {
|
|
2055
|
+
request.addQueryParam("limit", {
|
|
2056
|
+
key: "limit",
|
|
2057
|
+
value: options.limit,
|
|
2058
|
+
explode: false,
|
|
2059
|
+
encode: true,
|
|
2060
|
+
style: "form",
|
|
2061
|
+
isLimit: true,
|
|
2062
|
+
isOffset: false,
|
|
2063
|
+
isCursor: false
|
|
2064
|
+
});
|
|
2065
|
+
}
|
|
2066
|
+
return this.client.call(request);
|
|
2067
|
+
}
|
|
2068
|
+
/**
|
|
2069
|
+
* Get relationships for a memory
|
|
2070
|
+
* Retrieve all relationships for a memory.
|
|
2071
|
+
|
|
2072
|
+
**Direction Options:**
|
|
2073
|
+
- **outgoing**: Relationships where this memory is the source
|
|
2074
|
+
- **incoming**: Relationships where this memory is the target
|
|
2075
|
+
- **both**: All relationships involving this memory
|
|
2076
|
+
|
|
2077
|
+
* @param id - The memory ID
|
|
2078
|
+
* @param direction - Direction of relationships to retrieve
|
|
2079
|
+
*/
|
|
2080
|
+
async getMemoryRelationships(id, options) {
|
|
2081
|
+
const request = new Request({
|
|
2082
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2083
|
+
method: "GET",
|
|
2084
|
+
path: "/api/memories/{id}/relationships",
|
|
2085
|
+
config: this.config,
|
|
2086
|
+
retry: {
|
|
2087
|
+
attempts: 3,
|
|
2088
|
+
delayMs: 150,
|
|
2089
|
+
maxDelayMs: 5e3,
|
|
2090
|
+
jitterMs: 50,
|
|
2091
|
+
backoffFactor: 2
|
|
2092
|
+
}
|
|
2093
|
+
});
|
|
2094
|
+
request.addPathParam("id", {
|
|
2095
|
+
key: "id",
|
|
2096
|
+
value: id,
|
|
2097
|
+
explode: false,
|
|
2098
|
+
encode: true,
|
|
2099
|
+
style: "simple",
|
|
2100
|
+
isLimit: false,
|
|
2101
|
+
isOffset: false,
|
|
2102
|
+
isCursor: false
|
|
2103
|
+
});
|
|
2104
|
+
if (options?.direction !== void 0) {
|
|
2105
|
+
request.addQueryParam("direction", {
|
|
2106
|
+
key: "direction",
|
|
2107
|
+
value: options.direction,
|
|
2108
|
+
explode: false,
|
|
2109
|
+
encode: true,
|
|
2110
|
+
style: "form",
|
|
2111
|
+
isLimit: false,
|
|
2112
|
+
isOffset: false,
|
|
2113
|
+
isCursor: false
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
return this.client.call(request);
|
|
2117
|
+
}
|
|
2118
|
+
/**
|
|
2119
|
+
* Create a relationship between memories
|
|
2120
|
+
* Create a relationship between the source memory and a target memory.
|
|
2121
|
+
|
|
2122
|
+
**Relationship Types:**
|
|
2123
|
+
- **SUPERSEDES**: The source memory replaces/updates the target memory
|
|
2124
|
+
- **FOLLOWS**: The source memory follows chronologically from the target
|
|
2125
|
+
- **RESOLVES**: The source memory resolves an issue mentioned in the target
|
|
2126
|
+
- **CONTRADICTS**: The source memory contradicts the target memory
|
|
2127
|
+
- **REFERENCES**: The source memory references the target memory
|
|
2128
|
+
|
|
2129
|
+
When creating SUPERSEDES or CONTRADICTS relationships, the target memory's
|
|
2130
|
+
effectiveState will be automatically updated.
|
|
2131
|
+
|
|
2132
|
+
* @param id - The source memory ID
|
|
2133
|
+
* @param body - Request body
|
|
2134
|
+
*/
|
|
2135
|
+
async createMemoryRelationship(id, body) {
|
|
2136
|
+
const request = new Request({
|
|
2137
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2138
|
+
method: "POST",
|
|
2139
|
+
path: "/api/memories/{id}/relationships",
|
|
2140
|
+
config: this.config,
|
|
2141
|
+
retry: {
|
|
2142
|
+
attempts: 3,
|
|
2143
|
+
delayMs: 150,
|
|
2144
|
+
maxDelayMs: 5e3,
|
|
2145
|
+
jitterMs: 50,
|
|
2146
|
+
backoffFactor: 2
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2149
|
+
request.addPathParam("id", {
|
|
2150
|
+
key: "id",
|
|
2151
|
+
value: id,
|
|
2152
|
+
explode: false,
|
|
2153
|
+
encode: true,
|
|
2154
|
+
style: "simple",
|
|
2155
|
+
isLimit: false,
|
|
2156
|
+
isOffset: false,
|
|
2157
|
+
isCursor: false
|
|
2158
|
+
});
|
|
2159
|
+
if (body !== void 0) {
|
|
2160
|
+
request.addBody(body);
|
|
2161
|
+
}
|
|
2162
|
+
return this.client.call(request);
|
|
2163
|
+
}
|
|
2164
|
+
/**
|
|
2165
|
+
* Delete a relationship
|
|
2166
|
+
* Delete a specific relationship from a memory
|
|
2167
|
+
* @param id - The source memory ID
|
|
2168
|
+
* @param relationshipId - The relationship ID to delete
|
|
2169
|
+
*/
|
|
2170
|
+
async deleteMemoryRelationship(id, relationshipId) {
|
|
2171
|
+
const request = new Request({
|
|
2172
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2173
|
+
method: "DELETE",
|
|
2174
|
+
path: "/api/memories/{id}/relationships/{relationshipId}",
|
|
2175
|
+
config: this.config,
|
|
2176
|
+
retry: {
|
|
2177
|
+
attempts: 3,
|
|
2178
|
+
delayMs: 150,
|
|
2179
|
+
maxDelayMs: 5e3,
|
|
2180
|
+
jitterMs: 50,
|
|
2181
|
+
backoffFactor: 2
|
|
2182
|
+
}
|
|
2183
|
+
});
|
|
2184
|
+
request.addPathParam("id", {
|
|
2185
|
+
key: "id",
|
|
2186
|
+
value: id,
|
|
2187
|
+
explode: false,
|
|
2188
|
+
encode: true,
|
|
2189
|
+
style: "simple",
|
|
2190
|
+
isLimit: false,
|
|
2191
|
+
isOffset: false,
|
|
2192
|
+
isCursor: false
|
|
2193
|
+
});
|
|
2194
|
+
request.addPathParam("relationshipId", {
|
|
2195
|
+
key: "relationshipId",
|
|
2196
|
+
value: relationshipId,
|
|
2197
|
+
explode: false,
|
|
2198
|
+
encode: true,
|
|
2199
|
+
style: "simple",
|
|
2200
|
+
isLimit: false,
|
|
2201
|
+
isOffset: false,
|
|
2202
|
+
isCursor: false
|
|
2203
|
+
});
|
|
2204
|
+
return this.client.call(request);
|
|
2205
|
+
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Get timeline context for a memory
|
|
2208
|
+
* Get the chronological context around a memory.
|
|
2209
|
+
Returns preceding and following memories ordered by event time.
|
|
2210
|
+
Useful for understanding the narrative flow.
|
|
2211
|
+
|
|
2212
|
+
* @param id - The memory ID
|
|
2213
|
+
* @param before - Number of preceding memories to return
|
|
2214
|
+
* @param after - Number of following memories to return
|
|
2215
|
+
*/
|
|
2216
|
+
async getMemoryTimeline(id, options) {
|
|
2217
|
+
const request = new Request({
|
|
2218
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2219
|
+
method: "GET",
|
|
2220
|
+
path: "/api/memories/{id}/timeline",
|
|
2221
|
+
config: this.config,
|
|
2222
|
+
retry: {
|
|
2223
|
+
attempts: 3,
|
|
2224
|
+
delayMs: 150,
|
|
2225
|
+
maxDelayMs: 5e3,
|
|
2226
|
+
jitterMs: 50,
|
|
2227
|
+
backoffFactor: 2
|
|
2228
|
+
}
|
|
2229
|
+
});
|
|
2230
|
+
request.addPathParam("id", {
|
|
2231
|
+
key: "id",
|
|
2232
|
+
value: id,
|
|
2233
|
+
explode: false,
|
|
2234
|
+
encode: true,
|
|
2235
|
+
style: "simple",
|
|
2236
|
+
isLimit: false,
|
|
2237
|
+
isOffset: false,
|
|
2238
|
+
isCursor: false
|
|
2239
|
+
});
|
|
2240
|
+
if (options?.before !== void 0) {
|
|
2241
|
+
request.addQueryParam("before", {
|
|
2242
|
+
key: "before",
|
|
2243
|
+
value: options.before,
|
|
2244
|
+
explode: false,
|
|
2245
|
+
encode: true,
|
|
2246
|
+
style: "form",
|
|
2247
|
+
isLimit: false,
|
|
2248
|
+
isOffset: false,
|
|
2249
|
+
isCursor: false
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
if (options?.after !== void 0) {
|
|
2253
|
+
request.addQueryParam("after", {
|
|
2254
|
+
key: "after",
|
|
2255
|
+
value: options.after,
|
|
2256
|
+
explode: false,
|
|
2257
|
+
encode: true,
|
|
2258
|
+
style: "form",
|
|
2259
|
+
isLimit: false,
|
|
2260
|
+
isOffset: false,
|
|
2261
|
+
isCursor: false
|
|
2262
|
+
});
|
|
2263
|
+
}
|
|
2264
|
+
return this.client.call(request);
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* Detect potential relationships for a memory
|
|
2268
|
+
* Analyze a memory and detect potential relationships with other memories.
|
|
2269
|
+
Uses semantic similarity and pattern detection to suggest relationships.
|
|
2270
|
+
|
|
2271
|
+
Set `autoCreate: true` to automatically create high-confidence relationships.
|
|
2272
|
+
|
|
2273
|
+
* @param id - The memory ID
|
|
2274
|
+
* @param body - Request body
|
|
2275
|
+
*/
|
|
2276
|
+
async detectMemoryRelationships(id, options) {
|
|
2277
|
+
const request = new Request({
|
|
2278
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2279
|
+
method: "POST",
|
|
2280
|
+
path: "/api/memories/{id}/detect-relationships",
|
|
2281
|
+
config: this.config,
|
|
2282
|
+
retry: {
|
|
2283
|
+
attempts: 3,
|
|
2284
|
+
delayMs: 150,
|
|
2285
|
+
maxDelayMs: 5e3,
|
|
2286
|
+
jitterMs: 50,
|
|
2287
|
+
backoffFactor: 2
|
|
2288
|
+
}
|
|
2289
|
+
});
|
|
2290
|
+
request.addPathParam("id", {
|
|
2291
|
+
key: "id",
|
|
2292
|
+
value: id,
|
|
2293
|
+
explode: false,
|
|
2294
|
+
encode: true,
|
|
2295
|
+
style: "simple",
|
|
2296
|
+
isLimit: false,
|
|
2297
|
+
isOffset: false,
|
|
2298
|
+
isCursor: false
|
|
2299
|
+
});
|
|
2300
|
+
if (options?.body !== void 0) {
|
|
2301
|
+
request.addBody(options?.body);
|
|
2302
|
+
}
|
|
2303
|
+
return this.client.call(request);
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2306
|
+
|
|
2307
|
+
// src/services/narratives-service.ts
|
|
2308
|
+
var NarrativesService = class extends BaseService {
|
|
2309
|
+
/**
|
|
2310
|
+
* List narrative threads
|
|
2311
|
+
* List all narrative threads for the authenticated user.
|
|
2312
|
+
Narratives group related memories into coherent storylines.
|
|
2313
|
+
|
|
2314
|
+
* @param limit - Maximum number of narratives to return
|
|
2315
|
+
* @param offset - Number of narratives to skip
|
|
2316
|
+
* @param state - Filter by narrative state
|
|
2317
|
+
* @param topics - Comma-separated list of topics to filter by
|
|
2318
|
+
*/
|
|
2319
|
+
async listNarratives(options) {
|
|
2320
|
+
const request = new Request({
|
|
2321
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2322
|
+
method: "GET",
|
|
2323
|
+
path: "/api/narratives",
|
|
2324
|
+
config: this.config,
|
|
2325
|
+
retry: {
|
|
2326
|
+
attempts: 3,
|
|
2327
|
+
delayMs: 150,
|
|
2328
|
+
maxDelayMs: 5e3,
|
|
2329
|
+
jitterMs: 50,
|
|
2330
|
+
backoffFactor: 2
|
|
2331
|
+
}
|
|
2332
|
+
});
|
|
2333
|
+
if (options?.limit !== void 0) {
|
|
2334
|
+
request.addQueryParam("limit", {
|
|
2335
|
+
key: "limit",
|
|
2336
|
+
value: options.limit,
|
|
2337
|
+
explode: false,
|
|
2338
|
+
encode: true,
|
|
2339
|
+
style: "form",
|
|
2340
|
+
isLimit: true,
|
|
2341
|
+
isOffset: false,
|
|
2342
|
+
isCursor: false
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
if (options?.offset !== void 0) {
|
|
2346
|
+
request.addQueryParam("offset", {
|
|
2347
|
+
key: "offset",
|
|
2348
|
+
value: options.offset,
|
|
2349
|
+
explode: false,
|
|
2350
|
+
encode: true,
|
|
2351
|
+
style: "form",
|
|
2352
|
+
isLimit: false,
|
|
2353
|
+
isOffset: true,
|
|
2354
|
+
isCursor: false
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
if (options?.state !== void 0) {
|
|
2358
|
+
request.addQueryParam("state", {
|
|
2359
|
+
key: "state",
|
|
2360
|
+
value: options.state,
|
|
2361
|
+
explode: false,
|
|
2362
|
+
encode: true,
|
|
2363
|
+
style: "form",
|
|
2364
|
+
isLimit: false,
|
|
2365
|
+
isOffset: false,
|
|
2366
|
+
isCursor: false
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2369
|
+
if (options?.topics !== void 0) {
|
|
2370
|
+
request.addQueryParam("topics", {
|
|
2371
|
+
key: "topics",
|
|
2372
|
+
value: options.topics,
|
|
2373
|
+
explode: false,
|
|
2374
|
+
encode: true,
|
|
2375
|
+
style: "form",
|
|
2376
|
+
isLimit: false,
|
|
2377
|
+
isOffset: false,
|
|
2378
|
+
isCursor: false
|
|
2379
|
+
});
|
|
2380
|
+
}
|
|
2381
|
+
return this.client.call(request);
|
|
2382
|
+
}
|
|
2383
|
+
/**
|
|
2384
|
+
* Create a narrative thread
|
|
2385
|
+
* Create a new narrative thread starting from a root memory.
|
|
2386
|
+
Narratives help organize related memories into coherent storylines.
|
|
2387
|
+
|
|
2388
|
+
* @param body - Request body
|
|
2389
|
+
*/
|
|
2390
|
+
async createNarrative(body) {
|
|
2391
|
+
const request = new Request({
|
|
2392
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2393
|
+
method: "POST",
|
|
2394
|
+
path: "/api/narratives",
|
|
2395
|
+
config: this.config,
|
|
2396
|
+
retry: {
|
|
2397
|
+
attempts: 3,
|
|
2398
|
+
delayMs: 150,
|
|
2399
|
+
maxDelayMs: 5e3,
|
|
2400
|
+
jitterMs: 50,
|
|
2401
|
+
backoffFactor: 2
|
|
2402
|
+
}
|
|
2403
|
+
});
|
|
2404
|
+
if (body !== void 0) {
|
|
2405
|
+
request.addBody(body);
|
|
2406
|
+
}
|
|
2407
|
+
return this.client.call(request);
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Get a narrative thread
|
|
2411
|
+
* Retrieve a specific narrative thread by ID
|
|
2412
|
+
* @param id - The narrative ID
|
|
2413
|
+
*/
|
|
2414
|
+
async getNarrative(id) {
|
|
2415
|
+
const request = new Request({
|
|
2416
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2417
|
+
method: "GET",
|
|
2418
|
+
path: "/api/narratives/{id}",
|
|
2419
|
+
config: this.config,
|
|
2420
|
+
retry: {
|
|
2421
|
+
attempts: 3,
|
|
2422
|
+
delayMs: 150,
|
|
2423
|
+
maxDelayMs: 5e3,
|
|
2424
|
+
jitterMs: 50,
|
|
2425
|
+
backoffFactor: 2
|
|
2426
|
+
}
|
|
2427
|
+
});
|
|
2428
|
+
request.addPathParam("id", {
|
|
2429
|
+
key: "id",
|
|
2430
|
+
value: id,
|
|
2431
|
+
explode: false,
|
|
2432
|
+
encode: true,
|
|
2433
|
+
style: "simple",
|
|
2434
|
+
isLimit: false,
|
|
2435
|
+
isOffset: false,
|
|
2436
|
+
isCursor: false
|
|
2437
|
+
});
|
|
2438
|
+
return this.client.call(request);
|
|
2439
|
+
}
|
|
2440
|
+
/**
|
|
2441
|
+
* Delete a narrative thread
|
|
2442
|
+
* Delete a narrative thread.
|
|
2443
|
+
This does not delete the associated memories, only the narrative structure.
|
|
2444
|
+
|
|
2445
|
+
* @param id - The narrative ID
|
|
2446
|
+
*/
|
|
2447
|
+
async deleteNarrative(id) {
|
|
2448
|
+
const request = new Request({
|
|
2449
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2450
|
+
method: "DELETE",
|
|
2451
|
+
path: "/api/narratives/{id}",
|
|
2452
|
+
config: this.config,
|
|
2453
|
+
retry: {
|
|
2454
|
+
attempts: 3,
|
|
2455
|
+
delayMs: 150,
|
|
2456
|
+
maxDelayMs: 5e3,
|
|
2457
|
+
jitterMs: 50,
|
|
2458
|
+
backoffFactor: 2
|
|
2459
|
+
}
|
|
2460
|
+
});
|
|
2461
|
+
request.addPathParam("id", {
|
|
2462
|
+
key: "id",
|
|
2463
|
+
value: id,
|
|
2464
|
+
explode: false,
|
|
2465
|
+
encode: true,
|
|
2466
|
+
style: "simple",
|
|
2467
|
+
isLimit: false,
|
|
2468
|
+
isOffset: false,
|
|
2469
|
+
isCursor: false
|
|
2470
|
+
});
|
|
2471
|
+
return this.client.call(request);
|
|
2472
|
+
}
|
|
2473
|
+
/**
|
|
2474
|
+
* Update a narrative thread
|
|
2475
|
+
* Update a narrative thread's title, topics, or state.
|
|
2476
|
+
Use this to resolve, reopen, or modify narratives.
|
|
2477
|
+
|
|
2478
|
+
* @param id - The narrative ID
|
|
2479
|
+
* @param body - Request body
|
|
2480
|
+
*/
|
|
2481
|
+
async updateNarrative(id, body) {
|
|
2482
|
+
const request = new Request({
|
|
2483
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2484
|
+
method: "PATCH",
|
|
2485
|
+
path: "/api/narratives/{id}",
|
|
2486
|
+
config: this.config,
|
|
2487
|
+
retry: {
|
|
2488
|
+
attempts: 3,
|
|
2489
|
+
delayMs: 150,
|
|
2490
|
+
maxDelayMs: 5e3,
|
|
2491
|
+
jitterMs: 50,
|
|
2492
|
+
backoffFactor: 2
|
|
2493
|
+
}
|
|
2494
|
+
});
|
|
2495
|
+
request.addPathParam("id", {
|
|
2496
|
+
key: "id",
|
|
2497
|
+
value: id,
|
|
2498
|
+
explode: false,
|
|
2499
|
+
encode: true,
|
|
2500
|
+
style: "simple",
|
|
2501
|
+
isLimit: false,
|
|
2502
|
+
isOffset: false,
|
|
2503
|
+
isCursor: false
|
|
2504
|
+
});
|
|
2505
|
+
if (body !== void 0) {
|
|
2506
|
+
request.addBody(body);
|
|
2507
|
+
}
|
|
2508
|
+
return this.client.call(request);
|
|
2509
|
+
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Get narrative timeline
|
|
2512
|
+
* Get all memories in a narrative, ordered by their position in the narrative.
|
|
2513
|
+
Each memory includes its position and effective state.
|
|
2514
|
+
|
|
2515
|
+
* @param id - The narrative ID
|
|
2516
|
+
* @param limit - Maximum number of memories to return
|
|
2517
|
+
* @param offset - Number of memories to skip
|
|
2518
|
+
*/
|
|
2519
|
+
async getNarrativeTimeline(id, options) {
|
|
2520
|
+
const request = new Request({
|
|
2521
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2522
|
+
method: "GET",
|
|
2523
|
+
path: "/api/narratives/{id}/timeline",
|
|
2524
|
+
config: this.config,
|
|
2525
|
+
retry: {
|
|
2526
|
+
attempts: 3,
|
|
2527
|
+
delayMs: 150,
|
|
2528
|
+
maxDelayMs: 5e3,
|
|
2529
|
+
jitterMs: 50,
|
|
2530
|
+
backoffFactor: 2
|
|
2531
|
+
}
|
|
2532
|
+
});
|
|
2533
|
+
request.addPathParam("id", {
|
|
2534
|
+
key: "id",
|
|
2535
|
+
value: id,
|
|
2536
|
+
explode: false,
|
|
2537
|
+
encode: true,
|
|
2538
|
+
style: "simple",
|
|
2539
|
+
isLimit: false,
|
|
2540
|
+
isOffset: false,
|
|
2541
|
+
isCursor: false
|
|
2542
|
+
});
|
|
2543
|
+
if (options?.limit !== void 0) {
|
|
2544
|
+
request.addQueryParam("limit", {
|
|
2545
|
+
key: "limit",
|
|
2546
|
+
value: options.limit,
|
|
2547
|
+
explode: false,
|
|
2548
|
+
encode: true,
|
|
2549
|
+
style: "form",
|
|
2550
|
+
isLimit: true,
|
|
2551
|
+
isOffset: false,
|
|
2552
|
+
isCursor: false
|
|
2553
|
+
});
|
|
2554
|
+
}
|
|
2555
|
+
if (options?.offset !== void 0) {
|
|
2556
|
+
request.addQueryParam("offset", {
|
|
2557
|
+
key: "offset",
|
|
2558
|
+
value: options.offset,
|
|
2559
|
+
explode: false,
|
|
2560
|
+
encode: true,
|
|
2561
|
+
style: "form",
|
|
2562
|
+
isLimit: false,
|
|
2563
|
+
isOffset: true,
|
|
2564
|
+
isCursor: false
|
|
2565
|
+
});
|
|
2566
|
+
}
|
|
2567
|
+
return this.client.call(request);
|
|
2568
|
+
}
|
|
2569
|
+
/**
|
|
2570
|
+
* Add a memory to a narrative
|
|
2571
|
+
* Add an existing memory to a narrative thread.
|
|
2572
|
+
Optionally specify a position to insert the memory at.
|
|
2573
|
+
|
|
2574
|
+
* @param id - The narrative ID
|
|
2575
|
+
* @param body - Request body
|
|
2576
|
+
*/
|
|
2577
|
+
async addMemoryToNarrative(id, body) {
|
|
2578
|
+
const request = new Request({
|
|
2579
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2580
|
+
method: "POST",
|
|
2581
|
+
path: "/api/narratives/{id}/memories",
|
|
2582
|
+
config: this.config,
|
|
2583
|
+
retry: {
|
|
2584
|
+
attempts: 3,
|
|
2585
|
+
delayMs: 150,
|
|
2586
|
+
maxDelayMs: 5e3,
|
|
2587
|
+
jitterMs: 50,
|
|
2588
|
+
backoffFactor: 2
|
|
2589
|
+
}
|
|
2590
|
+
});
|
|
2591
|
+
request.addPathParam("id", {
|
|
2592
|
+
key: "id",
|
|
2593
|
+
value: id,
|
|
2594
|
+
explode: false,
|
|
2595
|
+
encode: true,
|
|
2596
|
+
style: "simple",
|
|
2597
|
+
isLimit: false,
|
|
2598
|
+
isOffset: false,
|
|
2599
|
+
isCursor: false
|
|
2600
|
+
});
|
|
2601
|
+
if (body !== void 0) {
|
|
2602
|
+
request.addBody(body);
|
|
2603
|
+
}
|
|
2604
|
+
return this.client.call(request);
|
|
2605
|
+
}
|
|
2606
|
+
/**
|
|
2607
|
+
* Remove a memory from a narrative
|
|
2608
|
+
* Remove a memory from a narrative thread.
|
|
2609
|
+
This does not delete the memory itself, only removes it from the narrative.
|
|
2610
|
+
|
|
2611
|
+
* @param id - The narrative ID
|
|
2612
|
+
* @param memoryId - The memory ID to remove
|
|
2613
|
+
*/
|
|
2614
|
+
async removeMemoryFromNarrative(id, memoryId) {
|
|
2615
|
+
const request = new Request({
|
|
2616
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2617
|
+
method: "DELETE",
|
|
2618
|
+
path: "/api/narratives/{id}/memories/{memoryId}",
|
|
2619
|
+
config: this.config,
|
|
2620
|
+
retry: {
|
|
2621
|
+
attempts: 3,
|
|
2622
|
+
delayMs: 150,
|
|
2623
|
+
maxDelayMs: 5e3,
|
|
2624
|
+
jitterMs: 50,
|
|
2625
|
+
backoffFactor: 2
|
|
2626
|
+
}
|
|
2627
|
+
});
|
|
2628
|
+
request.addPathParam("id", {
|
|
2629
|
+
key: "id",
|
|
2630
|
+
value: id,
|
|
2631
|
+
explode: false,
|
|
2632
|
+
encode: true,
|
|
2633
|
+
style: "simple",
|
|
2634
|
+
isLimit: false,
|
|
2635
|
+
isOffset: false,
|
|
2636
|
+
isCursor: false
|
|
2637
|
+
});
|
|
2638
|
+
request.addPathParam("memoryId", {
|
|
2639
|
+
key: "memoryId",
|
|
2640
|
+
value: memoryId,
|
|
2641
|
+
explode: false,
|
|
2642
|
+
encode: true,
|
|
2643
|
+
style: "simple",
|
|
2644
|
+
isLimit: false,
|
|
2645
|
+
isOffset: false,
|
|
2646
|
+
isCursor: false
|
|
2647
|
+
});
|
|
2648
|
+
return this.client.call(request);
|
|
2649
|
+
}
|
|
2650
|
+
};
|
|
2651
|
+
|
|
2652
|
+
// src/services/system-service.ts
|
|
2653
|
+
var SystemService = class extends BaseService {
|
|
2654
|
+
/**
|
|
2655
|
+
* Get OpenAPI specification
|
|
2656
|
+
* Returns the OpenAPI 3.x specification for the entire API. This endpoint is used by CI/CD to sync the API Gateway.
|
|
2657
|
+
* @param noCache - Bypass cache and regenerate specification
|
|
2658
|
+
*/
|
|
2659
|
+
async getOpenApiSpec(options) {
|
|
2660
|
+
const request = new Request({
|
|
2661
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2662
|
+
method: "GET",
|
|
2663
|
+
path: "/api/openapi.json",
|
|
2664
|
+
config: this.config,
|
|
2665
|
+
retry: {
|
|
2666
|
+
attempts: 3,
|
|
2667
|
+
delayMs: 150,
|
|
2668
|
+
maxDelayMs: 5e3,
|
|
2669
|
+
jitterMs: 50,
|
|
2670
|
+
backoffFactor: 2
|
|
2671
|
+
}
|
|
2672
|
+
});
|
|
2673
|
+
if (options?.noCache !== void 0) {
|
|
2674
|
+
request.addQueryParam("noCache", {
|
|
2675
|
+
key: "noCache",
|
|
2676
|
+
value: options.noCache,
|
|
2677
|
+
explode: false,
|
|
2678
|
+
encode: true,
|
|
2679
|
+
style: "form",
|
|
2680
|
+
isLimit: false,
|
|
2681
|
+
isOffset: false,
|
|
2682
|
+
isCursor: false
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2685
|
+
return this.client.call(request);
|
|
2686
|
+
}
|
|
2687
|
+
/**
|
|
2688
|
+
* Get system health status
|
|
2689
|
+
* Get the current health status of the system including database connectivity
|
|
2690
|
+
*/
|
|
2691
|
+
async getSystemHealth() {
|
|
2692
|
+
const request = new Request({
|
|
2693
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2694
|
+
method: "GET",
|
|
2695
|
+
path: "/api/system/health",
|
|
2696
|
+
config: this.config,
|
|
2697
|
+
retry: {
|
|
2698
|
+
attempts: 3,
|
|
2699
|
+
delayMs: 150,
|
|
2700
|
+
maxDelayMs: 5e3,
|
|
2701
|
+
jitterMs: 50,
|
|
2702
|
+
backoffFactor: 2
|
|
2703
|
+
}
|
|
2704
|
+
});
|
|
2705
|
+
return this.client.call(request);
|
|
2706
|
+
}
|
|
2707
|
+
/**
|
|
2708
|
+
* Get context status
|
|
2709
|
+
* Get database statistics and context information
|
|
2710
|
+
*/
|
|
2711
|
+
async getContextStatus() {
|
|
2712
|
+
const request = new Request({
|
|
2713
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2714
|
+
method: "GET",
|
|
2715
|
+
path: "/api/system/context/status",
|
|
2716
|
+
config: this.config,
|
|
2717
|
+
retry: {
|
|
2718
|
+
attempts: 3,
|
|
2719
|
+
delayMs: 150,
|
|
2720
|
+
maxDelayMs: 5e3,
|
|
2721
|
+
jitterMs: 50,
|
|
2722
|
+
backoffFactor: 2
|
|
2723
|
+
}
|
|
2724
|
+
});
|
|
2725
|
+
return this.client.call(request);
|
|
2726
|
+
}
|
|
2727
|
+
/**
|
|
2728
|
+
* Get feature flags
|
|
2729
|
+
* Get all feature flags for the authenticated user
|
|
2730
|
+
*/
|
|
2731
|
+
async getFeatureFlags() {
|
|
2732
|
+
const request = new Request({
|
|
2733
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2734
|
+
method: "GET",
|
|
2735
|
+
path: "/api/system/feature-flags",
|
|
2736
|
+
config: this.config,
|
|
2737
|
+
retry: {
|
|
2738
|
+
attempts: 3,
|
|
2739
|
+
delayMs: 150,
|
|
2740
|
+
maxDelayMs: 5e3,
|
|
2741
|
+
jitterMs: 50,
|
|
2742
|
+
backoffFactor: 2
|
|
2743
|
+
}
|
|
2744
|
+
});
|
|
2745
|
+
return this.client.call(request);
|
|
2746
|
+
}
|
|
2747
|
+
/**
|
|
2748
|
+
* Evaluate feature flag
|
|
2749
|
+
* Evaluate a specific feature flag for the authenticated user
|
|
2750
|
+
* @param body - Request body
|
|
2751
|
+
*/
|
|
2752
|
+
async evaluateFeatureFlag(body) {
|
|
2753
|
+
const request = new Request({
|
|
2754
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2755
|
+
method: "POST",
|
|
2756
|
+
path: "/api/system/feature-flags/evaluate",
|
|
2757
|
+
config: this.config,
|
|
2758
|
+
retry: {
|
|
2759
|
+
attempts: 3,
|
|
2760
|
+
delayMs: 150,
|
|
2761
|
+
maxDelayMs: 5e3,
|
|
2762
|
+
jitterMs: 50,
|
|
2763
|
+
backoffFactor: 2
|
|
2764
|
+
}
|
|
2765
|
+
});
|
|
2766
|
+
if (body !== void 0) {
|
|
2767
|
+
request.addBody(body);
|
|
2768
|
+
}
|
|
2769
|
+
return this.client.call(request);
|
|
2770
|
+
}
|
|
2771
|
+
/**
|
|
2772
|
+
* Analyze memory quality distribution
|
|
2773
|
+
* Analyze the quality distribution of memories for the authenticated user
|
|
2774
|
+
* @param includeDetails - Include detailed pruning candidate information
|
|
2775
|
+
* @param minQualityThreshold - Minimum quality threshold for pruning candidates (default 0.4)
|
|
2776
|
+
*/
|
|
2777
|
+
async analyzeMemoryQuality(options) {
|
|
2778
|
+
const request = new Request({
|
|
2779
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2780
|
+
method: "GET",
|
|
2781
|
+
path: "/api/system/memory/quality",
|
|
2782
|
+
config: this.config,
|
|
2783
|
+
retry: {
|
|
2784
|
+
attempts: 3,
|
|
2785
|
+
delayMs: 150,
|
|
2786
|
+
maxDelayMs: 5e3,
|
|
2787
|
+
jitterMs: 50,
|
|
2788
|
+
backoffFactor: 2
|
|
2789
|
+
}
|
|
2790
|
+
});
|
|
2791
|
+
if (options?.includeDetails !== void 0) {
|
|
2792
|
+
request.addQueryParam("includeDetails", {
|
|
2793
|
+
key: "includeDetails",
|
|
2794
|
+
value: options.includeDetails,
|
|
2795
|
+
explode: false,
|
|
2796
|
+
encode: true,
|
|
2797
|
+
style: "form",
|
|
2798
|
+
isLimit: false,
|
|
2799
|
+
isOffset: false,
|
|
2800
|
+
isCursor: false
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2803
|
+
if (options?.minQualityThreshold !== void 0) {
|
|
2804
|
+
request.addQueryParam("minQualityThreshold", {
|
|
2805
|
+
key: "minQualityThreshold",
|
|
2806
|
+
value: options.minQualityThreshold,
|
|
2807
|
+
explode: false,
|
|
2808
|
+
encode: true,
|
|
2809
|
+
style: "form",
|
|
2810
|
+
isLimit: false,
|
|
2811
|
+
isOffset: false,
|
|
2812
|
+
isCursor: false
|
|
2813
|
+
});
|
|
2814
|
+
}
|
|
2815
|
+
return this.client.call(request);
|
|
2816
|
+
}
|
|
2817
|
+
/**
|
|
2818
|
+
* Prune low-quality memories
|
|
2819
|
+
* Prune (soft delete) low-quality memories for the authenticated user
|
|
2820
|
+
* @param body - Request body
|
|
2821
|
+
*/
|
|
2822
|
+
async pruneMemories(options) {
|
|
2823
|
+
const request = new Request({
|
|
2824
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2825
|
+
method: "POST",
|
|
2826
|
+
path: "/api/system/memory/prune",
|
|
2827
|
+
config: this.config,
|
|
2828
|
+
retry: {
|
|
2829
|
+
attempts: 3,
|
|
2830
|
+
delayMs: 150,
|
|
2831
|
+
maxDelayMs: 5e3,
|
|
2832
|
+
jitterMs: 50,
|
|
2833
|
+
backoffFactor: 2
|
|
2834
|
+
}
|
|
2835
|
+
});
|
|
2836
|
+
if (options?.body !== void 0) {
|
|
2837
|
+
request.addBody(options?.body);
|
|
2838
|
+
}
|
|
2839
|
+
return this.client.call(request);
|
|
2840
|
+
}
|
|
2841
|
+
};
|
|
2842
|
+
|
|
2843
|
+
// src/services/patterns-service.ts
|
|
2844
|
+
var PatternsService = class extends BaseService {
|
|
2845
|
+
/**
|
|
2846
|
+
* List patterns
|
|
2847
|
+
* List all patterns for the authenticated user
|
|
2848
|
+
* @param limit - Maximum number of patterns to return
|
|
2849
|
+
* @param offset - Number of patterns to skip
|
|
2850
|
+
*/
|
|
2851
|
+
async listPatterns(options) {
|
|
2852
|
+
const request = new Request({
|
|
2853
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2854
|
+
method: "GET",
|
|
2855
|
+
path: "/api/patterns",
|
|
2856
|
+
config: this.config,
|
|
2857
|
+
retry: {
|
|
2858
|
+
attempts: 3,
|
|
2859
|
+
delayMs: 150,
|
|
2860
|
+
maxDelayMs: 5e3,
|
|
2861
|
+
jitterMs: 50,
|
|
2862
|
+
backoffFactor: 2
|
|
2863
|
+
}
|
|
2864
|
+
});
|
|
2865
|
+
if (options?.limit !== void 0) {
|
|
2866
|
+
request.addQueryParam("limit", {
|
|
2867
|
+
key: "limit",
|
|
2868
|
+
value: options.limit,
|
|
2869
|
+
explode: false,
|
|
2870
|
+
encode: true,
|
|
2871
|
+
style: "form",
|
|
2872
|
+
isLimit: true,
|
|
2873
|
+
isOffset: false,
|
|
2874
|
+
isCursor: false
|
|
2875
|
+
});
|
|
2876
|
+
}
|
|
2877
|
+
if (options?.offset !== void 0) {
|
|
2878
|
+
request.addQueryParam("offset", {
|
|
2879
|
+
key: "offset",
|
|
2880
|
+
value: options.offset,
|
|
2881
|
+
explode: false,
|
|
2882
|
+
encode: true,
|
|
2883
|
+
style: "form",
|
|
2884
|
+
isLimit: false,
|
|
2885
|
+
isOffset: true,
|
|
2886
|
+
isCursor: false
|
|
2887
|
+
});
|
|
2888
|
+
}
|
|
2889
|
+
return this.client.call(request);
|
|
2890
|
+
}
|
|
2891
|
+
/**
|
|
2892
|
+
* Compile patterns
|
|
2893
|
+
* Compile patterns from user's memories
|
|
2894
|
+
* @param body - Request body
|
|
2895
|
+
*/
|
|
2896
|
+
async compilePatterns(options) {
|
|
2897
|
+
const request = new Request({
|
|
2898
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2899
|
+
method: "POST",
|
|
2900
|
+
path: "/api/patterns/compile",
|
|
2901
|
+
config: this.config,
|
|
2902
|
+
retry: {
|
|
2903
|
+
attempts: 3,
|
|
2904
|
+
delayMs: 150,
|
|
2905
|
+
maxDelayMs: 5e3,
|
|
2906
|
+
jitterMs: 50,
|
|
2907
|
+
backoffFactor: 2
|
|
2908
|
+
}
|
|
2909
|
+
});
|
|
2910
|
+
if (options?.body !== void 0) {
|
|
2911
|
+
request.addBody(options?.body);
|
|
2912
|
+
}
|
|
2913
|
+
return this.client.call(request);
|
|
2914
|
+
}
|
|
2915
|
+
/**
|
|
2916
|
+
* Detect behavioral patterns
|
|
2917
|
+
* Run pattern detection algorithms to identify recurring behavioral patterns
|
|
2918
|
+
* @param body - Request body
|
|
2919
|
+
*/
|
|
2920
|
+
async detectPatterns(options) {
|
|
2921
|
+
const request = new Request({
|
|
2922
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2923
|
+
method: "POST",
|
|
2924
|
+
path: "/api/patterns/detect",
|
|
2925
|
+
config: this.config,
|
|
2926
|
+
retry: {
|
|
2927
|
+
attempts: 3,
|
|
2928
|
+
delayMs: 150,
|
|
2929
|
+
maxDelayMs: 5e3,
|
|
2930
|
+
jitterMs: 50,
|
|
2931
|
+
backoffFactor: 2
|
|
2932
|
+
}
|
|
2933
|
+
});
|
|
2934
|
+
if (options?.body !== void 0) {
|
|
2935
|
+
request.addBody(options?.body);
|
|
2936
|
+
}
|
|
2937
|
+
return this.client.call(request);
|
|
2938
|
+
}
|
|
2939
|
+
/**
|
|
2940
|
+
* Analyze pattern trends
|
|
2941
|
+
* Analyze pattern trends, correlations, and generate insights
|
|
2942
|
+
* @param body - Request body
|
|
2943
|
+
*/
|
|
2944
|
+
async analyzePatterns(options) {
|
|
2945
|
+
const request = new Request({
|
|
2946
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2947
|
+
method: "POST",
|
|
2948
|
+
path: "/api/patterns/analyze",
|
|
2949
|
+
config: this.config,
|
|
2950
|
+
retry: {
|
|
2951
|
+
attempts: 3,
|
|
2952
|
+
delayMs: 150,
|
|
2953
|
+
maxDelayMs: 5e3,
|
|
2954
|
+
jitterMs: 50,
|
|
2955
|
+
backoffFactor: 2
|
|
2956
|
+
}
|
|
2957
|
+
});
|
|
2958
|
+
if (options?.body !== void 0) {
|
|
2959
|
+
request.addBody(options?.body);
|
|
2960
|
+
}
|
|
2961
|
+
return this.client.call(request);
|
|
2962
|
+
}
|
|
2963
|
+
/**
|
|
2964
|
+
* Update pattern
|
|
2965
|
+
* Update an existing pattern with partial data
|
|
2966
|
+
* @param id - The pattern ID
|
|
2967
|
+
* @param body - Request body
|
|
2968
|
+
*/
|
|
2969
|
+
async updatePattern(id, body) {
|
|
2970
|
+
const request = new Request({
|
|
2971
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2972
|
+
method: "PATCH",
|
|
2973
|
+
path: "/api/patterns/{id}",
|
|
2974
|
+
config: this.config,
|
|
2975
|
+
retry: {
|
|
2976
|
+
attempts: 3,
|
|
2977
|
+
delayMs: 150,
|
|
2978
|
+
maxDelayMs: 5e3,
|
|
2979
|
+
jitterMs: 50,
|
|
2980
|
+
backoffFactor: 2
|
|
2981
|
+
}
|
|
2982
|
+
});
|
|
2983
|
+
request.addPathParam("id", {
|
|
2984
|
+
key: "id",
|
|
2985
|
+
value: id,
|
|
2986
|
+
explode: false,
|
|
2987
|
+
encode: true,
|
|
2988
|
+
style: "simple",
|
|
2989
|
+
isLimit: false,
|
|
2990
|
+
isOffset: false,
|
|
2991
|
+
isCursor: false
|
|
2992
|
+
});
|
|
2993
|
+
if (body !== void 0) {
|
|
2994
|
+
request.addBody(body);
|
|
2995
|
+
}
|
|
2996
|
+
return this.client.call(request);
|
|
2997
|
+
}
|
|
2998
|
+
/**
|
|
2999
|
+
* Record pattern feedback
|
|
3000
|
+
* Record feedback on a pattern
|
|
3001
|
+
* @param body - Request body
|
|
3002
|
+
*/
|
|
3003
|
+
async recordPatternFeedback(body) {
|
|
3004
|
+
const request = new Request({
|
|
3005
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3006
|
+
method: "POST",
|
|
3007
|
+
path: "/api/patterns/feedback",
|
|
3008
|
+
config: this.config,
|
|
3009
|
+
retry: {
|
|
3010
|
+
attempts: 3,
|
|
3011
|
+
delayMs: 150,
|
|
3012
|
+
maxDelayMs: 5e3,
|
|
3013
|
+
jitterMs: 50,
|
|
3014
|
+
backoffFactor: 2
|
|
3015
|
+
}
|
|
3016
|
+
});
|
|
3017
|
+
if (body !== void 0) {
|
|
3018
|
+
request.addBody(body);
|
|
3019
|
+
}
|
|
3020
|
+
return this.client.call(request);
|
|
3021
|
+
}
|
|
3022
|
+
};
|
|
3023
|
+
|
|
3024
|
+
// src/services/behavior-service.ts
|
|
3025
|
+
var BehaviorService = class extends BaseService {
|
|
3026
|
+
/**
|
|
3027
|
+
* Get behavioral state
|
|
3028
|
+
* Get current behavioral state for the authenticated user
|
|
3029
|
+
*/
|
|
3030
|
+
async getBehavioralState() {
|
|
3031
|
+
const request = new Request({
|
|
3032
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3033
|
+
method: "GET",
|
|
3034
|
+
path: "/api/patterns/behavior/state",
|
|
3035
|
+
config: this.config,
|
|
3036
|
+
retry: {
|
|
3037
|
+
attempts: 3,
|
|
3038
|
+
delayMs: 150,
|
|
3039
|
+
maxDelayMs: 5e3,
|
|
3040
|
+
jitterMs: 50,
|
|
3041
|
+
backoffFactor: 2
|
|
3042
|
+
}
|
|
3043
|
+
});
|
|
3044
|
+
return this.client.call(request);
|
|
3045
|
+
}
|
|
3046
|
+
/**
|
|
3047
|
+
* Update behavioral state
|
|
3048
|
+
* Update or mutate behavioral state
|
|
3049
|
+
* @param body - Request body
|
|
3050
|
+
*/
|
|
3051
|
+
async updateBehavioralState(options) {
|
|
3052
|
+
const request = new Request({
|
|
3053
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3054
|
+
method: "POST",
|
|
3055
|
+
path: "/api/patterns/behavior/state",
|
|
3056
|
+
config: this.config,
|
|
3057
|
+
retry: {
|
|
3058
|
+
attempts: 3,
|
|
3059
|
+
delayMs: 150,
|
|
3060
|
+
maxDelayMs: 5e3,
|
|
3061
|
+
jitterMs: 50,
|
|
3062
|
+
backoffFactor: 2
|
|
3063
|
+
}
|
|
3064
|
+
});
|
|
3065
|
+
if (options?.body !== void 0) {
|
|
3066
|
+
request.addBody(options?.body);
|
|
3067
|
+
}
|
|
3068
|
+
return this.client.call(request);
|
|
3069
|
+
}
|
|
3070
|
+
};
|
|
3071
|
+
|
|
3072
|
+
// src/services/topics-service.ts
|
|
3073
|
+
var TopicsService = class extends BaseService {
|
|
3074
|
+
/**
|
|
3075
|
+
* List topics
|
|
3076
|
+
* List all topics with pagination
|
|
3077
|
+
* @param limit - Maximum number of topics to return
|
|
3078
|
+
* @param offset - Number of topics to skip
|
|
3079
|
+
*/
|
|
3080
|
+
async listTopics(options) {
|
|
3081
|
+
const request = new Request({
|
|
3082
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3083
|
+
method: "GET",
|
|
3084
|
+
path: "/api/topics",
|
|
3085
|
+
config: this.config,
|
|
3086
|
+
retry: {
|
|
3087
|
+
attempts: 3,
|
|
3088
|
+
delayMs: 150,
|
|
3089
|
+
maxDelayMs: 5e3,
|
|
3090
|
+
jitterMs: 50,
|
|
3091
|
+
backoffFactor: 2
|
|
3092
|
+
}
|
|
3093
|
+
});
|
|
3094
|
+
if (options?.limit !== void 0) {
|
|
3095
|
+
request.addQueryParam("limit", {
|
|
3096
|
+
key: "limit",
|
|
3097
|
+
value: options.limit,
|
|
3098
|
+
explode: false,
|
|
3099
|
+
encode: true,
|
|
3100
|
+
style: "form",
|
|
3101
|
+
isLimit: true,
|
|
3102
|
+
isOffset: false,
|
|
3103
|
+
isCursor: false
|
|
3104
|
+
});
|
|
3105
|
+
}
|
|
3106
|
+
if (options?.offset !== void 0) {
|
|
3107
|
+
request.addQueryParam("offset", {
|
|
3108
|
+
key: "offset",
|
|
3109
|
+
value: options.offset,
|
|
3110
|
+
explode: false,
|
|
3111
|
+
encode: true,
|
|
3112
|
+
style: "form",
|
|
3113
|
+
isLimit: false,
|
|
3114
|
+
isOffset: true,
|
|
3115
|
+
isCursor: false
|
|
3116
|
+
});
|
|
3117
|
+
}
|
|
3118
|
+
return this.client.call(request);
|
|
3119
|
+
}
|
|
3120
|
+
/**
|
|
3121
|
+
* Get topic by ID
|
|
3122
|
+
* Retrieve a specific topic by its ID
|
|
3123
|
+
* @param id - The topic ID
|
|
3124
|
+
*/
|
|
3125
|
+
async getTopicById(id) {
|
|
3126
|
+
const request = new Request({
|
|
3127
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3128
|
+
method: "GET",
|
|
3129
|
+
path: "/api/topics/{id}",
|
|
3130
|
+
config: this.config,
|
|
3131
|
+
retry: {
|
|
3132
|
+
attempts: 3,
|
|
3133
|
+
delayMs: 150,
|
|
3134
|
+
maxDelayMs: 5e3,
|
|
3135
|
+
jitterMs: 50,
|
|
3136
|
+
backoffFactor: 2
|
|
3137
|
+
}
|
|
3138
|
+
});
|
|
3139
|
+
request.addPathParam("id", {
|
|
3140
|
+
key: "id",
|
|
3141
|
+
value: id,
|
|
3142
|
+
explode: false,
|
|
3143
|
+
encode: true,
|
|
3144
|
+
style: "simple",
|
|
3145
|
+
isLimit: false,
|
|
3146
|
+
isOffset: false,
|
|
3147
|
+
isCursor: false
|
|
3148
|
+
});
|
|
3149
|
+
return this.client.call(request);
|
|
3150
|
+
}
|
|
3151
|
+
/**
|
|
3152
|
+
* Merge topics
|
|
3153
|
+
* Merge two topics into one
|
|
3154
|
+
* @param body - Request body
|
|
3155
|
+
*/
|
|
3156
|
+
async mergeTopics(body) {
|
|
3157
|
+
const request = new Request({
|
|
3158
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3159
|
+
method: "POST",
|
|
3160
|
+
path: "/api/topics/merge",
|
|
3161
|
+
config: this.config,
|
|
3162
|
+
retry: {
|
|
3163
|
+
attempts: 3,
|
|
3164
|
+
delayMs: 150,
|
|
3165
|
+
maxDelayMs: 5e3,
|
|
3166
|
+
jitterMs: 50,
|
|
3167
|
+
backoffFactor: 2
|
|
3168
|
+
}
|
|
3169
|
+
});
|
|
3170
|
+
if (body !== void 0) {
|
|
3171
|
+
request.addBody(body);
|
|
3172
|
+
}
|
|
3173
|
+
return this.client.call(request);
|
|
3174
|
+
}
|
|
3175
|
+
/**
|
|
3176
|
+
* Discover related topics
|
|
3177
|
+
* Discover topics related to a given topic
|
|
3178
|
+
* @param body - Request body
|
|
3179
|
+
*/
|
|
3180
|
+
async discoverRelatedTopics(body) {
|
|
3181
|
+
const request = new Request({
|
|
3182
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3183
|
+
method: "POST",
|
|
3184
|
+
path: "/api/topics/discover-related",
|
|
3185
|
+
config: this.config,
|
|
3186
|
+
retry: {
|
|
3187
|
+
attempts: 3,
|
|
3188
|
+
delayMs: 150,
|
|
3189
|
+
maxDelayMs: 5e3,
|
|
3190
|
+
jitterMs: 50,
|
|
3191
|
+
backoffFactor: 2
|
|
3192
|
+
}
|
|
3193
|
+
});
|
|
3194
|
+
if (body !== void 0) {
|
|
3195
|
+
request.addBody(body);
|
|
3196
|
+
}
|
|
3197
|
+
return this.client.call(request);
|
|
3198
|
+
}
|
|
3199
|
+
/**
|
|
3200
|
+
* Calculate topic similarity
|
|
3201
|
+
* Calculate similarity score between two topics
|
|
3202
|
+
* @param body - Request body
|
|
3203
|
+
*/
|
|
3204
|
+
async calculateTopicSimilarity(body) {
|
|
3205
|
+
const request = new Request({
|
|
3206
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3207
|
+
method: "POST",
|
|
3208
|
+
path: "/api/topics/similarity",
|
|
3209
|
+
config: this.config,
|
|
3210
|
+
retry: {
|
|
3211
|
+
attempts: 3,
|
|
3212
|
+
delayMs: 150,
|
|
3213
|
+
maxDelayMs: 5e3,
|
|
3214
|
+
jitterMs: 50,
|
|
3215
|
+
backoffFactor: 2
|
|
3216
|
+
}
|
|
3217
|
+
});
|
|
3218
|
+
if (body !== void 0) {
|
|
3219
|
+
request.addBody(body);
|
|
3220
|
+
}
|
|
3221
|
+
return this.client.call(request);
|
|
3222
|
+
}
|
|
3223
|
+
/**
|
|
3224
|
+
* Find similar topics
|
|
3225
|
+
* Find topics similar to a given topic
|
|
3226
|
+
* @param body - Request body
|
|
3227
|
+
*/
|
|
3228
|
+
async findSimilarTopics(body) {
|
|
3229
|
+
const request = new Request({
|
|
3230
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3231
|
+
method: "POST",
|
|
3232
|
+
path: "/api/topics/similar",
|
|
3233
|
+
config: this.config,
|
|
3234
|
+
retry: {
|
|
3235
|
+
attempts: 3,
|
|
3236
|
+
delayMs: 150,
|
|
3237
|
+
maxDelayMs: 5e3,
|
|
3238
|
+
jitterMs: 50,
|
|
3239
|
+
backoffFactor: 2
|
|
3240
|
+
}
|
|
3241
|
+
});
|
|
3242
|
+
if (body !== void 0) {
|
|
3243
|
+
request.addBody(body);
|
|
3244
|
+
}
|
|
3245
|
+
return this.client.call(request);
|
|
3246
|
+
}
|
|
3247
|
+
/**
|
|
3248
|
+
* Cluster topics
|
|
3249
|
+
* Cluster topics using community detection algorithms
|
|
3250
|
+
* @param body - Request body
|
|
3251
|
+
*/
|
|
3252
|
+
async clusterTopics(options) {
|
|
3253
|
+
const request = new Request({
|
|
3254
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3255
|
+
method: "POST",
|
|
3256
|
+
path: "/api/topics/cluster",
|
|
3257
|
+
config: this.config,
|
|
3258
|
+
retry: {
|
|
3259
|
+
attempts: 3,
|
|
3260
|
+
delayMs: 150,
|
|
3261
|
+
maxDelayMs: 5e3,
|
|
3262
|
+
jitterMs: 50,
|
|
3263
|
+
backoffFactor: 2
|
|
3264
|
+
}
|
|
3265
|
+
});
|
|
3266
|
+
if (options?.body !== void 0) {
|
|
3267
|
+
request.addBody(options?.body);
|
|
3268
|
+
}
|
|
3269
|
+
return this.client.call(request);
|
|
3270
|
+
}
|
|
3271
|
+
/**
|
|
3272
|
+
* Detect communities
|
|
3273
|
+
* Detect communities in the topic graph using specified algorithm
|
|
3274
|
+
* @param body - Request body
|
|
3275
|
+
*/
|
|
3276
|
+
async detectCommunities(options) {
|
|
3277
|
+
const request = new Request({
|
|
3278
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3279
|
+
method: "POST",
|
|
3280
|
+
path: "/api/topics/detect-communities",
|
|
3281
|
+
config: this.config,
|
|
3282
|
+
retry: {
|
|
3283
|
+
attempts: 3,
|
|
3284
|
+
delayMs: 150,
|
|
3285
|
+
maxDelayMs: 5e3,
|
|
3286
|
+
jitterMs: 50,
|
|
3287
|
+
backoffFactor: 2
|
|
3288
|
+
}
|
|
3289
|
+
});
|
|
3290
|
+
if (options?.body !== void 0) {
|
|
3291
|
+
request.addBody(options?.body);
|
|
3292
|
+
}
|
|
3293
|
+
return this.client.call(request);
|
|
3294
|
+
}
|
|
3295
|
+
/**
|
|
3296
|
+
* Search topics
|
|
3297
|
+
* Search topics by query string using fulltext search
|
|
3298
|
+
* @param body - Request body
|
|
3299
|
+
*/
|
|
3300
|
+
async searchTopics(body) {
|
|
3301
|
+
const request = new Request({
|
|
3302
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3303
|
+
method: "POST",
|
|
3304
|
+
path: "/api/topics/search",
|
|
3305
|
+
config: this.config,
|
|
3306
|
+
retry: {
|
|
3307
|
+
attempts: 3,
|
|
3308
|
+
delayMs: 150,
|
|
3309
|
+
maxDelayMs: 5e3,
|
|
3310
|
+
jitterMs: 50,
|
|
3311
|
+
backoffFactor: 2
|
|
3312
|
+
}
|
|
3313
|
+
});
|
|
3314
|
+
if (body !== void 0) {
|
|
3315
|
+
request.addBody(body);
|
|
3316
|
+
}
|
|
3317
|
+
return this.client.call(request);
|
|
3318
|
+
}
|
|
3319
|
+
};
|
|
3320
|
+
|
|
3321
|
+
// src/services/communities-service.ts
|
|
3322
|
+
var CommunitiesService = class extends BaseService {
|
|
3323
|
+
/**
|
|
3324
|
+
* List communities
|
|
3325
|
+
* List all communities with pagination
|
|
3326
|
+
* @param limit - Maximum number of communities to return
|
|
3327
|
+
* @param offset - Number of communities to skip
|
|
3328
|
+
*/
|
|
3329
|
+
async listCommunities(options) {
|
|
3330
|
+
const request = new Request({
|
|
3331
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3332
|
+
method: "GET",
|
|
3333
|
+
path: "/api/topics/communities",
|
|
3334
|
+
config: this.config,
|
|
3335
|
+
retry: {
|
|
3336
|
+
attempts: 3,
|
|
3337
|
+
delayMs: 150,
|
|
3338
|
+
maxDelayMs: 5e3,
|
|
3339
|
+
jitterMs: 50,
|
|
3340
|
+
backoffFactor: 2
|
|
3341
|
+
}
|
|
3342
|
+
});
|
|
3343
|
+
if (options?.limit !== void 0) {
|
|
3344
|
+
request.addQueryParam("limit", {
|
|
3345
|
+
key: "limit",
|
|
3346
|
+
value: options.limit,
|
|
3347
|
+
explode: false,
|
|
3348
|
+
encode: true,
|
|
3349
|
+
style: "form",
|
|
3350
|
+
isLimit: true,
|
|
3351
|
+
isOffset: false,
|
|
3352
|
+
isCursor: false
|
|
3353
|
+
});
|
|
3354
|
+
}
|
|
3355
|
+
if (options?.offset !== void 0) {
|
|
3356
|
+
request.addQueryParam("offset", {
|
|
3357
|
+
key: "offset",
|
|
3358
|
+
value: options.offset,
|
|
3359
|
+
explode: false,
|
|
3360
|
+
encode: true,
|
|
3361
|
+
style: "form",
|
|
3362
|
+
isLimit: false,
|
|
3363
|
+
isOffset: true,
|
|
3364
|
+
isCursor: false
|
|
3365
|
+
});
|
|
3366
|
+
}
|
|
3367
|
+
return this.client.call(request);
|
|
3368
|
+
}
|
|
3369
|
+
/**
|
|
3370
|
+
* Get community by ID
|
|
3371
|
+
* Retrieve a specific community by its ID
|
|
3372
|
+
* @param id - The community ID
|
|
3373
|
+
*/
|
|
3374
|
+
async getCommunityById(id) {
|
|
3375
|
+
const request = new Request({
|
|
3376
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3377
|
+
method: "GET",
|
|
3378
|
+
path: "/api/topics/communities/{id}",
|
|
3379
|
+
config: this.config,
|
|
3380
|
+
retry: {
|
|
3381
|
+
attempts: 3,
|
|
3382
|
+
delayMs: 150,
|
|
3383
|
+
maxDelayMs: 5e3,
|
|
3384
|
+
jitterMs: 50,
|
|
3385
|
+
backoffFactor: 2
|
|
3386
|
+
}
|
|
3387
|
+
});
|
|
3388
|
+
request.addPathParam("id", {
|
|
3389
|
+
key: "id",
|
|
3390
|
+
value: id,
|
|
3391
|
+
explode: false,
|
|
3392
|
+
encode: true,
|
|
3393
|
+
style: "simple",
|
|
3394
|
+
isLimit: false,
|
|
3395
|
+
isOffset: false,
|
|
3396
|
+
isCursor: false
|
|
3397
|
+
});
|
|
3398
|
+
return this.client.call(request);
|
|
3399
|
+
}
|
|
3400
|
+
/**
|
|
3401
|
+
* Merge communities
|
|
3402
|
+
* Merge two communities into one
|
|
3403
|
+
* @param body - Request body
|
|
3404
|
+
*/
|
|
3405
|
+
async mergeCommunities(body) {
|
|
3406
|
+
const request = new Request({
|
|
3407
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3408
|
+
method: "POST",
|
|
3409
|
+
path: "/api/topics/communities/merge",
|
|
3410
|
+
config: this.config,
|
|
3411
|
+
retry: {
|
|
3412
|
+
attempts: 3,
|
|
3413
|
+
delayMs: 150,
|
|
3414
|
+
maxDelayMs: 5e3,
|
|
3415
|
+
jitterMs: 50,
|
|
3416
|
+
backoffFactor: 2
|
|
3417
|
+
}
|
|
3418
|
+
});
|
|
3419
|
+
if (body !== void 0) {
|
|
3420
|
+
request.addBody(body);
|
|
3421
|
+
}
|
|
3422
|
+
return this.client.call(request);
|
|
3423
|
+
}
|
|
3424
|
+
};
|
|
3425
|
+
|
|
3426
|
+
// src/services/users-service.ts
|
|
3427
|
+
var UsersService = class extends BaseService {
|
|
3428
|
+
/**
|
|
3429
|
+
* Sync user from WorkOS
|
|
3430
|
+
* Called by the customer portal after WorkOS authentication.
|
|
3431
|
+
Creates a new user if they don't exist, or updates their profile if they do.
|
|
3432
|
+
This is the main entry point for user provisioning.
|
|
3433
|
+
|
|
3434
|
+
* @param body - Request body
|
|
3435
|
+
*/
|
|
3436
|
+
async syncUser(body) {
|
|
3437
|
+
const request = new Request({
|
|
3438
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3439
|
+
method: "POST",
|
|
3440
|
+
path: "/api/users/sync",
|
|
3441
|
+
config: this.config,
|
|
3442
|
+
retry: {
|
|
3443
|
+
attempts: 3,
|
|
3444
|
+
delayMs: 150,
|
|
3445
|
+
maxDelayMs: 5e3,
|
|
3446
|
+
jitterMs: 50,
|
|
3447
|
+
backoffFactor: 2
|
|
3448
|
+
}
|
|
3449
|
+
});
|
|
3450
|
+
if (body !== void 0) {
|
|
3451
|
+
request.addBody(body);
|
|
3452
|
+
}
|
|
3453
|
+
return this.client.call(request);
|
|
3454
|
+
}
|
|
3455
|
+
/**
|
|
3456
|
+
* Get current user
|
|
3457
|
+
* Get the currently authenticated user's profile and usage information
|
|
3458
|
+
*/
|
|
3459
|
+
async getCurrentUser() {
|
|
3460
|
+
const request = new Request({
|
|
3461
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3462
|
+
method: "GET",
|
|
3463
|
+
path: "/api/users/me",
|
|
3464
|
+
config: this.config,
|
|
3465
|
+
retry: {
|
|
3466
|
+
attempts: 3,
|
|
3467
|
+
delayMs: 150,
|
|
3468
|
+
maxDelayMs: 5e3,
|
|
3469
|
+
jitterMs: 50,
|
|
3470
|
+
backoffFactor: 2
|
|
3471
|
+
}
|
|
3472
|
+
});
|
|
3473
|
+
return this.client.call(request);
|
|
3474
|
+
}
|
|
3475
|
+
/**
|
|
3476
|
+
* Update current user
|
|
3477
|
+
* Update the currently authenticated user's profile
|
|
3478
|
+
* @param body - Request body
|
|
3479
|
+
*/
|
|
3480
|
+
async updateCurrentUser(options) {
|
|
3481
|
+
const request = new Request({
|
|
3482
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3483
|
+
method: "PATCH",
|
|
3484
|
+
path: "/api/users/me",
|
|
3485
|
+
config: this.config,
|
|
3486
|
+
retry: {
|
|
3487
|
+
attempts: 3,
|
|
3488
|
+
delayMs: 150,
|
|
3489
|
+
maxDelayMs: 5e3,
|
|
3490
|
+
jitterMs: 50,
|
|
3491
|
+
backoffFactor: 2
|
|
3492
|
+
}
|
|
3493
|
+
});
|
|
3494
|
+
if (options?.body !== void 0) {
|
|
3495
|
+
request.addBody(options?.body);
|
|
3496
|
+
}
|
|
3497
|
+
return this.client.call(request);
|
|
3498
|
+
}
|
|
3499
|
+
/**
|
|
3500
|
+
* Get current user's usage
|
|
3501
|
+
* Get the currently authenticated user's memory usage statistics
|
|
3502
|
+
*/
|
|
3503
|
+
async getCurrentUserUsage() {
|
|
3504
|
+
const request = new Request({
|
|
3505
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3506
|
+
method: "GET",
|
|
3507
|
+
path: "/api/users/me/usage",
|
|
3508
|
+
config: this.config,
|
|
3509
|
+
retry: {
|
|
3510
|
+
attempts: 3,
|
|
3511
|
+
delayMs: 150,
|
|
3512
|
+
maxDelayMs: 5e3,
|
|
3513
|
+
jitterMs: 50,
|
|
3514
|
+
backoffFactor: 2
|
|
3515
|
+
}
|
|
3516
|
+
});
|
|
3517
|
+
return this.client.call(request);
|
|
3518
|
+
}
|
|
3519
|
+
/**
|
|
3520
|
+
* Get user by ID
|
|
3521
|
+
* Get a user by their internal ID (admin only)
|
|
3522
|
+
* @param id -
|
|
3523
|
+
*/
|
|
3524
|
+
async getUserById(id) {
|
|
3525
|
+
const request = new Request({
|
|
3526
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
3527
|
+
method: "GET",
|
|
3528
|
+
path: "/api/users/{id}",
|
|
3529
|
+
config: this.config,
|
|
3530
|
+
retry: {
|
|
3531
|
+
attempts: 3,
|
|
3532
|
+
delayMs: 150,
|
|
3533
|
+
maxDelayMs: 5e3,
|
|
3534
|
+
jitterMs: 50,
|
|
3535
|
+
backoffFactor: 2
|
|
3536
|
+
}
|
|
3537
|
+
});
|
|
3538
|
+
request.addPathParam("id", {
|
|
3539
|
+
key: "id",
|
|
3540
|
+
value: id,
|
|
3541
|
+
explode: false,
|
|
3542
|
+
encode: true,
|
|
3543
|
+
style: "simple",
|
|
3544
|
+
isLimit: false,
|
|
3545
|
+
isOffset: false,
|
|
3546
|
+
isCursor: false
|
|
3547
|
+
});
|
|
3548
|
+
return this.client.call(request);
|
|
3549
|
+
}
|
|
3550
|
+
};
|
|
3551
|
+
|
|
3552
|
+
// src/http/http-types.ts
|
|
3553
|
+
var SerializationStyle = /* @__PURE__ */ ((SerializationStyle2) => {
|
|
3554
|
+
SerializationStyle2["SIMPLE"] = "simple";
|
|
3555
|
+
SerializationStyle2["LABEL"] = "label";
|
|
3556
|
+
SerializationStyle2["MATRIX"] = "matrix";
|
|
3557
|
+
SerializationStyle2["FORM"] = "form";
|
|
3558
|
+
SerializationStyle2["SPACE_DELIMITED"] = "space_delimited";
|
|
3559
|
+
SerializationStyle2["PIPE_DELIMITED"] = "pipe_delimited";
|
|
3560
|
+
SerializationStyle2["DEEP_OBJECT"] = "deep_object";
|
|
3561
|
+
SerializationStyle2["NONE"] = "none";
|
|
3562
|
+
return SerializationStyle2;
|
|
3563
|
+
})(SerializationStyle || {});
|
|
3564
|
+
var ContentType = /* @__PURE__ */ ((ContentType2) => {
|
|
3565
|
+
ContentType2["Json"] = "json";
|
|
3566
|
+
ContentType2["Xml"] = "xml";
|
|
3567
|
+
ContentType2["Pdf"] = "pdf";
|
|
3568
|
+
ContentType2["Image"] = "image";
|
|
3569
|
+
ContentType2["File"] = "file";
|
|
3570
|
+
ContentType2["Binary"] = "binary";
|
|
3571
|
+
ContentType2["FormUrlEncoded"] = "form";
|
|
3572
|
+
ContentType2["Text"] = "text";
|
|
3573
|
+
ContentType2["MultipartFormData"] = "multipartFormData";
|
|
3574
|
+
ContentType2["EventStream"] = "eventStream";
|
|
3575
|
+
ContentType2["NoContent"] = "noContent";
|
|
3576
|
+
return ContentType2;
|
|
3577
|
+
})(ContentType || {});
|
|
3578
|
+
var Environment = /* @__PURE__ */ ((Environment2) => {
|
|
3579
|
+
Environment2["DEFAULT"] = "http://localhost:3000";
|
|
3580
|
+
return Environment2;
|
|
3581
|
+
})(Environment || {});
|
|
3582
|
+
|
|
3583
|
+
// src/models/schemas.ts
|
|
3584
|
+
var import_zod = require("zod");
|
|
3585
|
+
var error = import_zod.z.object({
|
|
3586
|
+
/** Error message */
|
|
3587
|
+
error: import_zod.z.string()
|
|
3588
|
+
});
|
|
3589
|
+
var pagination = import_zod.z.object({
|
|
3590
|
+
/** Maximum number of items per page */
|
|
3591
|
+
limit: import_zod.z.number().min(1),
|
|
3592
|
+
/** Number of items to skip */
|
|
3593
|
+
offset: import_zod.z.number().min(0),
|
|
3594
|
+
/** Total number of items */
|
|
3595
|
+
count: import_zod.z.number().min(0)
|
|
3596
|
+
});
|
|
3597
|
+
var memory = import_zod.z.object({
|
|
3598
|
+
/** Unique memory identifier */
|
|
3599
|
+
id: import_zod.z.string(),
|
|
3600
|
+
/** Memory content */
|
|
3601
|
+
content: import_zod.z.string(),
|
|
3602
|
+
/** Type of memory */
|
|
3603
|
+
memoryType: import_zod.z.enum(["episodic", "semantic", "procedural"]),
|
|
3604
|
+
/** Context or domain of the memory */
|
|
3605
|
+
context: import_zod.z.string().optional(),
|
|
3606
|
+
/** Associated topics */
|
|
3607
|
+
topics: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3608
|
+
/** System ingestion timestamp (when the system learned about this) */
|
|
3609
|
+
timestamp: import_zod.z.string().datetime().optional(),
|
|
3610
|
+
/** Event time (when the event actually occurred in reality) */
|
|
3611
|
+
eventTime: import_zod.z.string().datetime().optional(),
|
|
3612
|
+
/** Validity start time (when this fact becomes valid) */
|
|
3613
|
+
validFrom: import_zod.z.string().datetime().optional(),
|
|
3614
|
+
/** Validity end time (when this fact expires, null means never expires) */
|
|
3615
|
+
validTo: import_zod.z.string().datetime().nullable().optional(),
|
|
3616
|
+
/** Creation timestamp */
|
|
3617
|
+
createdAt: import_zod.z.string().datetime(),
|
|
3618
|
+
/** Last update timestamp */
|
|
3619
|
+
updatedAt: import_zod.z.string().datetime(),
|
|
3620
|
+
/** Confidence score (0-1) for this memory's accuracy */
|
|
3621
|
+
confidenceScore: import_zod.z.number().min(0).max(1).optional(),
|
|
3622
|
+
/** Basis for the confidence score */
|
|
3623
|
+
confidenceBasis: import_zod.z.enum(["direct-statement", "repeated-mention", "single-mention", "hedged", "inference", "external-source", "contradicted"]).optional(),
|
|
3624
|
+
/** Effective state of the memory in the narrative */
|
|
3625
|
+
effectiveState: import_zod.z.enum(["current", "superseded", "contradicted"]).optional()
|
|
3626
|
+
});
|
|
3627
|
+
var createMemoryRequest = import_zod.z.object({
|
|
3628
|
+
/** Conversation ID - use "NEW" to create a new conversation or provide existing conversation ID */
|
|
3629
|
+
conversationId: import_zod.z.string().min(1),
|
|
3630
|
+
/** Memory content */
|
|
3631
|
+
content: import_zod.z.string().min(1),
|
|
3632
|
+
/** Type of memory */
|
|
3633
|
+
memoryType: import_zod.z.enum(["episodic", "semantic", "procedural"]).optional(),
|
|
3634
|
+
/** Role (MCP protocol compatibility) */
|
|
3635
|
+
role: import_zod.z.enum(["user", "assistant", "system"]).optional(),
|
|
3636
|
+
/** Context or domain */
|
|
3637
|
+
context: import_zod.z.string().optional(),
|
|
3638
|
+
/** Associated topics */
|
|
3639
|
+
topics: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3640
|
+
/** Event time (when the event actually occurred in reality, ISO 8601 format) */
|
|
3641
|
+
eventTime: import_zod.z.string().datetime().optional(),
|
|
3642
|
+
/** Validity start time (when this fact becomes valid, ISO 8601 format) */
|
|
3643
|
+
validFrom: import_zod.z.string().datetime().optional(),
|
|
3644
|
+
/** Validity end time (when this fact expires, ISO 8601 format, omit for never expires) */
|
|
3645
|
+
validTo: import_zod.z.string().datetime().optional()
|
|
3646
|
+
});
|
|
3647
|
+
var updateMemoryRequest = import_zod.z.object({
|
|
3648
|
+
/** Updated memory content */
|
|
3649
|
+
content: import_zod.z.string().min(1).optional(),
|
|
3650
|
+
/** Updated memory type */
|
|
3651
|
+
memoryType: import_zod.z.enum(["episodic", "semantic", "procedural"]).optional(),
|
|
3652
|
+
/** Updated context or domain */
|
|
3653
|
+
context: import_zod.z.string().optional(),
|
|
3654
|
+
/** Updated topics */
|
|
3655
|
+
topics: import_zod.z.array(import_zod.z.string()).optional()
|
|
3656
|
+
});
|
|
3657
|
+
var createMemoryResponseMeta = import_zod.z.object({
|
|
3658
|
+
/** Conversation ID (actual ID if "NEW" was provided) */
|
|
3659
|
+
conversationId: import_zod.z.string(),
|
|
3660
|
+
/** Auto-assigned session ID based on 90-minute gap detection */
|
|
3661
|
+
sessionId: import_zod.z.string(),
|
|
3662
|
+
/** Whether a new session was created (true) or existing session was reused (false) */
|
|
3663
|
+
sessionCreated: import_zod.z.boolean(),
|
|
3664
|
+
/** Whether a new conversation was created (true if conversationId was "NEW") */
|
|
3665
|
+
conversationCreated: import_zod.z.boolean()
|
|
3666
|
+
});
|
|
3667
|
+
var createMemoryResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
3668
|
+
data: memory,
|
|
3669
|
+
meta: createMemoryResponseMeta
|
|
3670
|
+
}));
|
|
3671
|
+
var relatedMemoryResult = import_zod.z.object({
|
|
3672
|
+
memory: import_zod.z.object({
|
|
3673
|
+
/** Unique memory identifier */
|
|
3674
|
+
id: import_zod.z.string(),
|
|
3675
|
+
/** Memory content */
|
|
3676
|
+
content: import_zod.z.string(),
|
|
3677
|
+
/** Type of memory */
|
|
3678
|
+
memoryType: import_zod.z.enum(["episodic", "semantic", "procedural"]),
|
|
3679
|
+
/** Context or domain of the memory */
|
|
3680
|
+
context: import_zod.z.string().optional(),
|
|
3681
|
+
/** Associated topics */
|
|
3682
|
+
topics: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3683
|
+
/** System ingestion timestamp (when the system learned about this) */
|
|
3684
|
+
timestamp: import_zod.z.string().datetime().optional(),
|
|
3685
|
+
/** Event time (when the event actually occurred in reality) */
|
|
3686
|
+
eventTime: import_zod.z.string().datetime().optional(),
|
|
3687
|
+
/** Validity start time (when this fact becomes valid) */
|
|
3688
|
+
validFrom: import_zod.z.string().datetime().optional(),
|
|
3689
|
+
/** Validity end time (when this fact expires, null means never expires) */
|
|
3690
|
+
validTo: import_zod.z.string().datetime().nullable().optional(),
|
|
3691
|
+
/** Creation timestamp */
|
|
3692
|
+
createdAt: import_zod.z.string().datetime(),
|
|
3693
|
+
/** Last update timestamp */
|
|
3694
|
+
updatedAt: import_zod.z.string().datetime(),
|
|
3695
|
+
/** Confidence score (0-1) for this memory's accuracy */
|
|
3696
|
+
confidenceScore: import_zod.z.number().min(0).max(1).optional(),
|
|
3697
|
+
/** Basis for the confidence score */
|
|
3698
|
+
confidenceBasis: import_zod.z.enum(["direct-statement", "repeated-mention", "single-mention", "hedged", "inference", "external-source", "contradicted"]).optional(),
|
|
3699
|
+
/** Effective state of the memory in the narrative */
|
|
3700
|
+
effectiveState: import_zod.z.enum(["current", "superseded", "contradicted"]).optional()
|
|
3701
|
+
}),
|
|
3702
|
+
/** Relevance score (0-1). For similar: semantic similarity. For related: topic overlap ratio. For conversation: position score. */
|
|
3703
|
+
score: import_zod.z.number().min(0).max(1),
|
|
3704
|
+
/** Type of relationship: similar, similar-by-topic, conversation, or topic */
|
|
3705
|
+
relationship: import_zod.z.string(),
|
|
3706
|
+
/** Topics shared with the source memory (only for topic relationship) */
|
|
3707
|
+
sharedTopics: import_zod.z.array(import_zod.z.string()).optional()
|
|
3708
|
+
});
|
|
3709
|
+
var getMemoryResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
3710
|
+
data: memory
|
|
3711
|
+
}));
|
|
3712
|
+
var graphRAGQueryRequest = import_zod.z.object({
|
|
3713
|
+
/** GraphRAG query string */
|
|
3714
|
+
query: import_zod.z.string().min(1),
|
|
3715
|
+
/** Maximum graph traversal depth (alias: depth) */
|
|
3716
|
+
maxDepth: import_zod.z.number().min(1).max(5).optional(),
|
|
3717
|
+
/** Graph traversal depth (deprecated, use maxDepth) */
|
|
3718
|
+
depth: import_zod.z.number().min(1).max(5).optional(),
|
|
3719
|
+
/** Maximum number of results to return */
|
|
3720
|
+
limit: import_zod.z.number().min(1).max(100).optional(),
|
|
3721
|
+
/** Include relationship data in response */
|
|
3722
|
+
includeRelationships: import_zod.z.boolean().optional()
|
|
3723
|
+
});
|
|
3724
|
+
var graphRAGQueryResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
3725
|
+
/** Unique identifier for this query execution */
|
|
3726
|
+
queryId: import_zod.z.string(),
|
|
3727
|
+
/** Array of query results with graph context */
|
|
3728
|
+
results: import_zod.z.array(import_zod.z.object({
|
|
3729
|
+
memory,
|
|
3730
|
+
/** Relevance score from full-text search */
|
|
3731
|
+
score: import_zod.z.number(),
|
|
3732
|
+
/** Topics associated with this memory */
|
|
3733
|
+
topics: import_zod.z.array(import_zod.z.object({}).catchall(import_zod.z.unknown().nullable())),
|
|
3734
|
+
/** Entities mentioned in this memory */
|
|
3735
|
+
entities: import_zod.z.array(import_zod.z.object({}).catchall(import_zod.z.unknown().nullable())),
|
|
3736
|
+
/** Related memories through shared topics */
|
|
3737
|
+
relatedMemories: import_zod.z.array(import_zod.z.object({}).catchall(import_zod.z.unknown().nullable()))
|
|
3738
|
+
})),
|
|
3739
|
+
/** Query execution metadata */
|
|
3740
|
+
metadata: import_zod.z.object({
|
|
3741
|
+
/** Original query string */
|
|
3742
|
+
query: import_zod.z.string(),
|
|
3743
|
+
/** Graph traversal depth used */
|
|
3744
|
+
depth: import_zod.z.number(),
|
|
3745
|
+
/** Maximum number of results returned */
|
|
3746
|
+
limit: import_zod.z.number(),
|
|
3747
|
+
/** Query execution timestamp */
|
|
3748
|
+
timestamp: import_zod.z.string().datetime()
|
|
3749
|
+
})
|
|
3750
|
+
}));
|
|
3751
|
+
var conversation = import_zod.z.object({
|
|
3752
|
+
/** Unique conversation identifier */
|
|
3753
|
+
id: import_zod.z.string(),
|
|
3754
|
+
/** Conversation title */
|
|
3755
|
+
title: import_zod.z.string(),
|
|
3756
|
+
/** Conversation summary */
|
|
3757
|
+
summary: import_zod.z.string().nullable(),
|
|
3758
|
+
/** Creation timestamp */
|
|
3759
|
+
createdAt: import_zod.z.string().datetime(),
|
|
3760
|
+
/** Last update timestamp */
|
|
3761
|
+
updatedAt: import_zod.z.string().datetime()
|
|
3762
|
+
});
|
|
3763
|
+
var createConversationRequest = import_zod.z.object({
|
|
3764
|
+
/** Conversation title */
|
|
3765
|
+
title: import_zod.z.string().min(1),
|
|
3766
|
+
/** Optional conversation summary */
|
|
3767
|
+
summary: import_zod.z.string().optional()
|
|
3768
|
+
});
|
|
3769
|
+
var apiKey = import_zod.z.object({
|
|
3770
|
+
/** Unique API key identifier */
|
|
3771
|
+
id: import_zod.z.string(),
|
|
3772
|
+
/** Human-readable label for the API key */
|
|
3773
|
+
label: import_zod.z.string(),
|
|
3774
|
+
/** API key prefix for identification */
|
|
3775
|
+
prefix: import_zod.z.string(),
|
|
3776
|
+
/** Creation timestamp */
|
|
3777
|
+
createdAt: import_zod.z.string().datetime(),
|
|
3778
|
+
/** Expiration timestamp (null if never expires) */
|
|
3779
|
+
expiresAt: import_zod.z.string().datetime().nullable(),
|
|
3780
|
+
/** Last usage timestamp (null if never used) */
|
|
3781
|
+
lastUsedAt: import_zod.z.string().datetime().nullable()
|
|
3782
|
+
});
|
|
3783
|
+
var topic = import_zod.z.object({
|
|
3784
|
+
/** Topic name */
|
|
3785
|
+
name: import_zod.z.string(),
|
|
3786
|
+
/** Number of memories associated with this topic */
|
|
3787
|
+
count: import_zod.z.number().min(0)
|
|
3788
|
+
});
|
|
3789
|
+
var pattern = import_zod.z.object({
|
|
3790
|
+
/** Unique pattern identifier */
|
|
3791
|
+
id: import_zod.z.string(),
|
|
3792
|
+
/** Pattern type */
|
|
3793
|
+
type: import_zod.z.string(),
|
|
3794
|
+
/** Pattern description */
|
|
3795
|
+
description: import_zod.z.string(),
|
|
3796
|
+
/** Confidence score (0-1) */
|
|
3797
|
+
confidence: import_zod.z.number().min(0).max(1)
|
|
3798
|
+
});
|
|
3799
|
+
var serviceCheck = import_zod.z.object({
|
|
3800
|
+
/** Service status */
|
|
3801
|
+
status: import_zod.z.enum(["up", "down"]),
|
|
3802
|
+
/** Response time in milliseconds */
|
|
3803
|
+
responseTime: import_zod.z.number().optional()
|
|
3804
|
+
});
|
|
3805
|
+
var healthCheck = import_zod.z.object({
|
|
3806
|
+
/** Overall system health status */
|
|
3807
|
+
status: import_zod.z.enum(["healthy", "degraded", "unhealthy"]),
|
|
3808
|
+
/** Health check timestamp */
|
|
3809
|
+
timestamp: import_zod.z.string().datetime(),
|
|
3810
|
+
/** API version */
|
|
3811
|
+
version: import_zod.z.string(),
|
|
3812
|
+
/** System uptime in seconds */
|
|
3813
|
+
uptime: import_zod.z.number(),
|
|
3814
|
+
/** Individual service health checks */
|
|
3815
|
+
checks: import_zod.z.object({}).catchall(serviceCheck)
|
|
3816
|
+
});
|
|
3817
|
+
var searchRequest = import_zod.z.object({
|
|
3818
|
+
/** Search query */
|
|
3819
|
+
query: import_zod.z.string().min(1),
|
|
3820
|
+
/** Content filtering mode (defaults to unified) */
|
|
3821
|
+
mode: import_zod.z.enum(["unified", "content", "facts"]).optional(),
|
|
3822
|
+
/** Search algorithm: hybrid (combined, default), semantic (vector), or keyword (fulltext). */
|
|
3823
|
+
searchMethod: import_zod.z.enum(["keyword", "semantic", "hybrid"]).optional(),
|
|
3824
|
+
/** Maximum number of results (defaults to 20) */
|
|
3825
|
+
limit: import_zod.z.number().min(1).max(100).optional(),
|
|
3826
|
+
/** Offset for pagination (defaults to 0) */
|
|
3827
|
+
offset: import_zod.z.number().min(0).optional(),
|
|
3828
|
+
/** Weight for vector (semantic) results in hybrid search (0-1, defaults to 0.7) */
|
|
3829
|
+
vectorWeight: import_zod.z.number().min(0).max(1).optional(),
|
|
3830
|
+
/** Weight for fulltext (keyword) results in hybrid search (0-1, defaults to 0.3) */
|
|
3831
|
+
fulltextWeight: import_zod.z.number().min(0).max(1).optional(),
|
|
3832
|
+
/** Minimum similarity threshold for semantic search (0-1, defaults to 0.5) */
|
|
3833
|
+
threshold: import_zod.z.number().min(0).max(1).optional(),
|
|
3834
|
+
/** If true, include detailed explanation of how each result was matched */
|
|
3835
|
+
explain: import_zod.z.boolean().optional(),
|
|
3836
|
+
/** Point-in-time query: show what the system knew at this time (ISO 8601 format) */
|
|
3837
|
+
asOfTime: import_zod.z.string().datetime().optional(),
|
|
3838
|
+
/** Validity query: show facts that were valid at this time (ISO 8601 format) */
|
|
3839
|
+
validAtTime: import_zod.z.string().datetime().optional(),
|
|
3840
|
+
/** Event time range start (ISO 8601 format) */
|
|
3841
|
+
eventTimeFrom: import_zod.z.string().datetime().optional(),
|
|
3842
|
+
/** Event time range end (ISO 8601 format) */
|
|
3843
|
+
eventTimeTo: import_zod.z.string().datetime().optional(),
|
|
3844
|
+
/** Ingestion time range start (ISO 8601 format) */
|
|
3845
|
+
ingestionTimeFrom: import_zod.z.string().datetime().optional(),
|
|
3846
|
+
/** Ingestion time range end (ISO 8601 format) */
|
|
3847
|
+
ingestionTimeTo: import_zod.z.string().datetime().optional(),
|
|
3848
|
+
/** Include expired facts (defaults to false) */
|
|
3849
|
+
includeExpired: import_zod.z.boolean().optional(),
|
|
3850
|
+
/** Temporal query mode: 'current' (only valid now), 'historical' (as of a point in time), 'evolution' (chronological) */
|
|
3851
|
+
temporalMode: import_zod.z.enum(["current", "historical", "evolution"]).optional(),
|
|
3852
|
+
/** Filter by topics - returns memories that have ANY of the specified topics */
|
|
3853
|
+
topics: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3854
|
+
/** Filter by memory type */
|
|
3855
|
+
memoryType: import_zod.z.enum(["episodic", "semantic", "procedural"]).optional(),
|
|
3856
|
+
/** Filter by conversation ID */
|
|
3857
|
+
conversationId: import_zod.z.string().optional(),
|
|
3858
|
+
/** Include topics associated with matched memories (defaults to false for performance) */
|
|
3859
|
+
includeTopics: import_zod.z.boolean().optional(),
|
|
3860
|
+
/** Include entities mentioned in matched memories (defaults to false for performance) */
|
|
3861
|
+
includeEntities: import_zod.z.boolean().optional()
|
|
3862
|
+
});
|
|
3863
|
+
var entity = import_zod.z.object({
|
|
3864
|
+
/** Entity name */
|
|
3865
|
+
name: import_zod.z.string().optional(),
|
|
3866
|
+
/** Entity type */
|
|
3867
|
+
type: import_zod.z.string().optional()
|
|
3868
|
+
});
|
|
3869
|
+
var topicReference = import_zod.z.object({
|
|
3870
|
+
/** Topic unique identifier */
|
|
3871
|
+
id: import_zod.z.string().uuid(),
|
|
3872
|
+
/** Topic name */
|
|
3873
|
+
name: import_zod.z.string(),
|
|
3874
|
+
/** When the topic was created */
|
|
3875
|
+
createdAt: import_zod.z.string().datetime().optional()
|
|
3876
|
+
});
|
|
3877
|
+
var searchResult = import_zod.z.lazy(() => import_zod.z.object({
|
|
3878
|
+
memory: import_zod.z.object({
|
|
3879
|
+
/** Unique memory identifier */
|
|
3880
|
+
id: import_zod.z.string(),
|
|
3881
|
+
/** Memory content */
|
|
3882
|
+
content: import_zod.z.string(),
|
|
3883
|
+
/** Type of memory */
|
|
3884
|
+
memoryType: import_zod.z.enum(["episodic", "semantic", "procedural"]),
|
|
3885
|
+
/** Context or domain of the memory */
|
|
3886
|
+
context: import_zod.z.string().optional(),
|
|
3887
|
+
/** Associated topics */
|
|
3888
|
+
topics: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3889
|
+
/** System ingestion timestamp (when the system learned about this) */
|
|
3890
|
+
timestamp: import_zod.z.string().datetime().optional(),
|
|
3891
|
+
/** Event time (when the event actually occurred in reality) */
|
|
3892
|
+
eventTime: import_zod.z.string().datetime().optional(),
|
|
3893
|
+
/** Validity start time (when this fact becomes valid) */
|
|
3894
|
+
validFrom: import_zod.z.string().datetime().optional(),
|
|
3895
|
+
/** Validity end time (when this fact expires, null means never expires) */
|
|
3896
|
+
validTo: import_zod.z.string().datetime().nullable().optional(),
|
|
3897
|
+
/** Creation timestamp */
|
|
3898
|
+
createdAt: import_zod.z.string().datetime(),
|
|
3899
|
+
/** Last update timestamp */
|
|
3900
|
+
updatedAt: import_zod.z.string().datetime(),
|
|
3901
|
+
/** Confidence score (0-1) for this memory's accuracy */
|
|
3902
|
+
confidenceScore: import_zod.z.number().min(0).max(1).optional(),
|
|
3903
|
+
/** Basis for the confidence score */
|
|
3904
|
+
confidenceBasis: import_zod.z.enum(["direct-statement", "repeated-mention", "single-mention", "hedged", "inference", "external-source", "contradicted"]).optional(),
|
|
3905
|
+
/** Effective state of the memory in the narrative */
|
|
3906
|
+
effectiveState: import_zod.z.enum(["current", "superseded", "contradicted"]).optional()
|
|
3907
|
+
}),
|
|
3908
|
+
/** Relevance score for this result */
|
|
3909
|
+
score: import_zod.z.number(),
|
|
3910
|
+
/** Entities mentioned in this memory */
|
|
3911
|
+
entities: import_zod.z.array(entity).optional(),
|
|
3912
|
+
/** Topics associated with this memory */
|
|
3913
|
+
topics: import_zod.z.array(topicReference).optional(),
|
|
3914
|
+
/** Search method used to find this result */
|
|
3915
|
+
searchMethod: import_zod.z.string().optional(),
|
|
3916
|
+
/** Combined RRF score for hybrid search */
|
|
3917
|
+
hybridScore: import_zod.z.number().optional(),
|
|
3918
|
+
/** Vector similarity score (0-1) */
|
|
3919
|
+
vectorScore: import_zod.z.number().optional(),
|
|
3920
|
+
/** Rank in vector search results */
|
|
3921
|
+
vectorRank: import_zod.z.number().nullable().optional(),
|
|
3922
|
+
/** Fulltext search score */
|
|
3923
|
+
fulltextScore: import_zod.z.number().optional(),
|
|
3924
|
+
/** Rank in fulltext search results */
|
|
3925
|
+
fulltextRank: import_zod.z.number().nullable().optional(),
|
|
3926
|
+
/** Detailed explanation of the match (only when explain=true) */
|
|
3927
|
+
explanation: import_zod.z.object({
|
|
3928
|
+
/** Human-readable explanation of why this result matched */
|
|
3929
|
+
matchReason: import_zod.z.string(),
|
|
3930
|
+
/** Terms from the query that matched (for keyword search) */
|
|
3931
|
+
matchedTerms: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3932
|
+
/** Cosine similarity score for semantic match (0-1) */
|
|
3933
|
+
semanticSimilarity: import_zod.z.number().optional(),
|
|
3934
|
+
/** Factors that contributed to the match */
|
|
3935
|
+
contributingFactors: import_zod.z.array(import_zod.z.string()).optional()
|
|
3936
|
+
}).optional()
|
|
3937
|
+
}));
|
|
3938
|
+
var temporalMetadata = import_zod.z.object({
|
|
3939
|
+
/** Temporal query mode used */
|
|
3940
|
+
temporalMode: import_zod.z.string(),
|
|
3941
|
+
/** Point-in-time timestamp */
|
|
3942
|
+
asOfTime: import_zod.z.string().datetime().nullable(),
|
|
3943
|
+
/** Validity timestamp */
|
|
3944
|
+
validAtTime: import_zod.z.string().datetime().nullable(),
|
|
3945
|
+
/** Event time range filter */
|
|
3946
|
+
eventTimeRange: import_zod.z.object({
|
|
3947
|
+
from: import_zod.z.string().datetime().nullable(),
|
|
3948
|
+
to: import_zod.z.string().datetime().nullable()
|
|
3949
|
+
}).nullable(),
|
|
3950
|
+
/** Ingestion time range filter */
|
|
3951
|
+
ingestionTimeRange: import_zod.z.object({
|
|
3952
|
+
from: import_zod.z.string().datetime().nullable(),
|
|
3953
|
+
to: import_zod.z.string().datetime().nullable()
|
|
3954
|
+
}).nullable(),
|
|
3955
|
+
/** Whether expired facts are included */
|
|
3956
|
+
includeExpired: import_zod.z.boolean(),
|
|
3957
|
+
/** Whether temporal fields are included in results */
|
|
3958
|
+
temporalFieldsIncluded: import_zod.z.boolean()
|
|
3959
|
+
}).nullable();
|
|
3960
|
+
var searchResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
3961
|
+
/** Search results with metadata */
|
|
3962
|
+
data: import_zod.z.array(searchResult),
|
|
3963
|
+
/** Search method used for this query */
|
|
3964
|
+
searchMethod: import_zod.z.string().optional(),
|
|
3965
|
+
pagination: import_zod.z.object({
|
|
3966
|
+
/** Maximum number of items per page */
|
|
3967
|
+
limit: import_zod.z.number().min(1),
|
|
3968
|
+
/** Number of items to skip */
|
|
3969
|
+
offset: import_zod.z.number().min(0),
|
|
3970
|
+
/** Total number of items */
|
|
3971
|
+
count: import_zod.z.number().min(0)
|
|
3972
|
+
}),
|
|
3973
|
+
/** Temporal query metadata (null for semantic/hybrid search) */
|
|
3974
|
+
temporalMetadata
|
|
3975
|
+
}));
|
|
3976
|
+
var fact = import_zod.z.object({
|
|
3977
|
+
/** Unique identifier for the fact */
|
|
3978
|
+
id: import_zod.z.string(),
|
|
3979
|
+
/** User ID who owns this fact */
|
|
3980
|
+
userId: import_zod.z.string(),
|
|
3981
|
+
/** Fact name/label */
|
|
3982
|
+
name: import_zod.z.string(),
|
|
3983
|
+
/** Entity type */
|
|
3984
|
+
type: import_zod.z.string(),
|
|
3985
|
+
/** Fact description */
|
|
3986
|
+
description: import_zod.z.string().nullable().optional(),
|
|
3987
|
+
/** Confidence score (0-1) */
|
|
3988
|
+
confidence: import_zod.z.number().min(0).max(1).optional(),
|
|
3989
|
+
/** Creation timestamp */
|
|
3990
|
+
createdAt: import_zod.z.string().datetime(),
|
|
3991
|
+
/** Last update timestamp */
|
|
3992
|
+
updatedAt: import_zod.z.string().datetime()
|
|
3993
|
+
});
|
|
3994
|
+
var createFactRequest = import_zod.z.object({
|
|
3995
|
+
/** Fact subject (entity name) */
|
|
3996
|
+
subject: import_zod.z.string().min(1),
|
|
3997
|
+
/** Relationship type */
|
|
3998
|
+
predicate: import_zod.z.string().min(1),
|
|
3999
|
+
/** Fact object (related entity) */
|
|
4000
|
+
object: import_zod.z.string().min(1)
|
|
4001
|
+
});
|
|
4002
|
+
var updateFactRequest = import_zod.z.object({
|
|
4003
|
+
/** Fact subject (entity name) */
|
|
4004
|
+
subject: import_zod.z.string().min(1).optional(),
|
|
4005
|
+
/** Relationship type */
|
|
4006
|
+
predicate: import_zod.z.string().min(1).optional(),
|
|
4007
|
+
/** Fact object (related entity) */
|
|
4008
|
+
object: import_zod.z.string().min(1).optional(),
|
|
4009
|
+
/** Confidence score (0-1) */
|
|
4010
|
+
confidence: import_zod.z.number().min(0).max(1).optional()
|
|
4011
|
+
});
|
|
4012
|
+
var factSearchRequest = import_zod.z.object({
|
|
4013
|
+
/** Search query string */
|
|
4014
|
+
query: import_zod.z.string().min(1),
|
|
4015
|
+
/** Maximum number of results to return */
|
|
4016
|
+
limit: import_zod.z.number().min(1).max(100).optional()
|
|
4017
|
+
});
|
|
4018
|
+
var artifact = import_zod.z.object({
|
|
4019
|
+
/** Unique identifier for the artifact */
|
|
4020
|
+
id: import_zod.z.string(),
|
|
4021
|
+
/** User ID who owns this artifact */
|
|
4022
|
+
userId: import_zod.z.string(),
|
|
4023
|
+
/** Artifact content */
|
|
4024
|
+
content: import_zod.z.string(),
|
|
4025
|
+
/** Artifact type (e.g., note, document, code) */
|
|
4026
|
+
type: import_zod.z.string(),
|
|
4027
|
+
/** Artifact name */
|
|
4028
|
+
name: import_zod.z.string().nullable().optional(),
|
|
4029
|
+
/** Artifact description */
|
|
4030
|
+
description: import_zod.z.string().nullable().optional(),
|
|
4031
|
+
/** Associated memory ID */
|
|
4032
|
+
memoryId: import_zod.z.string().nullable().optional(),
|
|
4033
|
+
/** Associated conversation ID */
|
|
4034
|
+
conversationId: import_zod.z.string().nullable().optional(),
|
|
4035
|
+
/** Additional metadata */
|
|
4036
|
+
metadata: import_zod.z.object({}).optional(),
|
|
4037
|
+
/** Creation timestamp */
|
|
4038
|
+
createdAt: import_zod.z.string().datetime(),
|
|
4039
|
+
/** Last update timestamp */
|
|
4040
|
+
updatedAt: import_zod.z.string().datetime()
|
|
4041
|
+
});
|
|
4042
|
+
var createArtifactRequest = import_zod.z.object({
|
|
4043
|
+
/** Artifact content */
|
|
4044
|
+
content: import_zod.z.string().min(1),
|
|
4045
|
+
/** Artifact type (e.g., note, document, code) */
|
|
4046
|
+
type: import_zod.z.string().min(1),
|
|
4047
|
+
/** Artifact name */
|
|
4048
|
+
name: import_zod.z.string().optional(),
|
|
4049
|
+
/** Artifact description */
|
|
4050
|
+
description: import_zod.z.string().optional(),
|
|
4051
|
+
/** Associated memory ID */
|
|
4052
|
+
memoryId: import_zod.z.string().optional(),
|
|
4053
|
+
/** Associated conversation ID */
|
|
4054
|
+
conversationId: import_zod.z.string().optional(),
|
|
4055
|
+
/** Additional metadata */
|
|
4056
|
+
metadata: import_zod.z.object({}).optional()
|
|
4057
|
+
});
|
|
4058
|
+
var updateArtifactRequest = import_zod.z.object({
|
|
4059
|
+
/** Artifact content */
|
|
4060
|
+
content: import_zod.z.string().min(1).optional(),
|
|
4061
|
+
/** Artifact type (e.g., note, document, code) */
|
|
4062
|
+
type: import_zod.z.string().min(1).optional(),
|
|
4063
|
+
/** Artifact name */
|
|
4064
|
+
name: import_zod.z.string().optional(),
|
|
4065
|
+
/** Artifact description */
|
|
4066
|
+
description: import_zod.z.string().optional(),
|
|
4067
|
+
/** Additional metadata */
|
|
4068
|
+
metadata: import_zod.z.object({}).optional()
|
|
4069
|
+
});
|
|
4070
|
+
var community = import_zod.z.object({
|
|
4071
|
+
/** Unique identifier for the community */
|
|
4072
|
+
id: import_zod.z.string(),
|
|
4073
|
+
/** Community name */
|
|
4074
|
+
name: import_zod.z.string(),
|
|
4075
|
+
/** Community description */
|
|
4076
|
+
description: import_zod.z.string().nullable().optional(),
|
|
4077
|
+
/** Number of topics in this community */
|
|
4078
|
+
topicCount: import_zod.z.number().min(0).optional(),
|
|
4079
|
+
/** Creation timestamp */
|
|
4080
|
+
createdAt: import_zod.z.string().datetime(),
|
|
4081
|
+
/** Last update timestamp */
|
|
4082
|
+
updatedAt: import_zod.z.string().datetime()
|
|
4083
|
+
});
|
|
4084
|
+
var mergeCommunitiesRequest = import_zod.z.object({
|
|
4085
|
+
/** Source community ID to merge from */
|
|
4086
|
+
sourceCommunityId: import_zod.z.string().min(1),
|
|
4087
|
+
/** Target community ID to merge into */
|
|
4088
|
+
targetCommunityId: import_zod.z.string().min(1)
|
|
4089
|
+
});
|
|
4090
|
+
var memoryRelationship = import_zod.z.object({
|
|
4091
|
+
/** Unique relationship identifier */
|
|
4092
|
+
id: import_zod.z.string(),
|
|
4093
|
+
/** ID of the source memory (the memory that has the relationship) */
|
|
4094
|
+
sourceMemoryId: import_zod.z.string(),
|
|
4095
|
+
/** ID of the target memory (the memory being related to) */
|
|
4096
|
+
targetMemoryId: import_zod.z.string(),
|
|
4097
|
+
/** Type of relationship between memories */
|
|
4098
|
+
type: import_zod.z.enum(["SUPERSEDES", "FOLLOWS", "RESOLVES", "CONTRADICTS", "REFERENCES"]),
|
|
4099
|
+
/** Confidence score for the relationship (0-1) */
|
|
4100
|
+
confidence: import_zod.z.number().min(0).max(1),
|
|
4101
|
+
/** How the relationship was created */
|
|
4102
|
+
creationMethod: import_zod.z.enum(["manual", "auto-semantic", "auto-temporal"]),
|
|
4103
|
+
/** Human-readable explanation for why this relationship exists */
|
|
4104
|
+
reason: import_zod.z.string().optional(),
|
|
4105
|
+
/** When the relationship was created */
|
|
4106
|
+
createdAt: import_zod.z.string().datetime()
|
|
4107
|
+
});
|
|
4108
|
+
var createMemoryRelationshipRequest = import_zod.z.object({
|
|
4109
|
+
/** ID of the target memory to create a relationship with */
|
|
4110
|
+
targetMemoryId: import_zod.z.string().min(1),
|
|
4111
|
+
/** Type of relationship between memories */
|
|
4112
|
+
type: import_zod.z.enum(["SUPERSEDES", "FOLLOWS", "RESOLVES", "CONTRADICTS", "REFERENCES"]),
|
|
4113
|
+
/** Confidence score for the relationship (0-1, defaults to 1.0 for manual) */
|
|
4114
|
+
confidence: import_zod.z.number().min(0).max(1).optional(),
|
|
4115
|
+
/** Optional explanation for the relationship */
|
|
4116
|
+
reason: import_zod.z.string().optional()
|
|
4117
|
+
});
|
|
4118
|
+
var memoryRelationshipsResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
4119
|
+
data: import_zod.z.array(memoryRelationship),
|
|
4120
|
+
/** The source memory ID these relationships are for */
|
|
4121
|
+
sourceMemoryId: import_zod.z.string(),
|
|
4122
|
+
/** Direction of relationships returned */
|
|
4123
|
+
direction: import_zod.z.enum(["outgoing", "incoming", "both"])
|
|
4124
|
+
}));
|
|
4125
|
+
var narrativeThread = import_zod.z.object({
|
|
4126
|
+
/** Unique narrative thread identifier */
|
|
4127
|
+
id: import_zod.z.string(),
|
|
4128
|
+
/** User ID who owns this narrative */
|
|
4129
|
+
userId: import_zod.z.string(),
|
|
4130
|
+
/** Title describing the narrative thread */
|
|
4131
|
+
title: import_zod.z.string(),
|
|
4132
|
+
/** Current state of the narrative thread */
|
|
4133
|
+
state: import_zod.z.enum(["open", "resolved", "reopened", "superseded"]),
|
|
4134
|
+
/** ID of the first memory in this narrative */
|
|
4135
|
+
rootMemoryId: import_zod.z.string(),
|
|
4136
|
+
/** ID of the most recent memory in this narrative */
|
|
4137
|
+
currentMemoryId: import_zod.z.string().optional(),
|
|
4138
|
+
/** ID of the memory that resolved this narrative (if resolved) */
|
|
4139
|
+
resolutionMemoryId: import_zod.z.string().optional(),
|
|
4140
|
+
/** Topics associated with this narrative */
|
|
4141
|
+
topics: import_zod.z.array(import_zod.z.string()),
|
|
4142
|
+
/** Number of memories in this narrative */
|
|
4143
|
+
memoryCount: import_zod.z.number().min(0),
|
|
4144
|
+
/** When the narrative was created */
|
|
4145
|
+
createdAt: import_zod.z.string().datetime(),
|
|
4146
|
+
/** When the narrative was last updated */
|
|
4147
|
+
updatedAt: import_zod.z.string().datetime()
|
|
4148
|
+
});
|
|
4149
|
+
var createNarrativeRequest = import_zod.z.object({
|
|
4150
|
+
/** Title for the narrative thread */
|
|
4151
|
+
title: import_zod.z.string().min(1),
|
|
4152
|
+
/** ID of the first memory in this narrative */
|
|
4153
|
+
rootMemoryId: import_zod.z.string().min(1),
|
|
4154
|
+
/** Topics to associate with this narrative */
|
|
4155
|
+
topics: import_zod.z.array(import_zod.z.string()).optional()
|
|
4156
|
+
});
|
|
4157
|
+
var updateNarrativeRequest = import_zod.z.object({
|
|
4158
|
+
/** Updated title for the narrative */
|
|
4159
|
+
title: import_zod.z.string().min(1).optional(),
|
|
4160
|
+
/** Current state of the narrative thread */
|
|
4161
|
+
state: import_zod.z.enum(["open", "resolved", "reopened", "superseded"]).optional(),
|
|
4162
|
+
/** ID of the memory that resolves this narrative */
|
|
4163
|
+
resolutionMemoryId: import_zod.z.string().optional(),
|
|
4164
|
+
/** Updated topics for the narrative */
|
|
4165
|
+
topics: import_zod.z.array(import_zod.z.string()).optional()
|
|
4166
|
+
});
|
|
4167
|
+
var addMemoryToNarrativeRequest = import_zod.z.object({
|
|
4168
|
+
/** ID of the memory to add to the narrative */
|
|
4169
|
+
memoryId: import_zod.z.string().min(1),
|
|
4170
|
+
/** Position in the narrative (0-indexed, omit for append) */
|
|
4171
|
+
position: import_zod.z.number().min(0).optional()
|
|
4172
|
+
});
|
|
4173
|
+
var narrativeMemory = import_zod.z.object({
|
|
4174
|
+
memory: import_zod.z.object({
|
|
4175
|
+
/** Unique memory identifier */
|
|
4176
|
+
id: import_zod.z.string(),
|
|
4177
|
+
/** Memory content */
|
|
4178
|
+
content: import_zod.z.string(),
|
|
4179
|
+
/** Type of memory */
|
|
4180
|
+
memoryType: import_zod.z.enum(["episodic", "semantic", "procedural"]),
|
|
4181
|
+
/** Context or domain of the memory */
|
|
4182
|
+
context: import_zod.z.string().optional(),
|
|
4183
|
+
/** Associated topics */
|
|
4184
|
+
topics: import_zod.z.array(import_zod.z.string()).optional(),
|
|
4185
|
+
/** System ingestion timestamp (when the system learned about this) */
|
|
4186
|
+
timestamp: import_zod.z.string().datetime().optional(),
|
|
4187
|
+
/** Event time (when the event actually occurred in reality) */
|
|
4188
|
+
eventTime: import_zod.z.string().datetime().optional(),
|
|
4189
|
+
/** Validity start time (when this fact becomes valid) */
|
|
4190
|
+
validFrom: import_zod.z.string().datetime().optional(),
|
|
4191
|
+
/** Validity end time (when this fact expires, null means never expires) */
|
|
4192
|
+
validTo: import_zod.z.string().datetime().nullable().optional(),
|
|
4193
|
+
/** Creation timestamp */
|
|
4194
|
+
createdAt: import_zod.z.string().datetime(),
|
|
4195
|
+
/** Last update timestamp */
|
|
4196
|
+
updatedAt: import_zod.z.string().datetime(),
|
|
4197
|
+
/** Confidence score (0-1) for this memory's accuracy */
|
|
4198
|
+
confidenceScore: import_zod.z.number().min(0).max(1).optional(),
|
|
4199
|
+
/** Basis for the confidence score */
|
|
4200
|
+
confidenceBasis: import_zod.z.enum(["direct-statement", "repeated-mention", "single-mention", "hedged", "inference", "external-source", "contradicted"]).optional(),
|
|
4201
|
+
/** Effective state of the memory in the narrative */
|
|
4202
|
+
effectiveState: import_zod.z.enum(["current", "superseded", "contradicted"]).optional()
|
|
4203
|
+
}),
|
|
4204
|
+
/** Position of this memory in the narrative (0-indexed) */
|
|
4205
|
+
position: import_zod.z.number().min(0),
|
|
4206
|
+
/** Effective state of this memory in the narrative context */
|
|
4207
|
+
effectiveState: import_zod.z.enum(["current", "superseded", "contradicted"]).optional()
|
|
4208
|
+
});
|
|
4209
|
+
var narrativeTimelineResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
4210
|
+
data: import_zod.z.array(narrativeMemory),
|
|
4211
|
+
narrative: narrativeThread,
|
|
4212
|
+
pagination: import_zod.z.object({
|
|
4213
|
+
limit: import_zod.z.number(),
|
|
4214
|
+
offset: import_zod.z.number(),
|
|
4215
|
+
total: import_zod.z.number()
|
|
4216
|
+
})
|
|
4217
|
+
}));
|
|
4218
|
+
var getNarrativeResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
4219
|
+
data: narrativeThread
|
|
4220
|
+
}));
|
|
4221
|
+
var listNarrativesResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
4222
|
+
data: import_zod.z.array(narrativeThread),
|
|
4223
|
+
pagination: import_zod.z.object({
|
|
4224
|
+
limit: import_zod.z.number(),
|
|
4225
|
+
offset: import_zod.z.number(),
|
|
4226
|
+
count: import_zod.z.number()
|
|
4227
|
+
})
|
|
4228
|
+
}));
|
|
4229
|
+
var user = import_zod.z.object({
|
|
4230
|
+
id: import_zod.z.string().uuid(),
|
|
4231
|
+
email: import_zod.z.string().email(),
|
|
4232
|
+
firstName: import_zod.z.string().nullable(),
|
|
4233
|
+
lastName: import_zod.z.string().nullable(),
|
|
4234
|
+
profilePictureUrl: import_zod.z.string().url().nullable(),
|
|
4235
|
+
plan: import_zod.z.enum(["free", "pro", "enterprise"]),
|
|
4236
|
+
memoryLimit: import_zod.z.number(),
|
|
4237
|
+
retentionDays: import_zod.z.number().nullable(),
|
|
4238
|
+
createdAt: import_zod.z.string().datetime(),
|
|
4239
|
+
updatedAt: import_zod.z.string().datetime()
|
|
4240
|
+
});
|
|
4241
|
+
var userUsage = import_zod.z.object({
|
|
4242
|
+
memoriesUsed: import_zod.z.number(),
|
|
4243
|
+
memoryLimit: import_zod.z.number(),
|
|
4244
|
+
memoriesRemaining: import_zod.z.number(),
|
|
4245
|
+
percentUsed: import_zod.z.number(),
|
|
4246
|
+
plan: import_zod.z.enum(["free", "pro", "enterprise"]),
|
|
4247
|
+
periodStart: import_zod.z.string().datetime(),
|
|
4248
|
+
periodEnd: import_zod.z.string().datetime()
|
|
4249
|
+
});
|
|
4250
|
+
|
|
4251
|
+
// src/index.ts
|
|
4252
|
+
var Memnexus = class {
|
|
4253
|
+
config;
|
|
4254
|
+
/** API key management endpoints operations */
|
|
4255
|
+
apiKeys;
|
|
4256
|
+
/** Artifact storage and retrieval endpoints operations */
|
|
4257
|
+
artifacts;
|
|
4258
|
+
/** Conversation tracking and analysis endpoints operations */
|
|
4259
|
+
conversations;
|
|
4260
|
+
/** Fact extraction and management endpoints operations */
|
|
4261
|
+
facts;
|
|
4262
|
+
/** Graph-based retrieval augmented generation endpoints operations */
|
|
4263
|
+
graphrag;
|
|
4264
|
+
/** Health check endpoints operations */
|
|
4265
|
+
health;
|
|
4266
|
+
/** Memory management and retrieval endpoints operations */
|
|
4267
|
+
memories;
|
|
4268
|
+
/** Narrative thread management endpoints operations */
|
|
4269
|
+
narratives;
|
|
4270
|
+
/** System health, monitoring, and configuration endpoints operations */
|
|
4271
|
+
system;
|
|
4272
|
+
/** Pattern detection and behavioral analysis endpoints operations */
|
|
4273
|
+
patterns;
|
|
4274
|
+
/** Behavioral pattern tracking and state management endpoints operations */
|
|
4275
|
+
behavior;
|
|
4276
|
+
/** Topic detection, clustering, and management endpoints operations */
|
|
4277
|
+
topics;
|
|
4278
|
+
/** Topic community detection and management endpoints operations */
|
|
4279
|
+
communities;
|
|
4280
|
+
/** User management and profile endpoints operations */
|
|
4281
|
+
users;
|
|
4282
|
+
/**
|
|
4283
|
+
* Create a new SDK client.
|
|
4284
|
+
* @param config - SDK configuration
|
|
4285
|
+
*/
|
|
4286
|
+
constructor(config = {}) {
|
|
4287
|
+
this.config = {
|
|
4288
|
+
baseUrl: config.baseUrl || "http://localhost:3000",
|
|
4289
|
+
...config
|
|
4290
|
+
};
|
|
4291
|
+
this.apiKeys = new ApiKeysService(this.config);
|
|
4292
|
+
this.artifacts = new ArtifactsService(this.config);
|
|
4293
|
+
this.conversations = new ConversationsService(this.config);
|
|
4294
|
+
this.facts = new FactsService(this.config);
|
|
4295
|
+
this.graphrag = new GraphragService(this.config);
|
|
4296
|
+
this.health = new HealthService(this.config);
|
|
4297
|
+
this.memories = new MemoriesService(this.config);
|
|
4298
|
+
this.narratives = new NarrativesService(this.config);
|
|
4299
|
+
this.system = new SystemService(this.config);
|
|
4300
|
+
this.patterns = new PatternsService(this.config);
|
|
4301
|
+
this.behavior = new BehaviorService(this.config);
|
|
4302
|
+
this.topics = new TopicsService(this.config);
|
|
4303
|
+
this.communities = new CommunitiesService(this.config);
|
|
4304
|
+
this.users = new UsersService(this.config);
|
|
4305
|
+
}
|
|
4306
|
+
/**
|
|
4307
|
+
* Set the API token for authentication.
|
|
4308
|
+
* @param token - Bearer token
|
|
4309
|
+
*/
|
|
4310
|
+
setToken(token) {
|
|
4311
|
+
this.config.token = token;
|
|
4312
|
+
this.apiKeys.token = token;
|
|
4313
|
+
this.artifacts.token = token;
|
|
4314
|
+
this.conversations.token = token;
|
|
4315
|
+
this.facts.token = token;
|
|
4316
|
+
this.graphrag.token = token;
|
|
4317
|
+
this.health.token = token;
|
|
4318
|
+
this.memories.token = token;
|
|
4319
|
+
this.narratives.token = token;
|
|
4320
|
+
this.system.token = token;
|
|
4321
|
+
this.patterns.token = token;
|
|
4322
|
+
this.behavior.token = token;
|
|
4323
|
+
this.topics.token = token;
|
|
4324
|
+
this.communities.token = token;
|
|
4325
|
+
this.users.token = token;
|
|
4326
|
+
}
|
|
4327
|
+
/**
|
|
4328
|
+
* Set the base URL for API requests.
|
|
4329
|
+
* @param baseUrl - API base URL
|
|
4330
|
+
*/
|
|
4331
|
+
setBaseUrl(baseUrl) {
|
|
4332
|
+
this.config.baseUrl = baseUrl;
|
|
4333
|
+
this.apiKeys.baseUrl = baseUrl;
|
|
4334
|
+
this.artifacts.baseUrl = baseUrl;
|
|
4335
|
+
this.conversations.baseUrl = baseUrl;
|
|
4336
|
+
this.facts.baseUrl = baseUrl;
|
|
4337
|
+
this.graphrag.baseUrl = baseUrl;
|
|
4338
|
+
this.health.baseUrl = baseUrl;
|
|
4339
|
+
this.memories.baseUrl = baseUrl;
|
|
4340
|
+
this.narratives.baseUrl = baseUrl;
|
|
4341
|
+
this.system.baseUrl = baseUrl;
|
|
4342
|
+
this.patterns.baseUrl = baseUrl;
|
|
4343
|
+
this.behavior.baseUrl = baseUrl;
|
|
4344
|
+
this.topics.baseUrl = baseUrl;
|
|
4345
|
+
this.communities.baseUrl = baseUrl;
|
|
4346
|
+
this.users.baseUrl = baseUrl;
|
|
4347
|
+
}
|
|
4348
|
+
/**
|
|
4349
|
+
* Set the environment.
|
|
4350
|
+
* @param environment - API environment
|
|
4351
|
+
*/
|
|
4352
|
+
setEnvironment(environment) {
|
|
4353
|
+
this.config.environment = environment;
|
|
4354
|
+
this.apiKeys.environment = environment;
|
|
4355
|
+
this.artifacts.environment = environment;
|
|
4356
|
+
this.conversations.environment = environment;
|
|
4357
|
+
this.facts.environment = environment;
|
|
4358
|
+
this.graphrag.environment = environment;
|
|
4359
|
+
this.health.environment = environment;
|
|
4360
|
+
this.memories.environment = environment;
|
|
4361
|
+
this.narratives.environment = environment;
|
|
4362
|
+
this.system.environment = environment;
|
|
4363
|
+
this.patterns.environment = environment;
|
|
4364
|
+
this.behavior.environment = environment;
|
|
4365
|
+
this.topics.environment = environment;
|
|
4366
|
+
this.communities.environment = environment;
|
|
4367
|
+
this.users.environment = environment;
|
|
4368
|
+
}
|
|
4369
|
+
};
|
|
4370
|
+
var index_default = Memnexus;
|
|
4371
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4372
|
+
0 && (module.exports = {
|
|
4373
|
+
ApiKeysService,
|
|
4374
|
+
ArtifactsService,
|
|
4375
|
+
BehaviorService,
|
|
4376
|
+
CommunitiesService,
|
|
4377
|
+
ContentType,
|
|
4378
|
+
ConversationsService,
|
|
4379
|
+
Environment,
|
|
4380
|
+
FactsService,
|
|
4381
|
+
GraphragService,
|
|
4382
|
+
HealthService,
|
|
4383
|
+
Memnexus,
|
|
4384
|
+
MemoriesService,
|
|
4385
|
+
NarrativesService,
|
|
4386
|
+
PatternsService,
|
|
4387
|
+
SerializationStyle,
|
|
4388
|
+
SystemService,
|
|
4389
|
+
TopicsService,
|
|
4390
|
+
UsersService,
|
|
4391
|
+
addMemoryToNarrativeRequest,
|
|
4392
|
+
apiKey,
|
|
4393
|
+
artifact,
|
|
4394
|
+
community,
|
|
4395
|
+
conversation,
|
|
4396
|
+
createArtifactRequest,
|
|
4397
|
+
createConversationRequest,
|
|
4398
|
+
createFactRequest,
|
|
4399
|
+
createMemoryRelationshipRequest,
|
|
4400
|
+
createMemoryRequest,
|
|
4401
|
+
createMemoryResponse,
|
|
4402
|
+
createMemoryResponseMeta,
|
|
4403
|
+
createNarrativeRequest,
|
|
4404
|
+
entity,
|
|
4405
|
+
error,
|
|
4406
|
+
fact,
|
|
4407
|
+
factSearchRequest,
|
|
4408
|
+
getMemoryResponse,
|
|
4409
|
+
getNarrativeResponse,
|
|
4410
|
+
graphRAGQueryRequest,
|
|
4411
|
+
graphRAGQueryResponse,
|
|
4412
|
+
healthCheck,
|
|
4413
|
+
listNarrativesResponse,
|
|
4414
|
+
memory,
|
|
4415
|
+
memoryRelationship,
|
|
4416
|
+
memoryRelationshipsResponse,
|
|
4417
|
+
mergeCommunitiesRequest,
|
|
4418
|
+
narrativeMemory,
|
|
4419
|
+
narrativeThread,
|
|
4420
|
+
narrativeTimelineResponse,
|
|
4421
|
+
pagination,
|
|
4422
|
+
pattern,
|
|
4423
|
+
relatedMemoryResult,
|
|
4424
|
+
searchRequest,
|
|
4425
|
+
searchResponse,
|
|
4426
|
+
searchResult,
|
|
4427
|
+
serviceCheck,
|
|
4428
|
+
temporalMetadata,
|
|
4429
|
+
topic,
|
|
4430
|
+
topicReference,
|
|
4431
|
+
updateArtifactRequest,
|
|
4432
|
+
updateFactRequest,
|
|
4433
|
+
updateMemoryRequest,
|
|
4434
|
+
updateNarrativeRequest,
|
|
4435
|
+
user,
|
|
4436
|
+
userUsage
|
|
4437
|
+
});
|
|
4438
|
+
//# sourceMappingURL=index.cjs.map
|