@lanonasis/mem-intel-sdk 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/client.d.ts +28 -7
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/index.cjs +251 -13
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +251 -13
- package/dist/core/index.js.map +1 -1
- package/dist/core/types.d.ts +36 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index-sdk.d.ts +2 -0
- package/dist/index-sdk.d.ts.map +1 -1
- package/dist/index.cjs +251 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +251 -13
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +251 -13
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +251 -13
- package/dist/node/index.js.map +1 -1
- package/dist/react/hooks/useMemoryIntelligence.d.ts +11 -10
- package/dist/react/hooks/useMemoryIntelligence.d.ts.map +1 -1
- package/dist/react/index.cjs +251 -13
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +251 -13
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.cjs +272 -27
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +272 -27
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/utils/http-client.d.ts +35 -0
- package/dist/utils/http-client.d.ts.map +1 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/response-adapter.d.ts +66 -0
- package/dist/utils/response-adapter.d.ts.map +1 -0
- package/dist/vue/composables/useMemoryIntelligence.d.ts.map +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js.map +1 -1
- package/package.json +3 -3
package/dist/server/index.cjs
CHANGED
|
@@ -45,12 +45,120 @@ var ValidationError = class extends MemoryIntelligenceError {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
// src/utils/response-adapter.ts
|
|
49
|
+
function adaptEdgeFunctionResponse(httpResponse) {
|
|
50
|
+
if (httpResponse.error) {
|
|
51
|
+
return {
|
|
52
|
+
status: httpResponse.status,
|
|
53
|
+
error: httpResponse.error
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const envelope = httpResponse.data;
|
|
57
|
+
if (!envelope) {
|
|
58
|
+
return {
|
|
59
|
+
status: httpResponse.status,
|
|
60
|
+
error: {
|
|
61
|
+
message: "Empty response from server",
|
|
62
|
+
code: "EMPTY_RESPONSE"
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (!envelope.success && envelope.error) {
|
|
67
|
+
return {
|
|
68
|
+
status: httpResponse.status,
|
|
69
|
+
error: envelope.error,
|
|
70
|
+
usage: envelope.usage,
|
|
71
|
+
tier_info: envelope.tier_info
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
status: httpResponse.status,
|
|
76
|
+
data: envelope.data,
|
|
77
|
+
usage: envelope.usage,
|
|
78
|
+
tier_info: envelope.tier_info
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function isEdgeFunctionEnvelope(data) {
|
|
82
|
+
if (typeof data !== "object" || data === null) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const obj = data;
|
|
86
|
+
return "success" in obj && typeof obj.success === "boolean";
|
|
87
|
+
}
|
|
88
|
+
function adaptResponse(httpResponse) {
|
|
89
|
+
if (httpResponse.error) {
|
|
90
|
+
return {
|
|
91
|
+
status: httpResponse.status,
|
|
92
|
+
error: httpResponse.error
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const responseData = httpResponse.data;
|
|
96
|
+
if (isEdgeFunctionEnvelope(responseData)) {
|
|
97
|
+
return adaptEdgeFunctionResponse({
|
|
98
|
+
status: httpResponse.status,
|
|
99
|
+
data: responseData
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
status: httpResponse.status,
|
|
104
|
+
data: responseData
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
var ResponseCache = class {
|
|
108
|
+
cache = /* @__PURE__ */ new Map();
|
|
109
|
+
ttl;
|
|
110
|
+
constructor(ttlMs = 3e5) {
|
|
111
|
+
this.ttl = ttlMs;
|
|
112
|
+
}
|
|
113
|
+
generateKey(endpoint, params) {
|
|
114
|
+
const paramStr = params ? JSON.stringify(params) : "";
|
|
115
|
+
return `${endpoint}:${paramStr}`;
|
|
116
|
+
}
|
|
117
|
+
set(endpoint, data, params) {
|
|
118
|
+
const key = this.generateKey(endpoint, params);
|
|
119
|
+
this.cache.set(key, {
|
|
120
|
+
data,
|
|
121
|
+
timestamp: Date.now(),
|
|
122
|
+
endpoint,
|
|
123
|
+
params
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
get(endpoint, params) {
|
|
127
|
+
const key = this.generateKey(endpoint, params);
|
|
128
|
+
const entry = this.cache.get(key);
|
|
129
|
+
if (!entry) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
if (Date.now() - entry.timestamp > this.ttl) {
|
|
133
|
+
this.cache.delete(key);
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return entry.data;
|
|
137
|
+
}
|
|
138
|
+
clear() {
|
|
139
|
+
this.cache.clear();
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Clean up expired entries
|
|
143
|
+
*/
|
|
144
|
+
cleanup() {
|
|
145
|
+
const now = Date.now();
|
|
146
|
+
for (const [key, entry] of this.cache.entries()) {
|
|
147
|
+
if (now - entry.timestamp > this.ttl) {
|
|
148
|
+
this.cache.delete(key);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
48
154
|
// src/utils/http-client.ts
|
|
49
155
|
var HttpClient = class {
|
|
50
156
|
apiUrl;
|
|
51
157
|
apiKey;
|
|
52
158
|
timeout;
|
|
53
159
|
headers;
|
|
160
|
+
processingMode;
|
|
161
|
+
cache;
|
|
54
162
|
constructor(config) {
|
|
55
163
|
if (!config.apiKey) {
|
|
56
164
|
throw new ConfigurationError("API key is required");
|
|
@@ -63,11 +171,35 @@ var HttpClient = class {
|
|
|
63
171
|
this.apiUrl = config.apiUrl.replace(/\/$/, "");
|
|
64
172
|
this.apiKey = config.apiKey;
|
|
65
173
|
this.timeout = config.timeout || 3e4;
|
|
174
|
+
this.processingMode = config.processingMode || "api";
|
|
66
175
|
this.headers = {
|
|
67
176
|
"Content-Type": "application/json",
|
|
68
177
|
"X-API-Key": this.apiKey,
|
|
69
178
|
...config.headers
|
|
70
179
|
};
|
|
180
|
+
if (config.enableCache !== false && this.processingMode === "offline-fallback") {
|
|
181
|
+
this.cache = new ResponseCache(config.cacheTTL || 3e5);
|
|
182
|
+
} else {
|
|
183
|
+
this.cache = null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Get the current processing mode
|
|
188
|
+
*/
|
|
189
|
+
getProcessingMode() {
|
|
190
|
+
return this.processingMode;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Check if cache is enabled
|
|
194
|
+
*/
|
|
195
|
+
isCacheEnabled() {
|
|
196
|
+
return this.cache !== null;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Clear the response cache
|
|
200
|
+
*/
|
|
201
|
+
clearCache() {
|
|
202
|
+
this.cache?.clear();
|
|
71
203
|
}
|
|
72
204
|
async request(method, endpoint, data) {
|
|
73
205
|
const url = `${this.apiUrl}${endpoint}`;
|
|
@@ -127,6 +259,43 @@ var HttpClient = class {
|
|
|
127
259
|
};
|
|
128
260
|
}
|
|
129
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Enhanced request that handles Edge Function envelope format
|
|
264
|
+
* and supports offline-fallback caching
|
|
265
|
+
*/
|
|
266
|
+
async enhancedRequest(method, endpoint, data) {
|
|
267
|
+
const cacheKey = data ? JSON.stringify(data) : void 0;
|
|
268
|
+
const rawResponse = await this.request(method, endpoint, data);
|
|
269
|
+
if (rawResponse.error?.code === "NETWORK_ERROR" || rawResponse.error?.code === "TIMEOUT") {
|
|
270
|
+
if (this.processingMode === "offline-fallback" && this.cache) {
|
|
271
|
+
const cached = this.cache.get(endpoint, cacheKey ? JSON.parse(cacheKey) : void 0);
|
|
272
|
+
if (cached) {
|
|
273
|
+
return {
|
|
274
|
+
status: 200,
|
|
275
|
+
data: cached,
|
|
276
|
+
fromCache: true
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
status: rawResponse.status,
|
|
282
|
+
error: rawResponse.error,
|
|
283
|
+
fromCache: false
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
const adapted = adaptResponse(rawResponse);
|
|
287
|
+
if (!adapted.error && adapted.data && this.cache) {
|
|
288
|
+
this.cache.set(endpoint, adapted.data, cacheKey ? JSON.parse(cacheKey) : void 0);
|
|
289
|
+
}
|
|
290
|
+
return {
|
|
291
|
+
status: adapted.status,
|
|
292
|
+
data: adapted.data,
|
|
293
|
+
error: adapted.error,
|
|
294
|
+
usage: adapted.usage,
|
|
295
|
+
tier_info: adapted.tier_info,
|
|
296
|
+
fromCache: false
|
|
297
|
+
};
|
|
298
|
+
}
|
|
130
299
|
async get(endpoint) {
|
|
131
300
|
return this.request("GET", endpoint);
|
|
132
301
|
}
|
|
@@ -142,6 +311,22 @@ var HttpClient = class {
|
|
|
142
311
|
async delete(endpoint) {
|
|
143
312
|
return this.request("DELETE", endpoint);
|
|
144
313
|
}
|
|
314
|
+
// Enhanced methods with Edge Function envelope support
|
|
315
|
+
async getEnhanced(endpoint) {
|
|
316
|
+
return this.enhancedRequest("GET", endpoint);
|
|
317
|
+
}
|
|
318
|
+
async postEnhanced(endpoint, data) {
|
|
319
|
+
return this.enhancedRequest("POST", endpoint, data);
|
|
320
|
+
}
|
|
321
|
+
async putEnhanced(endpoint, data) {
|
|
322
|
+
return this.enhancedRequest("PUT", endpoint, data);
|
|
323
|
+
}
|
|
324
|
+
async patchEnhanced(endpoint, data) {
|
|
325
|
+
return this.enhancedRequest("PATCH", endpoint, data);
|
|
326
|
+
}
|
|
327
|
+
async deleteEnhanced(endpoint) {
|
|
328
|
+
return this.enhancedRequest("DELETE", endpoint);
|
|
329
|
+
}
|
|
145
330
|
};
|
|
146
331
|
|
|
147
332
|
// src/core/client.ts
|
|
@@ -149,20 +334,43 @@ var DEFAULT_API_URL = "https://api.lanonasis.com/api/v1";
|
|
|
149
334
|
var MemoryIntelligenceClient = class {
|
|
150
335
|
httpClient;
|
|
151
336
|
defaultResponseFormat;
|
|
337
|
+
processingMode;
|
|
152
338
|
constructor(config) {
|
|
153
339
|
if (!config.apiKey) {
|
|
154
340
|
throw new ConfigurationError(
|
|
155
341
|
"Missing required configuration: apiKey is required (format: lano_xxxxxxxxxx)"
|
|
156
342
|
);
|
|
157
343
|
}
|
|
344
|
+
this.processingMode = config.processingMode || "api";
|
|
158
345
|
this.httpClient = new HttpClient({
|
|
159
346
|
apiUrl: config.apiUrl || DEFAULT_API_URL,
|
|
160
347
|
apiKey: config.apiKey,
|
|
161
348
|
timeout: config.timeout,
|
|
162
|
-
headers: config.headers
|
|
349
|
+
headers: config.headers,
|
|
350
|
+
processingMode: this.processingMode,
|
|
351
|
+
enableCache: config.enableCache,
|
|
352
|
+
cacheTTL: config.cacheTTL
|
|
163
353
|
});
|
|
164
354
|
this.defaultResponseFormat = config.responseFormat || "markdown";
|
|
165
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* Get the current processing mode
|
|
358
|
+
*/
|
|
359
|
+
getProcessingMode() {
|
|
360
|
+
return this.processingMode;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Check if cache is enabled (for offline-fallback mode)
|
|
364
|
+
*/
|
|
365
|
+
isCacheEnabled() {
|
|
366
|
+
return this.httpClient.isCacheEnabled();
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Clear the response cache
|
|
370
|
+
*/
|
|
371
|
+
clearCache() {
|
|
372
|
+
this.httpClient.clearCache();
|
|
373
|
+
}
|
|
166
374
|
/**
|
|
167
375
|
* Get HTTP client for direct API access
|
|
168
376
|
*/
|
|
@@ -194,7 +402,7 @@ var MemoryIntelligenceClient = class {
|
|
|
194
402
|
* Analyze usage patterns and trends in memory collection
|
|
195
403
|
*/
|
|
196
404
|
async analyzePatterns(params) {
|
|
197
|
-
const response = await this.httpClient.
|
|
405
|
+
const response = await this.httpClient.postEnhanced(
|
|
198
406
|
"/intelligence/analyze-patterns",
|
|
199
407
|
{
|
|
200
408
|
...params,
|
|
@@ -204,13 +412,18 @@ var MemoryIntelligenceClient = class {
|
|
|
204
412
|
if (response.error) {
|
|
205
413
|
throw new DatabaseError(`Failed to analyze patterns: ${response.error.message}`);
|
|
206
414
|
}
|
|
207
|
-
return
|
|
415
|
+
return {
|
|
416
|
+
data: response.data,
|
|
417
|
+
usage: response.usage,
|
|
418
|
+
tier_info: response.tier_info,
|
|
419
|
+
fromCache: response.fromCache
|
|
420
|
+
};
|
|
208
421
|
}
|
|
209
422
|
/**
|
|
210
423
|
* Get AI-powered tag suggestions for a memory
|
|
211
424
|
*/
|
|
212
425
|
async suggestTags(params) {
|
|
213
|
-
const response = await this.httpClient.
|
|
426
|
+
const response = await this.httpClient.postEnhanced(
|
|
214
427
|
"/intelligence/suggest-tags",
|
|
215
428
|
{
|
|
216
429
|
...params,
|
|
@@ -220,13 +433,18 @@ var MemoryIntelligenceClient = class {
|
|
|
220
433
|
if (response.error) {
|
|
221
434
|
throw new DatabaseError(`Failed to suggest tags: ${response.error.message}`);
|
|
222
435
|
}
|
|
223
|
-
return
|
|
436
|
+
return {
|
|
437
|
+
data: response.data,
|
|
438
|
+
usage: response.usage,
|
|
439
|
+
tier_info: response.tier_info,
|
|
440
|
+
fromCache: response.fromCache
|
|
441
|
+
};
|
|
224
442
|
}
|
|
225
443
|
/**
|
|
226
444
|
* Find semantically related memories using vector similarity
|
|
227
445
|
*/
|
|
228
446
|
async findRelated(params) {
|
|
229
|
-
const response = await this.httpClient.
|
|
447
|
+
const response = await this.httpClient.postEnhanced(
|
|
230
448
|
"/intelligence/find-related",
|
|
231
449
|
{
|
|
232
450
|
...params,
|
|
@@ -236,13 +454,18 @@ var MemoryIntelligenceClient = class {
|
|
|
236
454
|
if (response.error) {
|
|
237
455
|
throw new DatabaseError(`Failed to find related memories: ${response.error.message}`);
|
|
238
456
|
}
|
|
239
|
-
return
|
|
457
|
+
return {
|
|
458
|
+
data: response.data,
|
|
459
|
+
usage: response.usage,
|
|
460
|
+
tier_info: response.tier_info,
|
|
461
|
+
fromCache: response.fromCache
|
|
462
|
+
};
|
|
240
463
|
}
|
|
241
464
|
/**
|
|
242
465
|
* Detect potential duplicate memories
|
|
243
466
|
*/
|
|
244
467
|
async detectDuplicates(params) {
|
|
245
|
-
const response = await this.httpClient.
|
|
468
|
+
const response = await this.httpClient.postEnhanced(
|
|
246
469
|
"/intelligence/detect-duplicates",
|
|
247
470
|
{
|
|
248
471
|
...params,
|
|
@@ -252,13 +475,18 @@ var MemoryIntelligenceClient = class {
|
|
|
252
475
|
if (response.error) {
|
|
253
476
|
throw new DatabaseError(`Failed to detect duplicates: ${response.error.message}`);
|
|
254
477
|
}
|
|
255
|
-
return
|
|
478
|
+
return {
|
|
479
|
+
data: response.data,
|
|
480
|
+
usage: response.usage,
|
|
481
|
+
tier_info: response.tier_info,
|
|
482
|
+
fromCache: response.fromCache
|
|
483
|
+
};
|
|
256
484
|
}
|
|
257
485
|
/**
|
|
258
486
|
* Extract insights and patterns from memories
|
|
259
487
|
*/
|
|
260
488
|
async extractInsights(params) {
|
|
261
|
-
const response = await this.httpClient.
|
|
489
|
+
const response = await this.httpClient.postEnhanced(
|
|
262
490
|
"/intelligence/extract-insights",
|
|
263
491
|
{
|
|
264
492
|
...params,
|
|
@@ -268,13 +496,18 @@ var MemoryIntelligenceClient = class {
|
|
|
268
496
|
if (response.error) {
|
|
269
497
|
throw new DatabaseError(`Failed to extract insights: ${response.error.message}`);
|
|
270
498
|
}
|
|
271
|
-
return
|
|
499
|
+
return {
|
|
500
|
+
data: response.data,
|
|
501
|
+
usage: response.usage,
|
|
502
|
+
tier_info: response.tier_info,
|
|
503
|
+
fromCache: response.fromCache
|
|
504
|
+
};
|
|
272
505
|
}
|
|
273
506
|
/**
|
|
274
507
|
* Check the health and organization quality of memories
|
|
275
508
|
*/
|
|
276
509
|
async healthCheck(params) {
|
|
277
|
-
const response = await this.httpClient.
|
|
510
|
+
const response = await this.httpClient.postEnhanced(
|
|
278
511
|
"/intelligence/health-check",
|
|
279
512
|
{
|
|
280
513
|
...params,
|
|
@@ -284,7 +517,12 @@ var MemoryIntelligenceClient = class {
|
|
|
284
517
|
if (response.error) {
|
|
285
518
|
throw new DatabaseError(`Failed to check health: ${response.error.message}`);
|
|
286
519
|
}
|
|
287
|
-
return
|
|
520
|
+
return {
|
|
521
|
+
data: response.data,
|
|
522
|
+
usage: response.usage,
|
|
523
|
+
tier_info: response.tier_info,
|
|
524
|
+
fromCache: response.fromCache
|
|
525
|
+
};
|
|
288
526
|
}
|
|
289
527
|
};
|
|
290
528
|
var ResponseFormat = {
|
|
@@ -322,7 +560,7 @@ function createMCPServer(config) {
|
|
|
322
560
|
const client = new MemoryIntelligenceClient(config);
|
|
323
561
|
const server = new mcp_js.McpServer({
|
|
324
562
|
name: "memory-intelligence-mcp-server",
|
|
325
|
-
version: "1.
|
|
563
|
+
version: "1.1.0"
|
|
326
564
|
});
|
|
327
565
|
server.registerTool(
|
|
328
566
|
"memory_analyze_patterns",
|
|
@@ -348,7 +586,8 @@ function createMCPServer(config) {
|
|
|
348
586
|
timeRangeDays: rawParams.time_range_days,
|
|
349
587
|
responseFormat: rawParams.response_format
|
|
350
588
|
};
|
|
351
|
-
const
|
|
589
|
+
const response = await client.analyzePatterns(params);
|
|
590
|
+
const analysis = response.data;
|
|
352
591
|
const responseText = formatResponse(
|
|
353
592
|
analysis,
|
|
354
593
|
params.responseFormat || "markdown",
|
|
@@ -438,7 +677,8 @@ function createMCPServer(config) {
|
|
|
438
677
|
includeExistingTags: rawParams.include_existing_tags,
|
|
439
678
|
responseFormat: rawParams.response_format
|
|
440
679
|
};
|
|
441
|
-
const
|
|
680
|
+
const response = await client.suggestTags(params);
|
|
681
|
+
const result = response.data;
|
|
442
682
|
const responseText = formatResponse(
|
|
443
683
|
result,
|
|
444
684
|
params.responseFormat || "markdown",
|
|
@@ -507,7 +747,8 @@ function createMCPServer(config) {
|
|
|
507
747
|
similarityThreshold: rawParams.similarity_threshold,
|
|
508
748
|
responseFormat: rawParams.response_format
|
|
509
749
|
};
|
|
510
|
-
const
|
|
750
|
+
const response = await client.findRelated(params);
|
|
751
|
+
const result = response.data;
|
|
511
752
|
const responseText = formatResponse(
|
|
512
753
|
result,
|
|
513
754
|
params.responseFormat || "markdown",
|
|
@@ -578,7 +819,8 @@ function createMCPServer(config) {
|
|
|
578
819
|
maxPairs: rawParams.max_pairs,
|
|
579
820
|
responseFormat: rawParams.response_format
|
|
580
821
|
};
|
|
581
|
-
const
|
|
822
|
+
const response = await client.detectDuplicates(params);
|
|
823
|
+
const result = response.data;
|
|
582
824
|
const responseText = formatResponse(
|
|
583
825
|
result,
|
|
584
826
|
params.responseFormat || "markdown",
|
|
@@ -651,7 +893,8 @@ function createMCPServer(config) {
|
|
|
651
893
|
maxMemories: rawParams.max_memories,
|
|
652
894
|
responseFormat: rawParams.response_format
|
|
653
895
|
};
|
|
654
|
-
const
|
|
896
|
+
const response = await client.extractInsights(params);
|
|
897
|
+
const result = response.data;
|
|
655
898
|
const responseText = formatResponse(
|
|
656
899
|
result,
|
|
657
900
|
params.responseFormat || "markdown",
|
|
@@ -672,14 +915,15 @@ ${data.summary}
|
|
|
672
915
|
`;
|
|
673
916
|
md += `## Insights
|
|
674
917
|
`;
|
|
918
|
+
const categoryIcons = {
|
|
919
|
+
pattern: "\u{1F504}",
|
|
920
|
+
learning: "\u{1F4A1}",
|
|
921
|
+
opportunity: "\u{1F680}",
|
|
922
|
+
risk: "\u26A0\uFE0F",
|
|
923
|
+
action_item: "\u2705"
|
|
924
|
+
};
|
|
675
925
|
for (const insight of data.insights) {
|
|
676
|
-
const icon = {
|
|
677
|
-
pattern: "\u{1F504}",
|
|
678
|
-
learning: "\u{1F4A1}",
|
|
679
|
-
opportunity: "\u{1F680}",
|
|
680
|
-
risk: "\u26A0\uFE0F",
|
|
681
|
-
action_item: "\u2705"
|
|
682
|
-
}[insight.category] || "\u{1F4CC}";
|
|
926
|
+
const icon = categoryIcons[insight.category] || "\u{1F4CC}";
|
|
683
927
|
md += `
|
|
684
928
|
### ${icon} ${insight.title}
|
|
685
929
|
`;
|
|
@@ -729,7 +973,8 @@ ${data.summary}
|
|
|
729
973
|
userId: rawParams.user_id,
|
|
730
974
|
responseFormat: rawParams.response_format
|
|
731
975
|
};
|
|
732
|
-
const
|
|
976
|
+
const response = await client.healthCheck(params);
|
|
977
|
+
const result = response.data;
|
|
733
978
|
const responseText = formatResponse(
|
|
734
979
|
result,
|
|
735
980
|
params.responseFormat || "markdown",
|