cc-viewer 1.9.4 → 1.9.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.
package/cli.js CHANGED
@@ -857,12 +857,15 @@ async function runSdkMode(extraClaudeArgs = [], cwd, noOpen = false) {
857
857
  // 若 SDK 内部异常吞掉了 result 消息这条信号就丢了 —— 至少打个 warn 让排查时有线索。
858
858
  // 显式 typeof 检查:以前用可选链 `?.()` 在 export 缺失时返回 undefined → catch 永远不触发
859
859
  // → 「至少 warn」承诺落空,turn-end 静默丢,bug 极难追。
860
- onTurnEnd: ({ sessionId, ts }) => {
860
+ onTurnEnd: ({ sessionId, ts, cwd }) => {
861
861
  if (typeof serverMod.broadcastTurnEnd !== 'function') {
862
862
  console.warn('[sdk] serverMod.broadcastTurnEnd is not a function (export missing?); turn-end signal dropped');
863
863
  return;
864
864
  }
865
- try { serverMod.broadcastTurnEnd(sessionId, ts); }
865
+ // Per-workspace (2026-10): forward the session cwd so the server routes the
866
+ // turn_end to THIS workspace's scope (SDK has no Stop-hook POST; without a
867
+ // scope hint every SDK turn-end resolved to the bound project).
868
+ try { serverMod.broadcastTurnEnd(sessionId, ts, null, cwd); }
866
869
  catch (err) { console.warn('[sdk] broadcastTurnEnd threw:', err?.message); }
867
870
  },
868
871
  // query 级失败(spawn/protocol/iterator)推到 Web UI toast —— 此前只有 console.error,