Add per-feature Cursor channel toggles for admin and runtime.
Memind CI / Test, build, and release guards (push) Has been cancelled

Expose page/data/scheduled-task/chat-bridge switches in the智趣体验通道 config so Tang can roll out Cursor paths independently with DeepSeek fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-31 09:40:52 +08:00
parent ac2c87be43
commit 617ff0d1dd
21 changed files with 915 additions and 127 deletions
+38 -2
View File
@@ -9,6 +9,7 @@ import {
import {
CURSOR_EXECUTOR_CHANNEL,
resolveCursorChannelEligible,
resolveCursorScheduledTaskEligible,
resolveWechatCursorExecutorEligible,
} from './wechat-cursor-executor-policy.mjs';
@@ -49,11 +50,18 @@ test('allowlisted user can use cursor channel for page.generate only', async ()
await service.updateAdminConfig({
enabled: true,
userAllowlist: ['john-uuid'],
intentAllowlist: ['page.generate'],
features: {
pageGenerate: { enabled: true },
pageData: { enabled: false },
excelAnalysis: { enabled: false },
chatBridge: { enabled: false },
scheduledTasks: { enabled: false },
},
}, { updatedBy: 'admin-1' });
const policy = await service.getEffectivePolicy('john-uuid', { userId: 'john-uuid' });
assert.equal(policy.userAllowed, true);
assert.equal(policy.features.pageGenerate.enabled, true);
assert.equal(
resolveWechatCursorExecutorEligible({
user: { userId: 'john-uuid' },
@@ -80,6 +88,24 @@ test('allowlisted user can use cursor channel for page.generate only', async ()
);
});
test('resolveCursorScheduledTaskEligible follows scheduledTasks feature toggle', async () => {
const pool = createMemoryPool();
const service = createWechatCursorExecutorAdminConfigService(pool);
await service.updateAdminConfig({
enabled: true,
userAllowlist: ['john-uuid'],
features: {
pageGenerate: { enabled: true },
scheduledTasks: { enabled: true },
},
}, { updatedBy: 'admin-1' });
const policy = await service.getEffectivePolicy('john-uuid', { userId: 'john-uuid' });
assert.equal(
resolveCursorScheduledTaskEligible({ user: { userId: 'john-uuid' }, policy }),
true,
);
});
test('isUserAllowedByWechatCursorPolicy matches username aliases', () => {
const policy = { enabled: true, userAllowlist: ['john'] };
assert.equal(
@@ -90,7 +116,17 @@ test('isUserAllowedByWechatCursorPolicy matches username aliases', () => {
});
test('isIntentAllowedByWechatCursorPolicy respects allowlist', () => {
const policy = { intentAllowlist: ['page.generate'] };
const policy = {
enabled: true,
intentAllowlist: ['page.generate'],
features: {
pageGenerate: { enabled: true },
pageData: { enabled: false },
excelAnalysis: { enabled: false },
chatBridge: { enabled: false },
scheduledTasks: { enabled: false },
},
};
assert.equal(isIntentAllowedByWechatCursorPolicy('page.generate', policy), true);
assert.equal(isIntentAllowedByWechatCursorPolicy('chat.general', policy), false);
});