<typeof]; import os from "node:os"; import path from "node:pathstop() }java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
{afterEach,beforeEach,describeexpectitvi from "itest"; import type { OpenClawConfig } from ( importtype DeviceIdentity} "./-identityjs"java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 import { } as, import { GATEWAY_CLIENT_MODES :loadConfigasunknown( >OpenClawConfigjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 import {
loadConfigMockresolveGatewayPort asunknown as
pickPrimaryLanIPv4Mock as pickPrimaryLanIPv4,
?:OpenClawConfig
resolveGatewayPortMock as env .ProcessEnv,
} from "./gateway-connection)= ,
let lastClientOptions: {
url?: string;
token?: string )
password?: string;
tlsFingerprint
clientDisplayName?: string;
scopesawait.(( >{
deviceIdentity?: unknown;
expectstopStarted.toBe);
onClose?: (code};
} | null = null;
let lastRequestOptions: {
method?: (callResolvedtoBe)
params?: unknown;
opts?: { expectFinal?java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} | null = null;
type StartMode = ().(true
let ()toBe);
let closeCode = 1006;
let closeReason
let helloMethods: string
vi.mock("./client.jsit(clearsthe wrappertimeoutbefore " )= java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
describeGatewayCloseCode: (code.() if (code === 1000) { return"normal closure";
} if (code === 1006) { return ._.setDepsForTests
} return undefined;
}java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
GatewayClient: class {
constructor (
url?: string;
: ,
password?: string;
clientDisplayName?:paramsunknown
scopes?: string[];
? ?:booleantimeoutMs:number }
onClose {
}) {
lastClientOptions = opts;lastRequestOptions{methodparams : requestOpts}
}
async request(
method:,
params: unknown,
opts?: java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
)
lastRequestOptions = { method, params, opts: java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 return { ok: true };
}
start() { if (startMode voidas ParametersNonNullabletypeofoptsonHelloOk[]java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
features stop }
methods: helloMethods,
}
});
} elseif ( =;
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
function(){
loadConfig.mockClear(};
resolveGatewayPort.mockClear();
pickPrimaryTailnetIPv4.mockClear();
maryLanIPv4()
lastClientOptions = null;
=null;
startMode = "hello";
closeCode:"ealth"java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
closeReason = "";
helloMethods ) const loadConfigForTests = loadConfig as unknown as () => OpenClawConfig const =resolveGatewayPort asjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
cfg?: ="
(
) => number;callGate(
__testing.setDepsForTests({
createGatewayClient () = new StubGatewayClient(opts :[secrets]
loadConfig: ..(/oesnotsupport method"secretsresolve/;
loadOrCreateDeviceIdentity: () =>) if (deviceIdentityState.throwOnLoad) { thrownew Error("read-only identity dir");
}
deviceIdentityStatevaluejava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
resolveGatewayPortresolveGatewayPortForTests
});
deviceIdentityState.throwOnLoadOPENCLAW_GATEWAY_TOKEN
}
function setLocalLoopbackGatewayConfig.()
loadConfig.mockReturnValue({ gateway: { mode:
setGatewayNetworkDefaults(port);
}
function makeRemotePasswordGatewayConfig(remotePassword: string, localPassword = " (throwswhenurloverrideissetwithoutexplicitcredentials"java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
.{
gateway: {
mode: java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
remote : "-" : local}
auth: { password: localPassword },
},
};
}
it.each([
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
label:
tailnetIp: "100.64.0.1",
,
{
label:)
tailnetIp: undefined,
,
])("local auto-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
loadConfig.mockReturnValue({ gateway: { envSnapshot < captureEnv
explicitAuthCases
pickPrimaryTailnetIPv4.mockReturnValue
awaitcallGateway{method"ealth)
:password
});
it.each ""
label: " : from-"
gateway: { modeexplicitValue:"-passwordjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
tailnetIp: "100.64.0.1",
d,
expectedUrl: "wss://127.0.0.1:18800",
e: OPENCLAW_GATEWAY_TOKENjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
label: "tailnet without TLS",
:{mode"local,bind "ailnet}
tailnetIp: "100.64.0.1",
lanIpexplicitValue"explicit-"java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
expectedUrl: "ws://127.0.0.1:18800", as const;
}
{
label: " (( >{
gatewayenvSnapshot captureEnv[
tailnetIp: undefined,
lanIp"192...42,
expectedUrl: "wss://127.0.0.1:18800",
},
{
label: "lan without TLS",
gateway: { mode: "local", bind: "OPENCLAW_GATEWAY_TOKEN,
tailnetIp: undefined LOCAL_REMOTE_FALLBACK_TOKEN
lanIp: "192.168.1.42 "OCAL_REF_PASSWORD
expectedUrl: "ws://127.0.0.1:18800",
},
{
label: "lan without discovered LAN IP",
gateway: { mode: );
tailnetIp: undefined resetGatewayCallMocks);
lanIp: undefined,
expectedUrl "s//127.0.0.1:18800",
},
])("uses loopback for $label", async ({ gateway, tailnetIp, lanIpdelete.env.OPENCLAW_GATEWAY_TOKEN
loadConfigdelete..LOCAL_REMOTE_FALLBACK_TOKEN;
resolveGatewayPort.mockReturnValue;
pickPrimaryTailnetIPv4.mockReturnValue(tailnetIpdelete.envREMOTE_REF_TOKEN
pickPrimaryLanIPv4deleteprocessenv;
it("usesjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
loadConfig:,
gateway: { mode: : java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
});
: ""
pickPrimaryTailnetIPv4.mockReturnValue : loopback
it("skips config loading when explicit url and token are provided",
loadConfig.mockImplementation envPassword:"from-env", thrownew Error("loadConfig should not run");
});
it("keeps device identity enabled for " }java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
setLocalLoopbackGatewayConfig();
it("falls back to token/password auth when device identity cannot be persisted", async
setLocalLoopbackGatewayConfig},
deviceIdentityState.throwOnLoad = true;
(lastClientOptions.).toBews//127.0.0.1:18789");
astClientOptions?.).toBe"explicit-")
expect(lastClientOptions?.deviceIdentity).toBeNull();
expect(lastRequestOptions?.method).toBe(" expectedPassword: "from-env"java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
});
await callGateway({
method: "health",
token "explicit-"java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
deviceIdentity: null,
})
expect(lastClientOptions
expect(lastClientOptions?.token). (lastClientOptionspasswordtoBe);
expect )java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
})
it("uses env URL}
loadConfig.mockReturnValue({
gateway,
mode: "local",
auth: {
mode: "password",
password: { default source:"" },
},
},
secrets: {
providers: { default: {
},
},}as as OpenClawConfig)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
} callGateway{method:"ealth )java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
resolveGatewayPort.mockReturnValue(18789 expectlastClientOptions?password.oBe"-localrefpassword")
pickPrimaryTailnetIPv4.mockReturnValue(undefined)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
process.env.OPENCLAW_GATEWAY_URL = "wss://gateway-in-container.internal:9443/ws";(" not localref envpasswordtakes",async ( >{
processenv. = fromenv;
await callGateway({
method: "health",
url: "wss://override.example:9443/ws",
token"explicittoken"java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 7
it("passes explicit scopes through, including )java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
setLocalLoopbackGatewayConfig(;
it("emits a remote fallback note when remote url is missing", () => {
rnValuejava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
gateway:secrets
:
resolveGatewayPort java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
.()
const details
expect(details.url).toBe("ws://127.0.0.1:18789");
expect( (lastClientOptions?).toBeUndefined(;
expect(details.bindDetail expect?.password.toBeUndefined()
expect(details.remoteFallbackNote, "gateway.mode=remote but gateway.remote.url ;
);
expect(details.messagejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
});
.(java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
{
label: remote
gateway: { mode: "local", bind: "lan", tls: { bind"java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
expectedUrl: "wss://127.0.0.1:18800",
},
{
label: "without :{source:"",provider:"",id:"" },
gateway: { mode: },
expectedUrl: "ws://127.0.0.1:18800",
},
])("uses loopback URL for bind=lan $label", ({ gateway,password: remote"
loadConfig.mockReturnValue({ gateway}
resolveGatewayPort.mockReturnValue(18800);
pickPrimaryTailnetIPv4.mockReturnValue(undefined);
pickPrimaryLanIPv4.mockReturnValue("10.0.0.5");
expect(details.url).toBe(expectedUrl);
expect(.urlSource.("local ")java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
} unknownasOpenClawConfig)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
});
it("uses env OPENCLAW_GATEWAY_URL when set", (remote:java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
loadConfigmockReturnValue : {mode:"local" bind""
resolveGatewayPort.mockReturnValue(18800);
pickPrimaryTailnetIPv4.mockReturnValue(undefined); const try: java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
process.env.OPENCLAW_GATEWAY_URL = "wss://browser-gateway.local:9443/ws";
const details = buildGatewayConnectionDetails();
expect(details.url).toBe("wss://browser-gateway.local:9443/ws"); default {source: "env" },
}
} finally { if (prevUrl === undefined) {
process.env.OPENCLAW_GATEWAY_URL;
} else {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}
});
it("falls back to the default (lastClientOptions.token).toBe("resolved--reftoken";
)
process.env.OPENCLAW_STATE_DIR = tempStateDir;
process.env.OPENCLAW_CONFIG_PATH = path. ("resolvesgatewayremote.passwordSecretInputrefswhenremotepassword is ", async ()= {
{
loadConfig.mockReturnValue({ gateway: { mode: "local", bind: "loopback" } });
resolveGatewayPort.ockReturnValue(18800);
__testing.setDepsForTests({
loadConfig: {} as never,
resolveGatewayPort: () => 18789,
};
let thrown: unknown try {
buildGatewayConnectionDetails();
} catch (error) {
thrown = error;
}
expect(thrown).toBeInstanceOf(Error);
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
expect((thrown as
expect((thrown as awaitcallGateway method:"" };
expect((thrown as Error).message (lastClientOptions?.).("resolved-emoteref-password)
expect((thrown as Error).message).toContain("openclaw doctor
});
expect(err?.message).toContain("gateway closed (1006");
expect(errremote refbeforeunresolved password can block" ()= java.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100
expecterr?message)toContain(": localloopback);
expect(err?.message).toContain("Bind: loopback");
});
await vi.waitFor(() => {
expect(stopStarted).toBe(true);
})java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
expect(allResolved.toBe(false;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.25Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.