OpenClaw 中继
在以下任务中使用此技能:
- "与 Molty 对话"
- "将此内容中继到 OpenClaw 频道会话中"
- "使用 acpx"
- "通过 acp 网关发送"
- "通过 SSH 远程 OpenClaw 桥接器工作"
一个技能,两种传输方式:
local(本地)ssh
默认使用 local,用于从当前 OpenClaw 检出版本直接进行传话式工作。当目标代理/会话位于另一台机器上时,使用 ssh。
对于 Peter 的设置,Molty 通常位于 Mac Studio 网关上,可通过 [email protected] 访问;避免使用 mac-studio SSH 别名进行一次性中继工作,因为该别名会自动附加 tmux。
脚本路径:scripts/openclaw_relay.py
目标别名文件:config/session_aliases.json
模式选择
当以下情况时选择 local:
- 用户明确指定
acpx - 目标会话位于当前机器上
- 目标是快速中继或私人询问
当以下情况时选择 ssh:
- 目标代理/会话位于另一台主机上
- 你想要一个持久的桥接会话
- 你需要在远程机器上异步执行队列/等待/显示流程
默认值
该脚本避免硬编码个人路径。必要时可通过环境变量或标志覆盖。
- 传输方式:
local - 本地仓库当前工作目录:当前工作目录
- 本地 acpx 仓库:
<cwd>/extensions/acpx - SSH 主机:
[email protected] - 远程仓库当前工作目录:
<remote-home>/clawdbot - 远程 acpx 仓库:
<remote-home>/Projects/oss/acpx - 网关令牌文件:
<home>/.openclaw/gateway.token - 控制会话名称:
codex-bridge - 目标别名文件:
config/session_aliases.json
有用的环境变量:
OPENCLAW_RELAY_TRANSPORTOPENCLAW_RELAY_HOSTOPENCLAW_RELAY_CWDOPENCLAW_RELAY_ACPX_REPOOPENCLAW_RELAY_GATEWAY_URLOPENCLAW_RELAY_GATEWAY_TOKEN_FILEOPENCLAW_RELAY_SESSIONOPENCLAW_RELAY_TARGETS_FILE
快速开始
健康检查:
python3 scripts/openclaw_relay.py doctor
列出已知目标别名:
python3 scripts/openclaw_relay.py targets
解析目标别名:
python3 scripts/openclaw_relay.py resolve --target maintainers
向目标会话私下提问:
python3 scripts/openclaw_relay.py ask \
--target maintainers \
--message "总结一下该频道当前的氛围。"
强制将文本发送到已解析的目标:
python3 scripts/openclaw_relay.py force-send \
--target maintainers \
--text "部署已完成。"
对于多行帖子,使用 --text-file <path> 或 --text-file - 而不是对消息进行 shell 转义。
当用户明确要求频道帖子时强制发送媒体:
python3 scripts/openclaw_relay.py force-send \
--transport ssh \
--host [email protected] \
--target maintainers \
--text "演示视频。" \
--media /tmp/demo.mp4
使用持久控制会话:
python3 scripts/openclaw_relay.py ensure
python3 scripts/openclaw_relay.py send --message "请回复完全相同的 OK。"
python3 scripts/openclaw_relay.py show
远程主机示例:
python3 scripts/openclaw_relay.py doctor --transport ssh --host [email protected]
python3 scripts/openclaw_relay.py send \
--transport ssh \
--host [email protected] \
--message "请回复完全相同的 OK。"
异步工作流
将工作排入队列并在同一个控制会话中轮询:
python3 scripts/openclaw_relay.py start --message "处理任务 X,完成后回复。"
python3 scripts/openclaw_relay.py wait --after-seq <last-seq>
python3 scripts/openclaw_relay.py show
目标别名
config/session_aliases.json 附带了占位符。请将其替换为你的实际设置值。
示例结构:
{
"main": "agent:<agentId>:main",
"maintainers": "agent:<agentId>:discord:channel:<channelId>"
}
会话规则
在选择命令时使用以下规则:
- 想要特定会话的私人回复:使用
ask - 想要目标会话自行决定是否发布:使用
publish - 想要保证直接发布:使用
force-send - 想要与控制大脑进行阻塞式连续交互:使用
send - 想要即发即忘的异步操作:使用
start,然后wait和show - 想要停止已排入队列的工作:使用
cancel
失败处理
如果中继工作失败:
- 运行
doctor。 - 运行
status。 - 运行
show。 - 如果控制会话卡住,运行
cancel,然后ensure,再重试。
如果路由发现不确定:
- 首先解析目标。
- 优先使用别名或确切的会话键。
- 在发送实际负载之前,使用一个小的探测性询问。
输出中继
返回实际的助手文本或投递结果,而不是 shell 噪音。
对于中继任务,报告:
- 使用的传输方式
- 目标会话键
- 路由探测/解析是否成功
- 最终发布或返回的结果