Revert "修复审批请求在聊天中无提示且无法响应 (#467)" (#553)

This reverts commit 56c7b59eaf.
This commit is contained in:
ekko
2026-05-09 08:36:13 +08:00
committed by GitHub
parent 56c7b59eaf
commit 9045f2a987
12 changed files with 9 additions and 767 deletions
@@ -1,29 +0,0 @@
export type ApprovalChoice = 'once' | 'session' | 'always' | 'deny'
export interface ApprovalCommand {
choice: ApprovalChoice
all: boolean
}
const APPROVAL_COMMAND_RE = /^\/(approve|deny)(?:\s+(session|always|all))?\s*$/i
export function parseApprovalCommand(input: string): ApprovalCommand | null {
const match = input.trim().match(APPROVAL_COMMAND_RE)
if (!match) return null
const verb = match[1].toLowerCase()
const modifier = match[2]?.toLowerCase()
if (verb === 'deny') {
if (modifier && modifier !== 'all') return null
return { choice: 'deny', all: modifier === 'all' }
}
if (modifier === 'session') return { choice: 'session', all: false }
if (modifier === 'always') return { choice: 'always', all: false }
return { choice: 'once', all: modifier === 'all' }
}
export function isApprovalCommand(input: string): boolean {
return parseApprovalCommand(input) != null
}