





















@@ -1,10 +1,7 @@
11import { randomUUID } from "node:crypto";
22import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
33import type { OpenClawConfig } from "../config/types.openclaw.js";
4-import { resolveGatewayClientBootstrap } from "../gateway/client-bootstrap.js";
5-import { GatewayClient, GatewayClientRequestError } from "../gateway/client.js";
6-import { APPROVALS_SCOPE, READ_SCOPE, WRITE_SCOPE } from "../gateway/method-scopes.js";
7-import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../gateway/protocol/client-info.js";
4+import type { GatewayClient } from "../gateway/client.js";
85import type { EventFrame } from "../gateway/protocol/index.js";
96import { extractFirstTextBlock } from "../shared/chat-message-content.js";
107import {
@@ -88,6 +85,17 @@ export class OpenClawChannelBridge {
8885return;
8986}
9087this.started = true;
88+const [
89+{ resolveGatewayClientBootstrap },
90+{ GatewayClient: GatewayClientCtor },
91+{ APPROVALS_SCOPE, READ_SCOPE, WRITE_SCOPE },
92+{ GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES },
93+] = await Promise.all([
94+import("../gateway/client-bootstrap.js"),
95+import("../gateway/client.js"),
96+import("../gateway/method-scopes.js"),
97+import("../gateway/protocol/client-info.js"),
98+]);
9199const bootstrap = await resolveGatewayClientBootstrap({
92100config: this.cfg,
93101gatewayUrl: this.params.gatewayUrl,
@@ -102,7 +110,7 @@ export class OpenClawChannelBridge {
102110return;
103111}
104112105-this.gateway = new GatewayClient({
113+this.gateway = new GatewayClientCtor({
106114url: bootstrap.url,
107115token: bootstrap.auth.token,
108116password: bootstrap.auth.password,
@@ -525,7 +533,11 @@ export class OpenClawChannelBridge {
525533}
526534527535export function shouldRetryInitialMcpGatewayConnect(error: Error): boolean {
528-if (error instanceof GatewayClientRequestError) {
536+if (
537+error.name === "GatewayClientRequestError" &&
538+"retryable" in error &&
539+typeof error.retryable === "boolean"
540+) {
529541return error.retryable;
530542}
531543const message = error.message.toLowerCase();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。