style: 完成所有文件的lint

This commit is contained in:
claude-code-best
2026-05-01 21:39:30 +08:00
parent d136872cc9
commit 6182015005
1333 changed files with 68255 additions and 77882 deletions

View File

@@ -1,41 +1,37 @@
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 { 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'
} 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
}
addMargin: boolean;
param: TextBlockParam;
verbose: boolean;
planContent?: string;
isTranscriptMode?: boolean;
timestamp?: string;
};
export function UserTextMessage({
addMargin,
@@ -46,49 +42,40 @@ export function UserTextMessage({
timestamp,
}: Props): React.ReactNode {
if (param.text.trim() === NO_CONTENT_MESSAGE) {
return null
return null;
}
// Plan to implement message (cleared context flow)
if (planContent) {
return <UserPlanMessage addMargin={addMargin} planContent={planContent} />
return <UserPlanMessage addMargin={addMargin} planContent={planContent} />;
}
if (extractTag(param.text, TICK_TAG)) {
return null
return null;
}
// Hide synthetic caveat messages (should be filtered by isMeta, this is defensive)
if (param.text.includes(`<${LOCAL_COMMAND_CAVEAT_TAG}>`)) {
return null
return null;
}
// Show bash output
if (
param.text.startsWith('<bash-stdout') ||
param.text.startsWith('<bash-stderr')
) {
return <UserBashOutputMessage content={param.text} verbose={verbose} />
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} />
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
) {
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
@@ -101,51 +88,39 @@ export function UserTextMessage({
if (param.text.startsWith('<github-webhook-activity>')) {
/* eslint-disable @typescript-eslint/no-require-imports */
const { UserGitHubWebhookMessage } =
require('./UserGitHubWebhookMessage.js') as typeof import('./UserGitHubWebhookMessage.js')
require('./UserGitHubWebhookMessage.js') as typeof import('./UserGitHubWebhookMessage.js');
/* eslint-enable @typescript-eslint/no-require-imports */
return <UserGitHubWebhookMessage addMargin={addMargin} param={param} />
return <UserGitHubWebhookMessage addMargin={addMargin} param={param} />;
}
}
// Bash inputs!
if (param.text.includes('<bash-input>')) {
return <UserBashInputMessage addMargin={addMargin} param={param} />
return <UserBashInputMessage addMargin={addMargin} param={param} />;
}
// Slash commands/
if (param.text.includes(`<${COMMAND_MESSAGE_TAG}>`)) {
return <UserCommandMessage addMargin={addMargin} param={param} />
return <UserCommandMessage addMargin={addMargin} param={param} />;
}
if (param.text.includes('<user-memory-input>')) {
return <UserMemoryInputMessage addMargin={addMargin} text={param.text} />
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}
/>
)
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} />
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} />
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
@@ -155,9 +130,9 @@ export function UserTextMessage({
if (param.text.includes('<fork-boilerplate>')) {
/* eslint-disable @typescript-eslint/no-require-imports */
const { UserForkBoilerplateMessage } =
require('./UserForkBoilerplateMessage.js') as typeof import('./UserForkBoilerplateMessage.js')
require('./UserForkBoilerplateMessage.js') as typeof import('./UserForkBoilerplateMessage.js');
/* eslint-enable @typescript-eslint/no-require-imports */
return <UserForkBoilerplateMessage addMargin={addMargin} param={param} />
return <UserForkBoilerplateMessage addMargin={addMargin} param={param} />;
}
}
@@ -168,9 +143,9 @@ export function UserTextMessage({
if (param.text.includes('<cross-session-message')) {
/* eslint-disable @typescript-eslint/no-require-imports */
const { UserCrossSessionMessage } =
require('./UserCrossSessionMessage.js') as typeof import('./UserCrossSessionMessage.js')
require('./UserCrossSessionMessage.js') as typeof import('./UserCrossSessionMessage.js');
/* eslint-enable @typescript-eslint/no-require-imports */
return <UserCrossSessionMessage addMargin={addMargin} param={param} />
return <UserCrossSessionMessage addMargin={addMargin} param={param} />;
}
}
@@ -178,20 +153,14 @@ export function UserTextMessage({
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')
const { UserChannelMessage } = require('./UserChannelMessage.js') as typeof import('./UserChannelMessage.js');
/* eslint-enable @typescript-eslint/no-require-imports */
return <UserChannelMessage addMargin={addMargin} param={param} />
return <UserChannelMessage addMargin={addMargin} param={param} />;
}
}
// User prompts>
return (
<UserPromptMessage
addMargin={addMargin}
param={param}
isTranscriptMode={isTranscriptMode}
timestamp={timestamp}
/>
)
<UserPromptMessage addMargin={addMargin} param={param} isTranscriptMode={isTranscriptMode} timestamp={timestamp} />
);
}