mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:00:50 +00:00
fix(control-ui): filter archived sessions (#77132)
Summary: - Use sessions.list as the Control UI source of truth for available sessions. - Hide archived sessions by default and keep the Sessions filter UI explicit, compact, and reversible. - Preserve session-change behavior, checkpoint details, generated i18n output, and chat/session picker consistency. Validation: - pnpm ui:i18n:check - pnpm test ui/src/styles/components.test.ts ui/src/ui/views/sessions.test.ts ui/src/ui/app-render.helpers.node.test.ts - pnpm test ui/src/ui/controllers/sessions.test.ts ui/src/ui/app-gateway.sessions.node.test.ts ui/src/ui/views/sessions.test.ts ui/src/styles/components.test.ts ui/src/ui/app-render.helpers.node.test.ts - pnpm tsgo:test:ui - Blacksmith Testbox: pnpm check:changed -- <PR paths>
This commit is contained in:
@@ -953,7 +953,35 @@ async function formatGeneratedTypeScript(filePath: string, source: string): Prom
|
||||
rejectOnFailure: true,
|
||||
},
|
||||
);
|
||||
return result.stdout;
|
||||
return restoreReplacementCorruptedStringLiterals(source, result.stdout);
|
||||
}
|
||||
|
||||
function restoreReplacementCorruptedStringLiterals(source: string, formatted: string): string {
|
||||
if (!formatted.includes("\uFFFD") || source.includes("\uFFFD")) {
|
||||
return formatted;
|
||||
}
|
||||
|
||||
const stringLiteralPattern = /"(?:\\.|[^"\\])*"/gu;
|
||||
const sourceLiterals = [...source.matchAll(stringLiteralPattern)];
|
||||
const formattedLiterals = [...formatted.matchAll(stringLiteralPattern)];
|
||||
if (sourceLiterals.length !== formattedLiterals.length) {
|
||||
return formatted;
|
||||
}
|
||||
|
||||
let output = "";
|
||||
let cursor = 0;
|
||||
for (const [index, formattedLiteral] of formattedLiterals.entries()) {
|
||||
const replacement = sourceLiterals[index]?.[0];
|
||||
const literal = formattedLiteral[0];
|
||||
const start = formattedLiteral.index;
|
||||
if (replacement === undefined || start === undefined) {
|
||||
return formatted;
|
||||
}
|
||||
output += formatted.slice(cursor, start);
|
||||
output += literal.includes("\uFFFD") && !replacement.includes("\uFFFD") ? replacement : literal;
|
||||
cursor = start + literal.length;
|
||||
}
|
||||
return `${output}${formatted.slice(cursor)}`;
|
||||
}
|
||||
|
||||
type PendingPrompt = {
|
||||
|
||||
Reference in New Issue
Block a user