6106b4e67c
- 删除应用侧 /history 精确匹配分支与 reloadHistory、chatPromptPolish 的 / 前缀绕过、chatCommandMetadata、memoryCommands、projectSummaryConstants 命令清单 - 删除只服务退役摘要面板的 project-summary/*Summaries.ts 与 agentTrace.ts 及对应测试 - 删除 /sync-canvas-project、/read、/trace 草稿回填死链(agentPresentation.ts 与 Rust suggested_canvas_tool_call) - 删除无人调用的 Tauri 命令 get_game_creation_agent_capabilities 与 get_limited_local_commands - 删除 --swarm-chat 入口、SwarmChat 变体、src/swarm_cli.rs 与整个 swarm_cli/ 目录 - 收敛 agent/interaction.rs 至自然语言 steer 决策路径,删除交互内核整层 - 删除 SWARM_TURN_*_ERROR、print_runtime_response_stream_status 及其专属测试 - 更新 ChatMarkdownMessage、chatPromptPolish、rememberCommand 与 appSurface 用例,移除斜杠命令断言
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
export function isAbsoluteProjectPath(value: string) {
|
|
const path = value.trim();
|
|
return (
|
|
path.startsWith('/') ||
|
|
/^[A-Za-z]:[\\/]/.test(path) ||
|
|
/^\\\\[^\\]+\\[^\\]+/.test(path)
|
|
);
|
|
}
|
|
|
|
export function projectPathHasControlCharacter(value: string) {
|
|
return value
|
|
.trim()
|
|
.split('')
|
|
.some((character) => {
|
|
const code = character.charCodeAt(0);
|
|
return code < 32 || code === 127;
|
|
});
|
|
}
|
|
|
|
// 失效事件只是重读提示:匹配 Windows 的普通 / verbatim 路径后,调用方仍用当前项目路径
|
|
// 读取权威清单。此比较不解析链接,也不作为文件访问授权依据。
|
|
export function projectPathsMatchForInvalidation(
|
|
eventPath: string,
|
|
activePath: string | null,
|
|
) {
|
|
if (!eventPath || !activePath) return false;
|
|
function normalize(path: string) {
|
|
if (/^\\\\\?\\UNC\\/i.test(path)) {
|
|
path = `\\\\${path.slice(8)}`;
|
|
} else if (/^\\\\\?\\[a-z]:\\/i.test(path)) {
|
|
path = path.slice(4);
|
|
}
|
|
if (/^[a-z]:[\\/]/i.test(path) || /^\\\\[^?.\\][^\\]*\\[^\\]+/.test(path)) {
|
|
return path.replace(/\\/g, '/').replace(/\/+$/, '').toLowerCase();
|
|
}
|
|
return path;
|
|
}
|
|
return normalize(eventPath) === normalize(activePath);
|
|
}
|