Documentation
¶
Index ¶
- Constants
- func BuildCoordinator(cfg bootstrap.Config, store *store.Store, models *bootstrap.ModelSet, ...) (*agentcore.Agent, *tools.AskUserTool)
- type CoCreateMessage
- type CoCreateReply
- type OutlineSnapshot
- type Runtime
- func (rt *Runtime) AskUser() *tools.AskUserTool
- func (rt *Runtime) Close()
- func (rt *Runtime) CoCreateStream(ctx context.Context, history []CoCreateMessage, onReply func(string)) (CoCreateReply, error)
- func (rt *Runtime) ConfiguredModels(provider string) []string
- func (rt *Runtime) ConfiguredProviders() []string
- func (rt *Runtime) CurrentModelSelection(role string) (provider, model string, explicit bool)
- func (rt *Runtime) Dir() string
- func (rt *Runtime) Done() <-chan struct{}
- func (rt *Runtime) Events() <-chan UIEvent
- func (rt *Runtime) Resume() (string, error)
- func (rt *Runtime) Snapshot() UISnapshot
- func (rt *Runtime) Start(prompt string) error
- func (rt *Runtime) Steer(text string)
- func (rt *Runtime) Stream() <-chan string
- func (rt *Runtime) StreamClear() <-chan struct{}
- func (rt *Runtime) SwitchModel(role, provider, model string) error
- type UIEvent
- type UISnapshot
Constants ¶
const ThinkingSep = "\x02"
ThinkingSep 是思考文本与正文之间的分隔标记。 streamFilter 在思考文本段前插入此标记,TUI 据此切换渲染样式。
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CoCreateMessage ¶ added in v0.0.3
type CoCreateReply ¶ added in v0.0.3
type OutlineSnapshot ¶
OutlineSnapshot 是大纲条目的展示摘要。
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime 封装协调器生命周期,提供 TUI 所需的非阻塞接口。
func NewRuntime ¶
NewRuntime 创建 Runtime:初始化 store/model/coordinator,注册事件订阅,但不启动 Prompt。
func (*Runtime) AskUser ¶
func (rt *Runtime) AskUser() *tools.AskUserTool
AskUser 返回 ask_user 工具实例,供 TUI 注入交互 handler。
func (*Runtime) CoCreateStream ¶ added in v0.0.3
func (rt *Runtime) CoCreateStream(ctx context.Context, history []CoCreateMessage, onReply func(string)) (CoCreateReply, error)
CoCreateStream 使用多轮对话帮助用户澄清创作需求。 ctx 由调用方控制生命周期,取消时 LLM 请求立即终止。
func (*Runtime) ConfiguredModels ¶ added in v0.0.2
ConfiguredModels 返回某个 provider 下已配置的模型列表。
func (*Runtime) ConfiguredProviders ¶ added in v0.0.2
ConfiguredProviders 返回已配置的 provider 列表。
func (*Runtime) CurrentModelSelection ¶ added in v0.0.2
CurrentModelSelection 返回指定 role 当前生效的 provider/model。 role 为空或 "default" 时返回默认模型。
func (*Runtime) Steer ¶
Steer 提交用户干预。 如果 coordinator 正在运行,通过 Steer 注入消息。 如果 coordinator 已停止(出错),通过 Prompt 重启 agent 循环。
func (*Runtime) StreamClear ¶
func (rt *Runtime) StreamClear() <-chan struct{}
StreamClear 返回只读流式清空信号通道。
func (*Runtime) SwitchModel ¶ added in v0.0.2
SwitchModel 热切换默认模型或指定角色模型。 role 为空或 "default" 时更新默认模型;否则写入角色级会话覆盖。
type UIEvent ¶
type UIEvent struct {
Time time.Time
Category string // TOOL / SYSTEM / REVIEW / CHECK / ERROR / AGENT
Summary string
Level string // info / warn / error / success
}
UIEvent 是 TUI 消费的结构化事件。
type UISnapshot ¶
type UISnapshot struct {
Provider string
NovelName string
ModelName string
Style string
StatusLabel string // READY / RUNNING / REVIEW / REWRITE / COMPLETE / ERROR
Phase string
Flow string
CurrentChapter int
TotalChapters int
CompletedCount int
TotalWordCount int
InProgressChapter int
PendingRewrites []int
RewriteReason string
PendingSteer string
RecoveryLabel string // 恢复类型描述,空表示新建
IsRunning bool
// 基础设定
Premise string // 前提概要
Outline []OutlineSnapshot // 大纲(每章标题 + 核心事件)
Characters []string // 角色列表(名字 + 身份)
Layered bool // 是否分层模式(滚动规划)
CurrentVolumeArc string // 当前卷弧位置(如"第1卷·第1弧")
NextVolumeTitle string // 下一卷预览标题(如有)
CompassDirection string // 终局方向
CompassScale string // 预估规模
// 详情区
LastCommitSummary string
LastReviewSummary string
LastCheckpointName string
RecentSummaries []string
}
UISnapshot 是 TUI 渲染所需的聚合状态快照。