mirror of
https://github.com/grp06/openclaw-studio.git
synced 2026-08-14 08:52:03 +00:00
tiny chnanges
This commit is contained in:
@@ -16,8 +16,8 @@ const REQUEST_TIMEOUT_MS = 15_000;
|
||||
const INITIAL_RECONNECT_DELAY_MS = 1_000;
|
||||
const MAX_RECONNECT_DELAY_MS = 15_000;
|
||||
const CONNECT_PROTOCOL = 3;
|
||||
const CONNECT_CLIENT_ID = "openclaw-control-ui";
|
||||
const CONNECT_CLIENT_MODE = "webchat";
|
||||
const CONNECT_CLIENT_ID = "gateway-client";
|
||||
const CONNECT_CLIENT_MODE = "backend";
|
||||
const CONNECT_CAPABILITIES = ["tool-events"];
|
||||
|
||||
const DEFAULT_METHOD_ALLOWLIST = new Set<string>([
|
||||
@@ -328,7 +328,7 @@ export class OpenClawGatewayAdapter {
|
||||
client: {
|
||||
id: CONNECT_CLIENT_ID,
|
||||
version: "dev",
|
||||
platform: "web",
|
||||
platform: "node",
|
||||
mode: CONNECT_CLIENT_MODE,
|
||||
},
|
||||
role: "operator",
|
||||
|
||||
@@ -38,6 +38,7 @@ describe("OpenClawGatewayAdapter", () => {
|
||||
const upstreamUrl = `ws://127.0.0.1:${address.port}`;
|
||||
let observedConnectClientId: string | null = null;
|
||||
let observedConnectClientMode: string | null = null;
|
||||
let observedConnectClientPlatform: string | null = null;
|
||||
let observedConnectCaps: string[] | null = null;
|
||||
|
||||
upstream.on("connection", (ws) => {
|
||||
@@ -47,13 +48,14 @@ describe("OpenClawGatewayAdapter", () => {
|
||||
id?: string;
|
||||
method?: string;
|
||||
params?: {
|
||||
client?: { id?: string; mode?: string };
|
||||
client?: { id?: string; mode?: string; platform?: string };
|
||||
caps?: string[];
|
||||
};
|
||||
};
|
||||
if (parsed?.method === "connect") {
|
||||
observedConnectClientId = parsed.params?.client?.id ?? null;
|
||||
observedConnectClientMode = parsed.params?.client?.mode ?? null;
|
||||
observedConnectClientPlatform = parsed.params?.client?.platform ?? null;
|
||||
observedConnectCaps = Array.isArray(parsed.params?.caps) ? parsed.params.caps : null;
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
@@ -81,8 +83,9 @@ describe("OpenClawGatewayAdapter", () => {
|
||||
"Control-plane gateway connection closed."
|
||||
);
|
||||
expect(Date.now() - startedAt).toBeLessThan(2_000);
|
||||
expect(observedConnectClientId).toBe("openclaw-control-ui");
|
||||
expect(observedConnectClientMode).toBe("webchat");
|
||||
expect(observedConnectClientId).toBe("gateway-client");
|
||||
expect(observedConnectClientMode).toBe("backend");
|
||||
expect(observedConnectClientPlatform).toBe("node");
|
||||
expect(observedConnectCaps).toEqual(expect.arrayContaining(["tool-events"]));
|
||||
|
||||
await adapter.stop();
|
||||
|
||||
Reference in New Issue
Block a user