UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.14 kB
import{r as truncateUtf16Safe}from"./utf16-slice-DA3Mllbx.mjs";import{c as redactSensitiveText}from"./redact-BT59pdZ_.mjs";import{a as workerSshCommandOptions,c as workerSshRemoteCommand,o as workerSshCommandPrefix}from"./ssh-CGUEkfXA.mjs"; //!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}))}export{runSshScript as i,isSuccess as n,matchesCommandFailure as r,commandFailure as t};