UNPKG

eve

Version:

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

1 lines 740 B
import{spawn}from"node:child_process";function clipboardSequence(e,t=process.env){let n=`\x1b]52;c;${Buffer.from(e).toString(`base64`)}\x07`;return t.TMUX!==void 0||t.STY!==void 0?`\x1bPtmux;\x1b${n}\x1b\\`:n}function clipboardCommand(e,t=process.env){if(e===`darwin`)return[`pbcopy`];if(e===`linux`)return t.WAYLAND_DISPLAY===void 0?[`xclip`,`-selection`,`clipboard`]:[`wl-copy`];if(e===`win32`)return[`clip`]}function copyTextToClipboard(e,t){t(clipboardSequence(e));let n=clipboardCommand(process.platform);if(n!==void 0)try{let t=spawn(n[0],n.slice(1),{stdio:[`pipe`,`ignore`,`ignore`],detached:!1});t.on(`error`,()=>{}),t.stdin?.on(`error`,()=>{}),t.stdin?.end(e)}catch{}}export{clipboardCommand,clipboardSequence,copyTextToClipboard};