Audit WebCRT commands from device stdout after tab completion.

ZTE tab redraws the input line via carriage return; parse the last prompt line from PTY stdout on Enter instead of stdin keystrokes. Also remove remaining ?? in AuditPage.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-02 10:53:15 +08:00
parent a9c7e81793
commit 6ea14e6d5e
5 changed files with 110 additions and 13 deletions

View file

@ -97,6 +97,12 @@ export function normalizeAuditLine(line: string): string {
function currentCommandLine(term: Terminal): string {
const buf = term.buffer.active;
for (let y = buf.cursorY; y >= Math.max(0, buf.cursorY - 3); y -= 1) {
const line = buf.getLine(y);
if (!line) continue;
const text = normalizeAuditLine(line.translateToString(true));
if (/[#>\]]\s*\S/.test(text) || /#[^\s]/.test(text)) return text;
}
const line = buf.getLine(buf.cursorY);
if (!line) return "";
return normalizeAuditLine(line.translateToString(true));

View file

@ -87,8 +87,8 @@ export function auditSummary(
: neIds.length;
return t("audit.summary.neExecBatch", {
n: String(Number.isFinite(targetCount) ? targetCount : 0),
ok: String(d.ok_count ?? 0),
fail: String(d.fail_count ?? 0),
ok: String(d.ok_count != null ? Number(d.ok_count) : 0),
fail: String(d.fail_count != null ? Number(d.fail_count) : 0),
});
}
if (action.startsWith("auth.")) {