Files
Agent-System-Core/hitl.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

46 lines
1.6 KiB
Go

package core
import "encoding/json"
// HITL 卡片协议(4.5):choice | input | confirm | form 四种;
// 发起方必须给 Choices 提供 description 与 impact——用户在决策点需要上下文。
type HITLCard struct {
ID ID `json:"id"`
RunID ID `json:"runId"`
ConversationID ID `json:"conversationId"`
Question string `json:"question"`
Kind HITLKind `json:"kind"`
Choices []HITLChoice `json:"choices,omitempty"`
AllowFreeInput bool `json:"allowFreeInput"`
FreeInputHint string `json:"freeInputHint,omitempty"`
TimeoutSec *int `json:"timeoutSec,omitempty"`
Form []UINode `json:"form,omitempty"` // form kind 的字段(UI 词汇)
CreatedAt string `json:"createdAt"`
Resolved bool `json:"resolved"`
}
type HITLKind string
const (
HITLKindChoice HITLKind = "choice"
HITLKindInput HITLKind = "input"
HITLKindConfirm HITLKind = "confirm"
HITLKindForm HITLKind = "form"
)
type HITLChoice struct {
ID string `json:"id"`
Label string `json:"label"`
Description string `json:"description"`
Impact string `json:"impact"` // 该选择可能造成的影响(必填)
Recommended bool `json:"recommended,omitempty"`
}
// HITLResponse 是用户对卡片的响应;自由输入时 ChoiceID 为空。
type HITLResponse struct {
CardID ID `json:"cardId"`
ChoiceID string `json:"choiceId,omitempty"`
FreeText string `json:"freeText,omitempty"`
FormData json.RawMessage `json:"formData,omitempty"`
}