mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-19 23:05: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,102 +1,95 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import { feature } from 'bun:bundle';
|
||||
import type { ToolResultBlockParam } from '@anthropic-ai/sdk/resources/index.mjs';
|
||||
import * as React from 'react';
|
||||
import { BULLET_OPERATOR } from '../../../constants/figures.js';
|
||||
import { Text } from '../../../ink.js';
|
||||
import { filterToolProgressMessages, type Tool, type Tools } from '../../../Tool.js';
|
||||
import type { ProgressMessage } from '../../../types/message.js';
|
||||
import { INTERRUPT_MESSAGE_FOR_TOOL_USE, isClassifierDenial, PLAN_REJECTION_PREFIX, REJECT_MESSAGE_WITH_REASON_PREFIX } from '../../../utils/messages.js';
|
||||
import { FallbackToolUseErrorMessage } from '../../FallbackToolUseErrorMessage.js';
|
||||
import { InterruptedByUser } from '../../InterruptedByUser.js';
|
||||
import { MessageResponse } from '../../MessageResponse.js';
|
||||
import { RejectedPlanMessage } from './RejectedPlanMessage.js';
|
||||
import { RejectedToolUseMessage } from './RejectedToolUseMessage.js';
|
||||
import { feature } from 'bun:bundle'
|
||||
import type { ToolResultBlockParam } from '@anthropic-ai/sdk/resources/index.mjs'
|
||||
import * as React from 'react'
|
||||
import { BULLET_OPERATOR } from '../../../constants/figures.js'
|
||||
import { Text } from '../../../ink.js'
|
||||
import {
|
||||
filterToolProgressMessages,
|
||||
type Tool,
|
||||
type Tools,
|
||||
} from '../../../Tool.js'
|
||||
import type { ProgressMessage } from '../../../types/message.js'
|
||||
import {
|
||||
INTERRUPT_MESSAGE_FOR_TOOL_USE,
|
||||
isClassifierDenial,
|
||||
PLAN_REJECTION_PREFIX,
|
||||
REJECT_MESSAGE_WITH_REASON_PREFIX,
|
||||
} from '../../../utils/messages.js'
|
||||
import { FallbackToolUseErrorMessage } from '../../FallbackToolUseErrorMessage.js'
|
||||
import { InterruptedByUser } from '../../InterruptedByUser.js'
|
||||
import { MessageResponse } from '../../MessageResponse.js'
|
||||
import { RejectedPlanMessage } from './RejectedPlanMessage.js'
|
||||
import { RejectedToolUseMessage } from './RejectedToolUseMessage.js'
|
||||
|
||||
type Props = {
|
||||
progressMessagesForMessage: ProgressMessage[];
|
||||
tool?: Tool; // undefined when resuming an old conversation that uses an old tool
|
||||
tools: Tools;
|
||||
param: ToolResultBlockParam;
|
||||
verbose: boolean;
|
||||
isTranscriptMode?: boolean;
|
||||
};
|
||||
export function UserToolErrorMessage(t0) {
|
||||
const $ = _c(14);
|
||||
const {
|
||||
progressMessagesForMessage,
|
||||
tool,
|
||||
tools,
|
||||
param,
|
||||
verbose,
|
||||
isTranscriptMode
|
||||
} = t0;
|
||||
if (typeof param.content === "string" && param.content.includes(INTERRUPT_MESSAGE_FOR_TOOL_USE)) {
|
||||
let t1;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = <MessageResponse height={1}><InterruptedByUser /></MessageResponse>;
|
||||
$[0] = t1;
|
||||
} else {
|
||||
t1 = $[0];
|
||||
}
|
||||
return t1;
|
||||
progressMessagesForMessage: ProgressMessage[]
|
||||
tool?: Tool // undefined when resuming an old conversation that uses an old tool
|
||||
tools: Tools
|
||||
param: ToolResultBlockParam
|
||||
verbose: boolean
|
||||
isTranscriptMode?: boolean
|
||||
}
|
||||
|
||||
export function UserToolErrorMessage({
|
||||
progressMessagesForMessage,
|
||||
tool,
|
||||
tools,
|
||||
param,
|
||||
verbose,
|
||||
isTranscriptMode,
|
||||
}: Props): React.ReactNode {
|
||||
if (
|
||||
typeof param.content === 'string' &&
|
||||
param.content.includes(INTERRUPT_MESSAGE_FOR_TOOL_USE)
|
||||
) {
|
||||
return (
|
||||
<MessageResponse height={1}>
|
||||
<InterruptedByUser />
|
||||
</MessageResponse>
|
||||
)
|
||||
}
|
||||
if (typeof param.content === "string" && param.content.startsWith(PLAN_REJECTION_PREFIX)) {
|
||||
let t1;
|
||||
if ($[1] !== param.content) {
|
||||
t1 = param.content.substring(PLAN_REJECTION_PREFIX.length);
|
||||
$[1] = param.content;
|
||||
$[2] = t1;
|
||||
} else {
|
||||
t1 = $[2];
|
||||
}
|
||||
const planContent = t1;
|
||||
let t2;
|
||||
if ($[3] !== planContent) {
|
||||
t2 = <RejectedPlanMessage plan={planContent} />;
|
||||
$[3] = planContent;
|
||||
$[4] = t2;
|
||||
} else {
|
||||
t2 = $[4];
|
||||
}
|
||||
return t2;
|
||||
|
||||
if (
|
||||
typeof param.content === 'string' &&
|
||||
param.content.startsWith(PLAN_REJECTION_PREFIX)
|
||||
) {
|
||||
// Extract the plan content from the error message
|
||||
const planContent = param.content.substring(PLAN_REJECTION_PREFIX.length)
|
||||
return <RejectedPlanMessage plan={planContent} />
|
||||
}
|
||||
if (typeof param.content === "string" && param.content.startsWith(REJECT_MESSAGE_WITH_REASON_PREFIX)) {
|
||||
let t1;
|
||||
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = <RejectedToolUseMessage />;
|
||||
$[5] = t1;
|
||||
} else {
|
||||
t1 = $[5];
|
||||
}
|
||||
return t1;
|
||||
|
||||
if (
|
||||
typeof param.content === 'string' &&
|
||||
param.content.startsWith(REJECT_MESSAGE_WITH_REASON_PREFIX)
|
||||
) {
|
||||
return <RejectedToolUseMessage />
|
||||
}
|
||||
if (feature("TRANSCRIPT_CLASSIFIER") && typeof param.content === "string" && isClassifierDenial(param.content)) {
|
||||
let t1;
|
||||
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = <MessageResponse height={1}><Text dimColor={true}>Denied by auto mode classifier {BULLET_OPERATOR} /feedback if incorrect</Text></MessageResponse>;
|
||||
$[6] = t1;
|
||||
} else {
|
||||
t1 = $[6];
|
||||
}
|
||||
return t1;
|
||||
|
||||
if (
|
||||
feature('TRANSCRIPT_CLASSIFIER') &&
|
||||
typeof param.content === 'string' &&
|
||||
isClassifierDenial(param.content)
|
||||
) {
|
||||
return (
|
||||
<MessageResponse height={1}>
|
||||
<Text dimColor>
|
||||
Denied by auto mode classifier {BULLET_OPERATOR} /feedback if
|
||||
incorrect
|
||||
</Text>
|
||||
</MessageResponse>
|
||||
)
|
||||
}
|
||||
let t1;
|
||||
if ($[7] !== isTranscriptMode || $[8] !== param.content || $[9] !== progressMessagesForMessage || $[10] !== tool || $[11] !== tools || $[12] !== verbose) {
|
||||
t1 = tool?.renderToolUseErrorMessage?.(param.content, {
|
||||
progressMessagesForMessage: filterToolProgressMessages(progressMessagesForMessage),
|
||||
|
||||
return (
|
||||
tool?.renderToolUseErrorMessage?.(param.content, {
|
||||
progressMessagesForMessage: filterToolProgressMessages(
|
||||
progressMessagesForMessage,
|
||||
),
|
||||
tools,
|
||||
verbose,
|
||||
isTranscriptMode
|
||||
}) ?? <FallbackToolUseErrorMessage result={param.content} verbose={verbose} />;
|
||||
$[7] = isTranscriptMode;
|
||||
$[8] = param.content;
|
||||
$[9] = progressMessagesForMessage;
|
||||
$[10] = tool;
|
||||
$[11] = tools;
|
||||
$[12] = verbose;
|
||||
$[13] = t1;
|
||||
} else {
|
||||
t1 = $[13];
|
||||
}
|
||||
return t1;
|
||||
isTranscriptMode,
|
||||
}) ?? (
|
||||
<FallbackToolUseErrorMessage result={param.content} verbose={verbose} />
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user