From 2711b638c85453b1924dfc5f3ae069fe38efd8bf Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Sat, 20 Jun 2026 10:31:02 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=20ccshareResume=20s?= =?UTF-8?q?tub=20=E5=8F=8A=20main.tsx=20=E7=9A=84=20ccshare=20fast-path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除 src/utils/ccshareResume.ts(parseCcshareId 恒返回 null、loadCcshare 恒抛错的 stub) - 同步移除 src/main.tsx 中 USER_TYPE === 'ant' 守卫下的 if (ccshareId) {...} else {...} 双分支 - 提升 else 块(文件路径 resume 处理)为直接进入 if (options.resume) 块内 ccshare 是 Anthropic 内部特性(go/ccshare URL),stub 未实现导致 ccshareId 恒为 null,整个 ccshare 分支永不进入;保留的文件路径 resume 路径不变。 Co-Authored-By: glm-5.2 --- src/main.tsx | 91 ++++++++++---------------------------- src/utils/ccshareResume.ts | 7 --- 2 files changed, 24 insertions(+), 74 deletions(-) delete mode 100644 src/utils/ccshareResume.ts diff --git a/src/main.tsx b/src/main.tsx index dd06bc1a7..3317f99c9 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -4238,19 +4238,24 @@ async function run(): Promise { } if (process.env.USER_TYPE === 'ant') { if (options.resume && typeof options.resume === 'string' && !maybeSessionId) { - // Check for ccshare URL (e.g. https://go/ccshare/boris-20260311-211036) - const { parseCcshareId, loadCcshare } = await import('./utils/ccshareResume.js'); - const ccshareId = parseCcshareId(options.resume); - if (ccshareId) { + const resolvedPath = resolve(options.resume); + try { + const resumeStart = performance.now(); + let logOption; try { - const resumeStart = performance.now(); - const logOption = await loadCcshare(ccshareId); - const result = await loadConversationForResume(logOption, undefined); + // Attempt to load as a transcript file; ENOENT falls through to session-ID handling + logOption = await loadTranscriptFromFile(resolvedPath); + } catch (error) { + if (!isENOENT(error)) throw error; + // ENOENT: not a file path — fall through to session-ID handling + } + if (logOption) { + const result = await loadConversationForResume(logOption, undefined /* sourceFile */); if (result) { processedResume = await processResumedConversation( result, { - forkSession: true, + forkSession: !!options.forkSession, transcriptPath: result.fullPath, }, resumeContext, @@ -4259,74 +4264,26 @@ async function run(): Promise { mainThreadAgentDefinition = processedResume.restoredAgentDef; } logEvent('tengu_session_resumed', { - entrypoint: 'ccshare' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, + entrypoint: 'file' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, success: true, resume_duration_ms: Math.round(performance.now() - resumeStart), }); } else { logEvent('tengu_session_resumed', { - entrypoint: 'ccshare' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, + entrypoint: 'file' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, success: false, }); } - } catch (error) { - logEvent('tengu_session_resumed', { - entrypoint: 'ccshare' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, - success: false, - }); - logError(error); - await exitWithError(root, `Unable to resume from ccshare: ${errorMessage(error)}`, () => - gracefulShutdown(1), - ); - } - } else { - const resolvedPath = resolve(options.resume); - try { - const resumeStart = performance.now(); - let logOption; - try { - // Attempt to load as a transcript file; ENOENT falls through to session-ID handling - logOption = await loadTranscriptFromFile(resolvedPath); - } catch (error) { - if (!isENOENT(error)) throw error; - // ENOENT: not a file path — fall through to session-ID handling - } - if (logOption) { - const result = await loadConversationForResume(logOption, undefined /* sourceFile */); - if (result) { - processedResume = await processResumedConversation( - result, - { - forkSession: !!options.forkSession, - transcriptPath: result.fullPath, - }, - resumeContext, - ); - if (processedResume.restoredAgentDef) { - mainThreadAgentDefinition = processedResume.restoredAgentDef; - } - logEvent('tengu_session_resumed', { - entrypoint: 'file' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, - success: true, - resume_duration_ms: Math.round(performance.now() - resumeStart), - }); - } else { - logEvent('tengu_session_resumed', { - entrypoint: 'file' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, - success: false, - }); - } - } - } catch (error) { - logEvent('tengu_session_resumed', { - entrypoint: 'file' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, - success: false, - }); - logError(error); - await exitWithError(root, `Unable to load transcript from file: ${options.resume}`, () => - gracefulShutdown(1), - ); } + } catch (error) { + logEvent('tengu_session_resumed', { + entrypoint: 'file' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, + success: false, + }); + logError(error); + await exitWithError(root, `Unable to load transcript from file: ${options.resume}`, () => + gracefulShutdown(1), + ); } } } diff --git a/src/utils/ccshareResume.ts b/src/utils/ccshareResume.ts deleted file mode 100644 index c4c708bb2..000000000 --- a/src/utils/ccshareResume.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Auto-generated stub — replace with real implementation -import type { LogOption } from 'src/types/logs.js' -export const parseCcshareId: (resume: string) => string | null = () => null -export const loadCcshare: (ccshareId: string) => Promise = - async () => { - throw new Error('ccshare not implemented') - }