chore: 移除 ccshareResume stub 及 main.tsx 的 ccshare fast-path

- 删除 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 <zai-org@claude-code-best.win>
This commit is contained in:
claude-code-best
2026-06-20 10:31:02 +08:00
parent b55ae75bf8
commit 2711b638c8
2 changed files with 24 additions and 74 deletions

View File

@@ -4238,19 +4238,24 @@ async function run(): Promise<CommanderCommand> {
} }
if (process.env.USER_TYPE === 'ant') { if (process.env.USER_TYPE === 'ant') {
if (options.resume && typeof options.resume === 'string' && !maybeSessionId) { if (options.resume && typeof options.resume === 'string' && !maybeSessionId) {
// Check for ccshare URL (e.g. https://go/ccshare/boris-20260311-211036) const resolvedPath = resolve(options.resume);
const { parseCcshareId, loadCcshare } = await import('./utils/ccshareResume.js'); try {
const ccshareId = parseCcshareId(options.resume); const resumeStart = performance.now();
if (ccshareId) { let logOption;
try { try {
const resumeStart = performance.now(); // Attempt to load as a transcript file; ENOENT falls through to session-ID handling
const logOption = await loadCcshare(ccshareId); logOption = await loadTranscriptFromFile(resolvedPath);
const result = await loadConversationForResume(logOption, undefined); } 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) { if (result) {
processedResume = await processResumedConversation( processedResume = await processResumedConversation(
result, result,
{ {
forkSession: true, forkSession: !!options.forkSession,
transcriptPath: result.fullPath, transcriptPath: result.fullPath,
}, },
resumeContext, resumeContext,
@@ -4259,74 +4264,26 @@ async function run(): Promise<CommanderCommand> {
mainThreadAgentDefinition = processedResume.restoredAgentDef; mainThreadAgentDefinition = processedResume.restoredAgentDef;
} }
logEvent('tengu_session_resumed', { 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, success: true,
resume_duration_ms: Math.round(performance.now() - resumeStart), resume_duration_ms: Math.round(performance.now() - resumeStart),
}); });
} else { } else {
logEvent('tengu_session_resumed', { 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, 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),
);
} }
} }
} }

View File

@@ -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<LogOption> =
async () => {
throw new Error('ccshare not implemented')
}