更新大量 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,100 +1,127 @@
import React from 'react';
import { MessageResponse } from '../../components/MessageResponse.js';
import { TOOL_SUMMARY_MAX_LENGTH } from '../../constants/toolLimits.js';
import { Box, Text } from '../../ink.js';
import type { ProgressMessage } from '../../types/message.js';
import { truncate } from '../../utils/format.js';
import type { Output, SearchResult, WebSearchProgress } from './WebSearchTool.js';
function getSearchSummary(results: (SearchResult | string | null | undefined)[]): {
searchCount: number;
totalResultCount: number;
import React from 'react'
import { MessageResponse } from '../../components/MessageResponse.js'
import { TOOL_SUMMARY_MAX_LENGTH } from '../../constants/toolLimits.js'
import { Box, Text } from '../../ink.js'
import type { ProgressMessage } from '../../types/message.js'
import { truncate } from '../../utils/format.js'
import type {
Output,
SearchResult,
WebSearchProgress,
} from './WebSearchTool.js'
function getSearchSummary(
results: (SearchResult | string | null | undefined)[],
): {
searchCount: number
totalResultCount: number
} {
let searchCount = 0;
let totalResultCount = 0;
let searchCount = 0
let totalResultCount = 0
for (const result of results) {
if (result != null && typeof result !== 'string') {
searchCount++;
totalResultCount += result.content?.length ?? 0;
searchCount++
totalResultCount += result.content?.length ?? 0
}
}
return {
searchCount,
totalResultCount
};
return { searchCount, totalResultCount }
}
export function renderToolUseMessage({
query,
allowed_domains,
blocked_domains
}: Partial<{
query: string;
allowed_domains?: string[];
blocked_domains?: string[];
}>, {
verbose
}: {
verbose: boolean;
}): React.ReactNode {
export function renderToolUseMessage(
{
query,
allowed_domains,
blocked_domains,
}: Partial<{
query: string
allowed_domains?: string[]
blocked_domains?: string[]
}>,
{ verbose }: { verbose: boolean },
): React.ReactNode {
if (!query) {
return null;
return null
}
let message = '';
let message = ''
if (query) {
message += `"${query}"`;
message += `"${query}"`
}
if (verbose) {
if (allowed_domains && allowed_domains.length > 0) {
message += `, only allowing domains: ${allowed_domains.join(', ')}`;
message += `, only allowing domains: ${allowed_domains.join(', ')}`
}
if (blocked_domains && blocked_domains.length > 0) {
message += `, blocking domains: ${blocked_domains.join(', ')}`;
message += `, blocking domains: ${blocked_domains.join(', ')}`
}
}
return message;
return message
}
export function renderToolUseProgressMessage(progressMessages: ProgressMessage<WebSearchProgress>[]): React.ReactNode {
export function renderToolUseProgressMessage(
progressMessages: ProgressMessage<WebSearchProgress>[],
): React.ReactNode {
if (progressMessages.length === 0) {
return null;
return null
}
const lastProgress = progressMessages[progressMessages.length - 1];
const lastProgress = progressMessages[progressMessages.length - 1]
if (!lastProgress?.data) {
return null;
return null
}
const data = lastProgress.data;
const data = lastProgress.data
switch (data.type) {
case 'query_update':
return <MessageResponse>
return (
<MessageResponse>
<Text dimColor>Searching: {data.query}</Text>
</MessageResponse>;
</MessageResponse>
)
case 'search_results_received':
return <MessageResponse>
return (
<MessageResponse>
<Text dimColor>
Found {data.resultCount} results for &quot;{data.query}&quot;
</Text>
</MessageResponse>;
</MessageResponse>
)
default:
return null;
return null
}
}
export function renderToolResultMessage(output: Output): React.ReactNode {
const {
searchCount
} = getSearchSummary(output.results ?? []);
const timeDisplay = output.durationSeconds >= 1 ? `${Math.round(output.durationSeconds)}s` : `${Math.round(output.durationSeconds * 1000)}ms`;
return <Box justifyContent="space-between" width="100%">
const { searchCount } = getSearchSummary(output.results ?? [])
const timeDisplay =
output.durationSeconds >= 1
? `${Math.round(output.durationSeconds)}s`
: `${Math.round(output.durationSeconds * 1000)}ms`
return (
<Box justifyContent="space-between" width="100%">
<MessageResponse height={1}>
<Text>
Did {searchCount} search
{searchCount !== 1 ? 'es' : ''} in {timeDisplay}
</Text>
</MessageResponse>
</Box>;
</Box>
)
}
export function getToolUseSummary(input: Partial<{
query: string;
}> | undefined): string | null {
export function getToolUseSummary(
input: Partial<{ query: string }> | undefined,
): string | null {
if (!input?.query) {
return null;
return null
}
return truncate(input.query, TOOL_SUMMARY_MAX_LENGTH);
return truncate(input.query, TOOL_SUMMARY_MAX_LENGTH)
}