mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-21 15:55:50 +00:00
更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121)
* style(B1-1): 格式化 ink/buddy/cli/context/screens/tasks/services/keybindings/state (43 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 修复了 Box.tsx 和 ScrollBox.tsx 中无效的 global.d.ts import。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-2): 格式化 commands (79 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-3): 格式化 components/messages,permissions,mcp,sandbox,shell (104 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-4): 格式化 components/PromptInput,FeedbackSurvey,tasks,agents,skills,design-system,wizard (73 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-5): 格式化 components其余 + hooks + tools (232 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-6): 格式化 main/entrypoints/utils/moreright (21 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: 更新 README,新增 Run.ps1/TODO.md,删除 V6.md - README.md: 大幅重写,更详细版本历史和配置示例 - Run.ps1: 新增 Windows 启动脚本 - TODO.md: 新增包完成清单 - V6.md: 删除(架构重构规划已不适用) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 修复以前的问题 * fix: 修复 login 面板的问题 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,166 +1,108 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import React, { useEffect } from 'react';
|
||||
import { type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, logEvent } from 'src/services/analytics/index.js';
|
||||
import type { TeleportRemoteResponse } from 'src/utils/conversationRecovery.js';
|
||||
import type { CodeSession } from 'src/utils/teleport/api.js';
|
||||
import { type TeleportSource, useTeleportResume } from '../hooks/useTeleportResume.js';
|
||||
import { Box, Text } from '../ink.js';
|
||||
import { useKeybinding } from '../keybindings/useKeybinding.js';
|
||||
import { ResumeTask } from './ResumeTask.js';
|
||||
import { Spinner } from './Spinner.js';
|
||||
import React, { useEffect } from 'react'
|
||||
import {
|
||||
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
logEvent,
|
||||
} from 'src/services/analytics/index.js'
|
||||
import type { TeleportRemoteResponse } from 'src/utils/conversationRecovery.js'
|
||||
import type { CodeSession } from 'src/utils/teleport/api.js'
|
||||
import {
|
||||
type TeleportSource,
|
||||
useTeleportResume,
|
||||
} from '../hooks/useTeleportResume.js'
|
||||
import { Box, Text } from '../ink.js'
|
||||
import { useKeybinding } from '../keybindings/useKeybinding.js'
|
||||
import { ResumeTask } from './ResumeTask.js'
|
||||
import { Spinner } from './Spinner.js'
|
||||
|
||||
interface TeleportResumeWrapperProps {
|
||||
onComplete: (result: TeleportRemoteResponse) => void;
|
||||
onCancel: () => void;
|
||||
onError?: (error: string, formattedMessage?: string) => void;
|
||||
isEmbedded?: boolean;
|
||||
source: TeleportSource;
|
||||
onComplete: (result: TeleportRemoteResponse) => void
|
||||
onCancel: () => void
|
||||
onError?: (error: string, formattedMessage?: string) => void
|
||||
isEmbedded?: boolean
|
||||
source: TeleportSource
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper component that manages the full teleport resume flow,
|
||||
* including session selection, loading state, and error handling
|
||||
*/
|
||||
export function TeleportResumeWrapper(t0) {
|
||||
const $ = _c(25);
|
||||
const {
|
||||
onComplete,
|
||||
onCancel,
|
||||
onError,
|
||||
isEmbedded: t1,
|
||||
source
|
||||
} = t0;
|
||||
const isEmbedded = t1 === undefined ? false : t1;
|
||||
const {
|
||||
resumeSession,
|
||||
isResuming,
|
||||
error,
|
||||
selectedSession
|
||||
} = useTeleportResume(source);
|
||||
let t2;
|
||||
let t3;
|
||||
if ($[0] !== source) {
|
||||
t2 = () => {
|
||||
logEvent("tengu_teleport_started", {
|
||||
source: source as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
|
||||
});
|
||||
};
|
||||
t3 = [source];
|
||||
$[0] = source;
|
||||
$[1] = t2;
|
||||
$[2] = t3;
|
||||
} else {
|
||||
t2 = $[1];
|
||||
t3 = $[2];
|
||||
}
|
||||
useEffect(t2, t3);
|
||||
let t4;
|
||||
if ($[3] !== error || $[4] !== onComplete || $[5] !== onError || $[6] !== resumeSession) {
|
||||
t4 = async session => {
|
||||
const result = await resumeSession(session);
|
||||
if (result) {
|
||||
onComplete(result);
|
||||
} else {
|
||||
if (error) {
|
||||
if (onError) {
|
||||
onError(error.message, error.formattedMessage);
|
||||
}
|
||||
}
|
||||
export function TeleportResumeWrapper({
|
||||
onComplete,
|
||||
onCancel,
|
||||
onError,
|
||||
isEmbedded = false,
|
||||
source,
|
||||
}: TeleportResumeWrapperProps): React.ReactNode {
|
||||
const { resumeSession, isResuming, error, selectedSession } =
|
||||
useTeleportResume(source)
|
||||
|
||||
// Log when teleport flow starts (for funnel tracking)
|
||||
useEffect(() => {
|
||||
logEvent('tengu_teleport_started', {
|
||||
source:
|
||||
source as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
})
|
||||
}, [source])
|
||||
|
||||
const handleSelect = async (session: CodeSession) => {
|
||||
const result = await resumeSession(session)
|
||||
if (result) {
|
||||
onComplete(result)
|
||||
} else if (error) {
|
||||
// If there's an error handler provided, use it
|
||||
if (onError) {
|
||||
onError(error.message, error.formattedMessage)
|
||||
}
|
||||
};
|
||||
$[3] = error;
|
||||
$[4] = onComplete;
|
||||
$[5] = onError;
|
||||
$[6] = resumeSession;
|
||||
$[7] = t4;
|
||||
} else {
|
||||
t4 = $[7];
|
||||
// Otherwise the error will be displayed in the UI
|
||||
}
|
||||
}
|
||||
const handleSelect = t4;
|
||||
let t5;
|
||||
if ($[8] !== onCancel) {
|
||||
t5 = () => {
|
||||
logEvent("tengu_teleport_cancelled", {});
|
||||
onCancel();
|
||||
};
|
||||
$[8] = onCancel;
|
||||
$[9] = t5;
|
||||
} else {
|
||||
t5 = $[9];
|
||||
|
||||
const handleCancel = () => {
|
||||
logEvent('tengu_teleport_cancelled', {})
|
||||
onCancel()
|
||||
}
|
||||
const handleCancel = t5;
|
||||
const t6 = !!error && !onError;
|
||||
let t7;
|
||||
if ($[10] !== t6) {
|
||||
t7 = {
|
||||
context: "Global",
|
||||
isActive: t6
|
||||
};
|
||||
$[10] = t6;
|
||||
$[11] = t7;
|
||||
} else {
|
||||
t7 = $[11];
|
||||
}
|
||||
useKeybinding("app:interrupt", handleCancel, t7);
|
||||
|
||||
// Allow Esc to dismiss the error state
|
||||
useKeybinding('app:interrupt', handleCancel, {
|
||||
context: 'Global',
|
||||
isActive: !!error && !onError,
|
||||
})
|
||||
|
||||
// Show loading spinner when resuming
|
||||
if (isResuming && selectedSession) {
|
||||
let t8;
|
||||
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t8 = <Box flexDirection="row"><Spinner /><Text bold={true}>Resuming session…</Text></Box>;
|
||||
$[12] = t8;
|
||||
} else {
|
||||
t8 = $[12];
|
||||
}
|
||||
let t9;
|
||||
if ($[13] !== selectedSession.title) {
|
||||
t9 = <Box flexDirection="column" padding={1}>{t8}<Text dimColor={true}>Loading "{selectedSession.title}"…</Text></Box>;
|
||||
$[13] = selectedSession.title;
|
||||
$[14] = t9;
|
||||
} else {
|
||||
t9 = $[14];
|
||||
}
|
||||
return t9;
|
||||
return (
|
||||
<Box flexDirection="column" padding={1}>
|
||||
<Box flexDirection="row">
|
||||
<Spinner />
|
||||
<Text bold>Resuming session…</Text>
|
||||
</Box>
|
||||
<Text dimColor>Loading "{selectedSession.title}"…</Text>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
// Show error if there was a problem resuming
|
||||
if (error && !onError) {
|
||||
let t8;
|
||||
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t8 = <Text bold={true} color="error">Failed to resume session</Text>;
|
||||
$[15] = t8;
|
||||
} else {
|
||||
t8 = $[15];
|
||||
}
|
||||
let t9;
|
||||
if ($[16] !== error.message) {
|
||||
t9 = <Text dimColor={true}>{error.message}</Text>;
|
||||
$[16] = error.message;
|
||||
$[17] = t9;
|
||||
} else {
|
||||
t9 = $[17];
|
||||
}
|
||||
let t10;
|
||||
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t10 = <Box marginTop={1}><Text dimColor={true}>Press <Text bold={true}>Esc</Text> to cancel</Text></Box>;
|
||||
$[18] = t10;
|
||||
} else {
|
||||
t10 = $[18];
|
||||
}
|
||||
let t11;
|
||||
if ($[19] !== t9) {
|
||||
t11 = <Box flexDirection="column" padding={1}>{t8}{t9}{t10}</Box>;
|
||||
$[19] = t9;
|
||||
$[20] = t11;
|
||||
} else {
|
||||
t11 = $[20];
|
||||
}
|
||||
return t11;
|
||||
return (
|
||||
<Box flexDirection="column" padding={1}>
|
||||
<Text bold color="error">
|
||||
Failed to resume session
|
||||
</Text>
|
||||
<Text dimColor>{error.message}</Text>
|
||||
<Box marginTop={1}>
|
||||
<Text dimColor>
|
||||
Press <Text bold>Esc</Text> to cancel
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
let t8;
|
||||
if ($[21] !== handleCancel || $[22] !== handleSelect || $[23] !== isEmbedded) {
|
||||
t8 = <ResumeTask onSelect={handleSelect} onCancel={handleCancel} isEmbedded={isEmbedded} />;
|
||||
$[21] = handleCancel;
|
||||
$[22] = handleSelect;
|
||||
$[23] = isEmbedded;
|
||||
$[24] = t8;
|
||||
} else {
|
||||
t8 = $[24];
|
||||
}
|
||||
return t8;
|
||||
|
||||
return (
|
||||
<ResumeTask
|
||||
onSelect={handleSelect}
|
||||
onCancel={handleCancel}
|
||||
isEmbedded={isEmbedded}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user