oioxo-mcp 0.5.10 → 0.5.11

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.
Files changed (2) hide show
  1. package/bundle/cli.js +2 -2
  2. package/package.json +1 -1
package/bundle/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var pre=Object.create;var w_=Object.defineProperty;var mre=Object.getOwnPropertyDescriptor;var gre=Object.getOwnPropertyNames;var yre=Object.getPrototypeOf,xre=Object.prototype.hasOwnProperty;var on=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var mr=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),La=(t,e)=>{for(var r in e)w_(t,r,{get:e[r],enumerable:!0})},RB=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of gre(e))!xre.call(t,s)&&s!==r&&w_(t,s,{get:()=>e[s],enumerable:!(n=mre(e,s))||n.enumerable});return t};var vt=(t,e,r)=>(r=t!=null?pre(yre(t)):{},RB(e||!t||!t.__esModule?w_(r,"default",{value:t,enumerable:!0}):r,t)),H=t=>RB(w_({},"__esModule",{value:!0}),t);import{promises as wl}from"node:fs";import*as Im from"node:path";import*as NB from"node:os";import{randomBytes as bre}from"node:crypto";import{execFile as _re}from"node:child_process";import{promisify as vre}from"node:util";async function Ua(){let t=process.env.OIOXO_TOKEN?.trim();if(t)return{token:t,expiresAt:Number.MAX_SAFE_INTEGER,device:process.env.OIOXO_DEVICE_ID||"env"};try{let e=JSON.parse(await wl.readFile(S_,"utf8"));return e?.token?e:null}catch{return null}}async function Sre(t){if(process.platform!=="win32")return;let e=process.env.USERNAME||process.env.USER;if(e)try{await wre("icacls",[t,"/inheritance:r","/grant:r",`${e}:F`],{windowsHide:!0})}catch{}}async function BB(t){await wl.mkdir(Tm,{recursive:!0}),await wl.writeFile(S_,JSON.stringify(t,null,2),{encoding:"utf8",mode:384}),await Sre(S_)}async function $B(){try{await wl.unlink(S_)}catch{}}async function Om(){let t=await Ua();if(t?.device)return t.device;try{let r=await wl.readFile(Im.join(Tm,"device"),"utf8");if(r.trim())return r.trim()}catch{}let e=bre(16).toString("base64url");return await wl.mkdir(Tm,{recursive:!0}),await wl.writeFile(Im.join(Tm,"device"),e,"utf8"),e}function Are(){return`cli-${process.platform==="win32"?"windows":process.platform==="darwin"?"mac":"linux"}`}function Ere(){if(process.env.OIOXO_DESKTOP_CLIENT_KEY)return process.env.OIOXO_DESKTOP_CLIENT_KEY;try{return""}catch{}return""}async function WC(){let t=await Ua(),e=await Om(),r={"content-type":"application/json","x-oioxo-client":Are(),"x-oioxo-device":e},n=Ere();return n&&(r["x-oioxo-desktop-key"]=n),t?.token&&t.expiresAt>Date.now()&&(r.authorization=`Bearer ${t.token}`),r}async function Dn(t,e){try{let r=await fetch(`${hn}/api/usage/save`,{method:"POST",headers:await WC(),body:JSON.stringify(t==="report"?{action:t,savedTokens:e}:{action:t})});return r.ok?await r.json():null}catch{return null}}async function vi(){let t=await Ua();return!!t&&t.expiresAt>Date.now()}async function MB(){if(!await vi())return{ok:!1,message:`OIOXO: sign in to use the coding agent. ${Pm}
2
+ var pre=Object.create;var w_=Object.defineProperty;var mre=Object.getOwnPropertyDescriptor;var gre=Object.getOwnPropertyNames;var yre=Object.getPrototypeOf,xre=Object.prototype.hasOwnProperty;var on=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var mr=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),La=(t,e)=>{for(var r in e)w_(t,r,{get:e[r],enumerable:!0})},RB=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of gre(e))!xre.call(t,s)&&s!==r&&w_(t,s,{get:()=>e[s],enumerable:!(n=mre(e,s))||n.enumerable});return t};var vt=(t,e,r)=>(r=t!=null?pre(yre(t)):{},RB(e||!t||!t.__esModule?w_(r,"default",{value:t,enumerable:!0}):r,t)),H=t=>RB(w_({},"__esModule",{value:!0}),t);import{promises as wl}from"node:fs";import*as Im from"node:path";import*as NB from"node:os";import{randomBytes as bre}from"node:crypto";import{execFile as _re}from"node:child_process";import{promisify as vre}from"node:util";async function Ua(){let t=process.env.OIOXO_TOKEN?.trim();if(t)return{token:t,expiresAt:Number.MAX_SAFE_INTEGER,device:process.env.OIOXO_DEVICE_ID||"env"};try{let e=JSON.parse(await wl.readFile(S_,"utf8"));return e?.token?e:null}catch{return null}}async function Sre(t){if(process.platform!=="win32")return;let e=process.env.USERNAME||process.env.USER;if(e)try{await wre("icacls",[t,"/inheritance:r","/grant:r",`${e}:F`],{windowsHide:!0})}catch{}}async function BB(t){await wl.mkdir(Tm,{recursive:!0}),await wl.writeFile(S_,JSON.stringify(t,null,2),{encoding:"utf8",mode:384}),await Sre(S_)}async function $B(){try{await wl.unlink(S_)}catch{}}async function Om(){let t=await Ua();if(t?.device)return t.device;try{let r=await wl.readFile(Im.join(Tm,"device"),"utf8");if(r.trim())return r.trim()}catch{}let e=bre(16).toString("base64url");return await wl.mkdir(Tm,{recursive:!0}),await wl.writeFile(Im.join(Tm,"device"),e,"utf8"),e}function Are(){return`cli-${process.platform==="win32"?"windows":process.platform==="darwin"?"mac":"linux"}`}function Ere(){if(process.env.OIOXO_DESKTOP_CLIENT_KEY)return process.env.OIOXO_DESKTOP_CLIENT_KEY;try{return"oioxo_fp_iIZcl4DsGORBvNab2v9OAsufqXKfJ6SlyU26mrohmS8"}catch{}return""}async function WC(){let t=await Ua(),e=await Om(),r={"content-type":"application/json","x-oioxo-client":Are(),"x-oioxo-device":e},n=Ere();return n&&(r["x-oioxo-desktop-key"]=n),t?.token&&t.expiresAt>Date.now()&&(r.authorization=`Bearer ${t.token}`),r}async function Dn(t,e){try{let r=await fetch(`${hn}/api/usage/save`,{method:"POST",headers:await WC(),body:JSON.stringify(t==="report"?{action:t,savedTokens:e}:{action:t})});return r.ok?await r.json():null}catch{return null}}async function vi(){let t=await Ua();return!!t&&t.expiresAt>Date.now()}async function MB(){if(!await vi())return{ok:!1,message:`OIOXO: sign in to use the coding agent. ${Pm}
3
3
  Free accounts include a monthly allowance; OIOXO Pro is unlimited \u2192 ${Da}`};let t=await Dn("check");return t?t.optimize?{ok:!0,state:t}:t.tier==="anon"?{ok:!1,message:`Your OIOXO session expired. ${Pm}`}:{ok:!1,message:`You've used your monthly OIOXO allowance. OIOXO Pro is unlimited \u2192 ${Da}`}:{ok:!1,message:"OIOXO could not verify your plan (oioxo.com unreachable). The coding agent is paused until the connection returns."}}var wre,hn,Tm,S_,Da,Pm,zo=mr(()=>{"use strict";wre=vre(_re),hn=process.env.OIOXO_CONTROL_PLANE?.replace(/\/$/,"")||"https://oioxo.com",Tm=process.env.OIOXO_HOME||Im.join(NB.homedir(),".oioxo"),S_=Im.join(Tm,"credentials.json");Da="https://oioxo.com/?upgrade=pro",Pm="Run `oioxo login` in a terminal to connect your OIOXO account."});import KB from"node:os";function HB(t){return t.minFitMB&&t.minFitMB>0?t.minFitMB:t.approxMB}function Zc(){return nh}async function ZB(){let t=GB();try{let e=await fetch(`${hn}/api/models?platform=${t}`,{headers:{"x-oioxo-client":t}});if(!e.ok)return nh;let r=await e.json();r.selection&&(nh=r.selection)}catch{}return nh}function GB(){let t=process.platform;return`cli-${t==="darwin"?"mac":t==="win32"?"windows":"linux"}`}async function one(){try{let{getLlama:t}=await import("node-llama-cpp");return!!(await t()).gpu}catch{return!1}}async function WB(t=()=>{}){let e=GB(),r,n;try{let m=await fetch(`${hn}/api/models?platform=${e}`,{headers:{"x-oioxo-client":e}});if(!m.ok)return null;let y=await m.json();r=y.models??[],n=y.selection??{},nh=n}catch{return null}let s=r.filter(m=>m.kind==="generic"||m.kind==="desktop").sort((m,y)=>m.approxMB-y.approxMB);if(!s.length)return null;let i=KB.totalmem()/1024**3,o=await one(),a=n.budgetFracOfTotalRam??.45,c=n.nativeDesktopCapMB??12e3,u=Math.min(i*1024*a,c);if(n.defaultAssetId){let m=s.find(y=>y.assetId===n.defaultAssetId);if(m&&HB(m)<=u)return{...FB(m),reason:`admin-pinned ${m.name} fits (${VB(i)} RAM, gpu=${o})`}}let l=[...s].reverse().find(m=>HB(m)<=u),d=s.find(m=>m.assetId===n.floorAssetId),f=l??d??s[0],p=l?`largest fitting tier (${VB(i)} RAM \xD7 ${a} \u2192 ${Math.round(u)}MB, gpu=${o})`:`device below floor \u2014 using ${f.name}`;return{...FB(f),reason:p}}function FB(t){return{assetId:t.assetId,name:t.name,manifestUrl:t.manifestUrl,approxMB:t.approxMB}}function VB(t){return`${t.toFixed(1)}GB`}function sk(){let t=KB.totalmem()/1073741824,e=[{gb:2,uri:"hf:Qwen/Qwen2.5-Coder-0.5B-Instruct-GGUF/qwen2.5-coder-0.5b-instruct-q4_k_m.gguf",label:"OIOXO Basic"},{gb:4,uri:"hf:Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF/qwen2.5-coder-1.5b-instruct-q4_k_m.gguf",label:"OIOXO Light"},{gb:10,uri:"hf:Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/qwen2.5-coder-7b-instruct-q4_k_m.gguf",label:"OIOXO Prime"}],r=t*(nh?.budgetFracOfTotalRam??.45),n=e[0];for(let s of e)(s.gb*.45<=r||s.gb<=t*.9)&&(n=s);return t>=16?n=e[2]:t>=6?n=e[1]:n=e[0],{uri:process.env.OIOXO_LOCAL_MODEL||n.uri,label:n.label}}var nh,T_=mr(()=>{"use strict";zo();nh=null});function e$(){return sh}async function t$(){if(QB&&sh)return sh;QB=!0;try{let t=await fetch(`${hn}/api/app-config`);if(!t.ok)return sh;let e=await t.json();e.coder&&(sh=e.coder)}catch{}return sh}var sh,QB,r$=mr(()=>{"use strict";zo();sh=null,QB=!1});function bne(t){let e=t.length%4?"=".repeat(4-t.length%4):"",r=atob(t.replace(/-/g,"+").replace(/_/g,"/")+e),n=new Uint8Array(r.length);for(let s=0;s<r.length;s++)n[s]=r.charCodeAt(s);return n}function n$(t){let e=t.indexOf(".");if(e<1)return null;try{return JSON.parse(xne.decode(bne(t.slice(0,e))))}catch{return null}}var ICe,xne,ok=mr(()=>{"use strict";ICe=new TextEncoder,xne=new TextDecoder});function s$(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}async function _ne(t,e){return crypto.subtle.importKey("raw",ak(t),{name:"AES-GCM"},!1,e)}async function i$(t,e){let r=await crypto.subtle.decrypt({name:"AES-GCM",iv:ak(s$(t.iv))},await _ne(e,["decrypt"]),ak(s$(t.ct)));return new Uint8Array(r)}var OCe,ak,o$=mr(()=>{"use strict";OCe=new TextEncoder,ak=t=>t});function vne(t){let e="";for(let r of t)e+=String.fromCharCode(r);return btoa(e)}function wne(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}async function Sne(){let t=await crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveBits"]),e=new Uint8Array(await crypto.subtle.exportKey("raw",t.publicKey));return{publicKeyB64:vne(e),privateKey:t.privateKey}}async function Ane(t){return crypto.subtle.importKey("raw",c$(wne(t)),{name:"ECDH",namedCurve:"P-256"},!1,[])}async function Ene(t,e,r){let n=new Uint8Array(await crypto.subtle.deriveBits({name:"ECDH",public:await Ane(e)},t,256)),s=await crypto.subtle.importKey("raw",c$(n),"HKDF",!1,["deriveBits"]),i=await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:a$.encode("oioxo:unlock"),info:a$.encode(r)},s,256);return new Uint8Array(i)}async function Cne(t,e,r,n){let s=`${r}|${n}|${e.assetId}|${t.publicKeyB64}|${e.serverPubB64}`,i=await Ene(t.privateKey,e.serverPubB64,s);return i$(e.wrapped,i)}async function u$(t,e){let r=e.fetchImpl??globalThis.fetch,n=await Sne(),s=new AbortController,i=setTimeout(()=>s.abort(),e.timeoutMs??15e3),o;try{o=await r(t,{method:"POST",headers:{"content-type":"application/json",...e.extraHeaders??{}},cache:"no-store",body:JSON.stringify({entitlement:e.entitlement,device:e.device,assetId:e.assetId,clientPubB64:n.publicKeyB64}),signal:s.signal})}catch(c){throw c.name==="AbortError"?new Error("unlock timed out"):c}finally{clearTimeout(i)}if(o.status===403){let c=await o.json().catch(()=>({}));throw new Error("unlock denied: "+(c.reason??"forbidden"))}if(!o.ok)throw new Error("unlock unavailable ("+o.status+")");let a=await o.json();return Cne(n,a,e.sub,e.device)}var a$,c$,l$=mr(()=>{"use strict";o$();ok();a$=new TextEncoder,c$=t=>t});import{homedir as kne}from"node:os";import d$ from"node:path";import{promises as Bm,createReadStream as Tne,createWriteStream as Ine}from"node:fs";import{createHash as f$,createDecipheriv as Pne}from"node:crypto";function One(t,e){return/^https?:\/\//i.test(e)?e:t.slice(0,t.lastIndexOf("/")+1)+e.replace(/^\.?\//,"")}async function h$(t,e){let r=Zc(),n=e??r?.fetchRetryTries??4,s=r?.fetchRetryBackoffMs??600,i;for(let o=0;o<n;o++){try{let a=await fetch(t);if(a.ok)return a;if(i=new Error(`HTTP ${a.status}`),a.status>=400&&a.status<500&&a.status!==429)break}catch(a){i=a}o<n-1&&await new Promise(a=>setTimeout(a,s*(o+1)))}throw new Error(`fetch failed after ${n} tries: ${i instanceof Error?i.message:String(i)}`)}async function Rne(t){let e=await Om(),r=await WC(),n=await fetch(`${hn}/api/entitlement`,{method:"POST",headers:r,body:JSON.stringify({device:e})});if(!n.ok)throw new Error(`entitlement failed (${n.status}) \u2014 sign in with \`oioxo login\`.`);let{entitlement:s}=await n.json(),i=s?n$(s):null;if(!s||!i)throw new Error("could not establish a session");if(!i.sub||i.sub==="anon")throw new Error("this model is Pro-only \u2014 your account did not unlock it (free entitlement).");return u$(`${hn}/api/code-key`,{entitlement:s,sub:i.sub,device:e,assetId:t,extraHeaders:r,timeoutMs:Zc()?.unlockTimeoutMs})}async function p$(t,e,r=()=>{}){let n=d$.join(kne(),".oioxo","models");await Bm.mkdir(n,{recursive:!0});let s=await(await h$(e)).json();if(!s?.chunks?.length||!s.sha256)throw new Error("OIOXO manifest is malformed");let i=d$.join(n,`${t}-${s.release}.gguf`);try{if((await Bm.stat(i)).size===s.totalBytes){let p=f$("sha256"),m=Tne(i);for await(let y of m)p.update(y);if(p.digest("hex")===s.sha256)return r(`\xB7 OIOXO model cached: ${s.fileName}`),i}}catch{}r(`\xB7 unlocking ${t} (device-bound handshake)\u2026`);let o=Buffer.from(await Rne(t)),a=i+".part",c=Ine(a),u=f$("sha256"),l=0,d=[...s.chunks].sort((f,p)=>f.index-p.index);try{for(let f of d){let p=Buffer.from(await(await h$(One(e,f.url))).arrayBuffer()),m=Buffer.from(f.iv,"base64"),y=p.subarray(p.length-16),_=p.subarray(0,p.length-16),S=Pne("aes-256-gcm",o,m);S.setAuthTag(y);let C=Buffer.concat([S.update(_),S.final()]);u.update(C),c.write(C)||await new Promise(E=>c.once("drain",()=>E())),l+=C.byteLength,r(`\xB7 decrypting OIOXO model\u2026 ${Math.round(l/s.totalBytes*100)}%`)}}finally{await new Promise((f,p)=>c.end(m=>m?p(m):f()))}if(l!==s.totalBytes)throw await Bm.rm(a,{force:!0}),new Error("OIOXO assembled size mismatch");if(u.digest("hex")!==s.sha256)throw await Bm.rm(a,{force:!0}),new Error("OIOXO integrity check failed");return await Bm.rename(a,i),r(`\xB7 OIOXO model ready: ${s.fileName} (decrypted, private \u2014 never leaves this machine)`),i}var m$=mr(()=>{"use strict";zo();ok();l$();T_()});var y$={};La(y$,{DeviceCoderLocal:()=>ck});import{homedir as Nne,totalmem as Bne}from"node:os";import g$ from"node:path";import{mkdir as $ne}from"node:fs/promises";function jne(){return e$()?.cliSystemPrompt||Mne}function zne(t){return[`TASK:
4
4
  ${t.task}`,`
5
5
  CONTEXT (OIOXO capsule):
@@ -364,7 +364,7 @@ ${f.map(m=>` ${m}`).join(`
364
364
 
365
365
  IMPORTED BY (changing ${l} may break these):
366
366
  ${p.map(m=>` ${m}`).join(`
367
- `)||" (none \u2014 no in-project callers)"}`)}),e.tool("remember","Save one durable fact about THIS project to .oioxo/memory.md (on-device, shared with the OIOXO IDEs). Use for decisions, conventions, gotchas worth keeping.",{fact:Bf.string().describe("The fact, one concise sentence.")},async({fact:c})=>(await lre(t,c),ja("Saved to .oioxo/memory.md."))),e.tool("recall","This project's rules and learned memory from .oioxo/ (same files the OIOXO IDEs maintain). Call when starting work in an unfamiliar repo.",{},async()=>{let c=TB(await kB(t));return ja(c||"No .oioxo/rules.md or memory.md in this project yet.")});let a=new VC;await e.connect(a)}zo();var PB=(()=>{try{return"0.5.10"}catch{}try{return hre(import.meta.url)("../../package.json").version}catch{return"0.0.0"}})(),FEe=`OIOXO ${PB} \u2014 context engine + terminal coding agent (https://oioxo.com)
367
+ `)||" (none \u2014 no in-project callers)"}`)}),e.tool("remember","Save one durable fact about THIS project to .oioxo/memory.md (on-device, shared with the OIOXO IDEs). Use for decisions, conventions, gotchas worth keeping.",{fact:Bf.string().describe("The fact, one concise sentence.")},async({fact:c})=>(await lre(t,c),ja("Saved to .oioxo/memory.md."))),e.tool("recall","This project's rules and learned memory from .oioxo/ (same files the OIOXO IDEs maintain). Call when starting work in an unfamiliar repo.",{},async()=>{let c=TB(await kB(t));return ja(c||"No .oioxo/rules.md or memory.md in this project yet.")});let a=new VC;await e.connect(a)}zo();var PB=(()=>{try{return"0.5.11"}catch{}try{return hre(import.meta.url)("../../package.json").version}catch{return"0.0.0"}})(),FEe=`OIOXO ${PB} \u2014 context engine + terminal coding agent (https://oioxo.com)
368
368
 
369
369
  Private, on your device. Cut your AI bill by up to ~90% in Copilot, Cursor & Claude,
370
370
  and code from your terminal \u2014 nothing leaves your machine.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oioxo-mcp",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "description": "OIOXO — cut your AI bill by up to ~90%: it feeds Claude Code, Copilot, Cursor and any MCP agent only the relevant slice of your codebase instead of whole files. Also a private terminal coding agent (`oioxo code`, on-device with --local or any key). Runs on your device; your own devices can build together over Wi-Fi.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",