@wendongfly/zihi 1.1.20 → 1.1.21

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/dist/chat.html CHANGED
@@ -1154,7 +1154,8 @@
1154
1154
  }
1155
1155
 
1156
1156
  function respondPermModal(requestId, allow, toolName, approveAll) {
1157
- if (!isController) { addStatusMessage('你没有控制权,无法操作'); return; }
1157
+ // 没有控制权时先尝试夺取(同账号会话所有者后端会放行)
1158
+ if (!isController && canTakeControl()) socket.emit('take-control', { sessionId: SESSION_ID });
1158
1159
  socket.emit('agent:permission', { requestId, allow, toolName, approveAll });
1159
1160
  const inlineActions = document.querySelector(`.perm-actions[data-reqid="${requestId}"]`);
1160
1161
  if (inlineActions) inlineActions.innerHTML = allow
@@ -1201,7 +1202,7 @@
1201
1202
  });
1202
1203
 
1203
1204
  window.respondAgentPermission = function(requestId, allow, btn, toolName) {
1204
- if (!isController) { addStatusMessage('你没有控制权,无法操作'); return; }
1205
+ if (!isController && canTakeControl()) socket.emit('take-control', { sessionId: SESSION_ID });
1205
1206
  const approveAll = !!toolName;
1206
1207
  socket.emit('agent:permission', { requestId, allow, toolName, approveAll });
1207
1208
  const actions = btn.closest('.perm-actions');