mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-13 02:01:16 +00:00
30 lines
843 B
TypeScript
30 lines
843 B
TypeScript
import { callGateway } from "../../gateway/call.js";
|
|
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../../utils/message-channel.js";
|
|
import { withProgress } from "../progress.js";
|
|
import type { NodesRpcOpts } from "./types.js";
|
|
|
|
export async function callGatewayCliRuntime(
|
|
method: string,
|
|
opts: NodesRpcOpts,
|
|
params?: unknown,
|
|
callOpts?: { transportTimeoutMs?: number },
|
|
) {
|
|
return await withProgress(
|
|
{
|
|
label: `Nodes ${method}`,
|
|
indeterminate: true,
|
|
enabled: opts.json !== true,
|
|
},
|
|
async () =>
|
|
await callGateway({
|
|
url: opts.url,
|
|
token: opts.token,
|
|
method,
|
|
params,
|
|
timeoutMs: callOpts?.transportTimeoutMs ?? Number(opts.timeout ?? 10_000),
|
|
clientName: GATEWAY_CLIENT_NAMES.CLI,
|
|
mode: GATEWAY_CLIENT_MODES.CLI,
|
|
}),
|
|
);
|
|
}
|