Discover Packages
github.com/Xsxdot/handoff
internal
executor
rawtap
package
Version:
v0.3.0
Opens a new window with list of versions in this module.
Published: Aug 19, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0 modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package rawtap 提供上游原始字节的旁路归档。
职责:
在 adapter 解析上游消息**之前**,把原始字节按行旁写到一个文件
由环境变量 HANDOFF_RAW_TAP_DIR 门控,缺省完全关闭(Open 返回 nil)
边界:
不解析、不过滤、不判断内容:拿到什么写什么,样本的价值就在于未经加工
不参与任何回合判定:Write 的返回值是 void,adapter 无从依赖它
不做轮转与容量上限:这是诊断开关,开着跑一次探针就关,不是常驻设施
为什么需要它:grok 与 codex 的上游是进程内 WebSocket、opencode 的 SSE 端口
由 adapter 随机选,三者都无法从进程外 tee。没有旁路就没有原始样本,
而没有原始样本的现场无法从任何一个 clone 复核——B74 的原始现场(2026-08-12)
正是因此永久丢失。
EnvDir 是开启旁路的环境变量名。值为一个目录路径;空或未设置即完全关闭。
Tap 是一个任务的原始字节旁路句柄。
全部方法对 nil 接收者安全:关闭状态下 Open 返回 nil,调用点因此不需要写
任何 if——这是「诊断开关绝不能污染主路径」的落地方式。
Open 按环境变量决定是否为某任务开启旁路。
参数:
executor: 执行者名(opencode/claudecode/grok/codex),作文件名前缀
taskID: 任务 ID,作文件名后缀
log: 用于报告开启与降级
返回:开启则返回句柄;未开启或开启失败返回 nil(调用方无需区分)
注意:开启失败不是错误——诊断开关拖垮执行是本末倒置,一律降级为关闭并告警。
Write 旁写一条上游原始消息,一次调用一行。
注意:
内嵌换行会被转义成 \n。上游消息(尤其是被截断的超长工具调用)内部可能
带裸换行,不转义的话一条消息在样本里会裂成多条,回放时与真实分帧对不上
写失败只记一次日志后静默:旁路是观测,观测失败不能影响被观测的东西
Source Files
¶
Click to show internal directories.
Click to hide internal directories.