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:
Variet Worker
2026-04-15 08:20:42 +09:00
parent 4684376c78
commit 01539e9bfb
4 changed files with 550 additions and 332 deletions

View File

@@ -112,7 +112,7 @@ export function generateApprovalObserverScript(_port: number): string {
// v12: Climb DOM tree to find context near the button
// Priority: pre/code (skip prompt-only) > substantial span/div/p text > aria-label > button text
// PROMPT_ONLY: matches terminal prompts like "...\project >" or "PS C:\...>" with no actual command
var PROMPT_ONLY_RE = /^(.*[\\/>»$#]\\s*)$/;
var PROMPT_ONLY_RE = /^[^\\n]*[\\/>\xbb$#]\\s*$/;
function extractContextFromNearby(btn) {
var node = btn;
var _debugTrail = [];