mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13: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,140 +1,64 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import * as React from 'react';
|
||||
import { useState } from 'react';
|
||||
import { Box, Text } from 'src/ink.js';
|
||||
import { formatAPIError } from 'src/services/api/errorUtils.js';
|
||||
import type { SystemAPIErrorMessage } from 'src/types/message.js';
|
||||
import { useInterval } from 'usehooks-ts';
|
||||
import { CtrlOToExpand } from '../CtrlOToExpand.js';
|
||||
import { MessageResponse } from '../MessageResponse.js';
|
||||
const MAX_API_ERROR_CHARS = 1000;
|
||||
import * as React from 'react'
|
||||
import { useState } from 'react'
|
||||
import { Box, Text } from 'src/ink.js'
|
||||
import { formatAPIError } from 'src/services/api/errorUtils.js'
|
||||
import type { SystemAPIErrorMessage } from 'src/types/message.js'
|
||||
import { useInterval } from 'usehooks-ts'
|
||||
import { CtrlOToExpand } from '../CtrlOToExpand.js'
|
||||
import { MessageResponse } from '../MessageResponse.js'
|
||||
|
||||
const MAX_API_ERROR_CHARS = 1000
|
||||
|
||||
type Props = {
|
||||
message: SystemAPIErrorMessage;
|
||||
verbose: boolean;
|
||||
};
|
||||
export function SystemAPIErrorMessage(t0) {
|
||||
const $ = _c(33);
|
||||
const {
|
||||
message: t1,
|
||||
verbose
|
||||
} = t0;
|
||||
const {
|
||||
retryAttempt,
|
||||
error,
|
||||
retryInMs,
|
||||
maxRetries
|
||||
} = t1;
|
||||
const hidden = true && retryAttempt < 4;
|
||||
const [countdownMs, setCountdownMs] = useState(0);
|
||||
const done = countdownMs >= retryInMs;
|
||||
let t2;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t2 = () => setCountdownMs(_temp);
|
||||
$[0] = t2;
|
||||
} else {
|
||||
t2 = $[0];
|
||||
}
|
||||
useInterval(t2, hidden || done ? null : 1000);
|
||||
message: SystemAPIErrorMessage
|
||||
verbose: boolean
|
||||
}
|
||||
|
||||
export function SystemAPIErrorMessage({
|
||||
message: { retryAttempt, error, retryInMs, maxRetries },
|
||||
verbose,
|
||||
}: Props): React.ReactNode {
|
||||
// Hidden for early retries on external builds to avoid noise. Compute before
|
||||
// useInterval so we never register a timer that just drives a null render.
|
||||
const hidden = process.env.USER_TYPE === 'external' && retryAttempt < 4
|
||||
|
||||
const [countdownMs, setCountdownMs] = useState(0)
|
||||
const done = countdownMs >= retryInMs
|
||||
useInterval(
|
||||
() => setCountdownMs(ms => ms + 1000),
|
||||
hidden || done ? null : 1000,
|
||||
)
|
||||
|
||||
if (hidden) {
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
let t3;
|
||||
if ($[1] !== countdownMs || $[2] !== retryInMs) {
|
||||
t3 = Math.round((retryInMs - countdownMs) / 1000);
|
||||
$[1] = countdownMs;
|
||||
$[2] = retryInMs;
|
||||
$[3] = t3;
|
||||
} else {
|
||||
t3 = $[3];
|
||||
}
|
||||
const retryInSecondsLive = Math.max(0, t3);
|
||||
let T0;
|
||||
let T1;
|
||||
let T2;
|
||||
let t4;
|
||||
let t5;
|
||||
let t6;
|
||||
let truncated;
|
||||
if ($[4] !== error || $[5] !== verbose) {
|
||||
const formatted = formatAPIError(error);
|
||||
truncated = !verbose && formatted.length > MAX_API_ERROR_CHARS;
|
||||
T2 = MessageResponse;
|
||||
T1 = Box;
|
||||
t6 = "column";
|
||||
T0 = Text;
|
||||
t4 = "error";
|
||||
t5 = truncated ? formatted.slice(0, MAX_API_ERROR_CHARS) + "\u2026" : formatted;
|
||||
$[4] = error;
|
||||
$[5] = verbose;
|
||||
$[6] = T0;
|
||||
$[7] = T1;
|
||||
$[8] = T2;
|
||||
$[9] = t4;
|
||||
$[10] = t5;
|
||||
$[11] = t6;
|
||||
$[12] = truncated;
|
||||
} else {
|
||||
T0 = $[6];
|
||||
T1 = $[7];
|
||||
T2 = $[8];
|
||||
t4 = $[9];
|
||||
t5 = $[10];
|
||||
t6 = $[11];
|
||||
truncated = $[12];
|
||||
}
|
||||
let t7;
|
||||
if ($[13] !== T0 || $[14] !== t4 || $[15] !== t5) {
|
||||
t7 = <T0 color={t4}>{t5}</T0>;
|
||||
$[13] = T0;
|
||||
$[14] = t4;
|
||||
$[15] = t5;
|
||||
$[16] = t7;
|
||||
} else {
|
||||
t7 = $[16];
|
||||
}
|
||||
let t8;
|
||||
if ($[17] !== truncated) {
|
||||
t8 = truncated && <CtrlOToExpand />;
|
||||
$[17] = truncated;
|
||||
$[18] = t8;
|
||||
} else {
|
||||
t8 = $[18];
|
||||
}
|
||||
const t9 = retryInSecondsLive === 1 ? "second" : "seconds";
|
||||
let t10;
|
||||
if ($[19] !== maxRetries || $[20] !== retryAttempt || $[21] !== retryInSecondsLive || $[22] !== t9) {
|
||||
t10 = <Text dimColor={true}>Retrying in {retryInSecondsLive}{" "}{t9}… (attempt{" "}{retryAttempt}/{maxRetries}){process.env.API_TIMEOUT_MS ? ` · API_TIMEOUT_MS=${process.env.API_TIMEOUT_MS}ms, try increasing it` : ""}</Text>;
|
||||
$[19] = maxRetries;
|
||||
$[20] = retryAttempt;
|
||||
$[21] = retryInSecondsLive;
|
||||
$[22] = t9;
|
||||
$[23] = t10;
|
||||
} else {
|
||||
t10 = $[23];
|
||||
}
|
||||
let t11;
|
||||
if ($[24] !== T1 || $[25] !== t10 || $[26] !== t6 || $[27] !== t7 || $[28] !== t8) {
|
||||
t11 = <T1 flexDirection={t6}>{t7}{t8}{t10}</T1>;
|
||||
$[24] = T1;
|
||||
$[25] = t10;
|
||||
$[26] = t6;
|
||||
$[27] = t7;
|
||||
$[28] = t8;
|
||||
$[29] = t11;
|
||||
} else {
|
||||
t11 = $[29];
|
||||
}
|
||||
let t12;
|
||||
if ($[30] !== T2 || $[31] !== t11) {
|
||||
t12 = <T2>{t11}</T2>;
|
||||
$[30] = T2;
|
||||
$[31] = t11;
|
||||
$[32] = t12;
|
||||
} else {
|
||||
t12 = $[32];
|
||||
}
|
||||
return t12;
|
||||
}
|
||||
function _temp(ms) {
|
||||
return ms + 1000;
|
||||
|
||||
const retryInSecondsLive = Math.max(
|
||||
0,
|
||||
Math.round((retryInMs - countdownMs) / 1000),
|
||||
)
|
||||
|
||||
const formatted = formatAPIError(error)
|
||||
const truncated = !verbose && formatted.length > MAX_API_ERROR_CHARS
|
||||
|
||||
return (
|
||||
<MessageResponse>
|
||||
<Box flexDirection="column">
|
||||
<Text color="error">
|
||||
{truncated
|
||||
? formatted.slice(0, MAX_API_ERROR_CHARS) + '…'
|
||||
: formatted}
|
||||
</Text>
|
||||
{truncated && <CtrlOToExpand />}
|
||||
<Text dimColor>
|
||||
Retrying in {retryInSecondsLive}{' '}
|
||||
{retryInSecondsLive === 1 ? 'second' : 'seconds'}… (attempt{' '}
|
||||
{retryAttempt}/{maxRetries})
|
||||
{process.env.API_TIMEOUT_MS
|
||||
? ` · API_TIMEOUT_MS=${process.env.API_TIMEOUT_MS}ms, try increasing it`
|
||||
: ''}
|
||||
</Text>
|
||||
</Box>
|
||||
</MessageResponse>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user