22import { spawn , type ChildProcess } from "node:child_process" ;
33import { createHash , randomBytes , randomUUID , timingSafeEqual } from "node:crypto" ;
44import type { EventEmitter } from "node:events" ;
5- import {
6- createServer ,
7- type IncomingMessage ,
8- type Server ,
9- type ServerResponse ,
10- } from "node:http" ;
5+ import { createServer , type IncomingMessage , type Server , type ServerResponse } from "node:http" ;
116import type { Socket } from "node:net" ;
12- import {
13- keepHttpServerTaskAlive ,
14- waitUntilAbort ,
15- } from "openclaw/plugin-sdk/channel-outbound" ;
167import type { ChannelGatewayContext } from "openclaw/plugin-sdk/channel-contract" ;
8+ import { keepHttpServerTaskAlive , waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound" ;
179import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue" ;
18- import {
19- createClaimableDedupe ,
20- type ClaimableDedupe ,
21- } from "openclaw/plugin-sdk/persistent-dedupe" ;
10+ import { createClaimableDedupe , type ClaimableDedupe } from "openclaw/plugin-sdk/persistent-dedupe" ;
2211import { RAFT_CHANNEL_ID , type ResolvedRaftAccount } from "./accounts.js" ;
2312import { dispatchRaftWake } from "./inbound.js" ;
2413
@@ -54,11 +43,7 @@ type RaftBridgeProcess = Pick<ChildProcess, "kill"> & Pick<EventEmitter, "once">
5443
5544type RaftGatewayDeps = {
5645 createToken ?: ( ) => string ;
57- spawnBridge ?: ( params : {
58- profile : string ;
59- endpoint : string ;
60- token : string ;
61- } ) => RaftBridgeProcess ;
46+ spawnBridge ?: ( params : { profile : string ; endpoint : string ; token : string } ) => RaftBridgeProcess ;
6247 wakeDedupe ?: ClaimableDedupe ;
6348} ;
6449
@@ -80,6 +65,8 @@ function spawnRaftBridge(params: {
8065 endpoint : string ;
8166 token : string ;
8267} ) : RaftBridgeProcess {
68+ // Raft owns the fixed bridge command. OpenClaw passes profile/loopback
69+ // endpoint/token as separate argv/env fields; wake payloads never reach argv.
8370 return spawn (
8471 "raft" ,
8572 [
@@ -247,7 +234,7 @@ export async function startRaftGatewayAccount(
247234 onDiskError : ( error ) => {
248235 ctx . log ?. warn ?.( `Raft wake dedupe storage failed: ${ String ( error ) } ` ) ;
249236 } ,
250- } ) ;
237+ } ) ;
251238 const token = ( deps . createToken ?? createToken ) ( ) ;
252239 const runtimeSession = randomUUID ( ) ;
253240 const sockets = new Set < Socket > ( ) ;
0 commit comments