cc-viewer 1.7.1 → 1.7.3

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.
@@ -259,7 +259,7 @@ function imLogs(req, res, parsedUrl, isLocal, deps) {
259
259
  try {
260
260
  // wire-v2: prefer the newest v2 session (by meta.startTs, journal mtime as
261
261
  // tie-break); fall back to legacy v1 files until they are migrated.
262
- const sessions = listV2Sessions(join(LOG_DIR, project)).filter((s) => !s.leader);
262
+ const sessions = listV2Sessions(join(LOG_DIR, project)).filter((s) => !s.leader && !s.discard);
263
263
  if (sessions.length > 0) {
264
264
  sessions.sort((a, b) => (a.startTs < b.startTs ? 1 : a.startTs > b.startTs ? -1 : 0));
265
265
  latest = `v2:${project}/${sessions[0].sid}`; // 直接喂给 /api/local-log?file=
package/server/server.js CHANGED
@@ -76,7 +76,7 @@ function execWithStdin(cmd, args, input, options) {
76
76
  child.stdin.end();
77
77
  });
78
78
  }
79
- import { _initPromise, _projectName, _logDir, _v2Writer, streamingState, resetStreamingState, PROFILE_PATH, setLivePort, getImLiveText, resetImLiveText } from './interceptor.js';
79
+ import { _initPromise, _projectName, _logDir, _v2Writer, streamingState, resetStreamingState, PROFILE_PATH, setLivePort, getImLiveText, resetImLiveText, markSessionStart } from './interceptor.js';
80
80
  import { V2LiveFeed } from './lib/v2/live-feed.js';
81
81
  import { sanitizePathComponent } from './lib/v2/layout.js';
82
82
  import { maybeResumeConvert } from './lib/v2/convert-manager.js';
@@ -554,6 +554,9 @@ const deps = {
554
554
  startLogWatch,
555
555
  stopLogWatch,
556
556
  scheduleTurnEndBroadcast: _scheduleTurnEndBroadcast,
557
+ // SessionStart hook notify → conversation-switch signal (in-terminal
558
+ // /resume). The source gate + V2Writer re-bind live in the interceptor.
559
+ onSessionStartNotify: markSessionStart,
557
560
  ensureImWatch: _ensureImWatch,
558
561
  maskProfiles: _maskProfiles,
559
562
  maskApiKey: _maskApiKey,
@@ -4,6 +4,7 @@ import { readdir, stat } from 'node:fs/promises';
4
4
  import { renameSyncWithRetry } from './lib/file-api.js';
5
5
  import { withFileLockAsync } from './lib/async-file-lock.js';
6
6
  import { dirSizeSync } from './lib/v2/layout.js';
7
+ import { isDiscardableSession } from './lib/v2/session-select.js';
7
8
  import { join, basename, resolve } from 'node:path';
8
9
  import { randomBytes } from 'node:crypto';
9
10
  import { LOG_DIR } from '../findcc.js';
@@ -117,6 +118,10 @@ export async function getWorkspaces() {
117
118
  const sessionDir = join(logDir, 'sessions', e.name);
118
119
  try {
119
120
  await stat(join(sessionDir, 'journal.jsonl'));
121
+ // Quota-probe orphans must not count: logCount>0 drives the
122
+ // auto -c heuristic, and a probe-only workspace would auto-continue
123
+ // into a conversation that does not exist (2026-07-16).
124
+ if (isDiscardableSession(sessionDir)) continue;
120
125
  // Folder size, not journal size — conv/blob/response files carry
121
126
  // most of a session's bytes (journal alone undercounts ~12x).
122
127
  totalSize += dirSizeSync(sessionDir);