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:
@@ -2,7 +2,7 @@
|
||||
"name": "gravity-bridge",
|
||||
"displayName": "Gravity Bridge",
|
||||
"description": "Discord-based unified approval system for Antigravity AI interactions.",
|
||||
"version": "0.5.44",
|
||||
"version": "0.5.45",
|
||||
"publisher": "variet",
|
||||
"engines": {
|
||||
"vscode": "^1.100.0"
|
||||
|
||||
@@ -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}`;
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user