llama-cpp-K2-FAST2 / tools /ui /src /lib /utils /parse-exec-shell-error.ts
VladHong's picture
llama.cpp k2-fast2: MBZUAI model/K2Horizon + FAST2 sliding-window override
c59fd93 verified
Raw History Blame Contribute Delete
525 Bytes
export function parseExecShellCommandError(
toolResultString: string | undefined
): string | undefined {
if (!toolResultString) return undefined;
try {
const parsed: unknown = JSON.parse(toolResultString);
if (
parsed &&
typeof parsed === 'object' &&
!Array.isArray(parsed) &&
typeof (parsed as Record<string, unknown>).error === 'string'
) {
return (parsed as { error: string }).error;
}
} catch {
// Plain-text result = stdout/stderr, no structured error to surface.
}
return undefined;
}