* 完善所有用到的type对象,并添加中文注释

* 补充遗失的type
This commit is contained in:
xiaoFjun-eng
2026-05-19 09:05:04 +08:00
committed by GitHub
parent c499bfb4ed
commit ea399f1862
68 changed files with 986 additions and 208 deletions

View File

@@ -1,3 +1,9 @@
// Auto-generated stub — replace with real implementation
export type FeedbackSurveyResponse = any
export type FeedbackSurveyType = any
/** 会话内满意度调查的选项(与数字键 03 映射一致)。 */
export type FeedbackSurveyResponse =
| 'dismissed' // 0关闭不反馈
| 'bad' // 1不满意
| 'fine' // 2一般
| 'good' // 3满意
/** 调查场景;当前仅实现会话级提示。 */
export type FeedbackSurveyType = 'session' // 主会话 Spinner/流程内触发

View File

@@ -1,3 +1,14 @@
// Auto-generated stub — replace with real implementation
export type SpinnerMode = any
export type RGBColor = any
/** 主循环/流式输出旁路指示器所处的交互阶段。 */
export type SpinnerMode =
| 'tool-input' // 等待用户对工具输入的响应
| 'tool-use' // 工具执行中
| 'responding' // 模型正在输出回复
| 'thinking' // 模型思考/规划(不区分 provider 细节)
| 'requesting' // 请求已发出、等待首包(含 shimmer 较快节奏)
/** 终端 24 位色(与 Ink `RGBColor` 及渐变插值工具一致)。 */
export type RGBColor = {
r: number // 红 0255
g: number // 绿 0255
b: number // 蓝 0255
}

View File

@@ -192,7 +192,7 @@ function buildStatusLineCommandInput(
const sessionId = getSessionId();
const sessionName = getCurrentSessionTitle(sessionId);
const rawUtil = getRawUtilization();
const rateLimits: StatusLineCommandInput['rate_limits'] = {
const rateLimits: NonNullable<StatusLineCommandInput['rate_limits']> = {
...(rawUtil.five_hour && {
five_hour: {
used_percentage: rawUtil.five_hour.utilization * 100,

View File

@@ -1,2 +1,28 @@
// Auto-generated stub — replace with real implementation
export type AgentWizardData = any
import type { CustomAgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
import type { AgentMemoryScope } from '@claude-code-best/builtin-tools/tools/AgentTool/agentMemory.js'
import type { SettingSource } from '../../../utils/settings/constants.js'
/**
* 「新建代理」向导在各步骤之间传递的可变状态。
* 字段随步骤渐进填充;`finalAgent` 在确认前由 Color 步骤合成。
*/
export type AgentWizardData = {
systemPrompt?: string // 系统提示词终稿
agentType?: string // 代理类型 slug目录名
generationPrompt?: string // 「生成模式」下用户输入的说明全文
selectedTools?: string[] // 限制可用工具undefined 表示全量
whenToUse?: string // 「何时调用」描述whenToUse
location?: SettingSource // 落盘位置:项目或个人 settings
selectedModel?: string // 覆盖默认模型(可选)
selectedColor?: string // 终端高亮色(可选)
wasGenerated?: boolean // 是否经模型一键生成过配置
method?: 'generate' | 'manual' // 创建路径:生成 vs 手工
isGenerating?: boolean // 生成请求进行中(用于 UI 防抖)
generatedAgent?: {
identifier: string // 生成器返回的 agentType 候选
whenToUse: string // 生成器返回的描述
systemPrompt: string // 生成器返回的系统提示
}
selectedMemory?: AgentMemoryScope // Memory 步骤选择的记忆作用域
finalAgent?: CustomAgentDefinition // 确认保存前的完整代理定义草稿
}

View File

@@ -1,8 +1,72 @@
// Auto-generated stub — replace with real implementation
export type ServerInfo = any
export type AgentMcpServerInfo = any
export type MCPViewState = any
export type StdioServerInfo = any
export type ClaudeAIServerInfo = any
export type HTTPServerInfo = any
export type SSEServerInfo = any
import type {
ConfigScope,
MCPServerConnection,
McpClaudeAIProxyServerConfig,
McpHTTPServerConfig,
McpSSEServerConfig,
McpStdioServerConfig,
} from '../../services/mcp/types.js'
/** `/mcp` 列表与菜单共用的服务器行基类字段。 */
type ServerInfoBase = {
name: string // MCP 服务器规范化名称
client: MCPServerConnection // 连接态与配置载体
scope: ConfigScope // 配置来源作用域
}
/** stdio MCP 服务器在 `/mcp` 与插件管理 UI 中的展示形态。 */
export type StdioServerInfo = ServerInfoBase & {
transport: 'stdio' // 标准输入输出子进程
config: McpStdioServerConfig // stdio 启动参数
}
/** SSE MCP 服务器(含 OAuth 会话态)。 */
export type SSEServerInfo = ServerInfoBase & {
transport: 'sse' // 服务端推送事件流
isAuthenticated: boolean | undefined // OAuth/会话是否已就绪(未知时为 undefined
config: McpSSEServerConfig // SSE URL 与头等
}
/** Streamable HTTP MCP 服务器。 */
export type HTTPServerInfo = ServerInfoBase & {
transport: 'http' // HTTP 流式或轮询类远端
isAuthenticated: boolean | undefined // 远端鉴权是否完成
config: McpHTTPServerConfig // HTTP 端点配置
}
/** Claude.ai 代理型 MCP 端点。 */
export type ClaudeAIServerInfo = ServerInfoBase & {
transport: 'claudeai-proxy' // 经 Claude.ai 的代理通道
isAuthenticated: boolean | undefined // 代理侧鉴权展示用
config: McpClaudeAIProxyServerConfig // 代理 id/url 等
}
/** 非 agent 声明的、已连接 MCP 在 UI 中的判别联合。 */
export type ServerInfo =
| StdioServerInfo
| SSEServerInfo
| HTTPServerInfo
| ClaudeAIServerInfo
/**
* 从 Agent frontmatter 提取、用于 `/mcp`「Agents」分组的 MCP 声明。
* 字段按传输方式可选出现,便于菜单统一读取。
*/
export type AgentMcpServerInfo = {
name: string // 在 agent 内声明的服务器名
sourceAgents: string[] // 引用该声明的 agentType 列表
transport: 'stdio' | 'sse' | 'http' | 'ws' // 传输类别
command?: string // stdio启动命令
url?: string // 远端:基础 URL
needsAuth: boolean // 是否依赖 OAuth/令牌
/** 远程传输在 UI 中展示的 OAuth 状态agent 声明路径下通常未知)。 */
isAuthenticated?: boolean // UI 展示用;可选
}
/** `/mcp` 设置面板的视图状态机。 */
export type MCPViewState =
| { type: 'list'; defaultTab?: string } // 服务器/Agents 列表;可选默认 tab
| { type: 'server-menu'; server: ServerInfo } // 选中某服务器后的操作菜单
| { type: 'server-tools'; server: ServerInfo } // 该服务器的工具列表
| { type: 'server-tool-detail'; server: ServerInfo; toolIndex: number } // 单个工具详情
| { type: 'agent-server-menu'; agentServer: AgentMcpServerInfo } // agent 声明的 MCP 菜单

View File

@@ -1,2 +1,5 @@
// Auto-generated stub — replace with real implementation
export type Option = any
/** CustomSelect / 权限规则列表等处的简单选项。 */
export type Option = {
label: string // 展示给用户的文本
value: string // 选中后回传的内部值(如规则 key、占位符
}

View File

@@ -2,9 +2,7 @@ import { createContext, type ReactNode, useCallback, useEffect, useMemo, useStat
import { useExitOnCtrlCDWithKeybindings } from '../../hooks/useExitOnCtrlCDWithKeybindings.js';
import type { WizardContextValue, WizardProviderProps } from './types.js';
// Use any here for the context since it will be cast properly when used
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const WizardContext = createContext<WizardContextValue<any> | null>(null);
export const WizardContext = createContext<WizardContextValue<Record<string, unknown>> | null>(null);
export function WizardProvider<T extends Record<string, unknown>>({
steps,
@@ -18,7 +16,7 @@ export function WizardProvider<T extends Record<string, unknown>>({
initialData?: T;
onComplete: (data: T) => void;
onCancel: () => void;
children: ReactNode;
children?: ReactNode;
title: string;
showStepCounter?: boolean;
}): ReactNode {
@@ -123,5 +121,9 @@ export function WizardProvider<T extends Record<string, unknown>>({
return null;
}
return <WizardContext.Provider value={contextValue}>{children || <CurrentStepComponent />}</WizardContext.Provider>;
return (
<WizardContext.Provider value={contextValue as unknown as WizardContextValue<Record<string, unknown>>}>
{children || <CurrentStepComponent />}
</WizardContext.Provider>
);
}

View File

@@ -1,4 +1,27 @@
// Auto-generated stub — replace with real implementation
export type WizardContextValue<T = any> = any
export type WizardProviderProps = any
export type WizardStepComponent = any
import type { Dispatch, ReactNode, SetStateAction } from 'react'
/** 向导中每一步的组件(无 props 或由 Wizard 包裹后注入上下文)。 */
export type WizardStepComponent = (() => ReactNode) | React.ComponentType
/** `WizardProvider` 的声明 props与实现处交叉类型合并。 */
export type WizardProviderProps = {
steps: WizardStepComponent[] // 步骤组件序列
children?: ReactNode // 可选:自定义包裹层;缺省时渲染当前步组件
title: string // 标题栏文案
showStepCounter?: boolean // 是否显示「第 n / 共 m 步」
}
/** 向导上下文:当前步骤索引、累积数据与导航。 */
export type WizardContextValue<T extends Record<string, unknown>> = {
currentStepIndex: number // 当前步骤下标
totalSteps: number // 步骤总数
wizardData: T // 各步写入的聚合数据
setWizardData: Dispatch<SetStateAction<T>> // 整体替换向导数据
updateWizardData: (updates: Partial<T>) => void // 局部合并更新
goNext: () => void // 下一步;末步则标记完成
goBack: () => void // 上一步或退出
goToStep: (index: number) => void // 非线性跳步(写入历史栈)
cancel: () => void // 放弃并清空历史
title: string // 与 Provider 同步的标题
showStepCounter: boolean // 是否展示步数计数
}