feat(wechat): add intent router and Cursor executor admin controls

Expose WeChat routing policy and Cursor experience channel settings in md.tkmind.cn with matching admin-api routes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-26 21:56:15 +08:00
parent 80c2091baf
commit 70433a3dcd
7 changed files with 626 additions and 0 deletions
+58
View File
@@ -108,6 +108,8 @@ export function createAdminApp(services) {
skillRuntimeConfigService,
billingConfigService,
wechatScheduleLlmConfigService,
wechatIntentRouterConfigService,
wechatCursorExecutorPolicyService,
adminSystemTestService,
systemTestAccountService,
wordFilterService,
@@ -395,6 +397,62 @@ export function createAdminApp(services) {
res.json(result);
});
adminApi.get('/wechat/intent-router/config', requireAdmin, async (_req, res) => {
if (!wechatIntentRouterConfigService?.getConfig) {
return res.status(503).json({ message: '微信意图路由配置未启用' });
}
const config = await wechatIntentRouterConfigService.getConfig();
return res.json({ config });
});
adminApi.get('/wechat/intent-router/runtime', requireAdmin, async (_req, res) => {
if (!wechatIntentRouterConfigService?.getRuntimeState) {
return res.status(503).json({ message: '微信意图路由配置未启用' });
}
return res.json(await wechatIntentRouterConfigService.getRuntimeState());
});
const updateWechatIntentRouterConfig = async (req, res) => {
if (!wechatIntentRouterConfigService?.updateConfig) {
return res.status(503).json({ message: '微信意图路由配置未启用' });
}
const config = await wechatIntentRouterConfigService.updateConfig(req.body ?? {}, {
updatedBy: req.currentUser.id,
});
return res.json({ config });
};
adminApi.put('/wechat/intent-router/config', requireAdmin, updateWechatIntentRouterConfig);
adminApi.patch('/wechat/intent-router/config', requireAdmin, updateWechatIntentRouterConfig);
adminApi.get('/wechat/cursor-executor/config', requireAdmin, async (_req, res) => {
if (!wechatCursorExecutorPolicyService?.getAdminConfig) {
return res.status(503).json({ message: '微信 Cursor 体验通道未启用' });
}
return res.json(await wechatCursorExecutorPolicyService.getAdminConfig());
});
adminApi.get('/wechat/cursor-executor/runtime', requireAdmin, async (_req, res) => {
if (!wechatCursorExecutorPolicyService?.getRuntimeState) {
return res.status(503).json({ message: '微信 Cursor 体验通道未启用' });
}
return res.json(await wechatCursorExecutorPolicyService.getRuntimeState());
});
const updateWechatCursorExecutorConfig = async (req, res) => {
if (!wechatCursorExecutorPolicyService?.updateAdminConfig) {
return res.status(503).json({ message: '微信 Cursor 体验通道未启用' });
}
const result = await wechatCursorExecutorPolicyService.updateAdminConfig(
req.body?.config ?? req.body ?? {},
{ updatedBy: req.currentUser.id },
);
return res.json(result);
};
adminApi.put('/wechat/cursor-executor/config', requireAdmin, updateWechatCursorExecutorConfig);
adminApi.patch('/wechat/cursor-executor/config', requireAdmin, updateWechatCursorExecutorConfig);
adminApi.get('/mindspace/config', requireAdmin, async (_req, res) => {
if (!loadMindSpaceConfig) return res.status(503).json({ message: 'MindSpace 配置未启用' });
const config = await loadMindSpaceConfig(pool);
+8
View File
@@ -43,6 +43,10 @@ export async function bootstrapAdminServices() {
const { createAssetGatewayConfigService } = await importMemind('asset-gateway.mjs');
const { ensureAssetGatewaySchema } = await importMemind('db.mjs');
const { createWechatScheduleLlmConfigService } = await importMemind('wechat-schedule-llm-config.mjs');
const { createWechatIntentRouterConfigService } = await importMemind('wechat-intent-router-config.mjs');
const { createWechatCursorExecutorAdminConfigService } = await importMemind(
'wechat-cursor-executor-admin-config.mjs',
);
const { createAdminSystemTestService } = await importMemind('admin-system-tests.mjs');
const { createOpsApi } = await importMemind('admin-routes.mjs');
const { createWordFilterService, ensureWordFilterSchema } = await importMemind('word-filter.mjs');
@@ -126,6 +130,8 @@ export async function bootstrapAdminServices() {
const wechatScheduleLlmConfigService = createWechatScheduleLlmConfigService(pool, {
env: process.env,
});
const wechatIntentRouterConfigService = createWechatIntentRouterConfigService(pool);
const wechatCursorExecutorPolicyService = createWechatCursorExecutorAdminConfigService(pool);
const adminSystemTestService = createAdminSystemTestService({
pool,
userAuth,
@@ -198,6 +204,8 @@ export async function bootstrapAdminServices() {
skillRuntimeConfigService,
billingConfigService,
wechatScheduleLlmConfigService,
wechatIntentRouterConfigService,
wechatCursorExecutorPolicyService,
adminSystemTestService,
systemTestAccountService,
wordFilterService,
+4
View File
@@ -112,6 +112,8 @@ ready
skillRuntimeConfigService,
billingConfigService,
wechatScheduleLlmConfigService,
wechatIntentRouterConfigService,
wechatCursorExecutorPolicyService,
adminSystemTestService,
systemTestAccountService,
wordFilterService,
@@ -142,6 +144,8 @@ ready
skillRuntimeConfigService,
billingConfigService,
wechatScheduleLlmConfigService,
wechatIntentRouterConfigService,
wechatCursorExecutorPolicyService,
adminSystemTestService,
systemTestAccountService,
wordFilterService,