Add per-feature Cursor channel toggles for admin and runtime.
Memind CI / Test, build, and release guards (push) Has been cancelled
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:
@@ -1,11 +1,13 @@
|
||||
import {
|
||||
CURSOR_EXECUTOR_CHANNEL,
|
||||
isChannelAllowedByCursorPolicy,
|
||||
isCursorFeatureEnabled,
|
||||
isIntentAllowedByWechatCursorPolicy,
|
||||
isUserAllowedByWechatCursorPolicy,
|
||||
} from './wechat-cursor-executor-admin-config.mjs';
|
||||
import { CURSOR_CHANNEL_FEATURES } from './cursor-channel-features.mjs';
|
||||
|
||||
export { CURSOR_EXECUTOR_CHANNEL };
|
||||
export { CURSOR_EXECUTOR_CHANNEL, CURSOR_CHANNEL_FEATURES };
|
||||
|
||||
export function resolveCursorChannelEligible({
|
||||
user = null,
|
||||
@@ -25,6 +27,32 @@ export function resolveCursorChannelEligible({
|
||||
return true;
|
||||
}
|
||||
|
||||
export function resolveCursorChatBridgeEligible({
|
||||
user = null,
|
||||
userId = null,
|
||||
policy = null,
|
||||
env = process.env,
|
||||
} = {}) {
|
||||
if (!policy?.enabled) return false;
|
||||
const subject = user ?? { userId };
|
||||
if (!isUserAllowedByWechatCursorPolicy(subject, policy)) return false;
|
||||
if (!isCursorFeatureEnabled(policy, CURSOR_CHANNEL_FEATURES.CHAT_BRIDGE)) return false;
|
||||
const bridgeEnvEnabled = String(env?.MEMIND_CURSOR_CHAT_BRIDGE_ENABLED ?? '').trim();
|
||||
if (!['1', 'true', 'yes', 'on'].includes(bridgeEnvEnabled.toLowerCase())) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function resolveCursorScheduledTaskEligible({
|
||||
user = null,
|
||||
userId = null,
|
||||
policy = null,
|
||||
} = {}) {
|
||||
if (!policy?.enabled) return false;
|
||||
const subject = user ?? { userId };
|
||||
if (!isUserAllowedByWechatCursorPolicy(subject, policy)) return false;
|
||||
return isCursorFeatureEnabled(policy, CURSOR_CHANNEL_FEATURES.SCHEDULED_TASKS);
|
||||
}
|
||||
|
||||
export function resolveWechatCursorExecutorEligible({
|
||||
user = null,
|
||||
userId = null,
|
||||
|
||||
Reference in New Issue
Block a user