@@ -2,23 +2,12 @@
|
2 | 2 | import { spawn, type ChildProcess } from "node:child_process"; |
3 | 3 | import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto"; |
4 | 4 | import 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"; |
11 | 6 | import type { Socket } from "node:net"; |
12 | | -import { |
13 | | -keepHttpServerTaskAlive, |
14 | | -waitUntilAbort, |
15 | | -} from "openclaw/plugin-sdk/channel-outbound"; |
16 | 7 | import type { ChannelGatewayContext } from "openclaw/plugin-sdk/channel-contract"; |
| 8 | +import { keepHttpServerTaskAlive, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound"; |
17 | 9 | import { 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"; |
22 | 11 | import { RAFT_CHANNEL_ID, type ResolvedRaftAccount } from "./accounts.js"; |
23 | 12 | import { dispatchRaftWake } from "./inbound.js"; |
24 | 13 | |
@@ -54,11 +43,7 @@ type RaftBridgeProcess = Pick<ChildProcess, "kill"> & Pick<EventEmitter, "once">
|
54 | 43 | |
55 | 44 | type RaftGatewayDeps = { |
56 | 45 | 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; |
62 | 47 | wakeDedupe?: ClaimableDedupe; |
63 | 48 | }; |
64 | 49 | |
@@ -80,6 +65,8 @@ function spawnRaftBridge(params: {
|
80 | 65 | endpoint: string; |
81 | 66 | token: string; |
82 | 67 | }): 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. |
83 | 70 | return spawn( |
84 | 71 | "raft", |
85 | 72 | [ |
@@ -247,7 +234,7 @@ export async function startRaftGatewayAccount(
|
247 | 234 | onDiskError: (error) => { |
248 | 235 | ctx.log?.warn?.(`Raft wake dedupe storage failed: ${String(error)}`); |
249 | 236 | }, |
250 | | -}); |
| 237 | + }); |
251 | 238 | const token = (deps.createToken ?? createToken)(); |
252 | 239 | const runtimeSession = randomUUID(); |
253 | 240 | const sockets = new Set<Socket>(); |
|