UNPKG

grix-connector

Version:

Connect local AI coding agents (Claude, Codex, Gemini, Qwen, DeepSeek, Cursor, OpenCode, Pi, OpenHuman, Reasonix) to the Grix scheduling platform. Also serves as an OpenClaw plugin for Grix channel transport.

2 lines (1 loc) 705 B
import{statSync as c}from"node:fs";import n from"node:path";import{resolveCodexHome as a}from"./codex-trust.js";const l=300*1e3;function i(t={}){if(t.lockPath&&t.lockPath.trim())return t.lockPath.trim();const e=process.env.CODEX_LOCK_PATH;return e&&e.trim()?e.trim():n.join(a(t.codexHome),"codex.lock")}function m(t={}){const e=i(t),r=t.staleMs??l;try{const s=c(e),o=Date.now()-s.mtimeMs>r;return{present:!0,locked:!o,stale:o,path:e}}catch{return{present:!1,locked:!1,stale:!1,path:e}}}function p(t={}){const e=m(t);if(e.locked&&!e.stale)throw new Error(`Codex session appears locked by another process: ${e.path}`);return e}export{p as assertCodexLockFree,m as checkCodexLock,i as resolveCodexLockPath};