* 完善所有用到的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,2 +1,13 @@
// Auto-generated stub — replace with real implementation
export type FileSuggestionCommandInput = any
/**
* `FileSuggestion` 自定义命令通过 stdin 接收的 JSON 负载,
* 字段与 `createBaseHookInput()` 一致并附加当前路径前缀 `query`。
*/
export type FileSuggestionCommandInput = {
session_id: string // 当前会话 id
transcript_path: string // 会话 transcript 文件路径
cwd: string // 工作目录
permission_mode?: string // 权限模式快照(若有)
agent_id?: string // 子代理 id若在 agent 内触发)
agent_type?: string // 子代理类型或主线程类型
query: string // 用户当前输入的路径前缀(待补全部分)
}

View File

@@ -1,8 +1,102 @@
// Auto-generated stub — replace with real implementation
export type NotebookCell = any
export type NotebookContent = any
export type NotebookCellOutput = any
export type NotebookCellSource = any
export type NotebookCellSourceOutput = any
export type NotebookOutputImage = any
export type NotebookCellType = any
/** Jupyter / nbformat 单元格类型。 */
export type NotebookCellType =
| 'code' // 可执行代码格
| 'markdown' // 文档格
| 'raw' // 原始文本格
/** 原始 notebook 中的流式输出单元。 */
export type NotebookStreamCellOutput = {
output_type: 'stream' // stdout/stderr 流
text?: string | string[] // 流片段,可为多段拼接
}
/** execute_result / display_data 的 data 载荷(节选常用键)。 */
export type NotebookDisplayData = Record<string, unknown> & {
'text/plain'?: string | string[] // 纯文本回退表示
}
/** 原始 notebook 中的执行结果或展示型输出。 */
export type NotebookRichCellOutput = {
output_type: 'execute_result' | 'display_data' // 执行结果或富展示
data?: NotebookDisplayData // MIME 桶(含图片/png 等)
}
/** 原始 notebook 中的错误输出。 */
export type NotebookErrorCellOutput = {
output_type: 'error' // 内核报错
ename: string // 异常类型名
evalue: string // 异常消息
traceback: string[] // 栈跟踪行数组
}
/** 单元格原始输出联合(解析自 ipynb。 */
export type NotebookCellOutput =
| NotebookStreamCellOutput
| NotebookRichCellOutput
| NotebookErrorCellOutput
/** 解析前的 notebook 单元格nbformat 子集)。 */
export type NotebookCell = {
id?: string // 单元格 idnbformat≥4.5 常见)
cell_type: NotebookCellType // 单元类型
source: string | string[] // 单元源码
execution_count?: number | null // 代码格执行计数
outputs?: NotebookCellOutput[] // 代码格输出列表
metadata?: Record<string, unknown> // 额外元数据(编辑工具会写入)
}
/** Notebook 顶层 metadata 中与语言相关的子集。 */
export type NotebookMetadata = {
language_info?: {
name?: string // 默认内核语言名(如 python
}
}
/** 磁盘上的 `.ipynb` 根结构(用于读入与增量编辑)。 */
export type NotebookContent = {
nbformat?: number // 主版本号(缺省按 4 处理)
nbformat_minor?: number // 次版本号(影响 id 策略等)
cells: NotebookCell[] // 单元序列
metadata: NotebookMetadata // 文档级元数据
}
/** 规范化后的内联图片载荷(送入模型 image block。 */
export type NotebookOutputImage = {
image_data: string // base64 无空白
media_type: 'image/png' | 'image/jpeg' // MIME 子类型
}
/** 经 `processOutput` 规范化后的流式输出(供工具消息使用)。 */
export type NotebookCellSourceStreamOutput = {
output_type: 'stream'
text: string // 已截断/拼接后的文本
}
/** 经 `processOutput` 规范化后的富输出。 */
export type NotebookCellSourceRichOutput = {
output_type: 'execute_result' | 'display_data'
text?: string // 从 text/plain 提取的正文
image?: NotebookOutputImage // 若有 image/png 或 jpeg
}
/** 经 `processOutput` 规范化后的错误输出。 */
export type NotebookCellSourceErrorOutput = {
output_type: 'error'
text: string // 合并 ename/evalue/traceback 后的单段文本
}
/** 送入工具链前的单元输出联合。 */
export type NotebookCellSourceOutput =
| NotebookCellSourceStreamOutput
| NotebookCellSourceRichOutput
| NotebookCellSourceErrorOutput
/** 送入模型工具结果的单元摘要结构。 */
export type NotebookCellSource = {
cellType: NotebookCellType // 与源 cell 对齐的类型
source: string // 拼接后的单元源码字符串
execution_count?: number // 代码格保留执行计数
cell_id: string // 稳定单元 id无则生成 cell-{index}
language?: string // 代码格语言 id非 python 时标注)
outputs?: NotebookCellSourceOutput[] // 规范化后的输出列表
}

View File

@@ -1,2 +1,67 @@
// Auto-generated stub — replace with real implementation
export type StatusLineCommandInput = any
/**
* 自定义状态行命令(`settings.statusLine.command`)通过 stdin 接收的 JSON。
* 与 `buildStatusLineCommandInput` 输出形状一致。
*/
export type StatusLineCommandInput = {
session_id: string // 会话 id
transcript_path: string // transcript 路径
cwd: string // 当前工作目录
permission_mode?: string // 工具权限模式快照
agent_id?: string // 子代理 id若有
agent_type?: string // 子代理类型或主线程类型
session_name?: string // 用户可见会话标题(若有)
model: {
id: string // 当前主循环模型 id
display_name: string // 已本地化的展示名
}
workspace: {
current_dir: string // 进程 cwd
project_dir: string // 项目根(原始 cwd
added_dirs: string[] // 附加工作区目录列表
}
version: string // CLI 版本号MACRO.VERSION
output_style: {
name: string // 当前输出样式名
}
cost: {
total_cost_usd: number // 累计美元成本估计
total_duration_ms: number // 会话墙钟时长
total_api_duration_ms: number // API 往返累计
total_lines_added: number // 归因新增行数
total_lines_removed: number // 归因删除行数
}
context_window: {
total_input_tokens: number | null // 累计输入 token未知为 null
total_output_tokens: number | null // 累计输出 token
context_window_size: number // 当前模型上下文上限
current_usage: {
input_tokens: number // 最近一条用量快照:输入
output_tokens: number // 最近一条用量快照:输出
cache_creation_input_tokens: number // 缓存写入 token
cache_read_input_tokens: number // 缓存命中读取 token
} | null // 尚无有效用量时为 null
used_percentage: number | null // 已用上下文占比
remaining_percentage: number | null // 剩余占比
}
exceeds_200k_tokens: boolean // 是否超过 200k 输入警戒
rate_limits?: {
five_hour?: { used_percentage: number; resets_at: number } // 5 小时窗口用量与重置时间戳
seven_day?: { used_percentage: number; resets_at: number } // 7 天窗口
}
vim?: {
mode: string // 当前 Vim 模式标签(如 INSERT
}
agent?: {
name: string // `--agent` 或子代理类型名
}
remote?: {
session_id: string // 远程/桥接会话标识
}
worktree?: {
name: string // worktree 展示名
path: string // worktree 根路径
branch?: string // 当前分支(可缺省)
original_cwd: string // 进入 worktree 前 cwd
original_branch?: string // 进入前分支(可缺省)
}
}