tmuxclihook 0.2.0 → 0.2.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmuxclihook",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "交互式 TUI 安装器:环境侦测、AI CLI 侦测、tmux-ai-status hooks 装/卸/修、TPM 软链校验",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,6 +29,9 @@ ADAPTER_SESSION_START_TIMING="deferred"
29
29
  # PermissionRequest 不含 tool_use_id,而 Codex 支持并行工具。用 sentinel 保守保持 `!`,
30
30
  # 直到 Stop/UserPromptSubmit/SessionStart 清理,避免其他工具完成时漏报待审批。
31
31
  ADAPTER_HOLD_UNMATCHED_PERMISSION="true"
32
+ # request_permissions 直接弹出 Codex 权限 UI,但上游不会发送 PermissionRequest hook。
33
+ # 它仍发送可配对的 PreToolUse/PostToolUse,因此可在 PreToolUse 阶段精确进入审批态。
34
+ ADAPTER_PERMISSION_PRE_TOOL_NAMES="request_permissions"
32
35
 
33
36
  # 自修复/TUI 调用的安装脚本
34
37
  ADAPTER_INSTALLER="${_LIB_DIR}/install-codex-hooks.sh"
@@ -105,19 +105,28 @@ case "$EVENT" in
105
105
  TOOL_USE_ID=$(echo "$INPUT" | jq -r '.tool_use_id // ""' 2>/dev/null)
106
106
  INPUT_DIGEST=$(echo "$INPUT" | jq -c '.tool_input // null' 2>/dev/null)
107
107
  _add_pending_pre "$TOOL_USE_ID" "$TOOL"
108
- # Claude 的 PermReq 不带 tool_use_id,派生看不到审批态;用 LIVE_STATUS 兜底。
109
- # Codex sentinel 和 OpenCode request ID 则会直接从 pending 集合派生。
110
- LIVE_STATUS=$(_current_pane_status)
111
- case "$LIVE_STATUS" in
112
- "!"|"?") STATUS="$LIVE_STATUS" ;;
113
- *)
114
- if _derive_status_from_pending; then
115
- STATUS="$DERIVED"
116
- else
117
- STATUS=">"
118
- fi
119
- ;;
120
- esac
108
+ _permission_pre_tool=0
109
+ for _permission_tool in ${ADAPTER_PERMISSION_PRE_TOOL_NAMES:-}; do
110
+ [ "$TOOL" = "$_permission_tool" ] && { _permission_pre_tool=1; break; }
111
+ done
112
+ if [ "$_permission_pre_tool" = "1" ]; then
113
+ STATUS="!"
114
+ _add_pending_perm "$TOOL_USE_ID" "$STATUS" "$TOOL"
115
+ else
116
+ # Claude 的 PermReq 不带 tool_use_id,派生看不到审批态;用 LIVE_STATUS 兜底。
117
+ # Codex sentinel 和 OpenCode request ID 则会直接从 pending 集合派生。
118
+ LIVE_STATUS=$(_current_pane_status)
119
+ case "$LIVE_STATUS" in
120
+ "!"|"?") STATUS="$LIVE_STATUS" ;;
121
+ *)
122
+ if _derive_status_from_pending; then
123
+ STATUS="$DERIVED"
124
+ else
125
+ STATUS=">"
126
+ fi
127
+ ;;
128
+ esac
129
+ fi
121
130
  ;;
122
131
  PostToolUse|PostToolUseFailure)
123
132
  TOOL=$(echo "$INPUT" | jq -r '.tool_name // ""' 2>/dev/null)