26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
// ============================================================
|
||
// 开发者/运维入口可见性(moduleId: web-feature-devtools)
|
||
// 计划员界面默认不出现开发入口:多智能体编排 / 重生中心 / 算法异步任务与
|
||
// MCP 插件登记 / 微观审计回放 / 开发者工具菜单。
|
||
// 排查时用带 ?devtools=1 的地址打开一次即可记住,或控制台执行
|
||
// localStorage.setItem('aps.devtools', '1') 后刷新;?devtools=0 关闭。
|
||
// ============================================================
|
||
|
||
const KEY = 'aps.devtools';
|
||
|
||
let cached: boolean | null = null;
|
||
|
||
export function devToolsEnabled(): boolean {
|
||
if (cached != null) return cached;
|
||
if (typeof window === 'undefined') return false;
|
||
try {
|
||
const q = new URLSearchParams(window.location.search).get('devtools');
|
||
if (q === '1') localStorage.setItem(KEY, '1');
|
||
else if (q === '0') localStorage.removeItem(KEY);
|
||
cached = localStorage.getItem(KEY) === '1';
|
||
} catch {
|
||
cached = false;
|
||
}
|
||
return cached;
|
||
}
|