UNPKG

@gguf/claw

Version:

WhatsApp gateway CLI (Baileys web) with Pi RPC agent

28 lines (26 loc) 1.17 kB
import { n as callGateway } from "./call-90HgQQ8o.js"; import { h as GATEWAY_CLIENT_NAMES, m as GATEWAY_CLIENT_MODES } from "./message-channel-BlgPSDAh.js"; import { n as withProgress } from "./progress-Da1ehW-x.js"; //#region src/cli/gateway-rpc.ts function addGatewayClientOptions(cmd) { return cmd.option("--url <url>", "Gateway WebSocket URL (defaults to gateway.remote.url when configured)").option("--token <token>", "Gateway token (if required)").option("--timeout <ms>", "Timeout in ms", "30000").option("--expect-final", "Wait for final response (agent)", false); } async function callGatewayFromCli(method, opts, params, extra) { const showProgress = extra?.progress ?? opts.json !== true; return await withProgress({ label: `Gateway ${method}`, indeterminate: true, enabled: showProgress }, async () => await callGateway({ url: opts.url, token: opts.token, method, params, expectFinal: extra?.expectFinal ?? Boolean(opts.expectFinal), timeoutMs: Number(opts.timeout ?? 1e4), clientName: GATEWAY_CLIENT_NAMES.CLI, mode: GATEWAY_CLIENT_MODES.CLI })); } //#endregion export { callGatewayFromCli as n, addGatewayClientOptions as t };