mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-23 15:11:42 +00:00
refactor: simplify nodes invoke option values
This commit is contained in:
@@ -36,16 +36,16 @@ export function registerNodesInvokeCommands(nodes: Command) {
|
||||
`command "${command}" is reserved for shell execution; use the exec tool with host=node instead`,
|
||||
);
|
||||
}
|
||||
const params = JSON.parse(String(opts.params ?? "{}")) as unknown;
|
||||
const params = JSON.parse(opts.params ?? "{}") as unknown;
|
||||
const timeoutMs = opts.invokeTimeout
|
||||
? Number.parseInt(String(opts.invokeTimeout), 10)
|
||||
? Number.parseInt(opts.invokeTimeout, 10)
|
||||
: undefined;
|
||||
|
||||
const invokeParams: Record<string, unknown> = {
|
||||
nodeId,
|
||||
command,
|
||||
params,
|
||||
idempotencyKey: String(opts.idempotencyKey ?? randomIdempotencyKey()),
|
||||
idempotencyKey: opts.idempotencyKey ?? randomIdempotencyKey(),
|
||||
};
|
||||
if (typeof timeoutMs === "number" && Number.isFinite(timeoutMs)) {
|
||||
invokeParams.timeoutMs = timeoutMs;
|
||||
|
||||
Reference in New Issue
Block a user