fix(observer/bridge): PROMPT_ONLY_RE — regex escaping + ellipsis prefix handling (v0.5.45) #task-619
Observer: \\\\s (4-backslash) → \\s (2-backslash) in template literal regex - Per known-issues rule: regex literals need 2-backslash for \s, \d etc. - Old: literal \\s matched, new: whitespace class matched correctly http-bridge: /^[\s\\\/]*[\w_.-]+\s*[>»$#]\s*$/ → /^.*[>»$#]\s*$/ - Old pattern failed on ellipsis '…' prefix (U+2026 not in charset) - Terminal prompt '…\\gravity_control >' was passing through as cmd - New pattern: any text ending with prompt marker is skipped
This commit is contained in:
@@ -273,7 +273,7 @@ function _handlePending(req: any, res: any, ctx: HttpBridgeContext) {
|
||||
}
|
||||
// v12: Validate extracted text is not just a prompt fragment
|
||||
// Skip enrichment only if it looks like a bare prompt (e.g. "\\gravity_control >")
|
||||
const PROMPT_ONLY_RE = /^[\s\\\/]*[\w_.-]+\s*[>»$#]\s*$/;
|
||||
const PROMPT_ONLY_RE = /^.*[>»$#]\s*$/;
|
||||
if (!PROMPT_ONLY_RE.test(extracted) && extracted.length > 3) {
|
||||
enrichedCmd = extracted.substring(0, 200);
|
||||
enrichedDesc = `[${rawCmd}] ${rawDesc}`;
|
||||
|
||||
Reference in New Issue
Block a user