Documentation
¶
Overview ¶
Package offload 是 ToolEndHook:超大工具结果卸载到文件系统, 上下文里只保留头部摘要与文件路径,防止大输出(日志、转储、目录遍历) 撑爆上下文。写入失败时降级透传原文,绝不阻断工具执行。 结果后处理不耦合工具节点本身,故为 hook 而非 warp。
配置 ReplayTool(如 read_file)后,摘要尾部提示模型用该工具回放 卸载文件全文,且该工具自身的结果免卸载——回放的意义就是把全文 带回上下文,再卸载即死循环。
Index ¶
Constants ¶
View Source
const DefaultThreshold = 4096
DefaultThreshold 超过此字节数的结果触发卸载。
Variables ¶
This section is empty.
Functions ¶
func WithReplayTool ¶ added in v1.3.2
WithReplayTool 指定回放工具名(如 read_file),摘要尾部提示模型用它回放全文。
Types ¶
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
type Options ¶
type Options struct {
// Threshold 触发阈值,默认 4096 字节。
Threshold int
// Dir 卸载目标目录(FS 内路径),默认 ".ezloop/offload"。
Dir string
// Head 保留在消息里的原文头部长度,默认 512。
Head int
// Skip 免卸载名单:这些工具的结果原样保留(如分身最终答案——
// 截断成摘要会伤主循环决策)。
Skip []string
// ReplayTool 回放工具名(如 read_file):摘要尾部提示模型用它读回
// 卸载文件全文,该工具的结果自动免卸载。空串(默认)不提示。
ReplayTool string
}
Click to show internal directories.
Click to hide internal directories.