mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +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,193 +1,124 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import type { UUID } from 'crypto';
|
||||
import React, { useCallback } from 'react';
|
||||
import { Box, Text } from '../ink.js';
|
||||
import { useKeybinding } from '../keybindings/useKeybinding.js';
|
||||
import { getAllBaseTools } from '../tools.js';
|
||||
import type { LogOption } from '../types/logs.js';
|
||||
import { formatRelativeTimeAgo } from '../utils/format.js';
|
||||
import { getSessionIdFromLog, isLiteLog, loadFullLog } from '../utils/sessionStorage.js';
|
||||
import { ConfigurableShortcutHint } from './ConfigurableShortcutHint.js';
|
||||
import { Byline } from './design-system/Byline.js';
|
||||
import { KeyboardShortcutHint } from './design-system/KeyboardShortcutHint.js';
|
||||
import { LoadingState } from './design-system/LoadingState.js';
|
||||
import { Messages } from './Messages.js';
|
||||
import type { UUID } from 'crypto'
|
||||
import React, { useCallback } from 'react'
|
||||
import { Box, Text } from '../ink.js'
|
||||
import { useKeybinding } from '../keybindings/useKeybinding.js'
|
||||
import { getAllBaseTools } from '../tools.js'
|
||||
import type { LogOption } from '../types/logs.js'
|
||||
import { formatRelativeTimeAgo } from '../utils/format.js'
|
||||
import {
|
||||
getSessionIdFromLog,
|
||||
isLiteLog,
|
||||
loadFullLog,
|
||||
} from '../utils/sessionStorage.js'
|
||||
import { ConfigurableShortcutHint } from './ConfigurableShortcutHint.js'
|
||||
import { Byline } from './design-system/Byline.js'
|
||||
import { KeyboardShortcutHint } from './design-system/KeyboardShortcutHint.js'
|
||||
import { LoadingState } from './design-system/LoadingState.js'
|
||||
import { Messages } from './Messages.js'
|
||||
|
||||
type Props = {
|
||||
log: LogOption;
|
||||
onExit: () => void;
|
||||
onSelect: (log: LogOption) => void;
|
||||
};
|
||||
export function SessionPreview(t0) {
|
||||
const $ = _c(33);
|
||||
const {
|
||||
log,
|
||||
onExit,
|
||||
onSelect
|
||||
} = t0;
|
||||
const [fullLog, setFullLog] = React.useState(null);
|
||||
let t1;
|
||||
let t2;
|
||||
if ($[0] !== log) {
|
||||
t1 = () => {
|
||||
setFullLog(null);
|
||||
if (isLiteLog(log)) {
|
||||
loadFullLog(log).then(setFullLog);
|
||||
}
|
||||
};
|
||||
t2 = [log];
|
||||
$[0] = log;
|
||||
$[1] = t1;
|
||||
$[2] = t2;
|
||||
} else {
|
||||
t1 = $[1];
|
||||
t2 = $[2];
|
||||
}
|
||||
React.useEffect(t1, t2);
|
||||
const isLoading = isLiteLog(log) && fullLog === null;
|
||||
const displayLog = fullLog ?? log;
|
||||
let t3;
|
||||
if ($[3] !== displayLog) {
|
||||
t3 = getSessionIdFromLog(displayLog) || "" as UUID;
|
||||
$[3] = displayLog;
|
||||
$[4] = t3;
|
||||
} else {
|
||||
t3 = $[4];
|
||||
}
|
||||
const conversationId = t3;
|
||||
let t4;
|
||||
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t4 = getAllBaseTools();
|
||||
$[5] = t4;
|
||||
} else {
|
||||
t4 = $[5];
|
||||
}
|
||||
const tools = t4;
|
||||
let t5;
|
||||
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t5 = {
|
||||
context: "Confirmation"
|
||||
};
|
||||
$[6] = t5;
|
||||
} else {
|
||||
t5 = $[6];
|
||||
}
|
||||
useKeybinding("confirm:no", onExit, t5);
|
||||
let t6;
|
||||
if ($[7] !== fullLog || $[8] !== log || $[9] !== onSelect) {
|
||||
t6 = () => {
|
||||
onSelect(fullLog ?? log);
|
||||
};
|
||||
$[7] = fullLog;
|
||||
$[8] = log;
|
||||
$[9] = onSelect;
|
||||
$[10] = t6;
|
||||
} else {
|
||||
t6 = $[10];
|
||||
}
|
||||
const handleSelect = t6;
|
||||
let t7;
|
||||
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t7 = {
|
||||
context: "Confirmation"
|
||||
};
|
||||
$[11] = t7;
|
||||
} else {
|
||||
t7 = $[11];
|
||||
}
|
||||
useKeybinding("confirm:yes", handleSelect, t7);
|
||||
if (isLoading) {
|
||||
let t8;
|
||||
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t8 = <LoadingState message={"Loading session\u2026"} />;
|
||||
$[12] = t8;
|
||||
} else {
|
||||
t8 = $[12];
|
||||
}
|
||||
let t9;
|
||||
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t9 = <Box flexDirection="column" padding={1}>{t8}<Text dimColor={true}><Byline><ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="cancel" /></Byline></Text></Box>;
|
||||
$[13] = t9;
|
||||
} else {
|
||||
t9 = $[13];
|
||||
}
|
||||
return t9;
|
||||
}
|
||||
let t8;
|
||||
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t8 = [];
|
||||
$[14] = t8;
|
||||
} else {
|
||||
t8 = $[14];
|
||||
}
|
||||
let t10;
|
||||
let t9;
|
||||
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t9 = [];
|
||||
t10 = new Set();
|
||||
$[15] = t10;
|
||||
$[16] = t9;
|
||||
} else {
|
||||
t10 = $[15];
|
||||
t9 = $[16];
|
||||
}
|
||||
let t11;
|
||||
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t11 = [];
|
||||
$[17] = t11;
|
||||
} else {
|
||||
t11 = $[17];
|
||||
}
|
||||
let t12;
|
||||
if ($[18] !== conversationId || $[19] !== displayLog.messages) {
|
||||
t12 = <Messages messages={displayLog.messages} tools={tools} commands={t8} verbose={true} toolJSX={null} toolUseConfirmQueue={t9} inProgressToolUseIDs={t10} isMessageSelectorVisible={false} conversationId={conversationId} screen="transcript" streamingToolUses={t11} showAllInTranscript={true} isLoading={false} />;
|
||||
$[18] = conversationId;
|
||||
$[19] = displayLog.messages;
|
||||
$[20] = t12;
|
||||
} else {
|
||||
t12 = $[20];
|
||||
}
|
||||
let t13;
|
||||
if ($[21] !== displayLog.modified) {
|
||||
t13 = formatRelativeTimeAgo(displayLog.modified);
|
||||
$[21] = displayLog.modified;
|
||||
$[22] = t13;
|
||||
} else {
|
||||
t13 = $[22];
|
||||
}
|
||||
const t14 = displayLog.gitBranch ? ` · ${displayLog.gitBranch}` : "";
|
||||
let t15;
|
||||
if ($[23] !== displayLog.messageCount || $[24] !== t13 || $[25] !== t14) {
|
||||
t15 = <Text>{t13} ·{" "}{displayLog.messageCount} messages{t14}</Text>;
|
||||
$[23] = displayLog.messageCount;
|
||||
$[24] = t13;
|
||||
$[25] = t14;
|
||||
$[26] = t15;
|
||||
} else {
|
||||
t15 = $[26];
|
||||
}
|
||||
let t16;
|
||||
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t16 = <Text dimColor={true}><Byline><KeyboardShortcutHint shortcut="Enter" action="resume" /><ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="cancel" /></Byline></Text>;
|
||||
$[27] = t16;
|
||||
} else {
|
||||
t16 = $[27];
|
||||
}
|
||||
let t17;
|
||||
if ($[28] !== t15) {
|
||||
t17 = <Box flexShrink={0} flexDirection="column" borderTopDimColor={true} borderBottom={false} borderLeft={false} borderRight={false} borderStyle="single" paddingLeft={2}>{t15}{t16}</Box>;
|
||||
$[28] = t15;
|
||||
$[29] = t17;
|
||||
} else {
|
||||
t17 = $[29];
|
||||
}
|
||||
let t18;
|
||||
if ($[30] !== t12 || $[31] !== t17) {
|
||||
t18 = <Box flexDirection="column">{t12}{t17}</Box>;
|
||||
$[30] = t12;
|
||||
$[31] = t17;
|
||||
$[32] = t18;
|
||||
} else {
|
||||
t18 = $[32];
|
||||
}
|
||||
return t18;
|
||||
log: LogOption
|
||||
onExit: () => void
|
||||
onSelect: (log: LogOption) => void
|
||||
}
|
||||
|
||||
export function SessionPreview({
|
||||
log,
|
||||
onExit,
|
||||
onSelect,
|
||||
}: Props): React.ReactNode {
|
||||
// fullLog holds the complete log with messages loaded.
|
||||
// The input `log` may be a "lite log" (empty messages array),
|
||||
// so we load the full messages on mount and store them here.
|
||||
const [fullLog, setFullLog] = React.useState<LogOption | null>(null)
|
||||
|
||||
// Load full messages if this is a lite log
|
||||
React.useEffect(() => {
|
||||
setFullLog(null)
|
||||
if (isLiteLog(log)) {
|
||||
void loadFullLog(log).then(setFullLog)
|
||||
}
|
||||
}, [log])
|
||||
|
||||
const isLoading = isLiteLog(log) && fullLog === null
|
||||
const displayLog = fullLog ?? log
|
||||
const conversationId = getSessionIdFromLog(displayLog) || ('' as UUID)
|
||||
|
||||
// Get all base tools for preview (no permissions needed for read-only view)
|
||||
const tools = getAllBaseTools()
|
||||
|
||||
// Handle keyboard input via keybindings
|
||||
useKeybinding('confirm:no', onExit, { context: 'Confirmation' })
|
||||
|
||||
const handleSelect = useCallback(() => {
|
||||
onSelect(fullLog ?? log)
|
||||
}, [onSelect, fullLog, log])
|
||||
|
||||
useKeybinding('confirm:yes', handleSelect, { context: 'Confirmation' })
|
||||
|
||||
// Show loading state while fetching full log
|
||||
if (isLoading) {
|
||||
return (
|
||||
<Box flexDirection="column" padding={1}>
|
||||
<LoadingState message="Loading session…" />
|
||||
<Text dimColor>
|
||||
<Byline>
|
||||
<ConfigurableShortcutHint
|
||||
action="confirm:no"
|
||||
context="Confirmation"
|
||||
fallback="Esc"
|
||||
description="cancel"
|
||||
/>
|
||||
</Byline>
|
||||
</Text>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Box flexDirection="column">
|
||||
<Messages
|
||||
messages={displayLog.messages}
|
||||
tools={tools}
|
||||
commands={[]}
|
||||
verbose={true}
|
||||
toolJSX={null}
|
||||
toolUseConfirmQueue={[]}
|
||||
inProgressToolUseIDs={new Set()}
|
||||
isMessageSelectorVisible={false}
|
||||
conversationId={conversationId}
|
||||
screen="transcript"
|
||||
streamingToolUses={[]}
|
||||
showAllInTranscript={true}
|
||||
isLoading={false}
|
||||
/>
|
||||
<Box
|
||||
flexShrink={0}
|
||||
flexDirection="column"
|
||||
borderTopDimColor
|
||||
borderBottom={false}
|
||||
borderLeft={false}
|
||||
borderRight={false}
|
||||
borderStyle="single"
|
||||
paddingLeft={2}
|
||||
>
|
||||
<Text>
|
||||
{formatRelativeTimeAgo(displayLog.modified)} ·{' '}
|
||||
{displayLog.messageCount} messages
|
||||
{displayLog.gitBranch ? ` · ${displayLog.gitBranch}` : ''}
|
||||
</Text>
|
||||
<Text dimColor>
|
||||
<Byline>
|
||||
<KeyboardShortcutHint shortcut="Enter" action="resume" />
|
||||
<ConfigurableShortcutHint
|
||||
action="confirm:no"
|
||||
context="Confirmation"
|
||||
fallback="Esc"
|
||||
description="cancel"
|
||||
/>
|
||||
</Byline>
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user