cc-viewer 1.9.26 → 1.9.27

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/index.html CHANGED
@@ -21,7 +21,7 @@
21
21
  // 整体显示大小已弃用 CSS zoom:Electron 改用 webFrame.setZoomFactor(首屏抢占见
22
22
  // electron/tab-content-preload.js),纯浏览器交由用户用浏览器自带快捷键缩放,故此处不再设 zoom。
23
23
  </script>
24
- <script type="module" crossorigin src="./assets/index-Dn7twftJ.js"></script>
24
+ <script type="module" crossorigin src="./assets/index-12XyZVeK.js"></script>
25
25
  <link rel="modulepreload" crossorigin href="./assets/vendor-antd-VJVAjRBJ.js">
26
26
  <link rel="modulepreload" crossorigin href="./assets/vendor-codemirror-D2yaEhu3.js">
27
27
  <link rel="modulepreload" crossorigin href="./assets/vendor-mdxeditor-DKI8QSRd.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-viewer",
3
- "version": "1.9.26",
3
+ "version": "1.9.27",
4
4
  "description": "Claude Code logging, visualization, and management toolkit — launch a web viewer alongside Claude Code with full request/response tracing, proxy, and mobile support",
5
5
  "license": "MIT",
6
6
  "main": "server.js",
package/server/server.js CHANGED
@@ -4066,6 +4066,28 @@ async function _doStop() {
4066
4066
  // are intentionally no pushSdkEntry/setSdkStreamingState shortcuts anymore.
4067
4067
 
4068
4068
  /** Broadcast a message to all terminal WS clients (for SDK canUseTool). */
4069
+ // Approval TERMINAL frames: id-addressed "this pending is over" events. Every client handler
4070
+ // clears ONLY the pending whose id matches (an unmatched id is a no-op), so cross-workspace
4071
+ // delivery adds no state. Routing these through view-narrowing turns a display-scoping
4072
+ // optimization into a correctness dependency: a connection stamp that diverges from the frame's
4073
+ // cwd/instanceKey at fire time silently drops the ONLY close signal — the server-side pending
4074
+ // entry is already deleted, so no reconnect replay can recover it and the modal hangs forever.
4075
+ // Precedents that already deliver these globally: PTY hook frames (routes/ask-perm.js),
4076
+ // _broadcastApprovalCloses, and the client-answer relays (server.js:2888+, 2931+, 3123+).
4077
+ // `ask-hook-cancelled` is deliberately EXCLUDED (it flushes a user message parked behind the
4078
+ // ask). *-auto-cancel and pending/state frames stay narrowed.
4079
+ const ID_ADDRESSED_APPROVAL_CLEARS = new Set([
4080
+ 'sdk-plan-resolved', 'sdk-ask-resolved', 'perm-hook-resolved',
4081
+ 'sdk-ask-timeout', 'perm-hook-timeout',
4082
+ 'ask-hook-resolved', 'ask-hook-timeout', // future-proof: currently direct-sent
4083
+ ]);
4084
+ function isIdAddressedApprovalClear(msg) {
4085
+ return !!msg && typeof msg === 'object'
4086
+ && typeof msg.type === 'string'
4087
+ && ID_ADDRESSED_APPROVAL_CLEARS.has(msg.type)
4088
+ && msg.id != null; // raw check: a no-id legacy perm-hook-timeout clears ALL — must stay scoped
4089
+ }
4090
+
4069
4091
  export function broadcastWsMessage(msg) { if (terminalWss) {
4070
4092
  // SDK multi-session (2026-10-12): a cwd-tagged frame belongs to one workspace's session.
4071
4093
  // Route it only to clients viewing that workspace (or the bound view with no ?project=),
@@ -4086,11 +4108,13 @@ export function broadcastWsMessage(msg) { if (terminalWss) {
4086
4108
  // killing the surviving twin viewer's spinner and queue bubbles). Untagged/cwd-only
4087
4109
  // frames keep the historical project-level behavior.
4088
4110
  const frameInstance = (msg && typeof msg === 'object' && typeof msg.instanceKey === 'string' && msg.instanceKey) ? msg.instanceKey : null;
4111
+ // Id-addressed approval terminal frames bypass the narrowing (see the block above).
4112
+ const clearAcrossViews = isIdAddressedApprovalClear(msg);
4089
4113
  const str = typeof msg === 'string' ? msg : JSON.stringify(msg);
4090
4114
  terminalWss.clients.forEach((c) => {
4091
4115
  if (c.readyState !== 1) return;
4092
- if (frameProj && c._ccvViewProject && c._ccvViewProject !== frameProj) return; // other workspace's frame
4093
- if (frameInstance && c._ccvViewInstance && c._ccvViewInstance !== frameInstance) return; // other instance of the same project
4116
+ if (!clearAcrossViews && frameProj && c._ccvViewProject && c._ccvViewProject !== frameProj) return; // other workspace's frame
4117
+ if (!clearAcrossViews && frameInstance && c._ccvViewInstance && c._ccvViewInstance !== frameInstance) return; // other instance of the same project
4094
4118
  try { c.send(str); } catch {}
4095
4119
  });
4096
4120
  }