Documentation
¶
Overview ¶
Package taskplan 提供 task_plan 工具:模型提交任务规划后中断等待 用户处置——执行 / 拒绝 / 按修改意见调整后重新提交。 实现与 approve 同构:OnToolStart 阻塞在 Decisions channel 上, 处置意见作为工具结果进入消息历史,由模型据此继续或修订。 task_plan 工具由 hook 在 OnStart 自动注册,core.WithHooks(New()) 即可, 无需再 core.WithTools(Tool())。
tools.go 定义 task_plan 壳工具:schema 是唯一实体(planArgs tag 反射生成), 真正的"执行体"是 Hook.OnToolStart 拦截后等用户处置,Invoke 不会被走到。
Index ¶
Constants ¶
View Source
const EventRequest = event.EventType("taskplan.request")
EventRequest 是规划提交事件,Data 为 *types.ToolCall(Args.plan 为规划全文)。
View Source
const ToolName = "task_plan"
ToolName 是规划提交工具的注册名。
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decision ¶
type Decision struct {
CallID string
Kind Kind
// Input:Revise 时为修改意见;Reject 时可选理由;Execute 时可选补充说明。
Input string
}
Decision 是对一次规划提交的回应。CallID 留空视为回应当前请求。
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
func New ¶
New 创建 hook 并返回决策 channel 的发送端。 task_plan 工具由 hook 在 OnStart 自动注册,无需再 core.WithTools(Tool())。 决策必须从其他 goroutine 发送,理由同 approve.New。
Click to show internal directories.
Click to hide internal directories.