feat(cursor): wire executor through portal, admin, and wechat routes

Register cursor in LLM executor bindings, route page/code tasks through
cursor runtime selection, and bootstrap wechat cursor policy services.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-27 09:33:47 +08:00
parent a29e1ec5c8
commit ad6dcc283f
17 changed files with 343 additions and 16 deletions
+30
View File
@@ -43,6 +43,7 @@ function plazaRouteError(res, req, error) {
* @param {object|null} deps.plazaOps
* @param {object|null} deps.wechatAdmin
* @param {object|null} deps.wechatIntentRouterConfigService
* @param {object|null} deps.wechatCursorExecutorPolicyService
*/
export function createAdminApi({
jsonBody,
@@ -66,6 +67,7 @@ export function createAdminApi({
plazaOps,
wechatAdmin,
wechatIntentRouterConfigService,
wechatCursorExecutorPolicyService,
subscriptionService,
templateCatalogService,
}) {
@@ -925,6 +927,34 @@ export function createAdminApi({
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('/llm-providers/catalog', requireAdmin, (_req, res) => {
if (!llmProviderService) return res.status(503).json({ message: '未启用 LLM 配置' });
res.json({ catalog: llmProviderService.catalog });