fix(approval): prototype 拦截器替代 approval/request waterfall hook

与 ask_user 同一根因:'approval/request' waterfall 分发在 per-fiber events
注册表,本插件 ctx.on 监听收不到。改为包装 ApprovalService.prototype.
request(类跨实例/fiber 共享),TG 审批答案与原请求竞速,保留 dual-path
语义;stop 时恢复原型。已验证运行态拦截器标记就位。
This commit is contained in:
root
2026-09-17 11:47:48 +08:00
parent 566932e0ae
commit f49ac5d3c0
3 changed files with 113 additions and 23 deletions
+5 -2
View File
@@ -42,10 +42,12 @@ export declare class TelegramBridge {
private readonly pendingAsks;
private hookTimer;
private readonly pendingApprovalsTG;
private disposeApprovalHook;
/** Prototype-ask interceptor state (see installAskInterceptor). */
private askInstalled;
private askRestore;
/** Prototype-approval interceptor state (see installApprovalInterceptor). */
private approvalInstalled;
private approvalRestore;
/** callId → tool name (tool/result failure notices) */
private readonly callNames;
/** sessionId → latest todo snapshot (/mission) */
@@ -140,7 +142,8 @@ export declare class TelegramBridge {
private handleTgAnswer;
/** Inline-keyboard tap on an ask message: toggle/record the choice, resolve when every question is answered. */
private handleAskCallback;
private onApprovalRequest;
private installApprovalInterceptor;
private aroundApprovalRequest;
private handleTgApproval;
private stopBound;
private sendMission;