mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-20 15:25:50 +00:00
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:
91
src/main.tsx
91
src/main.tsx
@@ -4238,19 +4238,24 @@ async function run(): Promise<CommanderCommand> {
|
||||
}
|
||||
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<CommanderCommand> {
|
||||
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),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
Reference in New Issue
Block a user