wezard 2.8.4 → 2.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -30,7 +30,7 @@ import { withImageClipboard, pasteVerifiedImage } from "./image-input.js";
|
|
|
30
30
|
import { createKeyedScheduler } from "../shared/keyed-scheduler.js";
|
|
31
31
|
import { withPaneInput } from "./pane-input.js";
|
|
32
32
|
import { activeBackends, resolveCliBackend, backendForPath, projectDirFor, projectDirsFor, } from "../shared/cli-backends.js";
|
|
33
|
-
import { isModalPane, isCodexHookReviewPane, isAskqSubmitPage, parseModalOptions, pickModalAnswer, pickAutoAllowAnswer, parseConfirmContext, modalFingerprint, looksLikePicker } from "../shared/modal-pane.js";
|
|
33
|
+
import { isModalPane, isCodexHookReviewPane, isAskqSubmitPage, parseModalOptions, pickModalAnswer, pickAutoAllowAnswer, parseConfirmContext, modalFingerprint, modalCallFingerprint, looksLikePicker } from "../shared/modal-pane.js";
|
|
34
34
|
import { hasMirrorAskq, runMirrorAskqFlow, hasMirrorPlan, mootMirrorPlan, runMirrorPlanFlow, hasMirrorPicker, mootMirrorPicker, runMirrorPickerFlow } from "./approval.js";
|
|
35
35
|
import { isAutoWindowActive } from "./session-cache.js";
|
|
36
36
|
import { noticeSuffixFor } from "./notices.js";
|
|
@@ -6441,7 +6441,7 @@ export const startMirror = (deps) => {
|
|
|
6441
6441
|
deny: async () => {
|
|
6442
6442
|
if (!valid())
|
|
6443
6443
|
return;
|
|
6444
|
-
const result = await pressNativePickerUnlocked(a,
|
|
6444
|
+
const result = await pressNativePickerUnlocked(a, modalCallFingerprint(v.screen), "no", valid);
|
|
6445
6445
|
if (!valid())
|
|
6446
6446
|
return;
|
|
6447
6447
|
log.info({ target: a.target, reason: policy.reason, result }, "picker sentinel: deny rule");
|
|
@@ -6483,7 +6483,7 @@ export const startMirror = (deps) => {
|
|
|
6483
6483
|
danger: policy.forceSingle,
|
|
6484
6484
|
voteTimeoutMs: cfg.approval.longPollSec * 1000,
|
|
6485
6485
|
// Human waiting is outside the lock; the eventual press obtains a new transaction.
|
|
6486
|
-
press: (what) => pressNativePicker(a,
|
|
6486
|
+
press: (what) => pressNativePicker(a, modalCallFingerprint(v.screen), what, guard),
|
|
6487
6487
|
}).then((sent) => {
|
|
6488
6488
|
// 卡没发出去 (WS 断/发送失败): 清指纹, 让下一 tick 对同屏重试发卡,
|
|
6489
6489
|
// 否则这只框会被指纹永久静默。
|
|
@@ -6516,8 +6516,9 @@ export const startMirror = (deps) => {
|
|
|
6516
6516
|
const pickerTimer = setInterval(() => void pickerTick(), 5_000);
|
|
6517
6517
|
// 审批卡点击后的代按回调。点击与本地按键之间隔着人的反应时间, 必须重读屏并
|
|
6518
6518
|
// 校验仍是**同一个调用**的确认框 —— 期间本地按掉旧框又弹了新框的话, 盲按就是
|
|
6519
|
-
//
|
|
6520
|
-
|
|
6519
|
+
// 替用户批准了他没看过的东西。比对按调用指纹 (modalCallFingerprint): 框外的
|
|
6520
|
+
// 实时进度行/状态栏变化不算变更; 任一侧认不出调用 (undefined) 也不按。
|
|
6521
|
+
const pressNativePickerUnlocked = async (a, expectCall, what, live) => {
|
|
6521
6522
|
if (!live() || !a.tmuxPane || !(await tmuxPaneAlive(a.tmuxPane)))
|
|
6522
6523
|
return { ok: false, reason: "pane 已不在" };
|
|
6523
6524
|
if (cliOf(a) === "codex")
|
|
@@ -6530,7 +6531,9 @@ export const startMirror = (deps) => {
|
|
|
6530
6531
|
if (pickerPolicy(cfg, cliOf(a), parseConfirmContext(v.screen), false).decision === "leave") {
|
|
6531
6532
|
return { ok: false, reason: "独立原生或交互审批,请在 CLI 中处理" };
|
|
6532
6533
|
}
|
|
6533
|
-
|
|
6534
|
+
// 按调用比对: 认不出就不按 (undefined 也不等), 换框绝不盲按。
|
|
6535
|
+
const call = modalCallFingerprint(v.screen);
|
|
6536
|
+
if (call === undefined || call !== expectCall) {
|
|
6534
6537
|
return { ok: false, reason: "当前确认框的操作或参数已变更,不代按" };
|
|
6535
6538
|
}
|
|
6536
6539
|
if (what === "no") {
|
|
@@ -6550,7 +6553,7 @@ export const startMirror = (deps) => {
|
|
|
6550
6553
|
? { ok: false, reason: `按下 ${pick.index} 后确认框仍在` }
|
|
6551
6554
|
: { ok: true, label: `${pick.index}. ${pick.label}` };
|
|
6552
6555
|
};
|
|
6553
|
-
const pressNativePicker = async (a,
|
|
6556
|
+
const pressNativePicker = async (a, call, what, guard) => withPaneInput(a.tmuxPane, (live) => pressNativePickerUnlocked(a, call, what, live), { guard });
|
|
6554
6557
|
// 调用方持有 pane 输入锁; clear 与 carry 的原生身份探测共用同一条 slash 提交流程。
|
|
6555
6558
|
const nativeCommands = (target, pane, codex, sameProcess, sameSession, allowed = () => true) => {
|
|
6556
6559
|
// 每次 slash 都在同一个物理输入锁里核对空框、idle 与进程; 不借用有补 Enter 的通用注入器。
|