@kafca/agentdock 0.1.45 → 0.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/renderer/assets/{Badge-BIojwD6s.js → Badge-BYREM3t3.js} +1 -1
- package/dist/renderer/assets/Chat-Dtb5X7sB.js +2 -0
- package/dist/renderer/assets/{ChatMarkdown-DqszsPB_.js → ChatMarkdown-_slLloCh.js} +1 -1
- package/dist/renderer/assets/Config-pHichs7H.js +21 -0
- package/dist/renderer/assets/CronList-CJQMeCjz.js +1 -0
- package/dist/renderer/assets/Dashboard-CY77Imde.js +26 -0
- package/dist/renderer/assets/{EmptyState-BqCx1oWr.js → EmptyState-DCqmct2y.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-BwK8Gpfa.js → KnowledgeDetail-DFrxa-pv.js} +1 -1
- package/dist/renderer/assets/KnowledgeHome-DL-vAfrH.js +11 -0
- package/dist/renderer/assets/Logs-jw9Uv590.js +1 -0
- package/dist/renderer/assets/{Modal-D2U4r2V0.js → Modal-ChSm7tk6.js} +1 -1
- package/dist/renderer/assets/MonitorList-DrEwyS71.js +1 -0
- package/dist/renderer/assets/{Page-urf5GcT_.js → Page-DhD-zgMU.js} +1 -1
- package/dist/renderer/assets/ProjectDetail-BVSjpfpL.js +11 -0
- package/dist/renderer/assets/ProjectList-CHGbTJjk.js +1 -0
- package/dist/renderer/assets/{Select-CAscWpy5.js → Select-rHs9CSam.js} +1 -1
- package/dist/renderer/assets/SessionChat-CDc2FNMA.js +1 -0
- package/dist/renderer/assets/SessionList-Mr1uAnRW.js +1 -0
- package/dist/renderer/assets/ThreadChat-Detu5UfN.js +23 -0
- package/dist/renderer/assets/Workspace-MRRg8ndJ.js +19 -0
- package/dist/renderer/assets/{arrow-left-7HrNuS-V.js → arrow-left-BU2NB2LA.js} +1 -1
- package/dist/renderer/assets/{book-open-BDoAu82s.js → book-open-D-TGvWwa.js} +1 -1
- package/dist/renderer/assets/bot-IYNh8tH5.js +6 -0
- package/dist/renderer/assets/{check-DGlyq4xX.js → check-CCZ0JO_S.js} +1 -1
- package/dist/renderer/assets/{chevron-down-Bb_3EHq9.js → chevron-down-00bRZi15.js} +1 -1
- package/dist/renderer/assets/{circle-DIpqZnYw.js → circle-CpQ8x4k_.js} +1 -1
- package/dist/renderer/assets/{desktop-Ci1fnRDR.js → desktop-D0k2aGSj.js} +1 -1
- package/dist/renderer/assets/{desktop-Do_UrC-o.js → desktop-JQkhNOF4.js} +1 -1
- package/dist/renderer/assets/{funnel-Bbf0ERLP.js → funnel-UbcrCBCp.js} +1 -1
- package/dist/renderer/assets/{heart-CGqU-qfw.js → heart-DvLsV7tL.js} +1 -1
- package/dist/renderer/assets/{index-Df-Trovt.js → index-B2L4G-b_.js} +1 -1
- package/dist/renderer/assets/index-CO4fGqmv.css +11 -0
- package/dist/renderer/assets/{index-DwhTjLA1.js → index-dy-g2Bh4.js} +3 -3
- package/dist/renderer/assets/{pencil-CHiy1MvK.js → pencil-qBYOgW5M.js} +1 -1
- package/dist/renderer/assets/{play-CGYnmC4Q.js → play-Dn6b4AGj.js} +1 -1
- package/dist/renderer/assets/{plus-B_Q5-Oj7.js → plus-CaApUwEm.js} +1 -1
- package/dist/renderer/assets/projects-BwF5RlNV.js +1 -0
- package/dist/renderer/assets/save-CN6yvTfD.js +11 -0
- package/dist/renderer/assets/{search-D8Dkhsyq.js → search-Dn2MxYiO.js} +1 -1
- package/dist/renderer/assets/{server-Cd96R7WL.js → server-DpcVLHeh.js} +1 -1
- package/dist/renderer/assets/{session-utils-BNUbQBfF.js → session-utils-DnD2Q_y1.js} +1 -1
- package/dist/renderer/assets/{sessions-BACfV8s1.js → sessions-eK5D4FLt.js} +1 -1
- package/dist/renderer/assets/{shield-check-Cnn-yQUA.js → shield-check-DSSJkacw.js} +1 -1
- package/dist/renderer/assets/{trash-2-oWCxwQ9D.js → trash-2-DmYJlEvO.js} +1 -1
- package/dist/renderer/assets/user-Cvf_uiyQ.js +6 -0
- package/dist/renderer/assets/{wifi-off-DHxnNkdY.js → wifi-off-CCTloj-V.js} +1 -1
- package/dist/renderer/index.html +2 -2
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-session-coordinator.js +2 -1
- package/dist-electron/services/local-ai-core/src/agents/pi/launch.js +1 -1
- package/dist-electron/services/local-ai-core/src/agents/shared/launch-utils.js +22 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/inbound.js +55 -1
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +132 -348
- package/dist-electron/services/local-ai-core/src/channel/shared/base-channel-gateway.js +303 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +131 -382
- package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +2 -1
- package/dist-electron/services/local-ai-core/src/runtime/channel-service.js +150 -0
- package/dist-electron/services/local-ai-core/src/runtime/env-utils.js +12 -0
- package/dist-electron/services/local-ai-core/src/runtime/external-service.js +234 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/automation-handler.js +34 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/capabilities-handler.js +12 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/channel-handler.js +65 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/external-handler.js +17 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/knowledge-handler.js +65 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/openai-handler.js +496 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/provider-handler.js +24 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/runtime-handler.js +68 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/runtimes-handler.js +37 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/scheduler-handler.js +34 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/security-handler.js +49 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/task-handler.js +27 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/thread-handler.js +42 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/workspace-handler.js +29 -0
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +40 -592
- package/dist-electron/services/local-ai-core/src/runtime/server-helpers.js +96 -0
- package/dist-electron/services/local-ai-core/src/runtime/server.js +107 -1084
- package/dist-electron/services/local-ai-core/src/runtime/standalone.js +13 -1
- package/dist-electron/src/pages/Projects/project-provider-config.js +75 -0
- package/dist-electron/tests/contracts/architecture-docs.test.js +1 -0
- package/dist-electron/tests/electron/agent-runtime-detector.test.js +18 -0
- package/dist-electron/tests/electron/knowledge-skill-script.test.js +15 -5
- package/dist-electron/tests/electron/lac-cli.test.js +591 -688
- package/dist-electron/tests/electron/plugin-kernel.test.js +47 -31
- package/dist-electron/tests/electron/project-provider-config.test.js +71 -0
- package/dist-electron/tests/electron/workspace-task-store.test.js +19 -9
- package/dist-electron/tests/integration/lark-gateway.test.js +80 -0
- package/dist-electron/tests/integration/local-core-cors.test.js +22 -0
- package/package.json +1 -1
- package/dist/renderer/assets/Chat-wjBR3XEX.js +0 -2
- package/dist/renderer/assets/Config-BDCHs5A2.js +0 -21
- package/dist/renderer/assets/CronList-CEWQYTov.js +0 -1
- package/dist/renderer/assets/Dashboard-DrWftfk3.js +0 -26
- package/dist/renderer/assets/KnowledgeHome-hhDTZMDO.js +0 -11
- package/dist/renderer/assets/Logs-C9xPEhFT.js +0 -1
- package/dist/renderer/assets/MonitorList-CayKbfwJ.js +0 -1
- package/dist/renderer/assets/ProjectDetail-B1GyAr7a.js +0 -11
- package/dist/renderer/assets/ProjectList-BoipQypE.js +0 -1
- package/dist/renderer/assets/SessionChat-BAVy5221.js +0 -1
- package/dist/renderer/assets/SessionList-BZpuMvh0.js +0 -1
- package/dist/renderer/assets/ThreadChat-JX7m9biG.js +0 -23
- package/dist/renderer/assets/Workspace-CFW8otjU.js +0 -14
- package/dist/renderer/assets/index-RaTga2BC.css +0 -11
- package/dist/renderer/assets/plug-Mexu4gyV.js +0 -6
- package/dist/renderer/assets/projects-C6bbkC-O.js +0 -1
- package/dist/renderer/assets/save-CJ_QFPw0.js +0 -6
- package/dist/renderer/assets/user-BzE9BwsY.js +0 -11
|
@@ -7,6 +7,7 @@ const node_module_1 = require("node:module");
|
|
|
7
7
|
const node_child_process_1 = require("node:child_process");
|
|
8
8
|
const desktop_js_1 = require("../../../../shared/desktop.js");
|
|
9
9
|
const index_js_1 = require("../agents/index.js");
|
|
10
|
+
const env_utils_js_1 = require("./env-utils.js");
|
|
10
11
|
function detectInstalledAgentRuntimes(options = {}) {
|
|
11
12
|
const env = options.env || process.env;
|
|
12
13
|
const configuredCommands = collectConfiguredAgentCommands(options.config);
|
|
@@ -131,7 +132,7 @@ function resolveCommand(command, env) {
|
|
|
131
132
|
if ((0, node_path_1.isAbsolute)(normalized) || normalized.includes('/') || normalized.includes('\\')) {
|
|
132
133
|
return isExecutableFile(normalized) ? normalized : null;
|
|
133
134
|
}
|
|
134
|
-
for (const dir of
|
|
135
|
+
for (const dir of (0, env_utils_js_1.getPathEnv)(env).split(node_path_1.delimiter).filter(Boolean)) {
|
|
135
136
|
for (const candidate of commandCandidates(normalized, env)) {
|
|
136
137
|
const fullPath = (0, node_path_1.join)(dir, candidate);
|
|
137
138
|
if (isExecutableFile(fullPath)) {
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChannelService = void 0;
|
|
4
|
+
class ChannelService {
|
|
5
|
+
runtimes;
|
|
6
|
+
constructor(runtimes) {
|
|
7
|
+
this.runtimes = runtimes;
|
|
8
|
+
}
|
|
9
|
+
async listStatuses(platform) {
|
|
10
|
+
if (!platform) {
|
|
11
|
+
const statuses = await Promise.all([...this.runtimes.values()].map((runtime) => runtime.listStatuses()));
|
|
12
|
+
return statuses.flat();
|
|
13
|
+
}
|
|
14
|
+
return this.resolve(platform).listStatuses();
|
|
15
|
+
}
|
|
16
|
+
async getStatus(platform, workspaceId, instanceId) {
|
|
17
|
+
return this.resolve(platform).getStatus(workspaceId, instanceId);
|
|
18
|
+
}
|
|
19
|
+
async testConnection(platform, workspaceId, instanceId) {
|
|
20
|
+
return this.resolve(platform).testConnection(workspaceId, instanceId);
|
|
21
|
+
}
|
|
22
|
+
async enable(platform, workspaceId, instanceId) {
|
|
23
|
+
return this.resolve(platform).enable(workspaceId, instanceId);
|
|
24
|
+
}
|
|
25
|
+
async disable(platform, workspaceId, instanceId) {
|
|
26
|
+
return this.resolve(platform).disable(workspaceId, instanceId);
|
|
27
|
+
}
|
|
28
|
+
async listPendingPairings(platform, workspaceId) {
|
|
29
|
+
return this.resolve(platform).listPendingPairings(workspaceId);
|
|
30
|
+
}
|
|
31
|
+
async approvePairing(platform, code) {
|
|
32
|
+
return this.resolve(platform).approvePairing(code);
|
|
33
|
+
}
|
|
34
|
+
async rejectPairing(platform, code) {
|
|
35
|
+
return this.resolve(platform).rejectPairing(code);
|
|
36
|
+
}
|
|
37
|
+
async listAuthorizedUsers(platform, workspaceId) {
|
|
38
|
+
return this.resolve(platform).listAuthorizedUsers(workspaceId);
|
|
39
|
+
}
|
|
40
|
+
async sendFile(platform, workspaceId, input) {
|
|
41
|
+
const runtime = this.resolve(platform);
|
|
42
|
+
if (runtime.sendOutboundMessage) {
|
|
43
|
+
const result = await runtime.sendOutboundMessage(workspaceId, {
|
|
44
|
+
route: {
|
|
45
|
+
type: 'channel.chat',
|
|
46
|
+
channelId: input.channelId,
|
|
47
|
+
participantId: input.participantId,
|
|
48
|
+
},
|
|
49
|
+
parts: [{
|
|
50
|
+
type: 'file',
|
|
51
|
+
path: input.path,
|
|
52
|
+
fileName: input.fileName,
|
|
53
|
+
metadata: input.workspacePath ? { workspacePath: input.workspacePath } : undefined,
|
|
54
|
+
}],
|
|
55
|
+
});
|
|
56
|
+
const attachment = result.attachments?.[0];
|
|
57
|
+
return {
|
|
58
|
+
platform: result.platform,
|
|
59
|
+
workspaceId: result.workspaceId,
|
|
60
|
+
channelId: result.channelId,
|
|
61
|
+
messageId: result.messageIds[0] || '',
|
|
62
|
+
messageIds: result.messageIds,
|
|
63
|
+
fileKey: String(attachment?.metadata?.fileKey || attachment?.attachmentId || ''),
|
|
64
|
+
attachmentId: attachment?.attachmentId,
|
|
65
|
+
fileName: attachment?.fileName || input.fileName || '',
|
|
66
|
+
fileSize: attachment?.fileSize || 0,
|
|
67
|
+
metadata: result.metadata,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (!runtime.sendFile) {
|
|
71
|
+
throw new Error(`Channel platform does not support sending files: ${platform}`);
|
|
72
|
+
}
|
|
73
|
+
return runtime.sendFile(workspaceId, input);
|
|
74
|
+
}
|
|
75
|
+
async sendMessage(platform, workspaceId, input) {
|
|
76
|
+
const runtime = this.resolve(platform);
|
|
77
|
+
if (!runtime.sendOutboundMessage) {
|
|
78
|
+
throw new Error(`Channel platform does not support outbound messages: ${platform}`);
|
|
79
|
+
}
|
|
80
|
+
return runtime.sendOutboundMessage(workspaceId, input);
|
|
81
|
+
}
|
|
82
|
+
async getQrCode(platform, workspaceId, instanceId) {
|
|
83
|
+
const runtime = this.resolve(platform);
|
|
84
|
+
if (!runtime.getQrCode) {
|
|
85
|
+
throw new Error(`Channel platform does not support QR setup: ${platform}`);
|
|
86
|
+
}
|
|
87
|
+
return runtime.getQrCode(workspaceId, instanceId);
|
|
88
|
+
}
|
|
89
|
+
async checkQrCodeStatus(platform, workspaceId, ticket, instanceId) {
|
|
90
|
+
const runtime = this.resolve(platform);
|
|
91
|
+
if (!runtime.checkQrCodeStatus) {
|
|
92
|
+
throw new Error(`Channel platform does not support QR setup: ${platform}`);
|
|
93
|
+
}
|
|
94
|
+
return runtime.checkQrCodeStatus(workspaceId, ticket, instanceId);
|
|
95
|
+
}
|
|
96
|
+
async getWeixinQrCode(workspaceId, instanceId) {
|
|
97
|
+
return this.getQrCode('weixin', workspaceId, instanceId);
|
|
98
|
+
}
|
|
99
|
+
async checkWeixinQrCodeStatus(workspaceId, ticket, instanceId) {
|
|
100
|
+
return this.checkQrCodeStatus('weixin', workspaceId, ticket, instanceId);
|
|
101
|
+
}
|
|
102
|
+
// Lark convenience wrappers
|
|
103
|
+
async listLarkStatuses() {
|
|
104
|
+
return this.listStatuses('lark');
|
|
105
|
+
}
|
|
106
|
+
async getLarkStatus(workspaceId, instanceId) {
|
|
107
|
+
return this.getStatus('lark', workspaceId, instanceId);
|
|
108
|
+
}
|
|
109
|
+
async testLarkConnection(workspaceId, instanceId) {
|
|
110
|
+
return this.testConnection('lark', workspaceId, instanceId);
|
|
111
|
+
}
|
|
112
|
+
async enableLark(workspaceId, instanceId) {
|
|
113
|
+
return this.enable('lark', workspaceId, instanceId);
|
|
114
|
+
}
|
|
115
|
+
async disableLark(workspaceId, instanceId) {
|
|
116
|
+
return this.disable('lark', workspaceId, instanceId);
|
|
117
|
+
}
|
|
118
|
+
async listLarkPendingPairings(workspaceId) {
|
|
119
|
+
return this.listPendingPairings('lark', workspaceId);
|
|
120
|
+
}
|
|
121
|
+
async approveLarkPairing(code) {
|
|
122
|
+
return this.approvePairing('lark', code);
|
|
123
|
+
}
|
|
124
|
+
async rejectLarkPairing(code) {
|
|
125
|
+
return this.rejectPairing('lark', code);
|
|
126
|
+
}
|
|
127
|
+
async listLarkAuthorizedUsers(workspaceId) {
|
|
128
|
+
return this.listAuthorizedUsers('lark', workspaceId);
|
|
129
|
+
}
|
|
130
|
+
async getLarkQrCode(workspaceId, instanceId) {
|
|
131
|
+
return this.getQrCode('lark', workspaceId, instanceId);
|
|
132
|
+
}
|
|
133
|
+
async checkLarkQrCodeStatus(workspaceId, ticket, instanceId) {
|
|
134
|
+
return this.checkQrCodeStatus('lark', workspaceId, ticket, instanceId);
|
|
135
|
+
}
|
|
136
|
+
async refreshBindings() {
|
|
137
|
+
await Promise.all([...this.runtimes.values()].map((runtime) => runtime.refreshBindings?.()));
|
|
138
|
+
}
|
|
139
|
+
assertPlatform(platform) {
|
|
140
|
+
this.resolve(platform);
|
|
141
|
+
}
|
|
142
|
+
resolve(platform) {
|
|
143
|
+
const runtime = this.runtimes.get(platform);
|
|
144
|
+
if (runtime) {
|
|
145
|
+
return runtime;
|
|
146
|
+
}
|
|
147
|
+
throw new Error(`Unsupported channel platform: ${platform}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.ChannelService = ChannelService;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPathEnv = getPathEnv;
|
|
4
|
+
function getPathEnv(env) {
|
|
5
|
+
let pathValue = '';
|
|
6
|
+
for (const [key, value] of Object.entries(env)) {
|
|
7
|
+
if (key.toLowerCase() === 'path') {
|
|
8
|
+
pathValue = String(value || '');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return pathValue;
|
|
12
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExternalService = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const provider_config_migration_js_1 = require("./provider-config-migration.js");
|
|
8
|
+
class ExternalService {
|
|
9
|
+
store;
|
|
10
|
+
workspaceRouter;
|
|
11
|
+
deps;
|
|
12
|
+
userDataPath;
|
|
13
|
+
constructor(store, workspaceRouter, deps, userDataPath) {
|
|
14
|
+
this.store = store;
|
|
15
|
+
this.workspaceRouter = workspaceRouter;
|
|
16
|
+
this.deps = deps;
|
|
17
|
+
this.userDataPath = userDataPath;
|
|
18
|
+
}
|
|
19
|
+
async ensureProject(input) {
|
|
20
|
+
const userId = normalizeExternalId(input.user_id, 'user_id');
|
|
21
|
+
const externalProjectId = normalizeExternalId(input.external_project_id, 'external_project_id');
|
|
22
|
+
const agentType = normalizeExternalSegment(input.agent_type || 'pi', 'pi');
|
|
23
|
+
const existing = this.store.getExternalProject(userId, externalProjectId);
|
|
24
|
+
const provider = this.resolveProvider(input.provider_id || existing?.providerId);
|
|
25
|
+
const workspaceId = externalWorkspaceId(userId, externalProjectId);
|
|
26
|
+
const workspacePath = this.projectBasePath(userId, externalProjectId);
|
|
27
|
+
const displayName = String(input.display_name || externalProjectId).trim() || externalProjectId;
|
|
28
|
+
(0, node_fs_1.mkdirSync)(workspacePath, { recursive: true, mode: 0o700 });
|
|
29
|
+
const now = new Date().toISOString();
|
|
30
|
+
const project = this.store.upsertExternalProject({
|
|
31
|
+
userId,
|
|
32
|
+
externalProjectId,
|
|
33
|
+
workspaceId,
|
|
34
|
+
workspacePath,
|
|
35
|
+
displayName,
|
|
36
|
+
agentType,
|
|
37
|
+
providerId: provider.id,
|
|
38
|
+
metadata: input.metadata || existing?.metadata || {},
|
|
39
|
+
createdAt: existing?.createdAt || now,
|
|
40
|
+
updatedAt: now,
|
|
41
|
+
});
|
|
42
|
+
await this.ensureWorkspaceConfig(project, input.model);
|
|
43
|
+
this.store.upsertWorkspaceRegistryEntry({
|
|
44
|
+
workspaceId: project.workspaceId,
|
|
45
|
+
displayName: project.displayName,
|
|
46
|
+
path: project.workspacePath,
|
|
47
|
+
deviceId: 'external',
|
|
48
|
+
defaultRuntimeId: project.agentType,
|
|
49
|
+
health: { status: 'healthy', summary: 'External workspace is available.', issues: [], checkedAt: now },
|
|
50
|
+
metadata: {
|
|
51
|
+
external: true,
|
|
52
|
+
userId: project.userId,
|
|
53
|
+
externalProjectId: project.externalProjectId,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
return project;
|
|
57
|
+
}
|
|
58
|
+
async createRun(input) {
|
|
59
|
+
if (!String(input.prompt || '').trim()) {
|
|
60
|
+
throw new Error('prompt is required.');
|
|
61
|
+
}
|
|
62
|
+
const project = await this.ensureProject(input);
|
|
63
|
+
const thread = await this.ensureThread(project, input);
|
|
64
|
+
const sent = await this.workspaceRouter.sendThreadMessage(thread.threadId, input.prompt, {
|
|
65
|
+
permissionMode: input.permission_mode,
|
|
66
|
+
runtimeEnv: input.runtime_env,
|
|
67
|
+
});
|
|
68
|
+
const task = this.store.getAgentTaskByRunId(sent.runId);
|
|
69
|
+
return {
|
|
70
|
+
project,
|
|
71
|
+
thread,
|
|
72
|
+
workspace_id: project.workspaceId,
|
|
73
|
+
thread_id: thread.threadId,
|
|
74
|
+
run_id: sent.runId,
|
|
75
|
+
task_id: task?.taskId,
|
|
76
|
+
events_url: `/api/local/v1/external/runs/${encodeURIComponent(sent.runId)}/events`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
async getRunSnapshot(runId) {
|
|
80
|
+
const task = this.store.getAgentTaskByRunId(runId);
|
|
81
|
+
const run = this.store.getRun(runId);
|
|
82
|
+
const threadId = task?.threadId || run?.thread_id || '';
|
|
83
|
+
const thread = threadId
|
|
84
|
+
? await this.workspaceRouter.getThread(threadId).catch(() => undefined)
|
|
85
|
+
: undefined;
|
|
86
|
+
return {
|
|
87
|
+
runId,
|
|
88
|
+
task,
|
|
89
|
+
thread,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
resolveProvider(providerId) {
|
|
93
|
+
const requested = String(providerId || '').trim();
|
|
94
|
+
if (requested) {
|
|
95
|
+
const provider = this.store.getModelProvider(requested);
|
|
96
|
+
if (!provider) {
|
|
97
|
+
throw new Error(`Provider not found: ${requested}`);
|
|
98
|
+
}
|
|
99
|
+
return provider;
|
|
100
|
+
}
|
|
101
|
+
const provider = this.store.listModelProviders()[0];
|
|
102
|
+
if (!provider) {
|
|
103
|
+
throw new Error('No model provider is configured. Create a provider before starting an external run.');
|
|
104
|
+
}
|
|
105
|
+
return provider;
|
|
106
|
+
}
|
|
107
|
+
async ensureWorkspaceConfig(project, model) {
|
|
108
|
+
const current = await this.readAndMigrateConfigFile();
|
|
109
|
+
const config = {
|
|
110
|
+
...(current.parsed || {}),
|
|
111
|
+
projects: Array.isArray(current.parsed?.projects) ? [...current.parsed.projects] : [],
|
|
112
|
+
};
|
|
113
|
+
const existingIndex = config.projects.findIndex((item) => item?.name === project.workspaceId);
|
|
114
|
+
const existing = existingIndex >= 0 ? config.projects[existingIndex] : undefined;
|
|
115
|
+
const defaultRuntimeImageId = Array.isArray(config.sandbox_runtime_images)
|
|
116
|
+
? config.sandbox_runtime_images.find((image) => image?.agent_type === project.agentType)?.id
|
|
117
|
+
: undefined;
|
|
118
|
+
const options = {
|
|
119
|
+
...(existing?.agent?.options || {}),
|
|
120
|
+
work_dir: project.workspacePath,
|
|
121
|
+
user_id: project.userId,
|
|
122
|
+
provider_id: project.providerId,
|
|
123
|
+
...(model ? { model } : {}),
|
|
124
|
+
sandbox: {
|
|
125
|
+
...(existing?.agent?.options?.sandbox || {}),
|
|
126
|
+
enabled: true,
|
|
127
|
+
...(defaultRuntimeImageId ? { runtime_image_id: defaultRuntimeImageId } : {}),
|
|
128
|
+
state_scope: 'project',
|
|
129
|
+
sandbox_lifecycle: 'per_thread',
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
const nextProject = {
|
|
133
|
+
name: project.workspaceId,
|
|
134
|
+
agent: {
|
|
135
|
+
...(existing?.agent || {}),
|
|
136
|
+
type: project.agentType,
|
|
137
|
+
options,
|
|
138
|
+
},
|
|
139
|
+
platforms: Array.isArray(existing?.platforms) ? existing.platforms : [],
|
|
140
|
+
admin_from: existing?.admin_from,
|
|
141
|
+
disabled_commands: existing?.disabled_commands,
|
|
142
|
+
};
|
|
143
|
+
if (existingIndex >= 0) {
|
|
144
|
+
config.projects[existingIndex] = nextProject;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
config.projects.push(nextProject);
|
|
148
|
+
}
|
|
149
|
+
await this.deps.saveStructuredConfig(config);
|
|
150
|
+
}
|
|
151
|
+
async ensureThread(project, input) {
|
|
152
|
+
const externalThreadId = normalizeExternalId(input.external_thread_id || `thread-${(0, node_crypto_1.randomUUID)()}`, 'external_thread_id');
|
|
153
|
+
const existing = this.store.getExternalThread(project.userId, project.externalProjectId, externalThreadId);
|
|
154
|
+
if (existing) {
|
|
155
|
+
const thread = await this.workspaceRouter.getThread(existing.threadId).catch(() => undefined);
|
|
156
|
+
if (thread) {
|
|
157
|
+
return existing;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const workspacePath = this.threadWorkspacePath(project.userId, project.externalProjectId, externalThreadId);
|
|
161
|
+
(0, node_fs_1.mkdirSync)(workspacePath, { recursive: true, mode: 0o700 });
|
|
162
|
+
const title = String(input.title || externalThreadId).trim() || externalThreadId;
|
|
163
|
+
const thread = await this.workspaceRouter.createThread(project.workspaceId, title);
|
|
164
|
+
const now = new Date().toISOString();
|
|
165
|
+
return this.store.upsertExternalThread({
|
|
166
|
+
userId: project.userId,
|
|
167
|
+
externalProjectId: project.externalProjectId,
|
|
168
|
+
externalThreadId,
|
|
169
|
+
workspaceId: project.workspaceId,
|
|
170
|
+
threadId: thread.id,
|
|
171
|
+
workspacePath,
|
|
172
|
+
metadata: input.metadata || {},
|
|
173
|
+
createdAt: now,
|
|
174
|
+
updatedAt: now,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
async readAndMigrateConfigFile() {
|
|
178
|
+
const current = await this.deps.readConfigState();
|
|
179
|
+
if (!current.parsed) {
|
|
180
|
+
return current;
|
|
181
|
+
}
|
|
182
|
+
const migrated = (0, provider_config_migration_js_1.migrateLegacyProjectProvidersToStore)(current.parsed, this.store);
|
|
183
|
+
if (!migrated.changed) {
|
|
184
|
+
return current;
|
|
185
|
+
}
|
|
186
|
+
const saved = await this.deps.saveStructuredConfig(migrated.config);
|
|
187
|
+
return {
|
|
188
|
+
...saved,
|
|
189
|
+
warnings: [
|
|
190
|
+
...(current.warnings || []),
|
|
191
|
+
...(saved.warnings || []),
|
|
192
|
+
...migrated.warnings,
|
|
193
|
+
],
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
projectBasePath(userId, externalProjectId) {
|
|
197
|
+
return (0, node_path_1.join)(this.workspaceRoot(), 'users', normalizeExternalSegment(userId, 'user'), 'projects', normalizeExternalSegment(externalProjectId, 'project'));
|
|
198
|
+
}
|
|
199
|
+
threadWorkspacePath(userId, externalProjectId, externalThreadId) {
|
|
200
|
+
return (0, node_path_1.join)(this.projectBasePath(userId, externalProjectId), 'threads', normalizeExternalSegment(externalThreadId, 'thread'), 'workspace');
|
|
201
|
+
}
|
|
202
|
+
workspaceRoot() {
|
|
203
|
+
return String(process.env.AGENTDOCK_EXTERNAL_WORKSPACE_ROOT || '').trim()
|
|
204
|
+
|| (0, node_path_1.join)(this.userDataPath, 'external-workspaces');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.ExternalService = ExternalService;
|
|
208
|
+
function normalizeExternalId(value, label) {
|
|
209
|
+
const normalized = String(value || '').trim();
|
|
210
|
+
if (!normalized) {
|
|
211
|
+
throw new Error(`${label} is required.`);
|
|
212
|
+
}
|
|
213
|
+
return normalized;
|
|
214
|
+
}
|
|
215
|
+
function normalizeExternalSegment(value, fallback) {
|
|
216
|
+
return String(value || '')
|
|
217
|
+
.trim()
|
|
218
|
+
.toLowerCase()
|
|
219
|
+
.replace(/[^a-z0-9._-]+/g, '-')
|
|
220
|
+
.replace(/^-+|-+$/g, '')
|
|
221
|
+
|| fallback;
|
|
222
|
+
}
|
|
223
|
+
function externalWorkspaceId(userId, externalProjectId) {
|
|
224
|
+
const base = [
|
|
225
|
+
'external',
|
|
226
|
+
normalizeExternalSegment(userId, 'user'),
|
|
227
|
+
normalizeExternalSegment(externalProjectId, 'project'),
|
|
228
|
+
].join('-');
|
|
229
|
+
const digest = (0, node_crypto_1.createHash)('sha256')
|
|
230
|
+
.update(`${userId}\0${externalProjectId}`)
|
|
231
|
+
.digest('hex')
|
|
232
|
+
.slice(0, 8);
|
|
233
|
+
return `${base}-${digest}`;
|
|
234
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerAutomationHandlers = registerAutomationHandlers;
|
|
4
|
+
const server_helpers_js_1 = require("../server-helpers.js");
|
|
5
|
+
function registerAutomationHandlers(map, automationMonitors) {
|
|
6
|
+
map.set('automation.monitors.list', async (_route, _req, res, url) => {
|
|
7
|
+
const workspaceId = String(url.searchParams.get('workspace_id') || '');
|
|
8
|
+
(0, server_helpers_js_1.json)(res, 200, { monitors: await automationMonitors.listMonitors(workspaceId || undefined) });
|
|
9
|
+
});
|
|
10
|
+
map.set('automation.monitors.create', async (_route, req, res) => {
|
|
11
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
12
|
+
(0, server_helpers_js_1.json)(res, 200, await automationMonitors.createMonitor(body));
|
|
13
|
+
});
|
|
14
|
+
map.set('automation.monitor.get', async (route, _req, res) => {
|
|
15
|
+
const monitor = automationMonitors.getMonitor(route.monitorId);
|
|
16
|
+
if (!monitor) {
|
|
17
|
+
throw new Error(`Automation monitor not found: ${route.monitorId}`);
|
|
18
|
+
}
|
|
19
|
+
(0, server_helpers_js_1.json)(res, 200, monitor);
|
|
20
|
+
});
|
|
21
|
+
map.set('automation.monitor.runs', async (route, _req, res) => {
|
|
22
|
+
(0, server_helpers_js_1.json)(res, 200, { runs: await automationMonitors.listRuns(route.monitorId) });
|
|
23
|
+
});
|
|
24
|
+
map.set('automation.monitor.run', async (route, _req, res) => {
|
|
25
|
+
(0, server_helpers_js_1.json)(res, 200, await automationMonitors.runMonitorNow(route.monitorId));
|
|
26
|
+
});
|
|
27
|
+
map.set('automation.monitor.update', async (route, req, res) => {
|
|
28
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
29
|
+
(0, server_helpers_js_1.json)(res, 200, await automationMonitors.updateMonitor(route.monitorId, body));
|
|
30
|
+
});
|
|
31
|
+
map.set('automation.monitor.delete', async (route, _req, res) => {
|
|
32
|
+
(0, server_helpers_js_1.json)(res, 200, await automationMonitors.deleteMonitor(route.monitorId));
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerCapabilitiesHandlers = registerCapabilitiesHandlers;
|
|
4
|
+
const server_helpers_js_1 = require("../server-helpers.js");
|
|
5
|
+
function registerCapabilitiesHandlers(map, kernel) {
|
|
6
|
+
map.set('capabilities.read', async (_route, _req, res) => {
|
|
7
|
+
(0, server_helpers_js_1.json)(res, 200, await kernel.getCapabilitySnapshot());
|
|
8
|
+
});
|
|
9
|
+
map.set('capabilities.snapshot', async (_route, _req, res) => {
|
|
10
|
+
(0, server_helpers_js_1.json)(res, 200, (await kernel.getCapabilitySnapshot()).snapshot);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerChannelHandlers = registerChannelHandlers;
|
|
4
|
+
const server_helpers_js_1 = require("../server-helpers.js");
|
|
5
|
+
function registerChannelHandlers(map, channelService) {
|
|
6
|
+
const cid = (url) => String(url.searchParams.get('instance_id') || url.searchParams.get('instanceId') || '').trim() || undefined;
|
|
7
|
+
map.set('platform.gateways.list', async (route, _req, res) => {
|
|
8
|
+
(0, server_helpers_js_1.json)(res, 200, { gateways: await channelService.listStatuses(route.platform) });
|
|
9
|
+
});
|
|
10
|
+
map.set('platform.pairings.list', async (route, _req, res, url) => {
|
|
11
|
+
const workspaceId = String(url.searchParams.get('workspace_id') || '');
|
|
12
|
+
(0, server_helpers_js_1.json)(res, 200, { pairings: await channelService.listPendingPairings(route.platform, workspaceId || undefined) });
|
|
13
|
+
});
|
|
14
|
+
map.set('platform.users.list', async (route, _req, res, url) => {
|
|
15
|
+
const workspaceId = String(url.searchParams.get('workspace_id') || '');
|
|
16
|
+
(0, server_helpers_js_1.json)(res, 200, { users: await channelService.listAuthorizedUsers(route.platform, workspaceId || undefined) });
|
|
17
|
+
});
|
|
18
|
+
map.set('platform.gateway.get', async (route, _req, res, url) => {
|
|
19
|
+
const p = route.platform;
|
|
20
|
+
(0, server_helpers_js_1.json)(res, 200, await channelService.getStatus(p, route.workspaceId, cid(url)));
|
|
21
|
+
});
|
|
22
|
+
map.set('platform.qrcode.status', async (route, _req, res, url) => {
|
|
23
|
+
const ticket = String(url.searchParams.get('ticket') || '');
|
|
24
|
+
if (!ticket) {
|
|
25
|
+
(0, server_helpers_js_1.jsonError)(res, 400, new Error('Missing ticket parameter'));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const p = route.platform;
|
|
29
|
+
(0, server_helpers_js_1.json)(res, 200, await channelService.checkQrCodeStatus(p, route.workspaceId, ticket, cid(url)));
|
|
30
|
+
});
|
|
31
|
+
map.set('platform.pairing.approve', async (route, req, res) => {
|
|
32
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
33
|
+
(0, server_helpers_js_1.json)(res, 200, await channelService.approvePairing(route.platform, String(body.code || '')));
|
|
34
|
+
});
|
|
35
|
+
map.set('platform.pairing.reject', async (route, req, res) => {
|
|
36
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
37
|
+
(0, server_helpers_js_1.json)(res, 200, await channelService.rejectPairing(route.platform, String(body.code || '')));
|
|
38
|
+
});
|
|
39
|
+
map.set('platform.gateway.test', async (route, _req, res, url) => {
|
|
40
|
+
const p = route.platform;
|
|
41
|
+
(0, server_helpers_js_1.json)(res, 200, await channelService.testConnection(p, route.workspaceId, cid(url)));
|
|
42
|
+
});
|
|
43
|
+
map.set('platform.gateway.enable', async (route, _req, res, url) => {
|
|
44
|
+
const p = route.platform;
|
|
45
|
+
(0, server_helpers_js_1.json)(res, 200, await channelService.enable(p, route.workspaceId, cid(url)));
|
|
46
|
+
});
|
|
47
|
+
map.set('platform.gateway.disable', async (route, _req, res, url) => {
|
|
48
|
+
const p = route.platform;
|
|
49
|
+
(0, server_helpers_js_1.json)(res, 200, await channelService.disable(p, route.workspaceId, cid(url)));
|
|
50
|
+
});
|
|
51
|
+
map.set('platform.file.send', async (route, req, res) => {
|
|
52
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
53
|
+
const p = route.platform;
|
|
54
|
+
(0, server_helpers_js_1.json)(res, 200, await channelService.sendFile(p, route.workspaceId, body));
|
|
55
|
+
});
|
|
56
|
+
map.set('platform.message.send', async (route, req, res) => {
|
|
57
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
58
|
+
const p = route.platform;
|
|
59
|
+
(0, server_helpers_js_1.json)(res, 200, await channelService.sendMessage(p, route.workspaceId, body));
|
|
60
|
+
});
|
|
61
|
+
map.set('platform.qrcode.create', async (route, _req, res, url) => {
|
|
62
|
+
const p = route.platform;
|
|
63
|
+
(0, server_helpers_js_1.json)(res, 200, await channelService.getQrCode(p, route.workspaceId, cid(url)));
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerExternalHandlers = registerExternalHandlers;
|
|
4
|
+
const server_helpers_js_1 = require("../server-helpers.js");
|
|
5
|
+
function registerExternalHandlers(map, externalService, attachExternalRunSseClient) {
|
|
6
|
+
map.set('external.project.ensure', async (_route, req, res) => {
|
|
7
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
8
|
+
(0, server_helpers_js_1.json)(res, 200, await externalService.ensureProject(body));
|
|
9
|
+
});
|
|
10
|
+
map.set('external.run.create', async (_route, req, res) => {
|
|
11
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
12
|
+
(0, server_helpers_js_1.json)(res, 200, await externalService.createRun(body));
|
|
13
|
+
});
|
|
14
|
+
map.set('external.run.events', async (route, _req, res) => {
|
|
15
|
+
await attachExternalRunSseClient(route.runId, res);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerKnowledgeHandlers = registerKnowledgeHandlers;
|
|
4
|
+
const server_helpers_js_1 = require("../server-helpers.js");
|
|
5
|
+
function registerKnowledgeHandlers(map, knowledgeProvider) {
|
|
6
|
+
map.set('knowledge.sources.list', async (_route, _req, res) => {
|
|
7
|
+
(0, server_helpers_js_1.json)(res, 200, { sources: await knowledgeProvider.listSources() });
|
|
8
|
+
});
|
|
9
|
+
map.set('knowledge.config.read', async (_route, _req, res) => {
|
|
10
|
+
(0, server_helpers_js_1.json)(res, 200, await knowledgeProvider.getConfig());
|
|
11
|
+
});
|
|
12
|
+
map.set('knowledge.config.update', async (_route, req, res) => {
|
|
13
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
14
|
+
(0, server_helpers_js_1.json)(res, 200, await knowledgeProvider.updateConfig(body));
|
|
15
|
+
});
|
|
16
|
+
map.set('knowledge.folders.list', async (_route, _req, res) => {
|
|
17
|
+
(0, server_helpers_js_1.json)(res, 200, { folders: await knowledgeProvider.listFolders() });
|
|
18
|
+
});
|
|
19
|
+
map.set('knowledge.folders.create', async (_route, req, res) => {
|
|
20
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
21
|
+
(0, server_helpers_js_1.json)(res, 200, await knowledgeProvider.createFolder(body));
|
|
22
|
+
});
|
|
23
|
+
map.set('knowledge.folder.update', async (route, req, res) => {
|
|
24
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
25
|
+
(0, server_helpers_js_1.json)(res, 200, await knowledgeProvider.updateFolder(route.folderId, body));
|
|
26
|
+
});
|
|
27
|
+
map.set('knowledge.folder.delete', async (route, _req, res) => {
|
|
28
|
+
(0, server_helpers_js_1.json)(res, 200, await knowledgeProvider.deleteFolder(route.folderId));
|
|
29
|
+
});
|
|
30
|
+
map.set('knowledge.bases.list', async (_route, _req, res) => {
|
|
31
|
+
(0, server_helpers_js_1.json)(res, 200, { bases: await knowledgeProvider.listKnowledgeBases() });
|
|
32
|
+
});
|
|
33
|
+
map.set('knowledge.bases.create', async (_route, req, res) => {
|
|
34
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
35
|
+
(0, server_helpers_js_1.json)(res, 200, await knowledgeProvider.createKnowledgeBase(body));
|
|
36
|
+
});
|
|
37
|
+
map.set('knowledge.base.get', async (route, _req, res) => {
|
|
38
|
+
(0, server_helpers_js_1.json)(res, 200, await knowledgeProvider.getKnowledgeBase(route.knowledgeBaseId));
|
|
39
|
+
});
|
|
40
|
+
map.set('knowledge.base.update', async (route, req, res) => {
|
|
41
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
42
|
+
(0, server_helpers_js_1.json)(res, 200, await knowledgeProvider.updateKnowledgeBase(route.knowledgeBaseId, body));
|
|
43
|
+
});
|
|
44
|
+
map.set('knowledge.base.delete', async (route, _req, res) => {
|
|
45
|
+
(0, server_helpers_js_1.json)(res, 200, await knowledgeProvider.deleteKnowledgeBase(route.knowledgeBaseId));
|
|
46
|
+
});
|
|
47
|
+
map.set('knowledge.base.files.list', async (route, _req, res) => {
|
|
48
|
+
(0, server_helpers_js_1.json)(res, 200, { files: await knowledgeProvider.listKnowledgeBaseFiles(route.knowledgeBaseId) });
|
|
49
|
+
});
|
|
50
|
+
map.set('knowledge.base.files.upload', async (route, req, res) => {
|
|
51
|
+
const contentType = String(req.headers['content-type'] || '').trim();
|
|
52
|
+
if (!contentType) {
|
|
53
|
+
throw new Error('Upload content type is required.');
|
|
54
|
+
}
|
|
55
|
+
const body = await (0, server_helpers_js_1.readRawBody)(req);
|
|
56
|
+
(0, server_helpers_js_1.json)(res, 200, { results: await knowledgeProvider.uploadKnowledgeBaseFiles(route.knowledgeBaseId, { contentType, body }) });
|
|
57
|
+
});
|
|
58
|
+
map.set('knowledge.base.file.delete', async (route, _req, res) => {
|
|
59
|
+
(0, server_helpers_js_1.json)(res, 200, await knowledgeProvider.deleteKnowledgeBaseFile(route.knowledgeBaseId, route.fileId));
|
|
60
|
+
});
|
|
61
|
+
map.set('knowledge.base.search', async (route, req, res) => {
|
|
62
|
+
const body = await (0, server_helpers_js_1.readJsonBody)(req);
|
|
63
|
+
(0, server_helpers_js_1.json)(res, 200, { results: await knowledgeProvider.searchKnowledgeBase(route.knowledgeBaseId, body) });
|
|
64
|
+
});
|
|
65
|
+
}
|