char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
0afb805b1
char/aliceai-t5-moe
1export function parseExecShellCommandError ( 2toolResultString :string | undefined 3) :string | undefined { 4if ( ! toolResultString ) return undefined ; 5 6// Exec results are usually large plain-text stdout; only a JSON object 7// root can carry an error field, so skip the parse otherwise 8const trimmed = toolResultString . trimStart (); 9 10if ( trimmed [ 0 ] !== '{' ) return undefined ; 11 12try { 13const parsed :unknown = JSON . parse ( trimmed ); 14 15if ( 16parsed && 17typeof parsed === 'object' && 18! Array . isArray ( parsed ) && 19typeof ( parsed as Record < string , unknown >). error === 'string' 20) { 21return ( parsed as { error :string }). error ; 22} 23} catch { 24// Plain-text result = stdout/stderr, no structured error to surface. 25} 26 27return undefined ; 28}