mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15: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,274 +1,197 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import { feature } from 'bun:bundle';
|
||||
import type { TextBlockParam } from '@anthropic-ai/sdk/resources/index.mjs';
|
||||
import * as React from 'react';
|
||||
import { NO_CONTENT_MESSAGE } from '../../constants/messages.js';
|
||||
import { COMMAND_MESSAGE_TAG, LOCAL_COMMAND_CAVEAT_TAG, TASK_NOTIFICATION_TAG, TEAMMATE_MESSAGE_TAG, TICK_TAG } from '../../constants/xml.js';
|
||||
import { isAgentSwarmsEnabled } from '../../utils/agentSwarmsEnabled.js';
|
||||
import { extractTag, INTERRUPT_MESSAGE, INTERRUPT_MESSAGE_FOR_TOOL_USE } from '../../utils/messages.js';
|
||||
import { InterruptedByUser } from '../InterruptedByUser.js';
|
||||
import { MessageResponse } from '../MessageResponse.js';
|
||||
import { UserAgentNotificationMessage } from './UserAgentNotificationMessage.js';
|
||||
import { UserBashInputMessage } from './UserBashInputMessage.js';
|
||||
import { UserBashOutputMessage } from './UserBashOutputMessage.js';
|
||||
import { UserCommandMessage } from './UserCommandMessage.js';
|
||||
import { UserLocalCommandOutputMessage } from './UserLocalCommandOutputMessage.js';
|
||||
import { UserMemoryInputMessage } from './UserMemoryInputMessage.js';
|
||||
import { UserPlanMessage } from './UserPlanMessage.js';
|
||||
import { UserPromptMessage } from './UserPromptMessage.js';
|
||||
import { UserResourceUpdateMessage } from './UserResourceUpdateMessage.js';
|
||||
import { UserTeammateMessage } from './UserTeammateMessage.js';
|
||||
import { feature } from 'bun:bundle'
|
||||
import type { TextBlockParam } from '@anthropic-ai/sdk/resources/index.mjs'
|
||||
import * as React from 'react'
|
||||
import { NO_CONTENT_MESSAGE } from '../../constants/messages.js'
|
||||
import {
|
||||
COMMAND_MESSAGE_TAG,
|
||||
LOCAL_COMMAND_CAVEAT_TAG,
|
||||
TASK_NOTIFICATION_TAG,
|
||||
TEAMMATE_MESSAGE_TAG,
|
||||
TICK_TAG,
|
||||
} from '../../constants/xml.js'
|
||||
import { isAgentSwarmsEnabled } from '../../utils/agentSwarmsEnabled.js'
|
||||
import {
|
||||
extractTag,
|
||||
INTERRUPT_MESSAGE,
|
||||
INTERRUPT_MESSAGE_FOR_TOOL_USE,
|
||||
} from '../../utils/messages.js'
|
||||
import { InterruptedByUser } from '../InterruptedByUser.js'
|
||||
import { MessageResponse } from '../MessageResponse.js'
|
||||
import { UserAgentNotificationMessage } from './UserAgentNotificationMessage.js'
|
||||
import { UserBashInputMessage } from './UserBashInputMessage.js'
|
||||
import { UserBashOutputMessage } from './UserBashOutputMessage.js'
|
||||
import { UserCommandMessage } from './UserCommandMessage.js'
|
||||
import { UserLocalCommandOutputMessage } from './UserLocalCommandOutputMessage.js'
|
||||
import { UserMemoryInputMessage } from './UserMemoryInputMessage.js'
|
||||
import { UserPlanMessage } from './UserPlanMessage.js'
|
||||
import { UserPromptMessage } from './UserPromptMessage.js'
|
||||
import { UserResourceUpdateMessage } from './UserResourceUpdateMessage.js'
|
||||
import { UserTeammateMessage } from './UserTeammateMessage.js'
|
||||
|
||||
type Props = {
|
||||
addMargin: boolean;
|
||||
param: TextBlockParam;
|
||||
verbose: boolean;
|
||||
planContent?: string;
|
||||
isTranscriptMode?: boolean;
|
||||
timestamp?: string;
|
||||
};
|
||||
export function UserTextMessage(t0) {
|
||||
const $ = _c(49);
|
||||
const {
|
||||
addMargin,
|
||||
param,
|
||||
verbose,
|
||||
planContent,
|
||||
isTranscriptMode,
|
||||
timestamp
|
||||
} = t0;
|
||||
if (param.text.trim() === NO_CONTENT_MESSAGE) {
|
||||
return null;
|
||||
}
|
||||
if (planContent) {
|
||||
let t1;
|
||||
if ($[0] !== addMargin || $[1] !== planContent) {
|
||||
t1 = <UserPlanMessage addMargin={addMargin} planContent={planContent} />;
|
||||
$[0] = addMargin;
|
||||
$[1] = planContent;
|
||||
$[2] = t1;
|
||||
} else {
|
||||
t1 = $[2];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
if (extractTag(param.text, TICK_TAG)) {
|
||||
return null;
|
||||
}
|
||||
if (param.text.includes(`<${LOCAL_COMMAND_CAVEAT_TAG}>`)) {
|
||||
return null;
|
||||
}
|
||||
if (param.text.startsWith("<bash-stdout") || param.text.startsWith("<bash-stderr")) {
|
||||
let t1;
|
||||
if ($[3] !== param.text || $[4] !== verbose) {
|
||||
t1 = <UserBashOutputMessage content={param.text} verbose={verbose} />;
|
||||
$[3] = param.text;
|
||||
$[4] = verbose;
|
||||
$[5] = t1;
|
||||
} else {
|
||||
t1 = $[5];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
if (param.text.startsWith("<local-command-stdout") || param.text.startsWith("<local-command-stderr")) {
|
||||
let t1;
|
||||
if ($[6] !== param.text) {
|
||||
t1 = <UserLocalCommandOutputMessage content={param.text} />;
|
||||
$[6] = param.text;
|
||||
$[7] = t1;
|
||||
} else {
|
||||
t1 = $[7];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
if (param.text === INTERRUPT_MESSAGE || param.text === INTERRUPT_MESSAGE_FOR_TOOL_USE) {
|
||||
let t1;
|
||||
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = <MessageResponse height={1}><InterruptedByUser /></MessageResponse>;
|
||||
$[8] = t1;
|
||||
} else {
|
||||
t1 = $[8];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
if (feature("KAIROS_GITHUB_WEBHOOKS")) {
|
||||
if (param.text.startsWith("<github-webhook-activity>")) {
|
||||
let t1;
|
||||
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = require("./UserGitHubWebhookMessage.js");
|
||||
$[9] = t1;
|
||||
} else {
|
||||
t1 = $[9];
|
||||
}
|
||||
const {
|
||||
UserGitHubWebhookMessage
|
||||
} = t1 as typeof import('./UserGitHubWebhookMessage.js');
|
||||
let t2;
|
||||
if ($[10] !== addMargin || $[11] !== param) {
|
||||
t2 = <UserGitHubWebhookMessage addMargin={addMargin} param={param} />;
|
||||
$[10] = addMargin;
|
||||
$[11] = param;
|
||||
$[12] = t2;
|
||||
} else {
|
||||
t2 = $[12];
|
||||
}
|
||||
return t2;
|
||||
}
|
||||
}
|
||||
if (param.text.includes("<bash-input>")) {
|
||||
let t1;
|
||||
if ($[13] !== addMargin || $[14] !== param) {
|
||||
t1 = <UserBashInputMessage addMargin={addMargin} param={param} />;
|
||||
$[13] = addMargin;
|
||||
$[14] = param;
|
||||
$[15] = t1;
|
||||
} else {
|
||||
t1 = $[15];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
if (param.text.includes(`<${COMMAND_MESSAGE_TAG}>`)) {
|
||||
let t1;
|
||||
if ($[16] !== addMargin || $[17] !== param) {
|
||||
t1 = <UserCommandMessage addMargin={addMargin} param={param} />;
|
||||
$[16] = addMargin;
|
||||
$[17] = param;
|
||||
$[18] = t1;
|
||||
} else {
|
||||
t1 = $[18];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
if (param.text.includes("<user-memory-input>")) {
|
||||
let t1;
|
||||
if ($[19] !== addMargin || $[20] !== param.text) {
|
||||
t1 = <UserMemoryInputMessage addMargin={addMargin} text={param.text} />;
|
||||
$[19] = addMargin;
|
||||
$[20] = param.text;
|
||||
$[21] = t1;
|
||||
} else {
|
||||
t1 = $[21];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
if (isAgentSwarmsEnabled() && param.text.includes(`<${TEAMMATE_MESSAGE_TAG}`)) {
|
||||
let t1;
|
||||
if ($[22] !== addMargin || $[23] !== isTranscriptMode || $[24] !== param) {
|
||||
t1 = <UserTeammateMessage addMargin={addMargin} param={param} isTranscriptMode={isTranscriptMode} />;
|
||||
$[22] = addMargin;
|
||||
$[23] = isTranscriptMode;
|
||||
$[24] = param;
|
||||
$[25] = t1;
|
||||
} else {
|
||||
t1 = $[25];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
if (param.text.includes(`<${TASK_NOTIFICATION_TAG}`)) {
|
||||
let t1;
|
||||
if ($[26] !== addMargin || $[27] !== param) {
|
||||
t1 = <UserAgentNotificationMessage addMargin={addMargin} param={param} />;
|
||||
$[26] = addMargin;
|
||||
$[27] = param;
|
||||
$[28] = t1;
|
||||
} else {
|
||||
t1 = $[28];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
if (param.text.includes("<mcp-resource-update") || param.text.includes("<mcp-polling-update")) {
|
||||
let t1;
|
||||
if ($[29] !== addMargin || $[30] !== param) {
|
||||
t1 = <UserResourceUpdateMessage addMargin={addMargin} param={param} />;
|
||||
$[29] = addMargin;
|
||||
$[30] = param;
|
||||
$[31] = t1;
|
||||
} else {
|
||||
t1 = $[31];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
if (feature("FORK_SUBAGENT")) {
|
||||
if (param.text.includes("<fork-boilerplate>")) {
|
||||
let t1;
|
||||
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = require("./UserForkBoilerplateMessage.js");
|
||||
$[32] = t1;
|
||||
} else {
|
||||
t1 = $[32];
|
||||
}
|
||||
const {
|
||||
UserForkBoilerplateMessage
|
||||
} = t1 as typeof import('./UserForkBoilerplateMessage.js');
|
||||
let t2;
|
||||
if ($[33] !== addMargin || $[34] !== param) {
|
||||
t2 = <UserForkBoilerplateMessage addMargin={addMargin} param={param} />;
|
||||
$[33] = addMargin;
|
||||
$[34] = param;
|
||||
$[35] = t2;
|
||||
} else {
|
||||
t2 = $[35];
|
||||
}
|
||||
return t2;
|
||||
}
|
||||
}
|
||||
if (feature("UDS_INBOX")) {
|
||||
if (param.text.includes("<cross-session-message")) {
|
||||
let t1;
|
||||
if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = require("./UserCrossSessionMessage.js");
|
||||
$[36] = t1;
|
||||
} else {
|
||||
t1 = $[36];
|
||||
}
|
||||
const {
|
||||
UserCrossSessionMessage
|
||||
} = t1 as typeof import('./UserCrossSessionMessage.js');
|
||||
let t2;
|
||||
if ($[37] !== addMargin || $[38] !== param) {
|
||||
t2 = <UserCrossSessionMessage addMargin={addMargin} param={param} />;
|
||||
$[37] = addMargin;
|
||||
$[38] = param;
|
||||
$[39] = t2;
|
||||
} else {
|
||||
t2 = $[39];
|
||||
}
|
||||
return t2;
|
||||
}
|
||||
}
|
||||
if (feature("KAIROS") || feature("KAIROS_CHANNELS")) {
|
||||
if (param.text.includes("<channel source=\"")) {
|
||||
let t1;
|
||||
if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = require("./UserChannelMessage.js");
|
||||
$[40] = t1;
|
||||
} else {
|
||||
t1 = $[40];
|
||||
}
|
||||
const {
|
||||
UserChannelMessage
|
||||
} = t1 as typeof import('./UserChannelMessage.js');
|
||||
let t2;
|
||||
if ($[41] !== addMargin || $[42] !== param) {
|
||||
t2 = <UserChannelMessage addMargin={addMargin} param={param} />;
|
||||
$[41] = addMargin;
|
||||
$[42] = param;
|
||||
$[43] = t2;
|
||||
} else {
|
||||
t2 = $[43];
|
||||
}
|
||||
return t2;
|
||||
}
|
||||
}
|
||||
let t1;
|
||||
if ($[44] !== addMargin || $[45] !== isTranscriptMode || $[46] !== param || $[47] !== timestamp) {
|
||||
t1 = <UserPromptMessage addMargin={addMargin} param={param} isTranscriptMode={isTranscriptMode} timestamp={timestamp} />;
|
||||
$[44] = addMargin;
|
||||
$[45] = isTranscriptMode;
|
||||
$[46] = param;
|
||||
$[47] = timestamp;
|
||||
$[48] = t1;
|
||||
} else {
|
||||
t1 = $[48];
|
||||
}
|
||||
return t1;
|
||||
addMargin: boolean
|
||||
param: TextBlockParam
|
||||
verbose: boolean
|
||||
planContent?: string
|
||||
isTranscriptMode?: boolean
|
||||
timestamp?: string
|
||||
}
|
||||
|
||||
export function UserTextMessage({
|
||||
addMargin,
|
||||
param,
|
||||
verbose,
|
||||
planContent,
|
||||
isTranscriptMode,
|
||||
timestamp,
|
||||
}: Props): React.ReactNode {
|
||||
if (param.text.trim() === NO_CONTENT_MESSAGE) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Plan to implement message (cleared context flow)
|
||||
if (planContent) {
|
||||
return <UserPlanMessage addMargin={addMargin} planContent={planContent} />
|
||||
}
|
||||
|
||||
if (extractTag(param.text, TICK_TAG)) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Hide synthetic caveat messages (should be filtered by isMeta, this is defensive)
|
||||
if (param.text.includes(`<${LOCAL_COMMAND_CAVEAT_TAG}>`)) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Show bash output
|
||||
if (
|
||||
param.text.startsWith('<bash-stdout') ||
|
||||
param.text.startsWith('<bash-stderr')
|
||||
) {
|
||||
return <UserBashOutputMessage content={param.text} verbose={verbose} />
|
||||
}
|
||||
|
||||
// Show command output
|
||||
if (
|
||||
param.text.startsWith('<local-command-stdout') ||
|
||||
param.text.startsWith('<local-command-stderr')
|
||||
) {
|
||||
return <UserLocalCommandOutputMessage content={param.text} />
|
||||
}
|
||||
|
||||
// Handle interruption messages specially
|
||||
if (
|
||||
param.text === INTERRUPT_MESSAGE ||
|
||||
param.text === INTERRUPT_MESSAGE_FOR_TOOL_USE
|
||||
) {
|
||||
return (
|
||||
<MessageResponse height={1}>
|
||||
<InterruptedByUser />
|
||||
</MessageResponse>
|
||||
)
|
||||
}
|
||||
|
||||
// GitHub webhook events (check_run, review comments, pushes) delivered via
|
||||
// bound-session routing after /subscribe-pr. The tag constant is stripped
|
||||
// from external builds — inline the literal so the import doesn't fail.
|
||||
// The require() below DCEs when both flags are off. startsWith (not
|
||||
// includes) and before the includes-checks below: defense-in-depth if
|
||||
// the sanitizer were ever weakened.
|
||||
if (feature('KAIROS_GITHUB_WEBHOOKS')) {
|
||||
if (param.text.startsWith('<github-webhook-activity>')) {
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
const { UserGitHubWebhookMessage } =
|
||||
require('./UserGitHubWebhookMessage.js') as typeof import('./UserGitHubWebhookMessage.js')
|
||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||
return <UserGitHubWebhookMessage addMargin={addMargin} param={param} />
|
||||
}
|
||||
}
|
||||
|
||||
// Bash inputs!
|
||||
if (param.text.includes('<bash-input>')) {
|
||||
return <UserBashInputMessage addMargin={addMargin} param={param} />
|
||||
}
|
||||
|
||||
// Slash commands/
|
||||
if (param.text.includes(`<${COMMAND_MESSAGE_TAG}>`)) {
|
||||
return <UserCommandMessage addMargin={addMargin} param={param} />
|
||||
}
|
||||
|
||||
if (param.text.includes('<user-memory-input>')) {
|
||||
return <UserMemoryInputMessage addMargin={addMargin} text={param.text} />
|
||||
}
|
||||
|
||||
// Teammate messages - only check when swarms enabled
|
||||
if (
|
||||
isAgentSwarmsEnabled() &&
|
||||
param.text.includes(`<${TEAMMATE_MESSAGE_TAG}`)
|
||||
) {
|
||||
return (
|
||||
<UserTeammateMessage
|
||||
addMargin={addMargin}
|
||||
param={param}
|
||||
isTranscriptMode={isTranscriptMode}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
// Task notifications (agent completions, bash completions, etc.)
|
||||
if (param.text.includes(`<${TASK_NOTIFICATION_TAG}`)) {
|
||||
return <UserAgentNotificationMessage addMargin={addMargin} param={param} />
|
||||
}
|
||||
|
||||
// MCP resource and polling update notifications
|
||||
if (
|
||||
param.text.includes('<mcp-resource-update') ||
|
||||
param.text.includes('<mcp-polling-update')
|
||||
) {
|
||||
return <UserResourceUpdateMessage addMargin={addMargin} param={param} />
|
||||
}
|
||||
|
||||
// Fork child's first message: collapse the rules/format boilerplate, show
|
||||
// only the directive. FORK_BOILERPLATE_TAG is inlined so the import doesn't
|
||||
// ship in external builds where feature('FORK_SUBAGENT') is false.
|
||||
if (feature('FORK_SUBAGENT')) {
|
||||
if (param.text.includes('<fork-boilerplate>')) {
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
const { UserForkBoilerplateMessage } =
|
||||
require('./UserForkBoilerplateMessage.js') as typeof import('./UserForkBoilerplateMessage.js')
|
||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||
return <UserForkBoilerplateMessage addMargin={addMargin} param={param} />
|
||||
}
|
||||
}
|
||||
|
||||
// Cross-session UDS message (from another Claude session's SendMessage).
|
||||
// CROSS_SESSION_MESSAGE_TAG is inlined so the import doesn't ship in
|
||||
// external builds where feature('UDS_INBOX') is false.
|
||||
if (feature('UDS_INBOX')) {
|
||||
if (param.text.includes('<cross-session-message')) {
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
const { UserCrossSessionMessage } =
|
||||
require('./UserCrossSessionMessage.js') as typeof import('./UserCrossSessionMessage.js')
|
||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||
return <UserCrossSessionMessage addMargin={addMargin} param={param} />
|
||||
}
|
||||
}
|
||||
|
||||
// Inbound channel message (MCP server push).
|
||||
if (feature('KAIROS') || feature('KAIROS_CHANNELS')) {
|
||||
if (param.text.includes('<channel source="')) {
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
const { UserChannelMessage } =
|
||||
require('./UserChannelMessage.js') as typeof import('./UserChannelMessage.js')
|
||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||
return <UserChannelMessage addMargin={addMargin} param={param} />
|
||||
}
|
||||
}
|
||||
|
||||
// User prompts>
|
||||
return (
|
||||
<UserPromptMessage
|
||||
addMargin={addMargin}
|
||||
param={param}
|
||||
isTranscriptMode={isTranscriptMode}
|
||||
timestamp={timestamp}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user