Skip to content

Commit 4110d80

Browse files
committed
ws: satisfy exact optional property checks
1 parent 76b2d28 commit 4110d80

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

apps/server/src/wsServer.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const OPENCLAW_TEST_RPC_TIMEOUT_MS = 10_000;
112112

113113
function testOpenclawGateway(
114114
input: TestOpenclawGatewayInput,
115-
): Effect.Effect<TestOpenclawGatewayResult> {
115+
): Effect.Effect<TestOpenclawGatewayResult, unknown> {
116116
return Effect.gen(function* () {
117117
const overallStart = Date.now();
118118
const steps: TestOpenclawGatewayStep[] = [];
@@ -153,7 +153,10 @@ function testOpenclawGateway(
153153
if (msg.id === id) {
154154
clearTimeout(timeout);
155155
socket.off("message", handler);
156-
resolve({ result: msg.result, error: msg.error });
156+
const payload: { result?: unknown; error?: { code: number; message: string } } = {};
157+
if ("result" in msg) payload.result = msg.result;
158+
if (msg.error !== undefined) payload.error = msg.error;
159+
resolve(payload);
157160
}
158161
} catch {
159162
// Ignore non-JSON messages
@@ -316,7 +319,10 @@ function testOpenclawGateway(
316319
const result = (response.result ?? {}) as Record<string, unknown>;
317320
const sessionId = typeof result.sessionId === "string" ? result.sessionId : undefined;
318321
const version = typeof result.version === "string" ? result.version : undefined;
319-
serverInfo = { version, sessionId };
322+
serverInfo = {
323+
...(version !== undefined ? { version } : {}),
324+
...(sessionId !== undefined ? { sessionId } : {}),
325+
};
320326
pushStep(
321327
"Session create",
322328
"pass",

0 commit comments

Comments
 (0)