@codex-ultra/cxu 0.2.31 → 0.2.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{spawnSync as m}from"node:child_process";import{chmodSync as b,existsSync as h,mkdirSync as v,statSync as w,writeFileSync as k}from"node:fs";import{createRequire as y}from"node:module";import{homedir as S}from"node:os";import{dirname as B,join as t}from"node:path";import{fileURLToPath as V}from"node:url";function s(){let e=process.platform;if(e==="win32")return'powershell -c "irm bun.sh/install.ps1 | iex"';if(e==="darwin"||e==="linux")return"curl -fsSL https://bun.sh/install | bash";return"Please install bun via your system package manager (e.g. pkg install bun), or see https://bun.sh"}var o="1.1.0",N=process.env.HOME||process.env.USERPROFILE||S();function I(){try{let n=y(import.meta.url)("../package.json");if(n?.version)return n.version}catch{}return"0.0.0-unknown"}function f(e){let n=/(\d+)\.(\d+)\.(\d+)/.exec(e);if(!n)return null;return[Number(n[1]),Number(n[2]),Number(n[3])]}function T(e,n){for(let r=0;r<3;r+=1)if(e[r]!==n[r])return e[r]<n[r]?-1:1;return 0}function O(){try{let e=m("bun",["--version"],{encoding:"utf8",timeout:5000,windowsHide:!0});if(e.status!==0)return null;return String(e.stdout??"").trim()||null}catch{return null}}function _(){let e=O();if(!e)return{ok:!1,hint:`Bun is required to compile the codex-ultra server on first run but was not found. Install it first: ${s()}`};let n=f(e),r=f(o);if(!n||!r||T(n,r)<0)return{ok:!1,hint:`Bun ${e} detected, but cxu needs Bun >= ${o} to compile the server. Upgrade: ${s()}`};return{ok:!0,version:e}}function E(e){let n=(String(e).match(/\d+/g)??["0"]).map(Number).slice(-4);while(n.length<4)n.unshift(0);return n.join(".")}function H(){let e=B(V(import.meta.url)),n=t(e,"..","server-bundle","index.js");return h(n)?n:null}function g(e){return t(N,".cxu","server",`v${e}`)}function d(e){let n=t(g(e),process.platform==="win32"?"codex-standalone.exe":"codex-standalone");try{if(h(n)&&w(n).size>0)return n}catch{return null}return null}function x(){let e=I(),n=d(e);if(n)return{ok:!0,exePath:n,built:!1};let r=_();if(!r.ok)return r;let u=H();if(!u)return{ok:!1,hint:"Server bundle missing from this cxu install (server-bundle/index.js). Reinstall with: npm install -g @codex-ultra/cxu"};let i=g(e);v(i,{recursive:!0});let l=t(i,process.platform==="win32"?"codex-standalone.exe":"codex-standalone"),c=["build","--compile",u,"--outfile",l,"--minify","--define",`STANDALONE_BUILD_VERSION="${e}"`,"--external","better-sqlite3","--external","@napi-rs/keyring","--external","bcryptjs"];if(process.platform==="win32")c.push("--windows-title","Codex Ultra Standalone","--windows-publisher","codex-ultra maintainers","--windows-version",E(e),"--windows-description","Codex Ultra standalone server (Bun single-file)");console.log(`cxu: compiling the server for this machine with Bun ${r.version} (one-time per version)...`);let a=m("bun",c,{stdio:"inherit",timeout:300000,windowsHide:!0});if(a.status!==0)return{ok:!1,hint:`Local server compile failed (bun exit ${a.status??"signal"}). Check the output above, ensure Bun >= ${o}, then retry: cxu serve`};if(process.platform!=="win32")try{b(l,493)}catch{}try{k(t(i,".build-info.json"),JSON.stringify({cxuVersion:e,bunVersion:r.version,builtAt:new Date().toISOString()},null,2))}catch{}let p=d(e);if(!p)return{ok:!1,hint:"Compile finished but the server binary is missing. Retry: cxu serve"};return console.log("cxu: server ready."),{ok:!0,exePath:p,built:!0}}try{let e=x();if(!e.ok)console.log(`cxu postinstall: skipped local server build. ${e.hint}`)}catch(e){let n=e instanceof Error?e.message:String(e);console.log(`cxu postinstall: skipped local server build (${n}). It will compile on first \`cxu serve\`.`)}
1
+ import{spawnSync as g}from"node:child_process";import{chmodSync as x,copyFileSync as k,existsSync as s,mkdirSync as v,statSync as b,writeFileSync as B}from"node:fs";import{createRequire as V}from"node:module";import{homedir as N}from"node:os";import{dirname as w,join as i}from"node:path";import{fileURLToPath as y}from"node:url";function u(){let e=process.platform;if(e==="win32")return'powershell -c "irm bun.sh/install.ps1 | iex"';if(e==="darwin"||e==="linux")return"curl -fsSL https://bun.sh/install | bash";return"Please install bun via your system package manager (e.g. pkg install bun), or see https://bun.sh"}var l="1.1.0",I=process.env.HOME||process.env.USERPROFILE||N();function T(){try{let r=V(import.meta.url)("../package.json");if(r?.version)return r.version}catch{}return"0.0.0-unknown"}function m(e){let r=/(\d+)\.(\d+)\.(\d+)/.exec(e);if(!r)return null;return[Number(r[1]),Number(r[2]),Number(r[3])]}function j(e,r){for(let t=0;t<3;t+=1)if(e[t]!==r[t])return e[t]<r[t]?-1:1;return 0}function O(){try{let e=g("bun",["--version"],{encoding:"utf8",timeout:5000,windowsHide:!0});if(e.status!==0)return null;return String(e.stdout??"").trim()||null}catch{return null}}function _(){let e=O();if(!e)return{ok:!1,hint:`Bun is required to compile the codex-ultra server on first run but was not found. Install it first: ${u()}`};let r=m(e),t=m(l);if(!r||!t||j(r,t)<0)return{ok:!1,hint:`Bun ${e} detected, but cxu needs Bun >= ${l} to compile the server. Upgrade: ${u()}`};return{ok:!0,version:e}}function C(e){let r=(String(e).match(/\d+/g)??["0"]).map(Number).slice(-4);while(r.length<4)r.unshift(0);return r.join(".")}function D(){let e=w(y(import.meta.url)),r=i(e,"..","server-bundle","index.js");return s(r)?r:null}function E(){let e=w(y(import.meta.url)),r=i(e,"..","server-bundle","sa-vm-mcp.mjs");return s(r)?r:null}function H(e){try{let r=E();if(!r)return;let t=c(e),n=i(t,"sa-vm-mcp.mjs");try{if(s(n)&&b(n).size>0)return}catch{}v(t,{recursive:!0}),k(r,n);try{x(n,420)}catch{}}catch{}}function c(e){return i(I,".cxu","server",`v${e}`)}function h(e){let r=i(c(e),process.platform==="win32"?"codex-standalone.exe":"codex-standalone");try{if(s(r)&&b(r).size>0)return r}catch{return null}return null}function S(){let e=T();if(process.platform!=="win32")H(e);let r=h(e);if(r)return{ok:!0,exePath:r,built:!1};let t=_();if(!t.ok)return t;let n=D();if(!n)return{ok:!1,hint:"Server bundle missing from this cxu install (server-bundle/index.js). Reinstall with: npm install -g @codex-ultra/cxu"};let o=c(e);v(o,{recursive:!0});let a=i(o,process.platform==="win32"?"codex-standalone.exe":"codex-standalone"),p=["build","--compile",n,"--outfile",a,"--minify","--define",`STANDALONE_BUILD_VERSION="${e}"`,"--external","better-sqlite3","--external","@napi-rs/keyring","--external","bcryptjs","--external","ws","--external","fetch-impersonate"];if(process.platform==="win32")p.push("--windows-title","Codex Ultra Standalone","--windows-publisher","codex-ultra maintainers","--windows-version",C(e),"--windows-description","Codex Ultra standalone server (Bun single-file)");console.log(`cxu: compiling the server for this machine with Bun ${t.version} (one-time per version)...`);let f=g("bun",p,{stdio:"inherit",timeout:300000,windowsHide:!0});if(f.status!==0)return{ok:!1,hint:`Local server compile failed (bun exit ${f.status??"signal"}). Check the output above, ensure Bun >= ${l}, then retry: cxu serve`};if(process.platform!=="win32")try{x(a,493)}catch{}try{B(i(o,".build-info.json"),JSON.stringify({cxuVersion:e,bunVersion:t.version,builtAt:new Date().toISOString()},null,2))}catch{}let d=h(e);if(!d)return{ok:!1,hint:"Compile finished but the server binary is missing. Retry: cxu serve"};return console.log("cxu: server ready."),{ok:!0,exePath:d,built:!0}}try{let e=S();if(!e.ok)console.log(`cxu postinstall: skipped local server build. ${e.hint}`)}catch(e){let r=e instanceof Error?e.message:String(e);console.log(`cxu postinstall: skipped local server build (${r}). It will compile on first \`cxu serve\`.`)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codex-ultra/cxu",
3
- "version": "0.2.31",
3
+ "version": "0.2.35",
4
4
  "description": "codex-ultra workbench launcher: server compiled locally with Bun + web UI (cxu starts it all).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",