@wendongfly/myhi 1.3.140 → 1.3.141

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
@@ -2331,6 +2331,10 @@
2331
2331
  });
2332
2332
 
2333
2333
  socket.on('agent:busy', (busy) => {
2334
+ // currentSession 是 joined 那一刻的快照,busy 字段不会自己更新。
2335
+ // 不同步的话:进页面时 AI 恰好在跑 → busy 永远停在 true → 之后每次回车
2336
+ // 都被当成"忙"转存草稿,消息再也发不出去(取回→又存草稿的死循环)。
2337
+ if (currentSession) currentSession.busy = busy;
2334
2338
  if (busy) { showThinking(); setWorkState('thinking'); }
2335
2339
  else { removeThinking(); setWorkState('idle'); }
2336
2340
  });
@@ -2410,7 +2414,8 @@
2410
2414
 
2411
2415
  // AI 还在跑这一轮(可能正开着子代理,整轮 result 未到,服务端 isBusy 会拒收):
2412
2416
  // 不再把输入连同刚上传的图片一起丢掉,转存草稿,本轮干完再取回。
2413
- if (currentSession?.mode === 'agent' && (workState !== 'idle' || currentSession?.busy)) {
2417
+ // 判定只看 workState —— 它由 agent:busy 事件驱动,joined 时已用会话真实忙闲初始化。
2418
+ if (currentSession?.mode === 'agent' && workState !== 'idle') {
2414
2419
  saveDraftFromInput('busy');
2415
2420
  return;
2416
2421
  }
@@ -3481,7 +3486,7 @@
3481
3486
  const tip = document.getElementById('draft-tip');
3482
3487
  if (!tip) return;
3483
3488
  const n = myDrafts().length;
3484
- const idle = workState === 'idle' && !currentSession?.busy;
3489
+ const idle = workState === 'idle';
3485
3490
  if (!n || !idle || _draftTipDismissed) { tip.style.display = 'none'; return; }
3486
3491
  document.getElementById('draft-tip-text').textContent =
3487
3492
  `本任务有 ${n} 条待发草稿 —— 点这里取回`;
@@ -3703,7 +3708,11 @@
3703
3708
  } catch {}
3704
3709
  await refreshInbox();
3705
3710
  renderInbox();
3706
- addStatusMessage(on ? '📥 这条已设为「自动接力」:本轮干完会自动发出' : '📥 已取消自动接力');
3711
+ addStatusMessage(on
3712
+ ? (workState === 'idle'
3713
+ ? '📥 已设为「自动接力」——会话当前空闲,马上就会发出'
3714
+ : '📥 这条已设为「自动接力」:本轮干完会自动发出')
3715
+ : '📥 已取消自动接力');
3707
3716
  };
3708
3717
 
3709
3718
  // 改投:会话结束了 / 当初记错任务了,把草稿挪到当前会话名下