UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 1.14 kB
import{sanitizeForTerminal}from"#cli/ui/output.js";import"#setup/primitives/index.js";const NPM_NOISE_LINE=/^\s*npm (?:silly|verbose|http|timing)\b/u,INSTALL_OUTPUT_MAX_BYTES=16384;function createInstallDiagnostics(){let e=[],t=0,n=!1,r=!1;return{append(i){let a=sanitizeForTerminal(i).trimEnd();if(a.trim()===``)return;let o=NPM_NOISE_LINE.test(a);if(o&&n)return;!o&&!n&&(e.length=0,t=0,r=!1,n=!0);let s=Buffer.from(a);if(s.length>=INSTALL_OUTPUT_MAX_BYTES){let e=s.length-INSTALL_OUTPUT_MAX_BYTES+1;for(;(s[e]&192)==128;)e+=1;a=s.subarray(e).toString(`utf8`),r=!0}for(e.push(a),t+=Buffer.byteLength(a)+1;e.length>20||t>INSTALL_OUTPUT_MAX_BYTES;)t-=Buffer.byteLength(e.shift())+1,r=!0},result(){return{lines:e,truncated:r}}}}function packageManagerInstallFailureCode(e){return e.kind===`workspace-probe-failed`?`workspace_probe_failed`:e.kind===`workspace-probe-unrecognized`?`workspace_probe_unrecognized`:e.result.termination.kind===`spawn-error`?e.result.termination.code===`ENOENT`?`package_manager_not_found`:`package_manager_start_failed`:`dependency_installation`}export{createInstallDiagnostics,packageManagerInstallFailureCode};