Files
Agent-System-Core/ui.go
T
weichen 9929d8f8ad Define the core contracts: domain model
Details (original message):
Define the core contracts: domain model, stream events, HITL, profiles, tools, plugins, UI vocabulary, ingest IR, retrieval and memory; golden-sample conformance tests; TS mirror.
2026-09-29 17:34:58 +00:00

55 lines
2.0 KiB
Go

package core
// UI schema 词汇(4.6 原则 3):设置界面、插件面板、HITL 表单、插件卡片共用
// 这套有限词汇,由前端通用渲染器渲染。插件不注入 React 组件;表达不了的高级
// 交互走 Core 契约扩展流程新增词汇,而不是开洞。
type UINodeType string
const (
UISection UINodeType = "section" // 标题 + 子节点
UIList UINodeType = "list" // 字符串列表
UIKV UINodeType = "kv" // 键值对列表
UIForm UINodeType = "form" // 字段表单(HITL form / 设置分区复用)
UIMarkdown UINodeType = "markdown"
UIDocRef UINodeType = "doc-ref" // 工件引用(右栏查看器打开)
UIActions UINodeType = "actions" // 可点动作(发命令/发消息)
UIChartLite UINodeType = "chart-lite"
)
type UINode struct {
Type UINodeType `json:"type"`
Title string `json:"title,omitempty"`
Items []string `json:"items,omitempty"` // list
KV [][2]string `json:"kv,omitempty"` // kv
Fields []UIField `json:"fields,omitempty"` // form
Markdown string `json:"markdown,omitempty"`
DocID ID `json:"docId,omitempty"` // doc-ref
Actions []UIAction `json:"actions,omitempty"`
Chart *UIChart `json:"chart,omitempty"`
Children []UINode `json:"children,omitempty"` // section
}
type UIField struct {
Key string `json:"key"`
Label string `json:"label"`
Type string `json:"type"` // text | textarea | number | boolean | select
Options []string `json:"options,omitempty"`
Required bool `json:"required,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Help string `json:"help,omitempty"`
Default string `json:"default,omitempty"`
}
type UIAction struct {
ID string `json:"id"`
Label string `json:"label"`
Style string `json:"style,omitempty"` // primary | default | danger
}
type UIChart struct {
Kind string `json:"kind"` // bar | line
Labels []string `json:"labels"`
Series []float64 `json:"series"`
}