feat: 问就是封包

This commit is contained in:
claude-code-best
2026-03-31 23:32:58 +08:00
parent d7a729ca68
commit dd9cd782a7
67 changed files with 423 additions and 172 deletions

View File

@@ -38,7 +38,7 @@ type TranscriptEntry = TranscriptMessage & {
export function deriveFirstPrompt(
firstUserMessage: Extract<SerializedMessage, { type: 'user' }> | undefined,
): string {
const content = firstUserMessage?.message?.content
const content = (firstUserMessage as any)?.message?.content
if (!content) return 'Branched conversation'
const raw =
typeof content === 'string'
@@ -240,7 +240,7 @@ export async function call(
// Build LogOption for resume
const now = new Date()
const firstPrompt = deriveFirstPrompt(
serializedMessages.find(m => m.type === 'user'),
serializedMessages.find(m => m.type === 'user') as Extract<SerializedMessage, { type: 'user' }> | undefined,
)
// Save custom title - use provided title or firstPrompt as default

View File

@@ -140,7 +140,7 @@ export function BrowseMarketplace({
} of marketplaces_0) {
if (marketplace) {
// Count how many plugins from this marketplace are installed
const installedFromThisMarketplace = count(marketplace.plugins, plugin => isPluginInstalled(createPluginId(plugin.name, name)));
const installedFromThisMarketplace = count(marketplace.plugins, (plugin: any) => isPluginInstalled(createPluginId(plugin.name, name)));
marketplaceInfos.push({
name,
totalPlugins: marketplace.plugins.length,
@@ -334,7 +334,7 @@ export function BrowseMarketplace({
failureCount++;
newFailedPlugins.push({
name: plugin_1.entry.name,
reason: result.error
reason: (result as { success: false; error: string }).error
});
}
}
@@ -397,7 +397,7 @@ export function BrowseMarketplace({
});
} else {
setIsInstalling(false);
setInstallError(result_0.error);
setInstallError((result_0 as { success: false; error: string }).error);
}
};

View File

@@ -248,7 +248,7 @@ export function DiscoverPlugins({
failureCount++;
newFailedPlugins.push({
name: plugin_0.entry.name,
reason: result.error
reason: (result as { success: false; error: string }).error
});
}
}
@@ -306,7 +306,7 @@ export function DiscoverPlugins({
});
} else {
setIsInstalling(false);
setInstallError(result_0.error);
setInstallError((result_0 as { success: false; error: string }).error);
}
};

View File

@@ -130,11 +130,12 @@ function Web({
});
const result = await importGithubToken(token);
if (!result.ok) {
const importErr = (result as { ok: false; error: ImportTokenError }).error;
logEvent('tengu_remote_setup_result', {
result: 'import_failed' as SafeString,
error_kind: result.error.kind as SafeString
error_kind: importErr.kind as SafeString
});
onDone(errorMessage(result.error, getCodeWebUrl()));
onDone(errorMessage(importErr, getCodeWebUrl()));
return;
}

View File

@@ -1,3 +1,4 @@
// Auto-generated type stub — replace with real implementation
export type resetLimits = any;
export type resetLimitsNonInteractive = any;
// Auto-generated stub — replace with real implementation
const stub = { isEnabled: () => false, isHidden: true, name: 'stub' };
export const resetLimits = stub;
export const resetLimitsNonInteractive = stub;

View File

@@ -154,11 +154,12 @@ function ResumeCommand({
}
// Different project - show command instead of resuming
const raw = await setClipboard(crossProjectCheck.command);
const crossCmd = (crossProjectCheck as { isCrossProject: true; isSameRepoWorktree: false; command: string }).command;
const raw = await setClipboard(crossCmd);
if (raw) process.stdout.write(raw);
// Format the output message
const message = ['', 'This conversation is from a different directory.', '', 'To resume, run:', ` ${crossProjectCheck.command}`, '', '(Command copied to clipboard)', ''].join('\n');
const message = ['', 'This conversation is from a different directory.', '', 'To resume, run:', ` ${crossCmd}`, '', '(Command copied to clipboard)', ''].join('\n');
onDone(message, {
display: 'user'
});

View File

@@ -136,7 +136,7 @@ export async function launchRemoteReview(
// consume at session creation routes billing: first N zero-rate, then
// anthropic:cccr org-service-key (overage-only).
if (!eligibility.eligible) {
const blockers = eligibility.errors.filter(
const blockers = (eligibility as { eligible: false; errors: Array<{ type: string }> }).errors.filter(
e => e.type !== 'no_remote_environment',
)
if (blockers.length > 0) {

View File

@@ -314,11 +314,12 @@ async function launchDetached(opts: {
const model = getUltraplanModel();
const eligibility = await checkRemoteAgentEligibility();
if (!eligibility.eligible) {
const eligErrors = (eligibility as { eligible: false; errors: Array<{ type: string }> }).errors;
logEvent('tengu_ultraplan_create_failed', {
reason: 'precondition' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
precondition_errors: eligibility.errors.map(e => e.type).join(',') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
precondition_errors: eligErrors.map(e => e.type).join(',') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
});
const reasons = eligibility.errors.map(formatPreconditionError).join('\n');
const reasons = eligErrors.map(formatPreconditionError).join('\n');
enqueuePendingNotification({
value: `ultraplan: cannot launch remote session —\n${reasons}`,
mode: 'task-notification'