fix(bridge): fix Discord signal relay false-positives and empty body logic

This commit is contained in:
Variet Worker
2026-04-10 00:12:01 +09:00
parent 22e1799d66
commit fadd39424b
6 changed files with 35 additions and 13 deletions

View File

@@ -275,19 +275,19 @@ export function generateApprovalObserverScript(_port: number): string {
// ONLY positive triggers should initiate a pending request group.
// Negative/secondary buttons (Deny, Reject, Dismiss) will be collected as siblings.
var PATS=[
{re:/^(?:Always\s*)?Run/i, type:'terminal_command'},
{re:/^(?:Always\s*)?Accept all/i, type:'diff_review'},
{re:/^(?:Always\s*)?Accept/i, type:'agent_step'},
{re:/^(?:Always\s*)?Allow/i, type:'permission'},
{re:/^(?:Always\s*)?Approve/i, type:'agent_step'},
{re:/^Retry/i, type:'error_recovery'},
{re:/^(?:Always\s*)?Run\b/i, type:'terminal_command'},
{re:/^(?:Always\s*)?Accept(?: all)?\b/i, type:'diff_review'},
{re:/^(?:Always\s*)?Accept\b/i, type:'agent_step'},
{re:/^(?:Always\s*)?Allow\b/i, type:'permission'},
{re:/^(?:Always\s*)?Approve\b/i, type:'agent_step'},
{re:/^Retry\b/i, type:'error_recovery'},
];
// ALL actionable button patterns (for grouping siblings in same container)
var ALL_ACTION_RE=[/^(?:Always\s*)?Run/i,/^(?:Always\s*)?Accept/i,/^Reject/i,/^(?:Always\s*)?Allow/i,/^Deny/i,/^(?:Always\s*)?Approve/i,/^Cancel$/i,/^Retry$/i,/^Dismiss$/i,/^Stop$/i,/^Decline$/i];
var ALL_ACTION_RE=[/^(?:Always\s*)?Run\b/i,/^(?:Always\s*)?Accept\b/i,/^Reject\b/i,/^(?:Always\s*)?Allow\b/i,/^Deny\b/i,/^(?:Always\s*)?Approve\b/i,/^Cancel\b/i,/^Retry\b/i,/^Dismiss\b/i,/^Stop\b/i,/^Decline\b/i];
// Reject button patterns for finding the counterpart
var REJECT_RE=[/^reject$/i,/^reject all$/i,/^cancel$/i,/^deny$/i,/^stop$/i,/^decline$/i,/^dismiss$/i];
var REJECT_RE=[/^reject\b/i,/^cancel\b/i,/^deny\b/i,/^stop\b/i,/^decline\b/i,/^dismiss\b/i];
// ── Stable button fingerprint (no getBoundingClientRect — scroll-safe) ──
function btnId(b,type){