Files
inkreach-agent/packages/plugin-sdk/src/status.ts
T

72 lines
2.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 内联槽位的数据类型(B2 状态胶囊 / B5 工具栏按钮)。
* 契约原则:内联 UI 一律"数据 + 深链",不注册组件——外置插件只有
* iframe 页有能力渲染自己的 React;宿主统一按数据渲染这些小 UI。
*/
/** 深链:点击行为 = 打开某个视图('chat' 或插件 id)并携带参数 */
export interface OpenViewAction {
view: string
params?: unknown
}
/** 徽标/胶囊共用色调语义 */
export type StatusTone = 'default' | 'accent' | 'success' | 'warn' | 'danger'
/** 详情弹层里的一行(数据驱动;openView 缺省为纯展示行) */
export interface StatusDetailRow {
/** svg 字符串(14px 线条风格,currentColor) */
icon?: string
label: string
/** 次级说明(label 下方小字) */
detail?: string
/** 右侧徽标文本(如 +76 -40、7/7、✓) */
trailing?: string
/** 徽标色调,缺省 default */
tone?: StatusTone
/** 整行点击的深链;缺省不可点击 */
openView?: OpenViewAction
}
/** 详情弹层分组(悬浮面板中为手风琴:默认收起只显示标题行,点击展开 rows) */
export interface StatusDetailSection {
/** 分组标题(如「计划」「进程」);缺省无标题(rows 直接平铺、不可收起) */
title?: string
/** 标题行尾徽标(如「4/4」「35分7秒」;收起态也可见——ZCode 式摘要) */
trailing?: string
/** 行尾徽标色调,缺省 default */
trailingTone?: StatusTone
rows: StatusDetailRow[]
}
/** 状态胶囊的展开详情:点击胶囊弹出宿主渲染的分组列表弹层。
* 声明了 detail 的胶囊,点击 = 展开弹层(行内 openView 负责深链);
* 未声明的胶囊保持原行为:点击 = item.openView。 */
export interface StatusDetail {
/** 弹层标题;缺省用胶囊文本 */
title?: string
sections: StatusDetailSection[]
}
/** 状态胶囊条目(TitleBar 胶囊区 / 聊天区浮动胶囊共用一份数据) */
export interface StatusItem {
text: string
/** svg 字符串(12-14px 线条风格,currentColor;缺省纯文字胶囊) */
icon?: string
tone?: StatusTone
/** 点击行为:深链;有 detail 时被弹层取代;两者都缺省不可点击 */
openView?: OpenViewAction
/** 点击展开的详情弹层(数据驱动,宿主统一渲染) */
detail?: StatusDetail
}
/** 输入区工具行按钮 */
export interface ToolbarButtonDef {
id: string
title: string
/** svg 字符串(16-20px 线条风格,宿主按 currentColor 渲染) */
icon?: string
/** 点击行为:深链;缺省不可点击 */
openView?: OpenViewAction
}