UNPKG

agent-device

Version:

Open source device layer for AI coding agents: a CLI, MCP server, and typed Node.js API to control mobile, web, TV, and desktop apps on devices and simulators, locally or in the cloud.

1 lines • 19.4 kB
import{r as e}from"./rolldown-runtime.js";import{B as t,C as n,v as r}from"./sdk-contracts.js";import{C as i,M as a,St as o,c as s,f as c,gt as l,j as u,l as d,m as f,p as ee,q as te,s as p,u as m}from"./sdk-io.js";import h from"node:crypto";import g from"node:fs";import _ from"node:os";import v from"node:path";function y(e){return e?.HOME?.trim()||_.homedir()}function b(e,t={}){return e===`~`?y(t.env):e.startsWith(`~/`)?x().join(y(t.env),e.slice(2)):e}function ne(e,t){let n=b(e,t),r=x();return r.isAbsolute(n)?n:r.resolve(t.cwd,n)}function x(){return process.platform===`win32`?v.win32:v.posix}function re(e){let t=e.AGENT_DEVICE_HOME?b(e.AGENT_DEVICE_HOME,{env:e}):v.join(b(`~`,{env:e}),`.agent-device`);if(!v.isAbsolute(t))throw new r(`INVALID_ARGS`,`AGENT_DEVICE_HOME must be absolute or ~/...`);return v.join(t,`config.json`)}function ie(e){let t=e.AGENT_DEVICE_CLAIMS_DIR?.trim();if(!t)return v.join(_.homedir(),`.agent-device`,`device-claims`);if(!v.isAbsolute(t))throw new r(`INVALID_ARGS`,`AGENT_DEVICE_CLAIMS_DIR must be an absolute path: ${t}`,{reason:`relative_claims_dir`});return v.resolve(t)}const ae={foreign_owned:`another local user owns that part of the path.`,world_writable:`any local user can write that part of the path.`,shared_group_writable:`the group can write that part of the path, and agent-device cannot tell who else belongs to that group.`,shared_parent:`another local user could create the script file there first.`,planted_link:`another local user could have put that symbolic link there, or could replace it.`,link_loop_exceeded:`that part of the path follows more symbolic links than the system allows, so where the script would land is not established.`,not_a_directory:`a directory was expected there, and something else stands in the way.`,entry_appeared:`a directory the script path needs was missing when the path was checked and appeared before this save could create it.`,unnamed_entry:"the script path has to end in one file name of at most 255 bytes, not `.`, `..`, `~`, a root, or nothing at all, and it cannot hold a NUL.",relative_destination:`the script path has to be absolute, so the directories it names are the ones that get checked.`,unresolvable_parent:"the script path names a directory that does not exist and steps back out of it with `..`, so where the script would land is not established.",unreachable_parent:`the directory the script path names does not exist, so the script has nowhere to be written.`,parent_replaced:`that directory was replaced while the script was staged, so the script may not be created in what stands there now.`},S=[`script_ancestor_untrusted`,`script_ancestry_replaced`];function oe(e){if(!(e instanceof r))return;let t=e.details?.reason;return typeof t==`string`&&S.includes(t)?t:void 0}function C(e,t,n){return new r(n===`unnamed_entry`?`INVALID_ARGS`:`COMMAND_FAILED`,`Refusing to save the script under ${t}: ${ae[n]}`,{reason:n===`parent_replaced`?S[1]:S[0],exposure:n,path:e,ancestor:t,hint:se(n,t)})}function se(e,t){return e===`parent_replaced`?`Re-record with open --save-script, or save under a directory nobody else can write.`:e===`unnamed_entry`?"End the script path in a valid file name, such as `--save-script=./workflows/journey.ad`.":e===`shared_group_writable`?`Close the directory to its group with \`chmod g-w ${t}\`, or save the script under a directory only you can write.`:`Save the script under a directory you own that only you can write, and keep the path out of directories other users own.`}function w(e){let t=x();return t===v.win32&&/^[\\/]|^[a-z]:/i.test(e)&&D(e,e),T(e,t)}function T(e,t){let n=ue(e,t);if(n===void 0)throw ce(e,t);return n}function E(e){if(/^[a-z]:[\\/]/i.test(e))return!0;let t=/^[\\/]{2}([^\\/]+)[\\/]+([^\\/]+)/.exec(e);return t!==null&&!/^(?:pipe|IPC\$|mailslot)$/i.test(t[2]??``)&&t.slice(1).every(e=>!/[:?*<>"|]|[. ]$/.test(e)&&!O(e))}function D(e,t){if(E(t))return v.win32.parse(v.win32.normalize(t)).root;throw new r(`INVALID_ARGS`,`Refusing to save the script at ${e}: ${t} lacks a supported Windows volume.`,{reason:`script_ancestor_untrusted`,exposure:`windows_path_form`,path:e,ancestor:t,hint:`Use an absolute drive-letter path or an ordinary Windows network share path.`})}function ce(e,t){let n=t.dirname(e);return t.sep===`\\`&&le(t.normalize(n),t)?new r(`INVALID_ARGS`,`Refusing to save the script under ${n}: a Windows path cannot hold \`:\` after its drive, and a directory in it does.`,{reason:S[0],exposure:`unnamed_entry`,path:e,ancestor:n,hint:"Remove the `:` from the directory names in the script path."}):C(e,n,`unnamed_entry`)}function O(e){return[...e].some(e=>e.charCodeAt(0)<32)}function le(e,t){return e.slice(t.parse(e).root.length).includes(`:`)}function ue(e,t){let n=t.sep===`\\`?/^~[\\/]*$/:/^~\/*$/;if(e.includes(`\0`)||/\p{Surrogate}/u.test(e)||n.test(e))return;let{base:r}=t.parse(e),i=t.sep===`\\`?r.length:Buffer.byteLength(r);if(!(r===``||r===`.`||r===`..`||i>de))return t.sep===`\\`?fe(t.normalize(e),t):r}const de=255;function fe(e,t){if(/^[\\/]/.test(e)&&!E(e))return;let{base:n}=t.parse(e);if(n===``||le(e,t)||/[<>:"/\\|?*]/.test(n)||O(n)||/[. ]$/.test(n))return;let r=n.split(`.`)[0]?.replace(/ +$/,``)??``;return/^(?:CON|PRN|AUX|NUL|COM[0-9¹²³]|LPT[0-9¹²³]|CONIN\$|CONOUT\$)$/i.test(r)?void 0:n}function pe(e,t){let n=x();if(w(e),n!==v.win32){let r=ne(e,t);return w(r),me(r,n.sep)}let r=e;if(e.startsWith(`~/`)){let i=y(t.env);(n.isAbsolute(i)||/^[a-z]:/i.test(i))&&D(e,i),r=n.join(i,e.slice(2)),w(r)}if(n.isAbsolute(r))return me(r,n.sep);D(e,t.cwd);let i=n.resolve(t.cwd,r);return w(i),i}function me(e,t){let n=e.length;for(;e[n-1]===`/`||e[n-1]===t;)--n;return e.slice(0,n)}function he(e){return{uid:process.getuid?.()??-1,privateAncestry:e.privateAncestry===!0}}function k(e,t){if(e.uid!==0&&e.uid!==t.uid)return`foreign_owned`;if(!(e.mode&512&&!t.privateAncestry)){if(e.mode&2)return`world_writable`;if(e.mode&16)return`shared_group_writable`}}function A(e,t){return e.uid!==0&&e.uid!==t.uid||e.mode&2?!0:!!(e.mode&16)}function ge(e,t,n){if(A(t,n)&&!(t.mode&512&&(e.uid===0||e.uid===n.uid)))return`planted_link`}function _e(e){let{entry:t}=j(e.destination);return l({destination:t,contents:e.contents,mode:ve,publish:e.publish,exactMode:!0}),t}const ve=384;function j(e,t={}){return M(e,!0,t)}function M(e,t,n={}){if(process.platform===`win32`)return ye(e,t);let r=Ce(e),i=w(e),a=he(n),o=we(r,e,a,t);if(A(o.authority,a))throw C(e,o.deepest,`shared_parent`);return F(o.deepest,o.identity,i)}function ye(e,t){let n=v.win32,r=D(e,e),i=T(e,n),a=n.dirname(n.normalize(e));return P(e,r),a===r||(t?be(e,r,a):P(e,a)),F(a,`windows`,i)}function be(e,t,n){let r=[],i=n;for(;i!==t&&!N(e,i);)r.push(i),i=v.win32.dirname(i);if(i===t)throw C(e,t,`unreachable_parent`);for(let t of r.reverse())if(!N(e,t))throw C(e,t,`unreachable_parent`)}function N(e,t){try{g.mkdirSync(t,{mode:448})}catch(n){let r=n.code;if(r===`ENOENT`)return!1;if(r!==`EEXIST`)throw n;P(e,t)}return!0}function P(e,t){let n;try{n=g.statSync(t,{throwIfNoEntry:!1})}catch(e){if(!xe(t,e))throw e}if(!n)throw C(e,t,`unreachable_parent`);if(!n.isDirectory())throw C(e,t,`not_a_directory`)}function xe(e,t){return process.platform===`win32`&&/^[\\/]{2}/.test(e)&&t?.code===`ECONNRESET`}function F(e,t,n){return{directory:e,identity:t,name:n,entry:x().join(e,n)}}function Se(e,t){let n=M(e,!1);if(n.identity!==t.identity||n.directory!==t.directory)throw C(e,n.directory,`parent_replaced`);return n}function Ce(e){let t=v.dirname(e);if(!v.isAbsolute(t))throw C(e,t,`relative_destination`);return t}function we(e,t,n,r){let i=(e,n)=>{throw C(t,e,n)},a=I(`/`,B(e),n,0,i),o=!1;for(;;){let[s,...c]=a.queue;if(s===void 0)return{deepest:a.deepest,authority:a.authority,identity:a.identity};if(s===`..`){a=I(v.dirname(a.deepest),c,n,a.hops,i);continue}let l=Te(a,s,c,n,i);if(l.ended===`short`){let{deepest:s,missing:c,unresolvable:u}=l;if(!r||o||u)throw C(t,s,u?`unresolvable_parent`:`unreachable_parent`);De(t,s,c,n),o=!0,a=I(`/`,B(e),n,0,i);continue}a=l.state}}function Te(e,t,n,r,i){let a=v.join(e.deepest,t),o=z(a);if(o===void 0)return{ended:`short`,deepest:e.deepest,missing:[t,...n],unresolvable:n.includes(`..`)};if(o.isSymbolicLink())return Ee(e,a,o,n,r,i);o.isDirectory()||i(a,`not_a_directory`);let s=L(o),c=k(s,r);return c&&i(a,c),{ended:`stand`,state:{deepest:a,authority:s,identity:R(o),queue:n,hops:e.hops}}}function Ee(e,t,n,r,i,a){let o=ge({uid:Number(n.uid)},e.authority,i);o&&a(t,o),e.hops>=30&&a(t,`link_loop_exceeded`);let s=g.readlinkSync(t);return{ended:`stand`,state:I(v.isAbsolute(s)?`/`:v.dirname(t),[...B(s),...r],i,e.hops+1,a)}}function I(e,t,n,r,i){let a=z(e);(a===void 0||!a.isDirectory())&&i(e,`not_a_directory`);let o=L(a),s=k(o,n);return s&&i(e,s),{deepest:e,authority:o,identity:R(a),queue:t,hops:r}}function L(e){return{uid:Number(e.uid),mode:Number(e.mode)}}function R(e){return`${e.dev}:${e.ino}`}function z(e){return g.lstatSync(e,{bigint:!0,throwIfNoEntry:!1})}function B(e){return e.split(`/`).filter(e=>e.length>0&&e!==`.`)}function De(e,t,n,r){let i=t;for(let t of n)i=Oe(e,i,t,r)}function Oe(e,t,n,r){let i=v.join(t,n),a=!0;try{g.mkdirSync(i,{mode:448})}catch(e){if(e.code!==`EEXIST`)throw e;a=!1}let o=z(i);if(o===void 0||!o.isDirectory())throw C(e,i,a?`not_a_directory`:`entry_appeared`);let s=L(o),c=k(s,r);if(c)throw C(e,i,c);if(a)return g.chmodSync(i,448),i;if(A(s,r))throw C(e,i,`shared_parent`);return i}const V=`owner.json`,ke=`.lock`,Ae=1e3,je=1e3;async function Me(e){let t=await e.acquire();try{let n=await e.task();return await t(),n}catch(e){throw await t().catch(()=>void 0),e}}const H=new Set,Ne=h.randomUUID();function Pe(e){return U(e,e=>p({owner:e}))}function U(e,t){let n;try{n=g.lstatSync(e)}catch(t){return Z(t)===`ENOENT`?{state:g.existsSync(J(e))?`publishing`:`absent`}:{state:`unproven`,reason:`owner-unreadable`}}if(!n.isDirectory())return{state:`unproven`,reason:`non-directory`};let r=Q(v.join(e,V));if(r.kind===`unreadable`)return{state:`unproven`,reason:`owner-unreadable`};if(r.kind===`unwritten`)return g.existsSync(J(e))?{state:`publishing`}:{state:`unproven`,reason:`owner-unwritten`};let{pid:i,startTime:a,acquiredAtMs:o}=r.owner;return{state:`held`,owner:{pid:i,startTime:a,acquiredAtMs:o},liveness:t(r.owner)}}function Fe(e){g.mkdirSync(v.dirname(e.lockDirPath),{recursive:!0});let t=Q(v.join(e.lockDirPath,V));return Ie(e,{standing:Be(t,t.kind===`owner`?p({owner:t.owner}):void 0),judgeOwner:e=>p({owner:e}),abandonedGuard:rt(e.lockDirPath,e=>u([e.pid]).get(e.pid)??null),guardHolderStartTime:ee().startTime})}function Ie(e,t){let{lockDirPath:n}=e,r=t.standing;if(r.kind===`live`)return{status:`busy`,inspection:r.inspection};if(!et(n,t.abandonedGuard,t.guardHolderStartTime))return{status:`busy`,inspection:U(n,t.judgeOwner)};let i=Le(n,()=>Re(e,r),e=>{e.status===`acquired`&&H.delete(e.claimToken)});return i.status===`acquired`?{status:`acquired`,acquisition:i.acquisition}:{status:i.status,inspection:i.inspection??U(n,t.judgeOwner)}}function Le(e,n,r){let i;try{i=n()}catch(n){try{X(e)}catch(n){o({level:`warn`,phase:`process_lock_guard_release_failed`,data:{lockDirPath:e,error:t(n)}})}throw n}try{X(e)}catch(e){throw r(i),e}return i}function Re(e,t){let{lockDirPath:n}=e,r=v.join(n,V),i=Ve(n,r);if(i.kind===`unproven`)return{status:`unproven`,inspection:i.inspection};if(i.kind===`owner`){if(t.kind!==`reclaimable`||!W(i.owner,t.owner))return{status:`busy`};if(Ze(n,r,i.owner)!==`removed`)return{status:`unproven`}}return ze(e,r)}function ze(e,t){let{lockDirPath:n,owner:r}=e;try{g.mkdirSync(n)}catch(e){if(Z(e)!==`EEXIST`)throw e;return{status:`unproven`}}let i=h.randomUUID(),a={...r,claimToken:i,claimIssuerId:Ne};try{Xe(t,a)}catch(e){try{g.rmdirSync(n)}catch{}throw e}return H.add(i),{status:`acquired`,claimToken:i,acquisition:Ye(e,a)}}function Be(e,t){if(e.kind!==`owner`||t===void 0)return{kind:`none`};if(ut(t)&&!dt(e.owner)){let{pid:n,startTime:r,acquiredAtMs:i}=e.owner;return{kind:`live`,inspection:{state:`held`,owner:{pid:n,startTime:r,acquiredAtMs:i},liveness:t}}}return{kind:`reclaimable`,owner:e.owner}}function Ve(e,t){let n;try{n=g.lstatSync(e)}catch(e){return Z(e)===`ENOENT`?{kind:`absent`}:{kind:`unproven`,inspection:{state:`unproven`,reason:`owner-unreadable`}}}if(!n.isDirectory())return{kind:`unproven`,inspection:{state:`unproven`,reason:`non-directory`}};let r=Q(t);return r.kind===`owner`?{kind:`owner`,owner:r.owner}:{kind:`unproven`,inspection:{state:`unproven`,reason:r.kind===`unwritten`?`owner-unwritten`:`owner-unreadable`}}}function W(e,t){return e.pid===t.pid&&e.startTime===t.startTime&&e.acquiredAtMs===t.acquiredAtMs&&e.claimToken===t.claimToken&&e.claimIssuerId===t.claimIssuerId}async function He(e){return(await Ue(e)).release}async function Ue(e){let t=Date.now()+(e.timeoutMs??3e4),n=e.pollMs??100;G(e.signal);let r=await We();g.mkdirSync(v.dirname(e.lockDirPath),{recursive:!0});do{G(e.signal);let i=Ie(e,await Ge(e,r));if(i.status===`acquired`)return i.acquisition;let a=t-Date.now();if(a<=0)break;await te(Math.min(n,a),e.signal),G(e.signal)}while(Date.now()<t);throw await qe(e)}function G(e){if(e?.aborted)throw n()}async function We(){return{owner:Je(),guardHolder:at(),guardHolderStartTime:(await f()).startTime}}async function Ge(e,t){let n=Q(v.join(e.lockDirPath,V)),r=n.kind===`owner`?await t.owner.classify(n.owner):void 0;return{standing:Be(n,r),judgeOwner:Ke(n,r),abandonedGuard:await it(e.lockDirPath,t.guardHolder),guardHolderStartTime:t.guardHolderStartTime}}function Ke(e,t){return n=>e.kind===`owner`&&t&&W(n,e.owner)?t:`unknown`}async function qe(e){let t=Q(v.join(e.lockDirPath,V)),n=t.kind===`owner`?await s({owner:t.owner}):void 0;return new r(`COMMAND_FAILED`,`Timed out waiting for ${e.description??`process lock`}`,{lockDirPath:e.lockDirPath,reason:`process_lock_timeout`,...lt(e.lockDirPath,t,n),inspection:U(e.lockDirPath,Ke(t,n)),hint:K(e.lockDirPath)})}function Je(){let e;return{async classify(t){!(e!==void 0&&W(e.owner,t)&&Date.now()-e.atMs<Ae)&&m(t.pid)&&i(t.pid)&&(e={owner:t,observation:(await a([t.pid])).get(t.pid)??null,atMs:Date.now()});let n=e&&W(e.owner,t)?e.observation:null;return d({owner:t},n)}}}function Ye(e,t){let{lockDirPath:n}=e,i=v.join(n,V),a=!0,s=!1;return Object.freeze({assertHeld(){if(!a||q(n,t)!==`owned`)throw new r(`COMMAND_FAILED`,`Process lock acquisition is no longer held`,{lockDirPath:n,ownerOwnershipLost:!0})},async release(){if(s)return;a=!1,H.delete(t.claimToken);let c=q(n,t);if(c===`absent`||c===`not-owner`){s=!0;return}let l=`unverified`;if(await ot(n))try{l=Ze(n,i,t)}finally{X(n)}if(l!==`unverified`){s=!0;return}throw o({level:`warn`,phase:`process_lock_release_unverified`,data:{lockDirPath:n,description:e.description,ownerReleaseUnverified:!0}}),new r(`COMMAND_FAILED`,`Cannot verify ownership of ${e.description??`process lock`}`,{lockDirPath:n,ownerReleaseUnverified:!0,hint:K(n)})}})}function K(e){return`Restore process inspection or stop the verified owner, then retry. Remove ${e} and ${J(e)} only after confirming all users of this state directory have stopped.`}function Xe(e,t){l({destination:e,contents:JSON.stringify(t)})}function Ze(e,t,n){let r=q(e,n);return r===`owned`?Qe(e,t,n):r===`absent`?`removed`:r}function q(e,t){let n=Q(v.join(e,V));return n.kind===`unreadable`?`unverified`:n.kind===`unwritten`?g.existsSync(e)?`unverified`:`absent`:c(n.owner,t)&&n.owner.claimToken===t.claimToken?`owned`:`not-owner`}function Qe(e,t,n){try{if(g.readdirSync(e).some(e=>e!==V))return`unverified`}catch(e){return Z(e)===`ENOENT`?`removed`:`unverified`}try{g.unlinkSync(t)}catch(e){if(Z(e)!==`ENOENT`)return`unverified`}try{return g.rmdirSync(e),`removed`}catch(e){if(Z(e)===`ENOENT`)return`removed`;try{l({destination:t,contents:JSON.stringify(n),publish:`link-exclusive`})}catch{}return`unverified`}}function J(e){return`${e.endsWith(ke)?e.slice(0,-5):e}.reclaim${ke}`}const $e=/^[0-9a-f-]{36}$/;function et(e,t,n){return tt(e,n)?!0:!t||!nt(e,t)?!1:tt(e,n)}function tt(e,t){let n=J(e),r={pid:process.pid,startTime:t,token:h.randomUUID()},i;try{i=g.openSync(n,`wx`,384)}catch(e){if(Z(e)!==`EEXIST`)throw e;return!1}try{g.writeSync(i,JSON.stringify(r))}catch(e){throw g.closeSync(i),g.unlinkSync(n),e}return g.closeSync(i),!0}function nt(e,t){let n=J(e),r=`${n}.${t.token}.reap`;try{g.closeSync(g.openSync(r,`wx`,384))}catch(e){if(Z(e)!==`EEXIST`)throw e;return!1}try{let r=Y(n);if(r?.holder.token!==t.token)return!1;try{g.unlinkSync(n)}catch(e){if(Z(e)!==`ENOENT`)throw e}return o({level:`warn`,phase:`process_lock_guard_reclaimed`,data:{lockDirPath:e,holderPid:r.holder.pid}}),!0}finally{g.rmSync(r,{force:!0})}}function Y(e){let t,n;try{t=g.readFileSync(e,`utf8`),n=Date.now()-g.statSync(e).mtimeMs}catch{return}let r;try{r=JSON.parse(t)}catch{return}if(typeof r!=`object`||!r)return;let i=r;if(!(!m(i.pid)||typeof i.token!=`string`)&&$e.test(i.token)&&(i.startTime===null||typeof i.startTime==`string`))return{holder:{pid:i.pid,startTime:i.startTime,token:i.token},ageMs:n}}function rt(e,t){let n=Y(J(e));if(!n||n.holder.pid===process.pid)return;let{holder:r,ageMs:a}=n,o=i(r.pid);if(o&&a<je)return;let s=o?t(r):null;return $(d({owner:r},s))?{token:r.token}:void 0}async function it(e,t){let n=Y(J(e));if(!n)return;let r=n.holder.pid!==process.pid&&n.ageMs>=je&&i(n.holder.pid)?await t.observe(n.holder):null;return rt(e,e=>e.token===n.holder.token?r:null)}function at(){let e;return{async observe(t){if(e?.token===t.token&&Date.now()-e.atMs<Ae)return e.observation;let n=await a([t.pid]);return e={token:t.token,observation:n.get(t.pid)??null,atMs:Date.now()},e.observation}}}async function ot(e){let t=Date.now()+5e3,n=(await f()).startTime,r=at();for(;!et(e,await it(e,r),n);){if(Date.now()>=t)return!1;await te(5)}return!0}function X(e){try{g.unlinkSync(J(e))}catch(t){throw new r(`COMMAND_FAILED`,`Process lock mutation guard release could not be confirmed.`,{reason:`process_lock_guard_release_failed`,lockDirPath:e,hint:K(e)},t)}}function Z(e){return e?.code}function Q(e){let t;try{t=g.readFileSync(e,`utf8`)}catch(e){return e?.code===`ENOENT`?{kind:`unwritten`}:{kind:`unreadable`}}let n=st(t);return n?{kind:`owner`,owner:n}:{kind:`unreadable`}}function st(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t)return null;let n=t;for(let[e,t]of Object.entries(ct))if(!t(n[e]))return null;return{pid:n.pid,startTime:typeof n.startTime==`string`?n.startTime:null,acquiredAtMs:n.acquiredAtMs,claimToken:typeof n.claimToken==`string`?n.claimToken:null,claimIssuerId:typeof n.claimIssuerId==`string`?n.claimIssuerId:void 0}}const ct={pid:m,acquiredAtMs:e=>typeof e==`number`&&Number.isFinite(e),startTime:e=>e==null||typeof e==`string`};function lt(e,t,n){let r=Date.now(),i;try{i=Math.max(0,Math.round(r-g.statSync(e).mtimeMs))}catch{}return{...i===void 0?{}:{lockAgeMs:i},...t.kind===`owner`?{ownerPid:t.owner.pid,ownerStartTime:t.owner.startTime,ownerAgeMs:Math.max(0,Math.round(r-t.owner.acquiredAtMs)),ownerLiveness:n}:t.kind===`unreadable`?{ownerRecordUnreadable:!0}:{}}}function ut(e){return!$(e)}function $(e){return e===`owner-process-dead`||e===`owner-process-reused`}function dt(e){return e.pid!==process.pid||e.claimToken===null||e.claimIssuerId!==Ne?!1:!H.has(e.claimToken)}var ft=e({NOT_REGULAR_FILE_HINT:()=>NOT_REGULAR_FILE_HINT,acquireProcessLock:()=>He,resolveDeviceClaimRoot:()=>ie,withProcessLock:()=>Me});export{Fe as a,j as c,oe as d,b as f,ne as h,Pe as i,_e as l,re as m,He as n,Me as o,ie as p,Ue as r,Se as s,ft as t,pe as u};