@superatomai/sdk-node 0.0.56 → 0.0.57
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.d.mts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +452 -111
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +452 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2359,10 +2359,30 @@ var BookmarksRequestMessageSchema = z3.object({
|
|
|
2359
2359
|
type: z3.literal("BOOKMARKS"),
|
|
2360
2360
|
payload: BookmarksRequestPayloadSchema
|
|
2361
2361
|
});
|
|
2362
|
+
var ArtifactsRequestPayloadSchema = z3.object({
|
|
2363
|
+
operation: z3.enum(["create", "update", "delete", "getAll", "getOne"]),
|
|
2364
|
+
data: z3.object({
|
|
2365
|
+
id: z3.number().optional(),
|
|
2366
|
+
name: z3.string().optional(),
|
|
2367
|
+
createdBy: z3.number().optional(),
|
|
2368
|
+
dsl: z3.record(z3.any()).optional(),
|
|
2369
|
+
status: z3.string().optional(),
|
|
2370
|
+
deleted: z3.boolean().optional(),
|
|
2371
|
+
limit: z3.number().optional()
|
|
2372
|
+
}).optional()
|
|
2373
|
+
});
|
|
2374
|
+
var ArtifactsRequestMessageSchema = z3.object({
|
|
2375
|
+
id: z3.string(),
|
|
2376
|
+
from: MessageParticipantSchema,
|
|
2377
|
+
type: z3.literal("ARTIFACTS"),
|
|
2378
|
+
payload: ArtifactsRequestPayloadSchema
|
|
2379
|
+
});
|
|
2380
|
+
var KbNodeTypeSchema = z3.enum(["global", "user", "query"]);
|
|
2362
2381
|
var KbNodesQueryFiltersSchema = z3.object({
|
|
2363
2382
|
query: z3.string().optional(),
|
|
2364
2383
|
category: z3.string().optional(),
|
|
2365
2384
|
tags: z3.array(z3.string()).optional(),
|
|
2385
|
+
type: KbNodeTypeSchema.optional(),
|
|
2366
2386
|
createdBy: z3.number().optional()
|
|
2367
2387
|
});
|
|
2368
2388
|
var KbNodesRequestPayloadSchema = z3.object({
|
|
@@ -2373,6 +2393,7 @@ var KbNodesRequestPayloadSchema = z3.object({
|
|
|
2373
2393
|
content: z3.string().optional(),
|
|
2374
2394
|
category: z3.string().optional(),
|
|
2375
2395
|
tags: z3.array(z3.string()).optional(),
|
|
2396
|
+
type: KbNodeTypeSchema.optional(),
|
|
2376
2397
|
createdBy: z3.number().optional(),
|
|
2377
2398
|
updatedBy: z3.number().optional(),
|
|
2378
2399
|
userId: z3.number().optional(),
|
|
@@ -5386,7 +5407,7 @@ var getKnowledgeBase = async ({
|
|
|
5386
5407
|
topK
|
|
5387
5408
|
});
|
|
5388
5409
|
if (!result || !result.content) {
|
|
5389
|
-
logger.
|
|
5410
|
+
logger.info("[KnowledgeBase] No knowledge base results returned");
|
|
5390
5411
|
return "";
|
|
5391
5412
|
}
|
|
5392
5413
|
logger.info(`[KnowledgeBase] Retrieved knowledge base context (${result.content.length} chars)`);
|
|
@@ -5400,8 +5421,101 @@ var getKnowledgeBase = async ({
|
|
|
5400
5421
|
return "";
|
|
5401
5422
|
}
|
|
5402
5423
|
};
|
|
5424
|
+
var getGlobalKnowledgeBase = async ({
|
|
5425
|
+
collections,
|
|
5426
|
+
limit = 100
|
|
5427
|
+
}) => {
|
|
5428
|
+
try {
|
|
5429
|
+
if (!collections || !collections["knowledge-base"] || !collections["knowledge-base"]["getGlobal"]) {
|
|
5430
|
+
logger.info("[KnowledgeBase] knowledge-base.getGlobal collection not registered, skipping");
|
|
5431
|
+
return "";
|
|
5432
|
+
}
|
|
5433
|
+
logger.info("[KnowledgeBase] Fetching global knowledge base nodes...");
|
|
5434
|
+
const result = await collections["knowledge-base"]["getGlobal"]({ limit });
|
|
5435
|
+
if (!result || !result.content) {
|
|
5436
|
+
logger.info("[KnowledgeBase] No global knowledge base nodes found");
|
|
5437
|
+
return "";
|
|
5438
|
+
}
|
|
5439
|
+
logger.info(`[KnowledgeBase] Retrieved ${result.count || 0} global knowledge base nodes`);
|
|
5440
|
+
return result.content;
|
|
5441
|
+
} catch (error) {
|
|
5442
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
5443
|
+
logger.warn(`[KnowledgeBase] Error fetching global knowledge base: ${errorMsg}`);
|
|
5444
|
+
return "";
|
|
5445
|
+
}
|
|
5446
|
+
};
|
|
5447
|
+
var getUserKnowledgeBase = async ({
|
|
5448
|
+
collections,
|
|
5449
|
+
userId,
|
|
5450
|
+
limit = 100
|
|
5451
|
+
}) => {
|
|
5452
|
+
try {
|
|
5453
|
+
if (!userId) {
|
|
5454
|
+
logger.info("[KnowledgeBase] No userId provided, skipping user knowledge base");
|
|
5455
|
+
return "";
|
|
5456
|
+
}
|
|
5457
|
+
if (!collections || !collections["knowledge-base"] || !collections["knowledge-base"]["getByUser"]) {
|
|
5458
|
+
logger.info("[KnowledgeBase] knowledge-base.getByUser collection not registered, skipping");
|
|
5459
|
+
return "";
|
|
5460
|
+
}
|
|
5461
|
+
logger.info(`[KnowledgeBase] Fetching user knowledge base nodes for userId: ${userId}...`);
|
|
5462
|
+
const result = await collections["knowledge-base"]["getByUser"]({
|
|
5463
|
+
userId: Number(userId),
|
|
5464
|
+
limit
|
|
5465
|
+
});
|
|
5466
|
+
if (!result || !result.content) {
|
|
5467
|
+
logger.info(`[KnowledgeBase] No user knowledge base nodes found for userId: ${userId}`);
|
|
5468
|
+
return "";
|
|
5469
|
+
}
|
|
5470
|
+
logger.info(`[KnowledgeBase] Retrieved ${result.count || 0} user knowledge base nodes for userId: ${userId}`);
|
|
5471
|
+
return result.content;
|
|
5472
|
+
} catch (error) {
|
|
5473
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
5474
|
+
logger.warn(`[KnowledgeBase] Error fetching user knowledge base: ${errorMsg}`);
|
|
5475
|
+
return "";
|
|
5476
|
+
}
|
|
5477
|
+
};
|
|
5478
|
+
var getAllKnowledgeBase = async ({
|
|
5479
|
+
prompt,
|
|
5480
|
+
collections,
|
|
5481
|
+
userId,
|
|
5482
|
+
topK = 3
|
|
5483
|
+
}) => {
|
|
5484
|
+
logger.info("[KnowledgeBase] Fetching all knowledge base contexts...");
|
|
5485
|
+
const [globalContext, userContext, queryContext] = await Promise.all([
|
|
5486
|
+
getGlobalKnowledgeBase({ collections }),
|
|
5487
|
+
getUserKnowledgeBase({ collections, userId }),
|
|
5488
|
+
getKnowledgeBase({ prompt, collections, topK })
|
|
5489
|
+
]);
|
|
5490
|
+
let combinedContext = "";
|
|
5491
|
+
if (globalContext) {
|
|
5492
|
+
combinedContext += "## Global Knowledge Base\n";
|
|
5493
|
+
combinedContext += "The following information applies to all queries:\n\n";
|
|
5494
|
+
combinedContext += globalContext + "\n\n";
|
|
5495
|
+
}
|
|
5496
|
+
if (userContext) {
|
|
5497
|
+
combinedContext += "## User-Specific Knowledge Base\n";
|
|
5498
|
+
combinedContext += "The following information is specific to this user:\n\n";
|
|
5499
|
+
combinedContext += userContext + "\n\n";
|
|
5500
|
+
}
|
|
5501
|
+
if (queryContext) {
|
|
5502
|
+
combinedContext += "## Relevant Knowledge Base (Query-Matched)\n";
|
|
5503
|
+
combinedContext += "The following information is semantically relevant to the current query:\n\n";
|
|
5504
|
+
combinedContext += queryContext + "\n\n";
|
|
5505
|
+
}
|
|
5506
|
+
logger.info(`[KnowledgeBase] Combined knowledge base context: global=${globalContext.length} chars, user=${userContext.length} chars, query=${queryContext.length} chars`);
|
|
5507
|
+
return {
|
|
5508
|
+
globalContext,
|
|
5509
|
+
userContext,
|
|
5510
|
+
queryContext,
|
|
5511
|
+
combinedContext: combinedContext.trim()
|
|
5512
|
+
};
|
|
5513
|
+
};
|
|
5403
5514
|
var KB = {
|
|
5404
|
-
getKnowledgeBase
|
|
5515
|
+
getKnowledgeBase,
|
|
5516
|
+
getGlobalKnowledgeBase,
|
|
5517
|
+
getUserKnowledgeBase,
|
|
5518
|
+
getAllKnowledgeBase
|
|
5405
5519
|
};
|
|
5406
5520
|
var knowledge_base_default = KB;
|
|
5407
5521
|
|
|
@@ -6264,8 +6378,9 @@ ${executedToolsText}`);
|
|
|
6264
6378
|
* @param components - Optional list of available components for matching suggestions
|
|
6265
6379
|
* @param externalTools - Optional array of external tools (email, calendar, etc.) that can be called
|
|
6266
6380
|
* @param category - Question category ('data_analysis' | 'data_modification' | 'general'). For data_modification, answer component streaming is skipped. For general, component generation is skipped entirely.
|
|
6381
|
+
* @param userId - Optional user ID for fetching user-specific knowledge base nodes
|
|
6267
6382
|
*/
|
|
6268
|
-
async generateTextResponse(userPrompt, apiKey, logCollector, conversationHistory, streamCallback, collections, components, externalTools, category) {
|
|
6383
|
+
async generateTextResponse(userPrompt, apiKey, logCollector, conversationHistory, streamCallback, collections, components, externalTools, category, userId) {
|
|
6269
6384
|
const errors = [];
|
|
6270
6385
|
logger.debug(`[${this.getProviderName()}] Starting text response generation`);
|
|
6271
6386
|
logger.debug(`[${this.getProviderName()}] User prompt: "${userPrompt.substring(0, 50)}..."`);
|
|
@@ -6314,11 +6429,13 @@ ${executedToolsText}`);
|
|
|
6314
6429
|
}
|
|
6315
6430
|
const schemaDoc = schema.generateSchemaDocumentation();
|
|
6316
6431
|
const databaseRules = await promptLoader.loadDatabaseRules();
|
|
6317
|
-
const
|
|
6432
|
+
const kbResult = await knowledge_base_default.getAllKnowledgeBase({
|
|
6318
6433
|
prompt: userPrompt,
|
|
6319
6434
|
collections,
|
|
6320
|
-
|
|
6435
|
+
userId,
|
|
6436
|
+
topK: 3
|
|
6321
6437
|
});
|
|
6438
|
+
const knowledgeBaseContext = kbResult.combinedContext;
|
|
6322
6439
|
const prompts = await promptLoader.loadPrompts("text-response", {
|
|
6323
6440
|
USER_PROMPT: userPrompt,
|
|
6324
6441
|
CONVERSATION_HISTORY: conversationHistory || "No previous conversation",
|
|
@@ -6444,26 +6561,48 @@ ${executedToolsText}`);
|
|
|
6444
6561
|
const executedToolsList = [];
|
|
6445
6562
|
let maxAttemptsReached = false;
|
|
6446
6563
|
let fullStreamedText = "";
|
|
6564
|
+
let streamBuffer = "";
|
|
6565
|
+
let flushTimer = null;
|
|
6566
|
+
const FLUSH_INTERVAL = 50;
|
|
6567
|
+
const flushStreamBuffer = () => {
|
|
6568
|
+
if (streamBuffer && streamCallback) {
|
|
6569
|
+
streamCallback(streamBuffer);
|
|
6570
|
+
streamBuffer = "";
|
|
6571
|
+
}
|
|
6572
|
+
flushTimer = null;
|
|
6573
|
+
};
|
|
6447
6574
|
const wrappedStreamCallback = streamCallback ? (chunk) => {
|
|
6448
6575
|
fullStreamedText += chunk;
|
|
6449
|
-
|
|
6576
|
+
streamBuffer += chunk;
|
|
6577
|
+
if (chunk.includes("\n") || chunk.length > 100) {
|
|
6578
|
+
if (flushTimer) {
|
|
6579
|
+
clearTimeout(flushTimer);
|
|
6580
|
+
flushTimer = null;
|
|
6581
|
+
}
|
|
6582
|
+
flushStreamBuffer();
|
|
6583
|
+
} else if (!flushTimer) {
|
|
6584
|
+
flushTimer = setTimeout(flushStreamBuffer, FLUSH_INTERVAL);
|
|
6585
|
+
}
|
|
6450
6586
|
} : void 0;
|
|
6587
|
+
const flushStream = () => {
|
|
6588
|
+
if (flushTimer) {
|
|
6589
|
+
clearTimeout(flushTimer);
|
|
6590
|
+
flushTimer = null;
|
|
6591
|
+
}
|
|
6592
|
+
flushStreamBuffer();
|
|
6593
|
+
};
|
|
6594
|
+
const streamDelay = (ms = 50) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
6451
6595
|
const withProgressHeartbeat = async (operation, progressMessage, intervalMs = 1e3) => {
|
|
6452
6596
|
if (!wrappedStreamCallback) {
|
|
6453
6597
|
return operation();
|
|
6454
6598
|
}
|
|
6455
6599
|
const startTime = Date.now();
|
|
6456
|
-
|
|
6457
|
-
const maxDots = 3;
|
|
6600
|
+
await streamDelay(30);
|
|
6458
6601
|
wrappedStreamCallback(`\u23F3 ${progressMessage}`);
|
|
6459
6602
|
const heartbeatInterval = setInterval(() => {
|
|
6460
6603
|
const elapsedSeconds = Math.floor((Date.now() - startTime) / 1e3);
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
if (elapsedSeconds >= 2) {
|
|
6464
|
-
wrappedStreamCallback(`${dots} (${elapsedSeconds}s)`);
|
|
6465
|
-
} else {
|
|
6466
|
-
wrappedStreamCallback(dots);
|
|
6604
|
+
if (elapsedSeconds >= 1) {
|
|
6605
|
+
wrappedStreamCallback(` (${elapsedSeconds}s)`);
|
|
6467
6606
|
}
|
|
6468
6607
|
}, intervalMs);
|
|
6469
6608
|
try {
|
|
@@ -6508,6 +6647,7 @@ Please try rephrasing your question or simplifying your request.
|
|
|
6508
6647
|
throw new Error(errorMsg);
|
|
6509
6648
|
}
|
|
6510
6649
|
try {
|
|
6650
|
+
flushStream();
|
|
6511
6651
|
if (wrappedStreamCallback) {
|
|
6512
6652
|
const paramsDisplay = Object.keys(params).length > 0 ? `
|
|
6513
6653
|
**Parameters:** ${JSON.stringify(params)}` : "";
|
|
@@ -6517,10 +6657,12 @@ Please try rephrasing your question or simplifying your request.
|
|
|
6517
6657
|
\u{1F50D} **Analyzing your question...**
|
|
6518
6658
|
|
|
6519
6659
|
`);
|
|
6660
|
+
await streamDelay(50);
|
|
6520
6661
|
if (reasoning) {
|
|
6521
6662
|
wrappedStreamCallback(`\u{1F4AD} ${reasoning}
|
|
6522
6663
|
|
|
6523
6664
|
`);
|
|
6665
|
+
await streamDelay(50);
|
|
6524
6666
|
}
|
|
6525
6667
|
wrappedStreamCallback(`\u{1F4DD} **Generated SQL Query:**
|
|
6526
6668
|
\`\`\`sql
|
|
@@ -6528,16 +6670,19 @@ ${sql}
|
|
|
6528
6670
|
\`\`\`${paramsDisplay}
|
|
6529
6671
|
|
|
6530
6672
|
`);
|
|
6673
|
+
await streamDelay(50);
|
|
6531
6674
|
} else {
|
|
6532
6675
|
wrappedStreamCallback(`
|
|
6533
6676
|
|
|
6534
6677
|
\u{1F504} **Retrying with corrected query (attempt ${attempts}/${MAX_QUERY_ATTEMPTS})...**
|
|
6535
6678
|
|
|
6536
6679
|
`);
|
|
6680
|
+
await streamDelay(50);
|
|
6537
6681
|
if (reasoning) {
|
|
6538
6682
|
wrappedStreamCallback(`\u{1F4AD} ${reasoning}
|
|
6539
6683
|
|
|
6540
6684
|
`);
|
|
6685
|
+
await streamDelay(50);
|
|
6541
6686
|
}
|
|
6542
6687
|
wrappedStreamCallback(`\u{1F4DD} **Corrected SQL Query:**
|
|
6543
6688
|
\`\`\`sql
|
|
@@ -6545,6 +6690,7 @@ ${sql}
|
|
|
6545
6690
|
\`\`\`${paramsDisplay}
|
|
6546
6691
|
|
|
6547
6692
|
`);
|
|
6693
|
+
await streamDelay(50);
|
|
6548
6694
|
}
|
|
6549
6695
|
}
|
|
6550
6696
|
logCollector?.logQuery(
|
|
@@ -6571,6 +6717,7 @@ ${sql}
|
|
|
6571
6717
|
\u2705 **Query executed successfully!**
|
|
6572
6718
|
|
|
6573
6719
|
`);
|
|
6720
|
+
await streamDelay(50);
|
|
6574
6721
|
if (Array.isArray(data) && data.length > 0) {
|
|
6575
6722
|
const firstRow = data[0];
|
|
6576
6723
|
const columns = Object.keys(firstRow);
|
|
@@ -6579,18 +6726,22 @@ ${sql}
|
|
|
6579
6726
|
wrappedStreamCallback(`**Result:** ${value}
|
|
6580
6727
|
|
|
6581
6728
|
`);
|
|
6729
|
+
await streamDelay(50);
|
|
6582
6730
|
} else if (data.length > 0) {
|
|
6583
6731
|
wrappedStreamCallback(`**Retrieved ${rowCount} rows**
|
|
6584
6732
|
|
|
6585
6733
|
`);
|
|
6734
|
+
await streamDelay(50);
|
|
6586
6735
|
wrappedStreamCallback(`<DataTable>${JSON.stringify(data)}</DataTable>
|
|
6587
6736
|
|
|
6588
6737
|
`);
|
|
6738
|
+
await streamDelay(50);
|
|
6589
6739
|
}
|
|
6590
6740
|
} else if (Array.isArray(data) && data.length === 0) {
|
|
6591
6741
|
wrappedStreamCallback(`**No rows returned.**
|
|
6592
6742
|
|
|
6593
6743
|
`);
|
|
6744
|
+
await streamDelay(50);
|
|
6594
6745
|
}
|
|
6595
6746
|
wrappedStreamCallback(`\u{1F4CA} **Analyzing results...**
|
|
6596
6747
|
|
|
@@ -6640,6 +6791,7 @@ Please try rephrasing your request or contact support.
|
|
|
6640
6791
|
throw new Error(errorMsg);
|
|
6641
6792
|
}
|
|
6642
6793
|
try {
|
|
6794
|
+
flushStream();
|
|
6643
6795
|
if (wrappedStreamCallback) {
|
|
6644
6796
|
if (attempts === 1) {
|
|
6645
6797
|
wrappedStreamCallback(`
|
|
@@ -6654,6 +6806,7 @@ Please try rephrasing your request or contact support.
|
|
|
6654
6806
|
|
|
6655
6807
|
`);
|
|
6656
6808
|
}
|
|
6809
|
+
await streamDelay(50);
|
|
6657
6810
|
}
|
|
6658
6811
|
const result2 = await withProgressHeartbeat(
|
|
6659
6812
|
() => externalTool.fn(toolInput),
|
|
@@ -6693,6 +6846,7 @@ Please try rephrasing your request or contact support.
|
|
|
6693
6846
|
wrappedStreamCallback(`\u2705 **${externalTool.name} completed successfully**
|
|
6694
6847
|
|
|
6695
6848
|
`);
|
|
6849
|
+
await streamDelay(50);
|
|
6696
6850
|
}
|
|
6697
6851
|
return JSON.stringify(result2, null, 2);
|
|
6698
6852
|
} catch (error) {
|
|
@@ -6761,6 +6915,7 @@ ${errorMsg}
|
|
|
6761
6915
|
textLength: textResponse.length
|
|
6762
6916
|
}
|
|
6763
6917
|
);
|
|
6918
|
+
flushStream();
|
|
6764
6919
|
if (wrappedStreamCallback && components && components.length > 0 && category !== "general") {
|
|
6765
6920
|
wrappedStreamCallback("\n\n\u{1F4CA} **Generating visualization components...**\n\n");
|
|
6766
6921
|
wrappedStreamCallback("__TEXT_COMPLETE__COMPONENT_GENERATION_START__");
|
|
@@ -7072,7 +7227,8 @@ ${errorMsg}
|
|
|
7072
7227
|
collections,
|
|
7073
7228
|
components,
|
|
7074
7229
|
toolsToUse,
|
|
7075
|
-
categoryClassification.category
|
|
7230
|
+
categoryClassification.category,
|
|
7231
|
+
userId
|
|
7076
7232
|
);
|
|
7077
7233
|
const elapsedTime = Date.now() - startTime;
|
|
7078
7234
|
logger.info(`[${this.getProviderName()}] Total time taken: ${elapsedTime}ms (${(elapsedTime / 1e3).toFixed(2)}s)`);
|
|
@@ -10145,6 +10301,182 @@ function sendResponse7(id, res, sendMessage, clientId) {
|
|
|
10145
10301
|
sendMessage(response);
|
|
10146
10302
|
}
|
|
10147
10303
|
|
|
10304
|
+
// src/handlers/artifacts.ts
|
|
10305
|
+
init_logger();
|
|
10306
|
+
async function handleArtifactsRequest(data, collections, sendMessage) {
|
|
10307
|
+
const executeCollection = async (collection, op, params) => {
|
|
10308
|
+
const handler = collections[collection]?.[op];
|
|
10309
|
+
if (!handler) {
|
|
10310
|
+
throw new Error(`Collection operation ${collection}.${op} not found`);
|
|
10311
|
+
}
|
|
10312
|
+
return await handler(params);
|
|
10313
|
+
};
|
|
10314
|
+
try {
|
|
10315
|
+
const request = ArtifactsRequestMessageSchema.parse(data);
|
|
10316
|
+
const { id, payload, from } = request;
|
|
10317
|
+
const { operation, data: requestData } = payload;
|
|
10318
|
+
const artifactId = requestData?.id;
|
|
10319
|
+
const name = requestData?.name;
|
|
10320
|
+
const createdBy = requestData?.createdBy;
|
|
10321
|
+
const dsl = requestData?.dsl;
|
|
10322
|
+
const status = requestData?.status;
|
|
10323
|
+
const deleted = requestData?.deleted;
|
|
10324
|
+
const limit = requestData?.limit;
|
|
10325
|
+
switch (operation) {
|
|
10326
|
+
case "create":
|
|
10327
|
+
await handleCreate6(id, name, createdBy, dsl, status, executeCollection, sendMessage, from.id);
|
|
10328
|
+
break;
|
|
10329
|
+
case "update":
|
|
10330
|
+
await handleUpdate6(id, artifactId, name, dsl, status, deleted, executeCollection, sendMessage, from.id);
|
|
10331
|
+
break;
|
|
10332
|
+
case "delete":
|
|
10333
|
+
await handleDelete6(id, artifactId, executeCollection, sendMessage, from.id);
|
|
10334
|
+
break;
|
|
10335
|
+
case "getAll":
|
|
10336
|
+
await handleGetAll6(id, limit, executeCollection, sendMessage, from.id);
|
|
10337
|
+
break;
|
|
10338
|
+
case "getOne":
|
|
10339
|
+
await handleGetOne6(id, artifactId, executeCollection, sendMessage, from.id);
|
|
10340
|
+
break;
|
|
10341
|
+
default:
|
|
10342
|
+
sendResponse8(id, {
|
|
10343
|
+
success: false,
|
|
10344
|
+
error: `Unknown operation: ${operation}`
|
|
10345
|
+
}, sendMessage, from.id);
|
|
10346
|
+
}
|
|
10347
|
+
} catch (error) {
|
|
10348
|
+
logger.error("Failed to handle artifacts request:", error);
|
|
10349
|
+
sendResponse8(null, {
|
|
10350
|
+
success: false,
|
|
10351
|
+
error: error instanceof Error ? error.message : "Unknown error occurred"
|
|
10352
|
+
}, sendMessage);
|
|
10353
|
+
}
|
|
10354
|
+
}
|
|
10355
|
+
async function handleCreate6(id, name, createdBy, dsl, status, executeCollection, sendMessage, clientId) {
|
|
10356
|
+
if (!name) {
|
|
10357
|
+
sendResponse8(id, {
|
|
10358
|
+
success: false,
|
|
10359
|
+
error: "name is required"
|
|
10360
|
+
}, sendMessage, clientId);
|
|
10361
|
+
return;
|
|
10362
|
+
}
|
|
10363
|
+
try {
|
|
10364
|
+
const result = await executeCollection("artifacts", "create", { name, createdBy, dsl, status });
|
|
10365
|
+
sendResponse8(id, {
|
|
10366
|
+
success: true,
|
|
10367
|
+
data: result.data,
|
|
10368
|
+
message: "Artifact created successfully"
|
|
10369
|
+
}, sendMessage, clientId);
|
|
10370
|
+
logger.info(`Artifact created: ID ${result.data.id}`);
|
|
10371
|
+
} catch (error) {
|
|
10372
|
+
sendResponse8(id, {
|
|
10373
|
+
success: false,
|
|
10374
|
+
error: error instanceof Error ? error.message : "Failed to create artifact"
|
|
10375
|
+
}, sendMessage, clientId);
|
|
10376
|
+
}
|
|
10377
|
+
}
|
|
10378
|
+
async function handleUpdate6(id, artifactId, name, dsl, status, deleted, executeCollection, sendMessage, clientId) {
|
|
10379
|
+
if (!artifactId) {
|
|
10380
|
+
sendResponse8(id, {
|
|
10381
|
+
success: false,
|
|
10382
|
+
error: "Artifact ID is required"
|
|
10383
|
+
}, sendMessage, clientId);
|
|
10384
|
+
return;
|
|
10385
|
+
}
|
|
10386
|
+
try {
|
|
10387
|
+
const result = await executeCollection("artifacts", "update", { id: artifactId, name, dsl, status, deleted });
|
|
10388
|
+
sendResponse8(id, {
|
|
10389
|
+
success: true,
|
|
10390
|
+
data: result.data,
|
|
10391
|
+
message: "Artifact updated successfully"
|
|
10392
|
+
}, sendMessage, clientId);
|
|
10393
|
+
logger.info(`Artifact updated: ID ${artifactId}`);
|
|
10394
|
+
} catch (error) {
|
|
10395
|
+
sendResponse8(id, {
|
|
10396
|
+
success: false,
|
|
10397
|
+
error: error instanceof Error ? error.message : "Failed to update artifact"
|
|
10398
|
+
}, sendMessage, clientId);
|
|
10399
|
+
}
|
|
10400
|
+
}
|
|
10401
|
+
async function handleDelete6(id, artifactId, executeCollection, sendMessage, clientId) {
|
|
10402
|
+
if (!artifactId) {
|
|
10403
|
+
sendResponse8(id, {
|
|
10404
|
+
success: false,
|
|
10405
|
+
error: "Artifact ID is required"
|
|
10406
|
+
}, sendMessage, clientId);
|
|
10407
|
+
return;
|
|
10408
|
+
}
|
|
10409
|
+
try {
|
|
10410
|
+
const result = await executeCollection("artifacts", "delete", { id: artifactId });
|
|
10411
|
+
sendResponse8(id, {
|
|
10412
|
+
success: true,
|
|
10413
|
+
data: result.data,
|
|
10414
|
+
message: "Artifact deleted successfully"
|
|
10415
|
+
}, sendMessage, clientId);
|
|
10416
|
+
logger.info(`Artifact deleted: ID ${artifactId}`);
|
|
10417
|
+
} catch (error) {
|
|
10418
|
+
sendResponse8(id, {
|
|
10419
|
+
success: false,
|
|
10420
|
+
error: error instanceof Error ? error.message : "Failed to delete artifact"
|
|
10421
|
+
}, sendMessage, clientId);
|
|
10422
|
+
}
|
|
10423
|
+
}
|
|
10424
|
+
async function handleGetAll6(id, limit, executeCollection, sendMessage, clientId) {
|
|
10425
|
+
try {
|
|
10426
|
+
const result = await executeCollection("artifacts", "getAll", { limit });
|
|
10427
|
+
sendResponse8(id, {
|
|
10428
|
+
success: true,
|
|
10429
|
+
data: result.data,
|
|
10430
|
+
count: result.count,
|
|
10431
|
+
message: `Retrieved ${result.count} artifacts`
|
|
10432
|
+
}, sendMessage, clientId);
|
|
10433
|
+
logger.info(`Retrieved all artifacts (count: ${result.count})`);
|
|
10434
|
+
} catch (error) {
|
|
10435
|
+
sendResponse8(id, {
|
|
10436
|
+
success: false,
|
|
10437
|
+
error: error instanceof Error ? error.message : "Failed to get artifacts"
|
|
10438
|
+
}, sendMessage, clientId);
|
|
10439
|
+
}
|
|
10440
|
+
}
|
|
10441
|
+
async function handleGetOne6(id, artifactId, executeCollection, sendMessage, clientId) {
|
|
10442
|
+
if (!artifactId) {
|
|
10443
|
+
sendResponse8(id, {
|
|
10444
|
+
success: false,
|
|
10445
|
+
error: "Artifact ID is required"
|
|
10446
|
+
}, sendMessage, clientId);
|
|
10447
|
+
return;
|
|
10448
|
+
}
|
|
10449
|
+
try {
|
|
10450
|
+
const result = await executeCollection("artifacts", "getOne", { id: artifactId });
|
|
10451
|
+
sendResponse8(id, {
|
|
10452
|
+
success: true,
|
|
10453
|
+
data: result.data,
|
|
10454
|
+
message: `Retrieved artifact ID ${artifactId}`
|
|
10455
|
+
}, sendMessage, clientId);
|
|
10456
|
+
logger.info(`Retrieved artifact: ID ${artifactId}`);
|
|
10457
|
+
} catch (error) {
|
|
10458
|
+
sendResponse8(id, {
|
|
10459
|
+
success: false,
|
|
10460
|
+
error: error instanceof Error ? error.message : "Failed to get artifact"
|
|
10461
|
+
}, sendMessage, clientId);
|
|
10462
|
+
}
|
|
10463
|
+
}
|
|
10464
|
+
function sendResponse8(id, res, sendMessage, clientId) {
|
|
10465
|
+
const response = {
|
|
10466
|
+
id: id || "unknown",
|
|
10467
|
+
type: "ARTIFACTS_RES",
|
|
10468
|
+
from: { type: "data-agent" },
|
|
10469
|
+
to: {
|
|
10470
|
+
type: "user",
|
|
10471
|
+
id: clientId
|
|
10472
|
+
},
|
|
10473
|
+
payload: {
|
|
10474
|
+
...res
|
|
10475
|
+
}
|
|
10476
|
+
};
|
|
10477
|
+
sendMessage(response);
|
|
10478
|
+
}
|
|
10479
|
+
|
|
10148
10480
|
// src/handlers/kb-nodes.ts
|
|
10149
10481
|
init_logger();
|
|
10150
10482
|
async function handleKbNodesRequest(data, collections, sendMessage) {
|
|
@@ -10164,6 +10496,7 @@ async function handleKbNodesRequest(data, collections, sendMessage) {
|
|
|
10164
10496
|
const content = requestData?.content;
|
|
10165
10497
|
const category = requestData?.category;
|
|
10166
10498
|
const tags = requestData?.tags;
|
|
10499
|
+
const type = requestData?.type;
|
|
10167
10500
|
const createdBy = requestData?.createdBy;
|
|
10168
10501
|
const updatedBy = requestData?.updatedBy;
|
|
10169
10502
|
const userId = requestData?.userId;
|
|
@@ -10173,22 +10506,22 @@ async function handleKbNodesRequest(data, collections, sendMessage) {
|
|
|
10173
10506
|
const offset = requestData?.offset;
|
|
10174
10507
|
switch (operation) {
|
|
10175
10508
|
case "create":
|
|
10176
|
-
await
|
|
10509
|
+
await handleCreate7(id, { title, content, category, tags, type, createdBy }, executeCollection, sendMessage, from.id);
|
|
10177
10510
|
break;
|
|
10178
10511
|
case "update":
|
|
10179
|
-
await
|
|
10512
|
+
await handleUpdate7(id, nodeId, { title, content, category, tags, type, updatedBy }, executeCollection, sendMessage, from.id);
|
|
10180
10513
|
break;
|
|
10181
10514
|
case "delete":
|
|
10182
|
-
await
|
|
10515
|
+
await handleDelete7(id, nodeId, executeCollection, sendMessage, from.id);
|
|
10183
10516
|
break;
|
|
10184
10517
|
case "getAll":
|
|
10185
|
-
await
|
|
10518
|
+
await handleGetAll7(id, limit, offset, executeCollection, sendMessage, from.id);
|
|
10186
10519
|
break;
|
|
10187
10520
|
case "getOne":
|
|
10188
|
-
await
|
|
10521
|
+
await handleGetOne7(id, nodeId, executeCollection, sendMessage, from.id);
|
|
10189
10522
|
break;
|
|
10190
10523
|
case "search":
|
|
10191
|
-
await handleSearch(id, { query, category, tags, createdBy, limit, offset }, executeCollection, sendMessage, from.id);
|
|
10524
|
+
await handleSearch(id, { query, category, tags, type, createdBy, limit, offset }, executeCollection, sendMessage, from.id);
|
|
10192
10525
|
break;
|
|
10193
10526
|
case "getByCategory":
|
|
10194
10527
|
await handleGetByCategory(id, category, limit, offset, executeCollection, sendMessage, from.id);
|
|
@@ -10203,37 +10536,37 @@ async function handleKbNodesRequest(data, collections, sendMessage) {
|
|
|
10203
10536
|
await handleGetTags(id, executeCollection, sendMessage, from.id);
|
|
10204
10537
|
break;
|
|
10205
10538
|
default:
|
|
10206
|
-
|
|
10539
|
+
sendResponse9(id, {
|
|
10207
10540
|
success: false,
|
|
10208
10541
|
error: `Unknown operation: ${operation}`
|
|
10209
10542
|
}, sendMessage, from.id);
|
|
10210
10543
|
}
|
|
10211
10544
|
} catch (error) {
|
|
10212
10545
|
logger.error("Failed to handle KB nodes request:", error);
|
|
10213
|
-
|
|
10546
|
+
sendResponse9(null, {
|
|
10214
10547
|
success: false,
|
|
10215
10548
|
error: error instanceof Error ? error.message : "Unknown error occurred"
|
|
10216
10549
|
}, sendMessage);
|
|
10217
10550
|
}
|
|
10218
10551
|
}
|
|
10219
|
-
async function
|
|
10220
|
-
const { title, content, category, tags, createdBy } = nodeData;
|
|
10552
|
+
async function handleCreate7(id, nodeData, executeCollection, sendMessage, clientId) {
|
|
10553
|
+
const { title, content, category, tags, type, createdBy } = nodeData;
|
|
10221
10554
|
if (!title || title.trim().length === 0) {
|
|
10222
|
-
|
|
10555
|
+
sendResponse9(id, {
|
|
10223
10556
|
success: false,
|
|
10224
10557
|
error: "Title is required and cannot be empty"
|
|
10225
10558
|
}, sendMessage, clientId);
|
|
10226
10559
|
return;
|
|
10227
10560
|
}
|
|
10228
10561
|
if (!content || content.trim().length === 0) {
|
|
10229
|
-
|
|
10562
|
+
sendResponse9(id, {
|
|
10230
10563
|
success: false,
|
|
10231
10564
|
error: "Content is required and cannot be empty"
|
|
10232
10565
|
}, sendMessage, clientId);
|
|
10233
10566
|
return;
|
|
10234
10567
|
}
|
|
10235
10568
|
if (!createdBy) {
|
|
10236
|
-
|
|
10569
|
+
sendResponse9(id, {
|
|
10237
10570
|
success: false,
|
|
10238
10571
|
error: "createdBy (user ID) is required"
|
|
10239
10572
|
}, sendMessage, clientId);
|
|
@@ -10245,11 +10578,12 @@ async function handleCreate6(id, nodeData, executeCollection, sendMessage, clien
|
|
|
10245
10578
|
content,
|
|
10246
10579
|
category: category || void 0,
|
|
10247
10580
|
tags: tags || void 0,
|
|
10581
|
+
type: type || "query",
|
|
10248
10582
|
createdBy
|
|
10249
10583
|
});
|
|
10250
10584
|
if (result && result.success) {
|
|
10251
10585
|
logger.info(`[DB] KB node created successfully: ${title}`);
|
|
10252
|
-
|
|
10586
|
+
sendResponse9(id, {
|
|
10253
10587
|
success: true,
|
|
10254
10588
|
data: {
|
|
10255
10589
|
...result.data,
|
|
@@ -10258,29 +10592,29 @@ async function handleCreate6(id, nodeData, executeCollection, sendMessage, clien
|
|
|
10258
10592
|
}, sendMessage, clientId);
|
|
10259
10593
|
return;
|
|
10260
10594
|
}
|
|
10261
|
-
|
|
10595
|
+
sendResponse9(id, {
|
|
10262
10596
|
success: false,
|
|
10263
10597
|
error: "Failed to create knowledge node"
|
|
10264
10598
|
}, sendMessage, clientId);
|
|
10265
10599
|
} catch (error) {
|
|
10266
10600
|
logger.error("[DB] Failed to create KB node:", error);
|
|
10267
|
-
|
|
10601
|
+
sendResponse9(id, {
|
|
10268
10602
|
success: false,
|
|
10269
10603
|
error: error instanceof Error ? error.message : "Failed to create knowledge node"
|
|
10270
10604
|
}, sendMessage, clientId);
|
|
10271
10605
|
}
|
|
10272
10606
|
}
|
|
10273
|
-
async function
|
|
10274
|
-
const { title, content, category, tags, updatedBy } = nodeData;
|
|
10607
|
+
async function handleUpdate7(id, nodeId, nodeData, executeCollection, sendMessage, clientId) {
|
|
10608
|
+
const { title, content, category, tags, type, updatedBy } = nodeData;
|
|
10275
10609
|
if (!nodeId) {
|
|
10276
|
-
|
|
10610
|
+
sendResponse9(id, {
|
|
10277
10611
|
success: false,
|
|
10278
10612
|
error: "Knowledge node ID is required"
|
|
10279
10613
|
}, sendMessage, clientId);
|
|
10280
10614
|
return;
|
|
10281
10615
|
}
|
|
10282
10616
|
if (!updatedBy) {
|
|
10283
|
-
|
|
10617
|
+
sendResponse9(id, {
|
|
10284
10618
|
success: false,
|
|
10285
10619
|
error: "updatedBy (user ID) is required"
|
|
10286
10620
|
}, sendMessage, clientId);
|
|
@@ -10293,11 +10627,12 @@ async function handleUpdate6(id, nodeId, nodeData, executeCollection, sendMessag
|
|
|
10293
10627
|
content,
|
|
10294
10628
|
category,
|
|
10295
10629
|
tags,
|
|
10630
|
+
type,
|
|
10296
10631
|
updatedBy
|
|
10297
10632
|
});
|
|
10298
10633
|
if (result && result.success) {
|
|
10299
10634
|
logger.info(`[DB] KB node updated successfully, ID: ${nodeId}`);
|
|
10300
|
-
|
|
10635
|
+
sendResponse9(id, {
|
|
10301
10636
|
success: true,
|
|
10302
10637
|
data: {
|
|
10303
10638
|
...result.data,
|
|
@@ -10306,21 +10641,21 @@ async function handleUpdate6(id, nodeId, nodeData, executeCollection, sendMessag
|
|
|
10306
10641
|
}, sendMessage, clientId);
|
|
10307
10642
|
return;
|
|
10308
10643
|
}
|
|
10309
|
-
|
|
10644
|
+
sendResponse9(id, {
|
|
10310
10645
|
success: false,
|
|
10311
10646
|
error: "Failed to update knowledge node"
|
|
10312
10647
|
}, sendMessage, clientId);
|
|
10313
10648
|
} catch (error) {
|
|
10314
10649
|
logger.error("[DB] Failed to update KB node:", error);
|
|
10315
|
-
|
|
10650
|
+
sendResponse9(id, {
|
|
10316
10651
|
success: false,
|
|
10317
10652
|
error: error instanceof Error ? error.message : "Failed to update knowledge node"
|
|
10318
10653
|
}, sendMessage, clientId);
|
|
10319
10654
|
}
|
|
10320
10655
|
}
|
|
10321
|
-
async function
|
|
10656
|
+
async function handleDelete7(id, nodeId, executeCollection, sendMessage, clientId) {
|
|
10322
10657
|
if (!nodeId) {
|
|
10323
|
-
|
|
10658
|
+
sendResponse9(id, {
|
|
10324
10659
|
success: false,
|
|
10325
10660
|
error: "Knowledge node ID is required"
|
|
10326
10661
|
}, sendMessage, clientId);
|
|
@@ -10330,7 +10665,7 @@ async function handleDelete6(id, nodeId, executeCollection, sendMessage, clientI
|
|
|
10330
10665
|
const result = await executeCollection("kbNodes", "delete", { id: nodeId });
|
|
10331
10666
|
if (result && result.success) {
|
|
10332
10667
|
logger.info(`[DB] KB node deleted successfully, ID: ${nodeId}`);
|
|
10333
|
-
|
|
10668
|
+
sendResponse9(id, {
|
|
10334
10669
|
success: true,
|
|
10335
10670
|
data: {
|
|
10336
10671
|
id: nodeId,
|
|
@@ -10340,19 +10675,19 @@ async function handleDelete6(id, nodeId, executeCollection, sendMessage, clientI
|
|
|
10340
10675
|
}, sendMessage, clientId);
|
|
10341
10676
|
return;
|
|
10342
10677
|
}
|
|
10343
|
-
|
|
10678
|
+
sendResponse9(id, {
|
|
10344
10679
|
success: false,
|
|
10345
10680
|
error: "Failed to delete knowledge node"
|
|
10346
10681
|
}, sendMessage, clientId);
|
|
10347
10682
|
} catch (error) {
|
|
10348
10683
|
logger.error("[DB] Failed to delete KB node:", error);
|
|
10349
|
-
|
|
10684
|
+
sendResponse9(id, {
|
|
10350
10685
|
success: false,
|
|
10351
10686
|
error: error instanceof Error ? error.message : "Failed to delete knowledge node"
|
|
10352
10687
|
}, sendMessage, clientId);
|
|
10353
10688
|
}
|
|
10354
10689
|
}
|
|
10355
|
-
async function
|
|
10690
|
+
async function handleGetAll7(id, limit, offset, executeCollection, sendMessage, clientId) {
|
|
10356
10691
|
try {
|
|
10357
10692
|
const result = await executeCollection("kbNodes", "getAll", {
|
|
10358
10693
|
limit: limit || 100,
|
|
@@ -10360,7 +10695,7 @@ async function handleGetAll6(id, limit, offset, executeCollection, sendMessage,
|
|
|
10360
10695
|
});
|
|
10361
10696
|
if (result && result.success) {
|
|
10362
10697
|
logger.info(`[DB] Retrieved ${result.count} KB nodes`);
|
|
10363
|
-
|
|
10698
|
+
sendResponse9(id, {
|
|
10364
10699
|
success: true,
|
|
10365
10700
|
data: {
|
|
10366
10701
|
nodes: result.data,
|
|
@@ -10370,21 +10705,21 @@ async function handleGetAll6(id, limit, offset, executeCollection, sendMessage,
|
|
|
10370
10705
|
}, sendMessage, clientId);
|
|
10371
10706
|
return;
|
|
10372
10707
|
}
|
|
10373
|
-
|
|
10708
|
+
sendResponse9(id, {
|
|
10374
10709
|
success: false,
|
|
10375
10710
|
error: "Failed to retrieve knowledge nodes"
|
|
10376
10711
|
}, sendMessage, clientId);
|
|
10377
10712
|
} catch (error) {
|
|
10378
10713
|
logger.error("[DB] Failed to get all KB nodes:", error);
|
|
10379
|
-
|
|
10714
|
+
sendResponse9(id, {
|
|
10380
10715
|
success: false,
|
|
10381
10716
|
error: error instanceof Error ? error.message : "Failed to retrieve knowledge nodes"
|
|
10382
10717
|
}, sendMessage, clientId);
|
|
10383
10718
|
}
|
|
10384
10719
|
}
|
|
10385
|
-
async function
|
|
10720
|
+
async function handleGetOne7(id, nodeId, executeCollection, sendMessage, clientId) {
|
|
10386
10721
|
if (!nodeId) {
|
|
10387
|
-
|
|
10722
|
+
sendResponse9(id, {
|
|
10388
10723
|
success: false,
|
|
10389
10724
|
error: "Knowledge node ID is required"
|
|
10390
10725
|
}, sendMessage, clientId);
|
|
@@ -10394,7 +10729,7 @@ async function handleGetOne6(id, nodeId, executeCollection, sendMessage, clientI
|
|
|
10394
10729
|
const result = await executeCollection("kbNodes", "getOne", { id: nodeId });
|
|
10395
10730
|
if (result && result.success) {
|
|
10396
10731
|
logger.info(`[DB] Retrieved KB node ID: ${nodeId}`);
|
|
10397
|
-
|
|
10732
|
+
sendResponse9(id, {
|
|
10398
10733
|
success: true,
|
|
10399
10734
|
data: {
|
|
10400
10735
|
node: result.data,
|
|
@@ -10403,32 +10738,33 @@ async function handleGetOne6(id, nodeId, executeCollection, sendMessage, clientI
|
|
|
10403
10738
|
}, sendMessage, clientId);
|
|
10404
10739
|
return;
|
|
10405
10740
|
}
|
|
10406
|
-
|
|
10741
|
+
sendResponse9(id, {
|
|
10407
10742
|
success: false,
|
|
10408
10743
|
error: "Failed to retrieve knowledge node"
|
|
10409
10744
|
}, sendMessage, clientId);
|
|
10410
10745
|
} catch (error) {
|
|
10411
10746
|
logger.error("[DB] Failed to get KB node:", error);
|
|
10412
|
-
|
|
10747
|
+
sendResponse9(id, {
|
|
10413
10748
|
success: false,
|
|
10414
10749
|
error: error instanceof Error ? error.message : "Failed to retrieve knowledge node"
|
|
10415
10750
|
}, sendMessage, clientId);
|
|
10416
10751
|
}
|
|
10417
10752
|
}
|
|
10418
10753
|
async function handleSearch(id, searchParams, executeCollection, sendMessage, clientId) {
|
|
10419
|
-
const { query, category, tags, createdBy, limit, offset } = searchParams;
|
|
10754
|
+
const { query, category, tags, type, createdBy, limit, offset } = searchParams;
|
|
10420
10755
|
try {
|
|
10421
10756
|
const result = await executeCollection("kbNodes", "search", {
|
|
10422
10757
|
query,
|
|
10423
10758
|
category,
|
|
10424
10759
|
tags,
|
|
10760
|
+
type,
|
|
10425
10761
|
createdBy,
|
|
10426
10762
|
limit: limit || 50,
|
|
10427
10763
|
offset: offset || 0
|
|
10428
10764
|
});
|
|
10429
10765
|
if (result && result.success) {
|
|
10430
10766
|
logger.info(`[DB] Search returned ${result.count} KB nodes`);
|
|
10431
|
-
|
|
10767
|
+
sendResponse9(id, {
|
|
10432
10768
|
success: true,
|
|
10433
10769
|
data: {
|
|
10434
10770
|
nodes: result.data,
|
|
@@ -10438,13 +10774,13 @@ async function handleSearch(id, searchParams, executeCollection, sendMessage, cl
|
|
|
10438
10774
|
}, sendMessage, clientId);
|
|
10439
10775
|
return;
|
|
10440
10776
|
}
|
|
10441
|
-
|
|
10777
|
+
sendResponse9(id, {
|
|
10442
10778
|
success: false,
|
|
10443
10779
|
error: "Failed to search knowledge nodes"
|
|
10444
10780
|
}, sendMessage, clientId);
|
|
10445
10781
|
} catch (error) {
|
|
10446
10782
|
logger.error("[DB] Failed to search KB nodes:", error);
|
|
10447
|
-
|
|
10783
|
+
sendResponse9(id, {
|
|
10448
10784
|
success: false,
|
|
10449
10785
|
error: error instanceof Error ? error.message : "Failed to search knowledge nodes"
|
|
10450
10786
|
}, sendMessage, clientId);
|
|
@@ -10452,7 +10788,7 @@ async function handleSearch(id, searchParams, executeCollection, sendMessage, cl
|
|
|
10452
10788
|
}
|
|
10453
10789
|
async function handleGetByCategory(id, category, limit, offset, executeCollection, sendMessage, clientId) {
|
|
10454
10790
|
if (!category) {
|
|
10455
|
-
|
|
10791
|
+
sendResponse9(id, {
|
|
10456
10792
|
success: false,
|
|
10457
10793
|
error: "Category is required"
|
|
10458
10794
|
}, sendMessage, clientId);
|
|
@@ -10466,7 +10802,7 @@ async function handleGetByCategory(id, category, limit, offset, executeCollectio
|
|
|
10466
10802
|
});
|
|
10467
10803
|
if (result && result.success) {
|
|
10468
10804
|
logger.info(`[DB] Retrieved ${result.count} KB nodes for category: ${category}`);
|
|
10469
|
-
|
|
10805
|
+
sendResponse9(id, {
|
|
10470
10806
|
success: true,
|
|
10471
10807
|
data: {
|
|
10472
10808
|
nodes: result.data,
|
|
@@ -10477,13 +10813,13 @@ async function handleGetByCategory(id, category, limit, offset, executeCollectio
|
|
|
10477
10813
|
}, sendMessage, clientId);
|
|
10478
10814
|
return;
|
|
10479
10815
|
}
|
|
10480
|
-
|
|
10816
|
+
sendResponse9(id, {
|
|
10481
10817
|
success: false,
|
|
10482
10818
|
error: "Failed to retrieve knowledge nodes by category"
|
|
10483
10819
|
}, sendMessage, clientId);
|
|
10484
10820
|
} catch (error) {
|
|
10485
10821
|
logger.error("[DB] Failed to get KB nodes by category:", error);
|
|
10486
|
-
|
|
10822
|
+
sendResponse9(id, {
|
|
10487
10823
|
success: false,
|
|
10488
10824
|
error: error instanceof Error ? error.message : "Failed to retrieve knowledge nodes by category"
|
|
10489
10825
|
}, sendMessage, clientId);
|
|
@@ -10491,7 +10827,7 @@ async function handleGetByCategory(id, category, limit, offset, executeCollectio
|
|
|
10491
10827
|
}
|
|
10492
10828
|
async function handleGetByUser(id, userId, limit, offset, executeCollection, sendMessage, clientId) {
|
|
10493
10829
|
if (!userId) {
|
|
10494
|
-
|
|
10830
|
+
sendResponse9(id, {
|
|
10495
10831
|
success: false,
|
|
10496
10832
|
error: "User ID is required"
|
|
10497
10833
|
}, sendMessage, clientId);
|
|
@@ -10505,7 +10841,7 @@ async function handleGetByUser(id, userId, limit, offset, executeCollection, sen
|
|
|
10505
10841
|
});
|
|
10506
10842
|
if (result && result.success) {
|
|
10507
10843
|
logger.info(`[DB] Retrieved ${result.count} KB nodes for user: ${userId}`);
|
|
10508
|
-
|
|
10844
|
+
sendResponse9(id, {
|
|
10509
10845
|
success: true,
|
|
10510
10846
|
data: {
|
|
10511
10847
|
nodes: result.data,
|
|
@@ -10516,13 +10852,13 @@ async function handleGetByUser(id, userId, limit, offset, executeCollection, sen
|
|
|
10516
10852
|
}, sendMessage, clientId);
|
|
10517
10853
|
return;
|
|
10518
10854
|
}
|
|
10519
|
-
|
|
10855
|
+
sendResponse9(id, {
|
|
10520
10856
|
success: false,
|
|
10521
10857
|
error: "Failed to retrieve knowledge nodes by user"
|
|
10522
10858
|
}, sendMessage, clientId);
|
|
10523
10859
|
} catch (error) {
|
|
10524
10860
|
logger.error("[DB] Failed to get KB nodes by user:", error);
|
|
10525
|
-
|
|
10861
|
+
sendResponse9(id, {
|
|
10526
10862
|
success: false,
|
|
10527
10863
|
error: error instanceof Error ? error.message : "Failed to retrieve knowledge nodes by user"
|
|
10528
10864
|
}, sendMessage, clientId);
|
|
@@ -10533,7 +10869,7 @@ async function handleGetCategories(id, executeCollection, sendMessage, clientId)
|
|
|
10533
10869
|
const result = await executeCollection("kbNodes", "getCategories", {});
|
|
10534
10870
|
if (result && result.success) {
|
|
10535
10871
|
logger.info(`[DB] Retrieved ${result.count} categories`);
|
|
10536
|
-
|
|
10872
|
+
sendResponse9(id, {
|
|
10537
10873
|
success: true,
|
|
10538
10874
|
data: {
|
|
10539
10875
|
categories: result.data,
|
|
@@ -10543,13 +10879,13 @@ async function handleGetCategories(id, executeCollection, sendMessage, clientId)
|
|
|
10543
10879
|
}, sendMessage, clientId);
|
|
10544
10880
|
return;
|
|
10545
10881
|
}
|
|
10546
|
-
|
|
10882
|
+
sendResponse9(id, {
|
|
10547
10883
|
success: false,
|
|
10548
10884
|
error: "Failed to retrieve categories"
|
|
10549
10885
|
}, sendMessage, clientId);
|
|
10550
10886
|
} catch (error) {
|
|
10551
10887
|
logger.error("[DB] Failed to get categories:", error);
|
|
10552
|
-
|
|
10888
|
+
sendResponse9(id, {
|
|
10553
10889
|
success: false,
|
|
10554
10890
|
error: error instanceof Error ? error.message : "Failed to retrieve categories"
|
|
10555
10891
|
}, sendMessage, clientId);
|
|
@@ -10560,7 +10896,7 @@ async function handleGetTags(id, executeCollection, sendMessage, clientId) {
|
|
|
10560
10896
|
const result = await executeCollection("kbNodes", "getTags", {});
|
|
10561
10897
|
if (result && result.success) {
|
|
10562
10898
|
logger.info(`[DB] Retrieved ${result.count} tags`);
|
|
10563
|
-
|
|
10899
|
+
sendResponse9(id, {
|
|
10564
10900
|
success: true,
|
|
10565
10901
|
data: {
|
|
10566
10902
|
tags: result.data,
|
|
@@ -10570,19 +10906,19 @@ async function handleGetTags(id, executeCollection, sendMessage, clientId) {
|
|
|
10570
10906
|
}, sendMessage, clientId);
|
|
10571
10907
|
return;
|
|
10572
10908
|
}
|
|
10573
|
-
|
|
10909
|
+
sendResponse9(id, {
|
|
10574
10910
|
success: false,
|
|
10575
10911
|
error: "Failed to retrieve tags"
|
|
10576
10912
|
}, sendMessage, clientId);
|
|
10577
10913
|
} catch (error) {
|
|
10578
10914
|
logger.error("[DB] Failed to get tags:", error);
|
|
10579
|
-
|
|
10915
|
+
sendResponse9(id, {
|
|
10580
10916
|
success: false,
|
|
10581
10917
|
error: error instanceof Error ? error.message : "Failed to retrieve tags"
|
|
10582
10918
|
}, sendMessage, clientId);
|
|
10583
10919
|
}
|
|
10584
10920
|
}
|
|
10585
|
-
function
|
|
10921
|
+
function sendResponse9(id, res, sendMessage, clientId) {
|
|
10586
10922
|
const response = {
|
|
10587
10923
|
id: id || "unknown",
|
|
10588
10924
|
type: "KB_NODES_RES",
|
|
@@ -10627,19 +10963,19 @@ async function handleMenusRequest(data, collections, sendMessage) {
|
|
|
10627
10963
|
const items = requestData?.items;
|
|
10628
10964
|
switch (operation) {
|
|
10629
10965
|
case "create":
|
|
10630
|
-
await
|
|
10966
|
+
await handleCreate8(id, name, componentName, icon, userMessage, parentId, sortOrder, props, isActive, executeCollection, sendMessage, from.id);
|
|
10631
10967
|
break;
|
|
10632
10968
|
case "update":
|
|
10633
|
-
await
|
|
10969
|
+
await handleUpdate8(id, menuId, name, componentName, icon, userMessage, parentId, sortOrder, props, isActive, executeCollection, sendMessage, from.id);
|
|
10634
10970
|
break;
|
|
10635
10971
|
case "delete":
|
|
10636
|
-
await
|
|
10972
|
+
await handleDelete8(id, menuId, executeCollection, sendMessage, from.id);
|
|
10637
10973
|
break;
|
|
10638
10974
|
case "getAll":
|
|
10639
|
-
await
|
|
10975
|
+
await handleGetAll8(id, executeCollection, sendMessage, from.id);
|
|
10640
10976
|
break;
|
|
10641
10977
|
case "getOne":
|
|
10642
|
-
await
|
|
10978
|
+
await handleGetOne8(id, menuId, executeCollection, sendMessage, from.id);
|
|
10643
10979
|
break;
|
|
10644
10980
|
case "getRootMenus":
|
|
10645
10981
|
await handleGetRootMenus(id, executeCollection, sendMessage, from.id);
|
|
@@ -10657,29 +10993,29 @@ async function handleMenusRequest(data, collections, sendMessage) {
|
|
|
10657
10993
|
await handleReorder(id, items, executeCollection, sendMessage, from.id);
|
|
10658
10994
|
break;
|
|
10659
10995
|
default:
|
|
10660
|
-
|
|
10996
|
+
sendResponse10(id, {
|
|
10661
10997
|
success: false,
|
|
10662
10998
|
error: `Unknown operation: ${operation}`
|
|
10663
10999
|
}, sendMessage, from.id);
|
|
10664
11000
|
}
|
|
10665
11001
|
} catch (error) {
|
|
10666
11002
|
logger.error("Failed to handle menus request:", error);
|
|
10667
|
-
|
|
11003
|
+
sendResponse10(null, {
|
|
10668
11004
|
success: false,
|
|
10669
11005
|
error: error instanceof Error ? error.message : "Unknown error occurred"
|
|
10670
11006
|
}, sendMessage);
|
|
10671
11007
|
}
|
|
10672
11008
|
}
|
|
10673
|
-
async function
|
|
11009
|
+
async function handleCreate8(id, name, componentName, icon, userMessage, parentId, sortOrder, props, isActive, executeCollection, sendMessage, clientId) {
|
|
10674
11010
|
if (!name) {
|
|
10675
|
-
|
|
11011
|
+
sendResponse10(id, {
|
|
10676
11012
|
success: false,
|
|
10677
11013
|
error: "name is required"
|
|
10678
11014
|
}, sendMessage, clientId);
|
|
10679
11015
|
return;
|
|
10680
11016
|
}
|
|
10681
11017
|
if (!componentName) {
|
|
10682
|
-
|
|
11018
|
+
sendResponse10(id, {
|
|
10683
11019
|
success: false,
|
|
10684
11020
|
error: "componentName is required"
|
|
10685
11021
|
}, sendMessage, clientId);
|
|
@@ -10696,22 +11032,22 @@ async function handleCreate7(id, name, componentName, icon, userMessage, parentI
|
|
|
10696
11032
|
props,
|
|
10697
11033
|
isActive
|
|
10698
11034
|
});
|
|
10699
|
-
|
|
11035
|
+
sendResponse10(id, {
|
|
10700
11036
|
success: true,
|
|
10701
11037
|
data: result.data,
|
|
10702
11038
|
message: "Menu created successfully"
|
|
10703
11039
|
}, sendMessage, clientId);
|
|
10704
11040
|
logger.info(`Menu created: ID ${result.data?.id}`);
|
|
10705
11041
|
} catch (error) {
|
|
10706
|
-
|
|
11042
|
+
sendResponse10(id, {
|
|
10707
11043
|
success: false,
|
|
10708
11044
|
error: error instanceof Error ? error.message : "Failed to create menu"
|
|
10709
11045
|
}, sendMessage, clientId);
|
|
10710
11046
|
}
|
|
10711
11047
|
}
|
|
10712
|
-
async function
|
|
11048
|
+
async function handleUpdate8(id, menuId, name, componentName, icon, userMessage, parentId, sortOrder, props, isActive, executeCollection, sendMessage, clientId) {
|
|
10713
11049
|
if (!menuId) {
|
|
10714
|
-
|
|
11050
|
+
sendResponse10(id, {
|
|
10715
11051
|
success: false,
|
|
10716
11052
|
error: "Menu ID is required"
|
|
10717
11053
|
}, sendMessage, clientId);
|
|
@@ -10729,22 +11065,22 @@ async function handleUpdate7(id, menuId, name, componentName, icon, userMessage,
|
|
|
10729
11065
|
props,
|
|
10730
11066
|
isActive
|
|
10731
11067
|
});
|
|
10732
|
-
|
|
11068
|
+
sendResponse10(id, {
|
|
10733
11069
|
success: true,
|
|
10734
11070
|
data: result.data,
|
|
10735
11071
|
message: "Menu updated successfully"
|
|
10736
11072
|
}, sendMessage, clientId);
|
|
10737
11073
|
logger.info(`Menu updated: ID ${menuId}`);
|
|
10738
11074
|
} catch (error) {
|
|
10739
|
-
|
|
11075
|
+
sendResponse10(id, {
|
|
10740
11076
|
success: false,
|
|
10741
11077
|
error: error instanceof Error ? error.message : "Failed to update menu"
|
|
10742
11078
|
}, sendMessage, clientId);
|
|
10743
11079
|
}
|
|
10744
11080
|
}
|
|
10745
|
-
async function
|
|
11081
|
+
async function handleDelete8(id, menuId, executeCollection, sendMessage, clientId) {
|
|
10746
11082
|
if (!menuId) {
|
|
10747
|
-
|
|
11083
|
+
sendResponse10(id, {
|
|
10748
11084
|
success: false,
|
|
10749
11085
|
error: "Menu ID is required"
|
|
10750
11086
|
}, sendMessage, clientId);
|
|
@@ -10752,23 +11088,23 @@ async function handleDelete7(id, menuId, executeCollection, sendMessage, clientI
|
|
|
10752
11088
|
}
|
|
10753
11089
|
try {
|
|
10754
11090
|
const result = await executeCollection("menus", "delete", { id: menuId });
|
|
10755
|
-
|
|
11091
|
+
sendResponse10(id, {
|
|
10756
11092
|
success: true,
|
|
10757
11093
|
data: result.data,
|
|
10758
11094
|
message: "Menu deleted successfully"
|
|
10759
11095
|
}, sendMessage, clientId);
|
|
10760
11096
|
logger.info(`Menu deleted: ID ${menuId}`);
|
|
10761
11097
|
} catch (error) {
|
|
10762
|
-
|
|
11098
|
+
sendResponse10(id, {
|
|
10763
11099
|
success: false,
|
|
10764
11100
|
error: error instanceof Error ? error.message : "Failed to delete menu"
|
|
10765
11101
|
}, sendMessage, clientId);
|
|
10766
11102
|
}
|
|
10767
11103
|
}
|
|
10768
|
-
async function
|
|
11104
|
+
async function handleGetAll8(id, executeCollection, sendMessage, clientId) {
|
|
10769
11105
|
try {
|
|
10770
11106
|
const result = await executeCollection("menus", "getAll", {});
|
|
10771
|
-
|
|
11107
|
+
sendResponse10(id, {
|
|
10772
11108
|
success: true,
|
|
10773
11109
|
data: result.data,
|
|
10774
11110
|
count: result.count,
|
|
@@ -10776,15 +11112,15 @@ async function handleGetAll7(id, executeCollection, sendMessage, clientId) {
|
|
|
10776
11112
|
}, sendMessage, clientId);
|
|
10777
11113
|
logger.info(`Retrieved all menus (count: ${result.count})`);
|
|
10778
11114
|
} catch (error) {
|
|
10779
|
-
|
|
11115
|
+
sendResponse10(id, {
|
|
10780
11116
|
success: false,
|
|
10781
11117
|
error: error instanceof Error ? error.message : "Failed to get menus"
|
|
10782
11118
|
}, sendMessage, clientId);
|
|
10783
11119
|
}
|
|
10784
11120
|
}
|
|
10785
|
-
async function
|
|
11121
|
+
async function handleGetOne8(id, menuId, executeCollection, sendMessage, clientId) {
|
|
10786
11122
|
if (!menuId) {
|
|
10787
|
-
|
|
11123
|
+
sendResponse10(id, {
|
|
10788
11124
|
success: false,
|
|
10789
11125
|
error: "Menu ID is required"
|
|
10790
11126
|
}, sendMessage, clientId);
|
|
@@ -10792,14 +11128,14 @@ async function handleGetOne7(id, menuId, executeCollection, sendMessage, clientI
|
|
|
10792
11128
|
}
|
|
10793
11129
|
try {
|
|
10794
11130
|
const result = await executeCollection("menus", "getOne", { id: menuId });
|
|
10795
|
-
|
|
11131
|
+
sendResponse10(id, {
|
|
10796
11132
|
success: true,
|
|
10797
11133
|
data: result.data,
|
|
10798
11134
|
message: `Retrieved menu ID ${menuId}`
|
|
10799
11135
|
}, sendMessage, clientId);
|
|
10800
11136
|
logger.info(`Retrieved menu: ID ${menuId}`);
|
|
10801
11137
|
} catch (error) {
|
|
10802
|
-
|
|
11138
|
+
sendResponse10(id, {
|
|
10803
11139
|
success: false,
|
|
10804
11140
|
error: error instanceof Error ? error.message : "Failed to get menu"
|
|
10805
11141
|
}, sendMessage, clientId);
|
|
@@ -10808,7 +11144,7 @@ async function handleGetOne7(id, menuId, executeCollection, sendMessage, clientI
|
|
|
10808
11144
|
async function handleGetRootMenus(id, executeCollection, sendMessage, clientId) {
|
|
10809
11145
|
try {
|
|
10810
11146
|
const result = await executeCollection("menus", "getRootMenus", {});
|
|
10811
|
-
|
|
11147
|
+
sendResponse10(id, {
|
|
10812
11148
|
success: true,
|
|
10813
11149
|
data: result.data,
|
|
10814
11150
|
count: result.count,
|
|
@@ -10816,7 +11152,7 @@ async function handleGetRootMenus(id, executeCollection, sendMessage, clientId)
|
|
|
10816
11152
|
}, sendMessage, clientId);
|
|
10817
11153
|
logger.info(`Retrieved root menus (count: ${result.count})`);
|
|
10818
11154
|
} catch (error) {
|
|
10819
|
-
|
|
11155
|
+
sendResponse10(id, {
|
|
10820
11156
|
success: false,
|
|
10821
11157
|
error: error instanceof Error ? error.message : "Failed to get root menus"
|
|
10822
11158
|
}, sendMessage, clientId);
|
|
@@ -10824,7 +11160,7 @@ async function handleGetRootMenus(id, executeCollection, sendMessage, clientId)
|
|
|
10824
11160
|
}
|
|
10825
11161
|
async function handleGetChildMenus(id, parentId, executeCollection, sendMessage, clientId) {
|
|
10826
11162
|
if (parentId === void 0 || parentId === null) {
|
|
10827
|
-
|
|
11163
|
+
sendResponse10(id, {
|
|
10828
11164
|
success: false,
|
|
10829
11165
|
error: "parentId is required"
|
|
10830
11166
|
}, sendMessage, clientId);
|
|
@@ -10832,7 +11168,7 @@ async function handleGetChildMenus(id, parentId, executeCollection, sendMessage,
|
|
|
10832
11168
|
}
|
|
10833
11169
|
try {
|
|
10834
11170
|
const result = await executeCollection("menus", "getChildMenus", { parentId });
|
|
10835
|
-
|
|
11171
|
+
sendResponse10(id, {
|
|
10836
11172
|
success: true,
|
|
10837
11173
|
data: result.data,
|
|
10838
11174
|
count: result.count,
|
|
@@ -10840,7 +11176,7 @@ async function handleGetChildMenus(id, parentId, executeCollection, sendMessage,
|
|
|
10840
11176
|
}, sendMessage, clientId);
|
|
10841
11177
|
logger.info(`Retrieved child menus for parent ${parentId} (count: ${result.count})`);
|
|
10842
11178
|
} catch (error) {
|
|
10843
|
-
|
|
11179
|
+
sendResponse10(id, {
|
|
10844
11180
|
success: false,
|
|
10845
11181
|
error: error instanceof Error ? error.message : "Failed to get child menus"
|
|
10846
11182
|
}, sendMessage, clientId);
|
|
@@ -10849,7 +11185,7 @@ async function handleGetChildMenus(id, parentId, executeCollection, sendMessage,
|
|
|
10849
11185
|
async function handleGetHierarchy(id, executeCollection, sendMessage, clientId) {
|
|
10850
11186
|
try {
|
|
10851
11187
|
const result = await executeCollection("menus", "getHierarchy", {});
|
|
10852
|
-
|
|
11188
|
+
sendResponse10(id, {
|
|
10853
11189
|
success: true,
|
|
10854
11190
|
data: result.data,
|
|
10855
11191
|
count: result.count,
|
|
@@ -10857,7 +11193,7 @@ async function handleGetHierarchy(id, executeCollection, sendMessage, clientId)
|
|
|
10857
11193
|
}, sendMessage, clientId);
|
|
10858
11194
|
logger.info(`Retrieved menus hierarchy (root count: ${result.count})`);
|
|
10859
11195
|
} catch (error) {
|
|
10860
|
-
|
|
11196
|
+
sendResponse10(id, {
|
|
10861
11197
|
success: false,
|
|
10862
11198
|
error: error instanceof Error ? error.message : "Failed to get menus hierarchy"
|
|
10863
11199
|
}, sendMessage, clientId);
|
|
@@ -10870,7 +11206,7 @@ async function handleQuery6(id, filters, limit, sort, executeCollection, sendMes
|
|
|
10870
11206
|
limit,
|
|
10871
11207
|
sort
|
|
10872
11208
|
});
|
|
10873
|
-
|
|
11209
|
+
sendResponse10(id, {
|
|
10874
11210
|
success: true,
|
|
10875
11211
|
data: result.data,
|
|
10876
11212
|
count: result.count,
|
|
@@ -10878,7 +11214,7 @@ async function handleQuery6(id, filters, limit, sort, executeCollection, sendMes
|
|
|
10878
11214
|
}, sendMessage, clientId);
|
|
10879
11215
|
logger.info(`Query returned ${result.count} menus`);
|
|
10880
11216
|
} catch (error) {
|
|
10881
|
-
|
|
11217
|
+
sendResponse10(id, {
|
|
10882
11218
|
success: false,
|
|
10883
11219
|
error: error instanceof Error ? error.message : "Failed to query menus"
|
|
10884
11220
|
}, sendMessage, clientId);
|
|
@@ -10886,7 +11222,7 @@ async function handleQuery6(id, filters, limit, sort, executeCollection, sendMes
|
|
|
10886
11222
|
}
|
|
10887
11223
|
async function handleReorder(id, items, executeCollection, sendMessage, clientId) {
|
|
10888
11224
|
if (!items || !Array.isArray(items) || items.length === 0) {
|
|
10889
|
-
|
|
11225
|
+
sendResponse10(id, {
|
|
10890
11226
|
success: false,
|
|
10891
11227
|
error: "items array is required"
|
|
10892
11228
|
}, sendMessage, clientId);
|
|
@@ -10894,20 +11230,20 @@ async function handleReorder(id, items, executeCollection, sendMessage, clientId
|
|
|
10894
11230
|
}
|
|
10895
11231
|
try {
|
|
10896
11232
|
const result = await executeCollection("menus", "reorder", { items });
|
|
10897
|
-
|
|
11233
|
+
sendResponse10(id, {
|
|
10898
11234
|
success: true,
|
|
10899
11235
|
data: result.data,
|
|
10900
11236
|
message: `Reordered ${items.length} menus successfully`
|
|
10901
11237
|
}, sendMessage, clientId);
|
|
10902
11238
|
logger.info(`Reordered ${items.length} menus`);
|
|
10903
11239
|
} catch (error) {
|
|
10904
|
-
|
|
11240
|
+
sendResponse10(id, {
|
|
10905
11241
|
success: false,
|
|
10906
11242
|
error: error instanceof Error ? error.message : "Failed to reorder menus"
|
|
10907
11243
|
}, sendMessage, clientId);
|
|
10908
11244
|
}
|
|
10909
11245
|
}
|
|
10910
|
-
function
|
|
11246
|
+
function sendResponse10(id, res, sendMessage, clientId) {
|
|
10911
11247
|
const response = {
|
|
10912
11248
|
id: id || "unknown",
|
|
10913
11249
|
type: "MENUS_RES",
|
|
@@ -12439,6 +12775,11 @@ var SuperatomSDK = class {
|
|
|
12439
12775
|
logger.error("Failed to handle bookmarks request:", error);
|
|
12440
12776
|
});
|
|
12441
12777
|
break;
|
|
12778
|
+
case "ARTIFACTS":
|
|
12779
|
+
handleArtifactsRequest(parsed, this.collections, (msg) => this.send(msg)).catch((error) => {
|
|
12780
|
+
logger.error("Failed to handle artifacts request:", error);
|
|
12781
|
+
});
|
|
12782
|
+
break;
|
|
12442
12783
|
case "KB_NODES":
|
|
12443
12784
|
handleKbNodesRequest(parsed, this.collections, (msg) => this.send(msg)).catch((error) => {
|
|
12444
12785
|
logger.error("Failed to handle KB nodes request:", error);
|