UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

35 lines (34 loc) • 1.31 kB
import { r as truncateUtf16Safe } from "./utf16-slice-CuDyEXgS.mjs"; import { s as redactSensitiveText } from "./redact-Mj7pppxC.mjs"; import { a as workerSshCommandOptions, c as workerSshRemoteCommand, o as workerSshCommandPrefix } from "./ssh-D2p4Rgme.mjs"; //#region src/gateway/worker-environments/bootstrap-command.ts function commandFailure(e, t) { const n = truncateUtf16Safe(redactSensitiveText(t.stderr.trim() || t.stdout.trim(), { mode: "tools" }).replace(/\s+/gu, " "), 512); const r = t.termination === "exit" ? `exit ${t.code ?? "unknown"}` : t.termination; return /* @__PURE__ */ new Error(`Worker bootstrap ${e} failed (${r})${n ? `: ${n}` : ""}`); } function isSuccess(e) { return e.termination === "exit" && e.code === 0; } function matchesCommandFailure(e, t, n) { return e.code === t || e.stderr.includes(n) || e.stdout.includes(n); } async function runSshScript(e) { return await e.runCommand([ ...workerSshCommandPrefix(e.prepared, e.port ?? e.prepared.port), "--", e.prepared.sshTarget, workerSshRemoteCommand([ "sh", "-s", "--", ...e.scriptArgs ]) ], workerSshCommandOptions({ input: e.script, timeoutMs: e.timeoutMs, signal: e.signal })); } //#endregion export { runSshScript as i, isSuccess as n, matchesCommandFailure as r, commandFailure as t };