更新大量 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:
claude-code-best
2026-04-04 23:24:27 +08:00
committed by GitHub
parent 02694918b5
commit 5b1a52b8e0
559 changed files with 103807 additions and 101817 deletions

View File

@@ -1,6 +1,5 @@
import { c as _c } from "react/compiler-runtime";
import * as React from 'react';
import { useContext } from 'react';
import * as React from 'react'
import { useContext } from 'react'
/**
* Context to indicate that shell output should be shown in full (not truncated).
@@ -9,27 +8,24 @@ import { useContext } from 'react';
* This follows the same pattern as MessageResponseContext and SubAgentContext -
* a boolean context that child components can check to modify their behavior.
*/
const ExpandShellOutputContext = React.createContext(false);
export function ExpandShellOutputProvider(t0) {
const $ = _c(2);
const {
children
} = t0;
let t1;
if ($[0] !== children) {
t1 = <ExpandShellOutputContext.Provider value={true}>{children}</ExpandShellOutputContext.Provider>;
$[0] = children;
$[1] = t1;
} else {
t1 = $[1];
}
return t1;
const ExpandShellOutputContext = React.createContext(false)
export function ExpandShellOutputProvider({
children,
}: {
children: React.ReactNode
}): React.ReactNode {
return (
<ExpandShellOutputContext.Provider value={true}>
{children}
</ExpandShellOutputContext.Provider>
)
}
/**
* Returns true if this component is rendered inside an ExpandShellOutputProvider,
* indicating the shell output should be shown in full rather than truncated.
*/
export function useExpandShellOutput() {
return useContext(ExpandShellOutputContext);
export function useExpandShellOutput(): boolean {
return useContext(ExpandShellOutputContext)
}

View File

@@ -1,106 +1,98 @@
import { c as _c } from "react/compiler-runtime";
import * as React from 'react';
import { useMemo } from 'react';
import { useTerminalSize } from '../../hooks/useTerminalSize.js';
import { Ansi, Text } from '../../ink.js';
import { createHyperlink } from '../../utils/hyperlink.js';
import { jsonParse, jsonStringify } from '../../utils/slowOperations.js';
import { renderTruncatedContent } from '../../utils/terminal.js';
import { MessageResponse } from '../MessageResponse.js';
import { InVirtualListContext } from '../messageActions.js';
import { useExpandShellOutput } from './ExpandShellOutputContext.js';
import * as React from 'react'
import { useMemo } from 'react'
import { useTerminalSize } from '../../hooks/useTerminalSize.js'
import { Ansi, Text } from '../../ink.js'
import { createHyperlink } from '../../utils/hyperlink.js'
import { jsonParse, jsonStringify } from '../../utils/slowOperations.js'
import { renderTruncatedContent } from '../../utils/terminal.js'
import { MessageResponse } from '../MessageResponse.js'
import { InVirtualListContext } from '../messageActions.js'
import { useExpandShellOutput } from './ExpandShellOutputContext.js'
export function tryFormatJson(line: string): string {
try {
const parsed = jsonParse(line);
const stringified = jsonStringify(parsed);
const parsed = jsonParse(line)
const stringified = jsonStringify(parsed)
// Check if precision was lost during JSON round-trip
// This happens when large integers exceed Number.MAX_SAFE_INTEGER
// We normalize both strings by removing whitespace and unnecessary
// escapes (\/ is valid but optional in JSON) for comparison
const normalizedOriginal = line.replace(/\\\//g, '/').replace(/\s+/g, '');
const normalizedStringified = stringified.replace(/\s+/g, '');
const normalizedOriginal = line.replace(/\\\//g, '/').replace(/\s+/g, '')
const normalizedStringified = stringified.replace(/\s+/g, '')
if (normalizedOriginal !== normalizedStringified) {
// Precision loss detected - return original line unformatted
return line;
return line
}
return jsonStringify(parsed, null, 2);
return jsonStringify(parsed, null, 2)
} catch {
return line;
return line
}
}
const MAX_JSON_FORMAT_LENGTH = 10_000;
const MAX_JSON_FORMAT_LENGTH = 10_000
export function tryJsonFormatContent(content: string): string {
if (content.length > MAX_JSON_FORMAT_LENGTH) {
return content;
return content
}
const allLines = content.split('\n');
return allLines.map(tryFormatJson).join('\n');
const allLines = content.split('\n')
return allLines.map(tryFormatJson).join('\n')
}
// Match http(s) URLs inside JSON string values. Conservative: no quotes,
// no whitespace, no trailing comma/brace that'd be JSON structure.
const URL_IN_JSON = /https?:\/\/[^\s"'<>\\]+/g;
const URL_IN_JSON = /https?:\/\/[^\s"'<>\\]+/g
export function linkifyUrlsInText(content: string): string {
return content.replace(URL_IN_JSON, url => createHyperlink(url));
return content.replace(URL_IN_JSON, url => createHyperlink(url))
}
export function OutputLine(t0) {
const $ = _c(11);
const {
content,
verbose,
isError,
isWarning,
linkifyUrls
} = t0;
const {
columns
} = useTerminalSize();
const expandShellOutput = useExpandShellOutput();
const inVirtualList = React.useContext(InVirtualListContext);
const shouldShowFull = verbose || expandShellOutput;
let t1;
if ($[0] !== columns || $[1] !== content || $[2] !== inVirtualList || $[3] !== linkifyUrls || $[4] !== shouldShowFull) {
bb0: {
let formatted = tryJsonFormatContent(content);
if (linkifyUrls) {
formatted = linkifyUrlsInText(formatted);
}
if (shouldShowFull) {
t1 = stripUnderlineAnsi(formatted);
break bb0;
}
t1 = stripUnderlineAnsi(renderTruncatedContent(formatted, columns, inVirtualList));
export function OutputLine({
content,
verbose,
isError,
isWarning,
linkifyUrls,
}: {
content: string
verbose: boolean
isError?: boolean
isWarning?: boolean
linkifyUrls?: boolean
}): React.ReactNode {
const { columns } = useTerminalSize()
// Context-based expansion for latest user shell output (from ! commands)
const expandShellOutput = useExpandShellOutput()
const inVirtualList = React.useContext(InVirtualListContext)
// Show full output if verbose mode OR if this is the latest user shell output
const shouldShowFull = verbose || expandShellOutput
const formattedContent = useMemo(() => {
let formatted = tryJsonFormatContent(content)
if (linkifyUrls) {
formatted = linkifyUrlsInText(formatted)
}
$[0] = columns;
$[1] = content;
$[2] = inVirtualList;
$[3] = linkifyUrls;
$[4] = shouldShowFull;
$[5] = t1;
} else {
t1 = $[5];
}
const formattedContent = t1;
const color = isError ? "error" : isWarning ? "warning" : undefined;
let t2;
if ($[6] !== formattedContent) {
t2 = <Ansi>{formattedContent}</Ansi>;
$[6] = formattedContent;
$[7] = t2;
} else {
t2 = $[7];
}
let t3;
if ($[8] !== color || $[9] !== t2) {
t3 = <MessageResponse><Text color={color}>{t2}</Text></MessageResponse>;
$[8] = color;
$[9] = t2;
$[10] = t3;
} else {
t3 = $[10];
}
return t3;
if (shouldShowFull) {
return stripUnderlineAnsi(formatted)
}
return stripUnderlineAnsi(
renderTruncatedContent(formatted, columns, inVirtualList),
)
}, [content, shouldShowFull, columns, linkifyUrls, inVirtualList])
const color = isError ? 'error' : isWarning ? 'warning' : undefined
return (
<MessageResponse>
<Text color={color}>
<Ansi>{formattedContent}</Ansi>
</Text>
</MessageResponse>
)
}
/**
@@ -112,6 +104,8 @@ export function OutputLine(t0) {
*/
export function stripUnderlineAnsi(content: string): string {
return content.replace(
// eslint-disable-next-line no-control-regex
/\u001b\[([0-9]+;)*4(;[0-9]+)*m|\u001b\[4(;[0-9]+)*m|\u001b\[([0-9]+;)*4m/g, '');
// eslint-disable-next-line no-control-regex
/\u001b\[([0-9]+;)*4(;[0-9]+)*m|\u001b\[4(;[0-9]+)*m|\u001b\[([0-9]+;)*4m/g,
'',
)
}

View File

@@ -1,149 +1,87 @@
import { c as _c } from "react/compiler-runtime";
import React from 'react';
import stripAnsi from 'strip-ansi';
import { Box, Text } from '../../ink.js';
import { formatFileSize } from '../../utils/format.js';
import { MessageResponse } from '../MessageResponse.js';
import { OffscreenFreeze } from '../OffscreenFreeze.js';
import { ShellTimeDisplay } from './ShellTimeDisplay.js';
import React from 'react'
import stripAnsi from 'strip-ansi'
import { Box, Text } from '../../ink.js'
import { formatFileSize } from '../../utils/format.js'
import { MessageResponse } from '../MessageResponse.js'
import { OffscreenFreeze } from '../OffscreenFreeze.js'
import { ShellTimeDisplay } from './ShellTimeDisplay.js'
type Props = {
output: string;
fullOutput: string;
elapsedTimeSeconds?: number;
totalLines?: number;
totalBytes?: number;
timeoutMs?: number;
taskId?: string;
verbose: boolean;
};
export function ShellProgressMessage(t0) {
const $ = _c(30);
const {
output,
fullOutput,
elapsedTimeSeconds,
totalLines,
totalBytes,
timeoutMs,
verbose
} = t0;
let t1;
if ($[0] !== fullOutput) {
t1 = stripAnsi(fullOutput.trim());
$[0] = fullOutput;
$[1] = t1;
} else {
t1 = $[1];
}
const strippedFullOutput = t1;
let lines;
let t2;
if ($[2] !== output || $[3] !== strippedFullOutput || $[4] !== verbose) {
const strippedOutput = stripAnsi(output.trim());
lines = strippedOutput.split("\n").filter(_temp);
t2 = verbose ? strippedFullOutput : lines.slice(-5).join("\n");
$[2] = output;
$[3] = strippedFullOutput;
$[4] = verbose;
$[5] = lines;
$[6] = t2;
} else {
lines = $[5];
t2 = $[6];
}
const displayLines = t2;
output: string
fullOutput: string
elapsedTimeSeconds?: number
totalLines?: number
totalBytes?: number
timeoutMs?: number
taskId?: string
verbose: boolean
}
export function ShellProgressMessage({
output,
fullOutput,
elapsedTimeSeconds,
totalLines,
totalBytes,
timeoutMs,
verbose,
}: Props): React.ReactNode {
const strippedFullOutput = stripAnsi(fullOutput.trim())
const strippedOutput = stripAnsi(output.trim())
const lines = strippedOutput.split('\n').filter(line => line)
const displayLines = verbose ? strippedFullOutput : lines.slice(-5).join('\n')
// OffscreenFreeze: BashTool yields progress (elapsedTimeSeconds) every second.
// If this line scrolls into scrollback, each tick forces a full terminal reset.
// A foreground `sleep 600` on a 29-row terminal with 4000 rows of history
// produced 507 resets over 10 minutes (go/ccshare/maxk-20260226-190348).
if (!lines.length) {
let t3;
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
t3 = <Text dimColor={true}>Running </Text>;
$[7] = t3;
} else {
t3 = $[7];
}
let t4;
if ($[8] !== elapsedTimeSeconds || $[9] !== timeoutMs) {
t4 = <MessageResponse><OffscreenFreeze>{t3}<ShellTimeDisplay elapsedTimeSeconds={elapsedTimeSeconds} timeoutMs={timeoutMs} /></OffscreenFreeze></MessageResponse>;
$[8] = elapsedTimeSeconds;
$[9] = timeoutMs;
$[10] = t4;
} else {
t4 = $[10];
}
return t4;
return (
<MessageResponse>
<OffscreenFreeze>
<Text dimColor>Running </Text>
<ShellTimeDisplay
elapsedTimeSeconds={elapsedTimeSeconds}
timeoutMs={timeoutMs}
/>
</OffscreenFreeze>
</MessageResponse>
)
}
const extraLines = totalLines ? Math.max(0, totalLines - 5) : 0;
let lineStatus = "";
// Not truncated: "+2 lines" (total exceeds displayed 5)
// Truncated: "~2000 lines" (extrapolated estimate from tail sample)
const extraLines = totalLines ? Math.max(0, totalLines - 5) : 0
let lineStatus = ''
if (!verbose && totalBytes && totalLines) {
lineStatus = `~${totalLines} lines`;
} else {
if (!verbose && extraLines > 0) {
lineStatus = `+${extraLines} lines`;
}
lineStatus = `~${totalLines} lines`
} else if (!verbose && extraLines > 0) {
lineStatus = `+${extraLines} lines`
}
const t3 = verbose ? undefined : Math.min(5, lines.length);
let t4;
if ($[11] !== displayLines) {
t4 = <Text dimColor={true}>{displayLines}</Text>;
$[11] = displayLines;
$[12] = t4;
} else {
t4 = $[12];
}
let t5;
if ($[13] !== t3 || $[14] !== t4) {
t5 = <Box height={t3} flexDirection="column" overflow="hidden">{t4}</Box>;
$[13] = t3;
$[14] = t4;
$[15] = t5;
} else {
t5 = $[15];
}
let t6;
if ($[16] !== lineStatus) {
t6 = lineStatus ? <Text dimColor={true}>{lineStatus}</Text> : null;
$[16] = lineStatus;
$[17] = t6;
} else {
t6 = $[17];
}
let t7;
if ($[18] !== elapsedTimeSeconds || $[19] !== timeoutMs) {
t7 = <ShellTimeDisplay elapsedTimeSeconds={elapsedTimeSeconds} timeoutMs={timeoutMs} />;
$[18] = elapsedTimeSeconds;
$[19] = timeoutMs;
$[20] = t7;
} else {
t7 = $[20];
}
let t8;
if ($[21] !== totalBytes) {
t8 = totalBytes ? <Text dimColor={true}>{formatFileSize(totalBytes)}</Text> : null;
$[21] = totalBytes;
$[22] = t8;
} else {
t8 = $[22];
}
let t9;
if ($[23] !== t6 || $[24] !== t7 || $[25] !== t8) {
t9 = <Box flexDirection="row" gap={1}>{t6}{t7}{t8}</Box>;
$[23] = t6;
$[24] = t7;
$[25] = t8;
$[26] = t9;
} else {
t9 = $[26];
}
let t10;
if ($[27] !== t5 || $[28] !== t9) {
t10 = <MessageResponse><OffscreenFreeze><Box flexDirection="column">{t5}{t9}</Box></OffscreenFreeze></MessageResponse>;
$[27] = t5;
$[28] = t9;
$[29] = t10;
} else {
t10 = $[29];
}
return t10;
}
function _temp(line) {
return line;
return (
<MessageResponse>
<OffscreenFreeze>
<Box flexDirection="column">
<Box
height={verbose ? undefined : Math.min(5, lines.length)}
flexDirection="column"
overflow="hidden"
>
<Text dimColor>{displayLines}</Text>
</Box>
<Box flexDirection="row" gap={1}>
{lineStatus ? <Text dimColor>{lineStatus}</Text> : null}
<ShellTimeDisplay
elapsedTimeSeconds={elapsedTimeSeconds}
timeoutMs={timeoutMs}
/>
{totalBytes ? (
<Text dimColor>{formatFileSize(totalBytes)}</Text>
) : null}
</Box>
</Box>
</OffscreenFreeze>
</MessageResponse>
)
}

View File

@@ -1,73 +1,28 @@
import { c as _c } from "react/compiler-runtime";
import React from 'react';
import { Text } from '../../ink.js';
import { formatDuration } from '../../utils/format.js';
import React from 'react'
import { Text } from '../../ink.js'
import { formatDuration } from '../../utils/format.js'
type Props = {
elapsedTimeSeconds?: number;
timeoutMs?: number;
};
export function ShellTimeDisplay(t0) {
const $ = _c(10);
const {
elapsedTimeSeconds,
timeoutMs
} = t0;
if (elapsedTimeSeconds === undefined && !timeoutMs) {
return null;
}
let t1;
if ($[0] !== timeoutMs) {
t1 = timeoutMs ? formatDuration(timeoutMs, {
hideTrailingZeros: true
}) : undefined;
$[0] = timeoutMs;
$[1] = t1;
} else {
t1 = $[1];
}
const timeout = t1;
if (elapsedTimeSeconds === undefined) {
const t2 = `(timeout ${timeout})`;
let t3;
if ($[2] !== t2) {
t3 = <Text dimColor={true}>{t2}</Text>;
$[2] = t2;
$[3] = t3;
} else {
t3 = $[3];
}
return t3;
}
const t2 = elapsedTimeSeconds * 1000;
let t3;
if ($[4] !== t2) {
t3 = formatDuration(t2);
$[4] = t2;
$[5] = t3;
} else {
t3 = $[5];
}
const elapsed = t3;
if (timeout) {
const t4 = `(${elapsed} · timeout ${timeout})`;
let t5;
if ($[6] !== t4) {
t5 = <Text dimColor={true}>{t4}</Text>;
$[6] = t4;
$[7] = t5;
} else {
t5 = $[7];
}
return t5;
}
const t4 = `(${elapsed})`;
let t5;
if ($[8] !== t4) {
t5 = <Text dimColor={true}>{t4}</Text>;
$[8] = t4;
$[9] = t5;
} else {
t5 = $[9];
}
return t5;
elapsedTimeSeconds?: number
timeoutMs?: number
}
export function ShellTimeDisplay({
elapsedTimeSeconds,
timeoutMs,
}: Props): React.ReactNode {
if (elapsedTimeSeconds === undefined && !timeoutMs) {
return null
}
const timeout = timeoutMs
? formatDuration(timeoutMs, { hideTrailingZeros: true })
: undefined
if (elapsedTimeSeconds === undefined) {
return <Text dimColor>{`(timeout ${timeout})`}</Text>
}
const elapsed = formatDuration(elapsedTimeSeconds * 1000)
if (timeout) {
return <Text dimColor>{`(${elapsed} · timeout ${timeout})`}</Text>
}
return <Text dimColor>{`(${elapsed})`}</Text>
}