mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-19 06:45: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,112 +1,113 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import * as React from 'react';
|
||||
import { Box, Text } from '../../ink.js';
|
||||
import { isShutdownApproved, isShutdownRejected, isShutdownRequest, type ShutdownRejectedMessage, type ShutdownRequestMessage } from '../../utils/teammateMailbox.js';
|
||||
import * as React from 'react'
|
||||
import { Box, Text } from '../../ink.js'
|
||||
import {
|
||||
isShutdownApproved,
|
||||
isShutdownRejected,
|
||||
isShutdownRequest,
|
||||
type ShutdownRejectedMessage,
|
||||
type ShutdownRequestMessage,
|
||||
} from '../../utils/teammateMailbox.js'
|
||||
|
||||
type ShutdownRequestProps = {
|
||||
request: ShutdownRequestMessage;
|
||||
};
|
||||
request: ShutdownRequestMessage
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a shutdown request with a warning-colored border.
|
||||
*/
|
||||
export function ShutdownRequestDisplay(t0) {
|
||||
const $ = _c(7);
|
||||
const {
|
||||
request
|
||||
} = t0;
|
||||
let t1;
|
||||
if ($[0] !== request.from) {
|
||||
t1 = <Box marginBottom={1}><Text color="warning" bold={true}>Shutdown request from {request.from}</Text></Box>;
|
||||
$[0] = request.from;
|
||||
$[1] = t1;
|
||||
} else {
|
||||
t1 = $[1];
|
||||
}
|
||||
let t2;
|
||||
if ($[2] !== request.reason) {
|
||||
t2 = request.reason && <Box><Text>Reason: {request.reason}</Text></Box>;
|
||||
$[2] = request.reason;
|
||||
$[3] = t2;
|
||||
} else {
|
||||
t2 = $[3];
|
||||
}
|
||||
let t3;
|
||||
if ($[4] !== t1 || $[5] !== t2) {
|
||||
t3 = <Box flexDirection="column" marginY={1}><Box borderStyle="round" borderColor="warning" flexDirection="column" paddingX={1} paddingY={1}>{t1}{t2}</Box></Box>;
|
||||
$[4] = t1;
|
||||
$[5] = t2;
|
||||
$[6] = t3;
|
||||
} else {
|
||||
t3 = $[6];
|
||||
}
|
||||
return t3;
|
||||
export function ShutdownRequestDisplay({
|
||||
request,
|
||||
}: ShutdownRequestProps): React.ReactNode {
|
||||
return (
|
||||
<Box flexDirection="column" marginY={1}>
|
||||
<Box
|
||||
borderStyle="round"
|
||||
borderColor="warning"
|
||||
flexDirection="column"
|
||||
paddingX={1}
|
||||
paddingY={1}
|
||||
>
|
||||
<Box marginBottom={1}>
|
||||
<Text color="warning" bold>
|
||||
Shutdown request from {request.from}
|
||||
</Text>
|
||||
</Box>
|
||||
{request.reason && (
|
||||
<Box>
|
||||
<Text>Reason: {request.reason}</Text>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
type ShutdownRejectedProps = {
|
||||
response: ShutdownRejectedMessage;
|
||||
};
|
||||
response: ShutdownRejectedMessage
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a shutdown rejected message with a subtle (grey) border.
|
||||
*/
|
||||
export function ShutdownRejectedDisplay(t0) {
|
||||
const $ = _c(8);
|
||||
const {
|
||||
response
|
||||
} = t0;
|
||||
let t1;
|
||||
if ($[0] !== response.from) {
|
||||
t1 = <Text color="subtle" bold={true}>Shutdown rejected by {response.from}</Text>;
|
||||
$[0] = response.from;
|
||||
$[1] = t1;
|
||||
} else {
|
||||
t1 = $[1];
|
||||
}
|
||||
let t2;
|
||||
if ($[2] !== response.reason) {
|
||||
t2 = <Box marginTop={1} borderStyle="dashed" borderColor="subtle" borderLeft={false} borderRight={false} paddingX={1}><Text>Reason: {response.reason}</Text></Box>;
|
||||
$[2] = response.reason;
|
||||
$[3] = t2;
|
||||
} else {
|
||||
t2 = $[3];
|
||||
}
|
||||
let t3;
|
||||
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t3 = <Box marginTop={1}><Text dimColor={true}>Teammate is continuing to work. You may request shutdown again later.</Text></Box>;
|
||||
$[4] = t3;
|
||||
} else {
|
||||
t3 = $[4];
|
||||
}
|
||||
let t4;
|
||||
if ($[5] !== t1 || $[6] !== t2) {
|
||||
t4 = <Box flexDirection="column" marginY={1}><Box borderStyle="round" borderColor="subtle" flexDirection="column" paddingX={1} paddingY={1}>{t1}{t2}{t3}</Box></Box>;
|
||||
$[5] = t1;
|
||||
$[6] = t2;
|
||||
$[7] = t4;
|
||||
} else {
|
||||
t4 = $[7];
|
||||
}
|
||||
return t4;
|
||||
export function ShutdownRejectedDisplay({
|
||||
response,
|
||||
}: ShutdownRejectedProps): React.ReactNode {
|
||||
return (
|
||||
<Box flexDirection="column" marginY={1}>
|
||||
<Box
|
||||
borderStyle="round"
|
||||
borderColor="subtle"
|
||||
flexDirection="column"
|
||||
paddingX={1}
|
||||
paddingY={1}
|
||||
>
|
||||
<Text color="subtle" bold>
|
||||
Shutdown rejected by {response.from}
|
||||
</Text>
|
||||
<Box
|
||||
marginTop={1}
|
||||
borderStyle="dashed"
|
||||
borderColor="subtle"
|
||||
borderLeft={false}
|
||||
borderRight={false}
|
||||
paddingX={1}
|
||||
>
|
||||
<Text>Reason: {response.reason}</Text>
|
||||
</Box>
|
||||
<Box marginTop={1}>
|
||||
<Text dimColor>
|
||||
Teammate is continuing to work. You may request shutdown again
|
||||
later.
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to parse and render a shutdown message from raw content.
|
||||
* Returns the rendered component if it's a shutdown message, null otherwise.
|
||||
*/
|
||||
export function tryRenderShutdownMessage(content: string): React.ReactNode | null {
|
||||
const request = isShutdownRequest(content);
|
||||
export function tryRenderShutdownMessage(
|
||||
content: string,
|
||||
): React.ReactNode | null {
|
||||
const request = isShutdownRequest(content)
|
||||
if (request) {
|
||||
return <ShutdownRequestDisplay request={request} />;
|
||||
return <ShutdownRequestDisplay request={request} />
|
||||
}
|
||||
|
||||
// Shutdown approved is handled inline by the caller — skip it here
|
||||
if (isShutdownApproved(content)) {
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
const rejected = isShutdownRejected(content);
|
||||
|
||||
const rejected = isShutdownRejected(content)
|
||||
if (rejected) {
|
||||
return <ShutdownRejectedDisplay response={rejected} />;
|
||||
return <ShutdownRejectedDisplay response={rejected} />
|
||||
}
|
||||
return null;
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,17 +116,20 @@ export function tryRenderShutdownMessage(content: string): React.ReactNode | nul
|
||||
* Returns null if the content is not a shutdown message.
|
||||
*/
|
||||
export function getShutdownMessageSummary(content: string): string | null {
|
||||
const request = isShutdownRequest(content);
|
||||
const request = isShutdownRequest(content)
|
||||
if (request) {
|
||||
return `[Shutdown Request from ${request.from}]${request.reason ? ` ${request.reason}` : ''}`;
|
||||
return `[Shutdown Request from ${request.from}]${request.reason ? ` ${request.reason}` : ''}`
|
||||
}
|
||||
const approved = isShutdownApproved(content);
|
||||
|
||||
const approved = isShutdownApproved(content)
|
||||
if (approved) {
|
||||
return `[Shutdown Approved] ${approved.from} is now exiting`;
|
||||
return `[Shutdown Approved] ${approved.from} is now exiting`
|
||||
}
|
||||
const rejected = isShutdownRejected(content);
|
||||
|
||||
const rejected = isShutdownRejected(content)
|
||||
if (rejected) {
|
||||
return `[Shutdown Rejected] ${rejected.from}: ${rejected.reason}`;
|
||||
return `[Shutdown Rejected] ${rejected.from}: ${rejected.reason}`
|
||||
}
|
||||
return null;
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user