openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.04 kB
JavaScript
import{h as normalizeExecutableToken}from"./shell-inline-command-Ba_Xy6r0.mjs";import{f as isShellWrapperExecutable,m as resolveShellWrapperTransportArgv,t as POSIX_PARSEABLE_SHELL_WRAPPERS}from"./shell-wrapper-resolution-NzL5LGuL.mjs";
//!src/infra/command-explainer/format.ts
function spanToCommandSpan(e){if(!Number.isSafeInteger(e.startIndex)||!Number.isSafeInteger(e.endIndex))return null;if(e.startIndex<0||e.endIndex<=e.startIndex)return null;return{startIndex:e.startIndex,endIndex:e.endIndex}}function isUnsupportedShellWrapperArgv(e){const t=(resolveShellWrapperTransportArgv([...e])??e)[0];if(!t)return false;const n=normalizeExecutableToken(t);return isShellWrapperExecutable(n)&&!POSIX_PARSEABLE_SHELL_WRAPPERS.has(n)}function formatCommandSpans(e){if(e.topLevelCommands.some(e=>isUnsupportedShellWrapperArgv(e.argv)))return[];const t=[];for(const n of[...e.topLevelCommands,...e.nestedCommands]){const e=spanToCommandSpan(n.executableSpan);if(e)t.push(e)}return t}export{isUnsupportedShellWrapperArgv as n,formatCommandSpans as t};