@wendongfly/zihi 1.1.19 → 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');
@@ -2235,10 +2236,11 @@
2235
2236
 
2236
2237
  // ── 清除会话 ──────────────────────────────────
2237
2238
  window.doClear = function() {
2239
+ if (!confirm('确定清除当前会话的所有对话和 Claude 上下文?')) return;
2238
2240
  chatArea.innerHTML = '';
2239
2241
  endStream();
2240
2242
  if (!isController && canTakeControl()) socket.emit('take-control', { sessionId: SESSION_ID });
2241
- socket.emit('agent:query', { prompt: '/clear' });
2243
+ socket.emit('agent:clear');
2242
2244
  clearSessionHistory(SESSION_ID); // 同时清除离线缓存
2243
2245
  addStatusMessage('已清除对话和 Claude 上下文');
2244
2246
  };