@nilux-ai/code 1.0.10 → 1.0.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 (3) hide show
  1. package/README.md +31 -13
  2. package/dist/cli.js +1 -1
  3. package/package.json +84 -64
package/README.md CHANGED
@@ -3,28 +3,42 @@
3
3
  An AI engineer that lives in your terminal. Nilux reads, writes, runs, and remembers — across
4
4
  sessions — so you can stay on the command line and let it do the work.
5
5
 
6
- ## Install
7
-
8
6
  ```bash
9
7
  npm install -g @nilux-ai/code
8
+ nilux
10
9
  ```
11
10
 
12
11
  Requires Node.js 18 or newer. Works on macOS, Linux, and Windows.
13
12
 
14
- ## Start
13
+ ## What it does
15
14
 
16
- ```bash
17
- nilux
18
- ```
15
+ Describe a task in plain language. Nilux finds the relevant files itself, proposes a change, shows
16
+ you the diff, and applies it once you approve. It runs commands, reads their output, and keeps
17
+ going — the same loop you would run by hand, without the typing.
18
+
19
+ - **Works across the whole project.** It searches and reads before it edits, so a rename reaches
20
+ every call site rather than the one file you had open.
21
+ - **Asks before it acts.** Every file edit and every command is shown first. Four approval modes,
22
+ from confirm-everything to hands-free — `Shift+Tab` cycles between them mid-session.
23
+ - **Remembers your project.** Conventions, decisions and the shape of the codebase survive between
24
+ sessions, so you stop re-explaining the same context every morning.
25
+ - **Delegates.** For wide work it spawns subagents that explore in their own context and report
26
+ back, instead of filling yours with search results.
27
+ - **Connects to your tools.** Any Model Context Protocol server — databases, APIs, cloud consoles —
28
+ becomes available inside the session from one config entry.
29
+
30
+ ## What it costs
19
31
 
20
- On first run it walks you through signing in. From there, just describe what you want done —
21
- Nilux plans it, edits files, runs commands (asking before anything irreversible), and picks up
22
- where you left off next time.
32
+ Pay only for the tokens you use. No seat, no subscription, no minimum.
23
33
 
24
- ## How it costs
34
+ | Model | Input | Output | Context |
35
+ |-------|-------|--------|---------|
36
+ | Nilux Standard | $0.28 / 1M tokens | $0.56 / 1M tokens | 1M |
37
+ | Nilux Pro | $0.87 / 1M tokens | $1.74 / 1M tokens | 1M |
25
38
 
26
- Pay only for what you use no subscription. You top up a balance and each request draws from it
27
- at a clear per-token rate. Check yours any time with `/balance`.
39
+ Repeated context is billed at a small fraction of the input rate, which is most of a long coding
40
+ session. Check your balance any time with `/balance`, or see the live rates and a cost calculator
41
+ at [nilux.dev/pricing](https://nilux.dev/pricing).
28
42
 
29
43
  ## Handy commands
30
44
 
@@ -33,7 +47,10 @@ at a clear per-token rate. Check yours any time with `/balance`.
33
47
  | `/resume` | Continue an earlier conversation |
34
48
  | `/rewind` | Roll back to an earlier point in the session |
35
49
  | `/compact` | Summarise a long conversation to keep it fast and cheap |
36
- | `/mode` | Switch how much Nilux confirms with you, from review-everything to hands-free |
50
+ | `/model` | Switch between Standard and Pro mid-session |
51
+ | `/mcp` | Manage Model Context Protocol servers |
52
+ | `/skills` | List reusable prompts available as slash commands |
53
+ | `/init` | Generate a `nilux.md` with project context for the team |
37
54
  | `/balance` | Show your remaining balance |
38
55
  | `/help` | List everything |
39
56
 
@@ -41,6 +58,7 @@ at a clear per-token rate. Check yours any time with `/balance`.
41
58
 
42
59
  - Website: https://nilux.dev
43
60
  - Docs: https://nilux.dev/docs
61
+ - Quickstart: https://nilux.dev/docs/quickstart
44
62
  - Changelog: https://nilux.dev/changelog
45
63
 
46
64
  ## License
package/dist/cli.js CHANGED
@@ -37,7 +37,7 @@ If installed but not in PATH, set: NILUX_GIT_BASH_PATH=C:\\Program Files\\Git\\b
37
37
 
38
38
  `);w=O.pop()||"";for(let T of O){let S=T.split(`
39
39
  `),g="";for(let h of S)if(h.startsWith("data:")){let m=h.slice(5);g+=(g?`
40
- `:"")+(m.startsWith(" ")?m.slice(1):m)}if(!g)continue;try{let h=JSON.parse(g);if(h.id===H)return Z.cancel(),h;this.emit("message",h)}catch{}}}}finally{Z.releaseLock()}throw Error("SSE stream ended without response")}close(){if(this.sessionId)fetch(this.url,{method:"DELETE",headers:{"Mcp-Session-Id":this.sessionId}}).catch(()=>{});this.connected=!1,this.sessionId=null,this.onClose?.(),this.emit("close")}isConnected(){return this.connected}}});async function rL(C,H){if(C.transport==="sse")return pL(C,H);if(C.transport==="http"||C.transport==="streamable-http")return iL(C,H);if(C.url){if(C.url.startsWith("sse://")||C.url.includes("/sse"))return pL(C,H);if(C.url.startsWith("http://")||C.url.startsWith("https://"))return iL(C,H);throw Error(`Unsupported URL scheme: ${C.url}`)}if(C.command)return xR(C);throw Error("Server config must have either command or url")}var pR=lD(()=>{kR();jR();gR();kR();jR();gR()});import MW from"fs";import hl from"path";import H4A from"os";import J4A from"crypto";function hL(C,H){let Z=JSON.stringify({name:C,url:H});return J4A.createHash("sha256").update(Z).digest("hex").slice(0,16)}function iR(){try{if(MW.existsSync(lL))return JSON.parse(MW.readFileSync(lL,"utf-8"))}catch{}return{}}function nl(C){let H=hl.dirname(lL);if(!MW.existsSync(H))MW.mkdirSync(H,{recursive:!0,mode:448});MW.writeFileSync(lL,JSON.stringify(C,null,2),{encoding:"utf-8",mode:384})}function rR(C){return iR()[C]||null}function nL(C,H){let Z=iR();Z[C]=H,nl(Z)}function fl(C){let H=iR();if(H[C])delete H[C],nl(H)}function fL(C){return C.expiresAt>Date.now()+Z4A}function ol(C){return C.expiresAt<=Date.now()}function lR(C){return!!C.refreshToken}var lL,Z4A=300000;var sl=lD(()=>{lL=hl.join(H4A.homedir(),".nilux","mcp-oauth.json")});import nR from"crypto";import tl from"http";import{execFile as hR}from"child_process";async function dW(C){let H=new URL(C).origin,Z=new URL(C).pathname,Y=[`${H}/.well-known/oauth-authorization-server${Z==="/"?"":Z}`,`${H}/.well-known/oauth-authorization-server`,`${H}/.well-known/openid-configuration`];for(let w of Y)try{let W=await fetch(w,{headers:{"MCP-Protocol-Version":U4A}});if(!W.ok)continue;let y=await W.json();if(y.authorization_endpoint&&y.token_endpoint)return{issuer:y.issuer,authorization_endpoint:y.authorization_endpoint,token_endpoint:y.token_endpoint,registration_endpoint:y.registration_endpoint,revocation_endpoint:y.revocation_endpoint,scopes_supported:y.scopes_supported,response_types_supported:y.response_types_supported,code_challenge_methods_supported:y.code_challenge_methods_supported}}catch{}return null}function $4A(){let C=nR.randomBytes(32).toString("base64url"),Z=nR.createHash("sha256").update(C).digest().toString("base64url");return{codeVerifier:C,codeChallenge:Z}}function Y4A(){return nR.randomUUID()}async function X4A(){return new Promise((C,H)=>{let Z=tl.createServer();Z.listen(0,"127.0.0.1",()=>{let Y=Z.address();if(Y&&typeof Y!=="string"){let w=Y.port;Z.close(()=>C(w))}else Z.close(()=>H(Error("Failed to find available port")))}),Z.on("error",H)})}async function u4A(C){let H,Z,Y=new Promise((y,O)=>{H=y,Z=O}),w=tl.createServer((y,O)=>{if(y.url?.split("?")[0]!=="/callback"){O.writeHead(404),O.end("Not found");return}let S=new URL(y.url,`http://localhost:${C}`),g=S.searchParams.get("code"),h=S.searchParams.get("state"),m=S.searchParams.get("error");if(m){O.writeHead(200,{"Content-Type":"text/html"}),O.end("<html><body><h1>Authorization failed</h1><p>You can close this tab.</p></body></html>"),Z(Error(`OAuth error: ${m}`));return}if(!g||!h){O.writeHead(400,{"Content-Type":"text/html"}),O.end("<html><body><h1>Missing parameters</h1></body></html>");return}O.writeHead(200,{"Content-Type":"text/html"}),O.end("<html><body><h1>Authorization successful!</h1><p>You can close this tab and return to the terminal.</p></body></html>"),H({code:g,state:h})});return w.listen(C,"127.0.0.1"),{promise:Y,stop:()=>{try{w.close()}catch{}Z(Error("Callback server stopped"))}}}function z4A(C,H,Z,Y,w,W){let y=new URLSearchParams({response_type:"code",client_id:H,redirect_uri:Z,code_challenge:Y,code_challenge_method:"S256",state:w});if(W&&W.length>0)y.set("scope",W.join(" "));return`${C.authorization_endpoint}?${y.toString()}`}async function w4A(C,H,Z,Y,w,W){let y=new URLSearchParams({grant_type:"authorization_code",code:H,redirect_uri:Y,client_id:w,code_verifier:Z}),O={"Content-Type":"application/x-www-form-urlencoded"};if(W)O.Authorization="Basic "+Buffer.from(`${w}:${W}`).toString("base64");let T=await fetch(C.token_endpoint,{method:"POST",headers:O,body:y.toString()});if(!T.ok){let h=await T.text();throw Error(`Token exchange failed (${T.status}): ${h}`)}let S=await T.json(),g=typeof S.expires_in==="number"&&S.expires_in>0?S.expires_in:3600;return{accessToken:S.access_token,refreshToken:S.refresh_token,expiresAt:Date.now()+g*1000,scope:S.scope,clientId:w,clientSecret:W}}async function fR(C,H,Z,Y){let w=new URLSearchParams({grant_type:"refresh_token",refresh_token:H,client_id:Z}),W={"Content-Type":"application/x-www-form-urlencoded"};if(Y)W.Authorization="Basic "+Buffer.from(`${Z}:${Y}`).toString("base64");let y=await fetch(C.token_endpoint,{method:"POST",headers:W,body:w.toString()});if(!y.ok){let S=await y.text();throw Error(`Token refresh failed (${y.status}): ${S}`)}let O=await y.json(),T=typeof O.expires_in==="number"&&O.expires_in>0?O.expires_in:3600;return{accessToken:O.access_token,refreshToken:O.refresh_token||H,expiresAt:Date.now()+T*1000,scope:O.scope,clientId:Z,clientSecret:Y}}async function W4A(C,H,Z="Nilux AI CLI"){if(!C.registration_endpoint)throw Error("Server does not support dynamic client registration");let Y=await fetch(C.registration_endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_name:Z,redirect_uris:[H],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none"})});if(!Y.ok){let W=await Y.text();throw Error(`Client registration failed (${Y.status}): ${W}`)}let w=await Y.json();return{clientId:w.client_id,clientSecret:w.client_secret}}function V4A(C){let H=(Z)=>{if(Z)console.error("Failed to open browser:",Z.message)};if(process.platform==="win32")hR("rundll32",["url.dll,FileProtocolHandler",C],H);else if(process.platform==="darwin")hR("open",[C],H);else hR("xdg-open",[C],H)}async function Ml(C,H,Z){let Y=await dW(C);if(!Y)throw Error(`OAuth discovery failed for ${C} — no .well-known/oauth-authorization-server found`);let w=await X4A(),W=`http://localhost:${w}/callback`,y,O;if(Y.registration_endpoint){let e=await W4A(Y,W,`Nilux AI — ${H}`);y=e.clientId,O=e.clientSecret}else y="nilux-ai-cli";let{codeVerifier:T,codeChallenge:S}=$4A(),g=Y4A(),h=z4A(Y,y,W,S,g,Z),{promise:m,stop:d}=await u4A(w);V4A(h);try{let e=await Promise.race([m,new Promise((BA,UA)=>setTimeout(()=>UA(Error("OAuth callback timed out after 5 minutes")),300000))]);if(e.state!==g)throw Error("OAuth state mismatch — possible CSRF attack");return{tokens:await w4A(Y,e.code,T,W,y,O),metadata:Y}}finally{d()}}var U4A="2025-03-26";var dl=()=>{};import{EventEmitter as q4A}from"events";function oL(){return++y4A}function M5(){if(!oR)oR=new sL;return oR}async function cl(){let C=M5();return await C.initialize(),C}var y4A=0,sL,oR=null;var bl=lD(()=>{pR();PR();sl();dl();sL=class sL extends q4A{connections=new Map;serverStates=new Map;reconnectAttempts=new Map;intentionalDisconnect=new Set;constructor(){super()}async initialize(C=!0){let H=await au();for(let[Z,Y]of Object.entries(H))this.serverStates.set(Z,{name:Z,config:Y,status:Y.disabled?"disabled":"not-started",tools:[]});if(C)await this.connectAll()}async connectAll(){let C=[];for(let[H,Z]of this.serverStates)if(Z.status==="not-started"&&!Z.config.disabled)C.push(this.connect(H).catch(()=>{}));await Promise.allSettled(C)}async connect(C){if(!this.serverStates.get(C)){let Y=await vY(C);if(!Y)throw Error(`Server ${C} not found`);this.serverStates.set(C,{name:C,config:Y,status:"not-started",tools:[]})}let Z=this.serverStates.get(C);if(Z.config.disabled)return Z.status="disabled",!1;Z.status="pending",this.emit("status-change",C,"pending");try{let Y=await this.resolveAuthProvider(C,Z.config);if(Y==="needs-auth")return Z.status="needs-auth",this.emit("status-change",C,"needs-auth"),!1;let w=await rL(Z.config,Y||void 0);w.onError=(y)=>{this.handleDisconnect(C,y)},w.onClose=()=>{this.handleDisconnect(C)};let W={serverName:C,transport:w,status:"connected"};return this.connections.set(C,W),await this.initializeProtocol(C),await this.loadTools(C),Z.status="connected",Z.error=void 0,Z.lastConnected=Date.now(),this.reconnectAttempts.delete(C),this.emit("status-change",C,"connected"),!0}catch(Y){return Z.status="failed",Z.error=Y.message,this.emit("status-change",C,"failed",Y),!1}}async resolveAuthProvider(C,H){if(!H.url)return null;let Z=hL(C,H.url),Y=rR(Z),w=null;if(!Y){if(w=await dW(H.url).catch(()=>null),!w)return null}if(Y&&fL(Y))return this.buildAuthProvider(Z,Y,H.url);if(Y&&!fL(Y)&&lR(Y))try{if(!w)w=await dW(H.url);if(w&&Y.refreshToken){let W=await fR(w,Y.refreshToken,Y.clientId||"nilux-ai-cli",Y.clientSecret);return nL(Z,W),this.buildAuthProvider(Z,W,H.url)}}catch{}return"needs-auth"}async authenticate(C){let H=this.serverStates.get(C);if(!H?.config.url)return!1;try{let Z=await Ml(H.config.url,C),Y=hL(C,H.config.url);return nL(Y,Z.tokens),this.connect(C)}catch(Z){return!1}}buildAuthProvider(C,H,Z){let Y=H,w=null;return{async getToken(){if(ol(Y))return null;return Y.accessToken},async refreshIfNeeded(){if(fL(Y))return!0;if(!lR(Y)||!Y.refreshToken)return!1;if(w)return w;return w=(async()=>{try{let W=await dW(Z);if(!W)return!1;let y=await fR(W,Y.refreshToken,Y.clientId||"nilux-ai-cli",Y.clientSecret);return Y=y,nL(C,y),!0}catch{return!1}finally{w=null}})(),w}}}async initializeProtocol(C){let H=await this.request(C,{jsonrpc:"2.0",id:oL(),method:"initialize",params:{protocolVersion:"2024-11-05",capabilities:{tools:{}},clientInfo:{name:"nilux-ai",version:"1.0.0"}}});if(H.error)throw Error(`Initialize failed: ${H.error.message}`);await this.notify(C,{jsonrpc:"2.0",id:oL(),method:"notifications/initialized"})}async loadTools(C){let H=await this.request(C,{jsonrpc:"2.0",id:oL(),method:"tools/list"});if(H.error)throw Error(`Failed to load tools: ${H.error.message}`);let Y=(H.result.tools||[]).map((W)=>({...W,serverName:C,originalName:W.name,fullName:`mcp__${C}__${W.name}`})),w=this.serverStates.get(C);if(w)w.tools=Y;return this.emit("tools-loaded",C,Y),Y}async request(C,H){let Z=this.connections.get(C);if(!Z)throw Error(`Not connected to server ${C}`);return Z.transport.send(H)}async notify(C,H){let Z=this.connections.get(C);if(!Z)throw Error(`Not connected to server ${C}`);Z.transport.send(H).catch(()=>{})}async callTool(C,H,Z){let Y=await this.request(C,{jsonrpc:"2.0",id:oL(),method:"tools/call",params:{name:H,arguments:Z}});if(Y.error)return{content:[{type:"text",text:`Error: ${Y.error.message}`}],isError:!0};return Y.result}async callToolByFullName(C,H){let Z=C.split("__");if(Z.length!==3||Z[0]!=="mcp")throw Error(`Invalid MCP tool name: ${C}`);let Y=Z[1],w=Z[2];return this.callTool(Y,w,H)}handleDisconnect(C,H){let Z=this.serverStates.get(C);if(Z)Z.status="failed",Z.error=H?.message;if(this.connections.delete(C),this.emit("disconnected",C,H),this.intentionalDisconnect.has(C)){this.intentionalDisconnect.delete(C);return}this.scheduleReconnect(C)}scheduleReconnect(C){if(this.serverStates.get(C)?.config.disabled)return;let Z=this.reconnectAttempts.get(C)||0;if(Z>=5)return;let Y=Math.min(1000*Math.pow(2,Z),30000);this.reconnectAttempts.set(C,Z+1),setTimeout(()=>{this.connect(C).catch(()=>{})},Y)}disconnect(C){this.reconnectAttempts.delete(C),this.intentionalDisconnect.add(C);let H=this.connections.get(C);if(H)H.transport.close(),this.connections.delete(C);let Z=this.serverStates.get(C);if(Z){let Y=!1;if(Z.config.url){let w=hL(C,Z.config.url);if(rR(w))fl(w),Y=!0}Z.status=Y?"needs-auth":"not-started",Z.tools=[]}this.emit("status-change",C,Z?.status||"not-started")}setDisabled(C,H){let Z=this.serverStates.get(C);if(!Z)return;if(Z.config.disabled=H,H)this.disconnect(C),Z.status="disabled",this.emit("status-change",C,"disabled");else Z.status="not-started",this.emit("status-change",C,"not-started");gL(C).then((Y)=>{if(Y)mL(C,!H,Y).catch(()=>{})}).catch(()=>{})}async reconnect(C){return this.disconnect(C),this.reconnectAttempts.delete(C),this.connect(C)}getServerStates(){return Array.from(this.serverStates.values())}getServerState(C){return this.serverStates.get(C)}getAllTools(){let C=[];for(let H of this.serverStates.values())if(H.status==="connected")C.push(...H.tools);return C}getTools(C){return this.serverStates.get(C)?.tools||[]}findTool(C){for(let H of this.serverStates.values()){let Z=H.tools.find((Y)=>Y.fullName===C);if(Z)return Z}return}searchTools(C){let H=C.toLowerCase();return this.getAllTools().filter((Z)=>Z.name.toLowerCase().includes(H)||Z.description.toLowerCase().includes(H))}isConnected(C){return this.connections.has(C)}disconnectAll(){for(let C of this.connections.keys())this.disconnect(C)}}});var el={};K8(el,{updateMcpServer:()=>OR,setMcpServerEnabled:()=>mL,removeMcpServer:()=>jL,mcpServerExists:()=>il,initializeMcp:()=>cl,getMcpServersByScope:()=>pl,getMcpServerScope:()=>gL,getMcpServer:()=>vY,getMcpClient:()=>M5,getAllMcpServers:()=>au,createTransport:()=>rL,addMcpServer:()=>oW,MCP_TIMEOUT:()=>t6A,MCP_MAX_RECONNECT_DELAY:()=>c6A,MCP_MAX_RECONNECT_ATTEMPTS:()=>b6A,MCP_MAX_OUTPUT_TOKENS:()=>e6A,MCP_INIT_TIMEOUT:()=>M6A,MCP_INITIAL_RECONNECT_DELAY:()=>d6A,MCPClient:()=>sL});var KY=lD(()=>{PR();bl();pR()});var sR;var al=lD(()=>{sR={name:"@nilux-ai/code",version:"1.0.10",description:"An AI engineer that lives in your terminal — reads, writes, runs, and remembers across sessions.",type:"module",main:"dist/cli.js",bin:{nilux:"dist/cli.js"},scripts:{dev:"tsx src/cli-entry.ts",build:"rm -rf dist && bun build src/cli-entry.ts --outfile dist/cli.js --target node --minify --external @vscode/ripgrep --external koffi",check:"tsc --noEmit"},files:["dist"],dependencies:{"@vscode/ripgrep":"^1.17.0",koffi:"^3.1.0"},devDependencies:{"@types/diff-match-patch":"^1.0.36","@types/node":"^24.3.0","@types/react":"^19.2.7","@types/react-reconciler":"^0.33.0","@types/ws":"^8.18.1","@vscode/ripgrep":"^1.17.0",chokidar:"^3.5.3",commander:"^14.0.2","diff-match-patch":"^1.0.5","eventsource-parser":"^3.0.6","find-up":"^7.0.0",glob:"^10.3.0","highlight.js":"^11.11.1",ink:"^6.6.0","ink-spinner":"^5.0.0","ink-text-input":"^6.0.0",react:"^19.2.3","react-devtools-core":"^6.1.5","react-reconciler":"^0.33.0",semidown:"^0.0.3","sql.js":"^1.14.1",tsx:"^4.20.5",typescript:"^5.9.2","web-tree-sitter":"^0.26.8",ws:"^8.17.0"},engines:{node:">=18.0.0"},keywords:["ai","code-assistant","cli","nilux"],author:"Nilux",license:"Apache-2.0",homepage:"https://nilux.dev",bugs:{url:"https://nilux.dev/feedback"}}});var xF,TY;var cW=lD(()=>{al();xF=sR.version,TY=sR.name});var IQ=DD((O4A,tL)=>{(function(){function C(SA,$D){Object.defineProperty(Y.prototype,SA,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",$D[0],$D[1])}})}function H(SA){if(SA===null||typeof SA!=="object")return null;return SA=UB&&SA[UB]||SA["@@iterator"],typeof SA==="function"?SA:null}function Z(SA,$D){SA=(SA=SA.constructor)&&(SA.displayName||SA.name)||"ReactClass";var vD=SA+"."+$D;fD[vD]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",$D,SA),fD[vD]=!0)}function Y(SA,$D,vD){this.props=SA,this.context=$D,this.refs=hB,this.updater=vD||AB}function w(){}function W(SA,$D,vD){this.props=SA,this.context=$D,this.refs=hB,this.updater=vD||AB}function y(){}function O(SA){return""+SA}function T(SA){try{O(SA);var $D=!1}catch(J_){$D=!0}if($D){$D=console;var vD=$D.error,vB=typeof Symbol==="function"&&Symbol.toStringTag&&SA[Symbol.toStringTag]||SA.constructor.name||"Object";return vD.call($D,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",vB),O(SA)}}function S(SA){if(SA==null)return null;if(typeof SA==="function")return SA.$$typeof===PB?null:SA.displayName||SA.name||null;if(typeof SA==="string")return SA;switch(SA){case XD:return"Fragment";case uD:return"Profiler";case cD:return"StrictMode";case HD:return"Suspense";case qD:return"SuspenseList";case ND:return"Activity"}if(typeof SA==="object")switch(typeof SA.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),SA.$$typeof){case oA:return"Portal";case mA:return SA.displayName||"Context";case gA:return(SA._context.displayName||"Context")+".Consumer";case BD:var $D=SA.render;return SA=SA.displayName,SA||(SA=$D.displayName||$D.name||"",SA=SA!==""?"ForwardRef("+SA+")":"ForwardRef"),SA;case SD:return $D=SA.displayName||null,$D!==null?$D:S(SA.type)||"Memo";case IB:$D=SA._payload,SA=SA._init;try{return S(SA($D))}catch(vD){}}return null}function g(SA){if(SA===XD)return"<>";if(typeof SA==="object"&&SA!==null&&SA.$$typeof===IB)return"<...>";try{var $D=S(SA);return $D?"<"+$D+">":"<...>"}catch(vD){return"<...>"}}function h(){var SA=oD.A;return SA===null?null:SA.getOwner()}function m(){return Error("react-stack-top-frame")}function d(SA){if(c_.call(SA,"key")){var $D=Object.getOwnPropertyDescriptor(SA,"key").get;if($D&&$D.isReactWarning)return!1}return SA.key!==void 0}function e(SA,$D){function vD(){gB||(gB=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",$D))}vD.isReactWarning=!0,Object.defineProperty(SA,"key",{get:vD,configurable:!0})}function b(){var SA=S(this.type);return JQ[SA]||(JQ[SA]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),SA=this.props.ref,SA!==void 0?SA:null}function BA(SA,$D,vD,vB,J_,b_){var a_=vD.ref;return SA={$$typeof:eA,type:SA,key:$D,props:vD,_owner:vB},(a_!==void 0?a_:null)!==null?Object.defineProperty(SA,"ref",{enumerable:!1,get:b}):Object.defineProperty(SA,"ref",{enumerable:!1,value:null}),SA._store={},Object.defineProperty(SA._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(SA,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(SA,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:J_}),Object.defineProperty(SA,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:b_}),Object.freeze&&(Object.freeze(SA.props),Object.freeze(SA)),SA}function UA(SA,$D){return $D=BA(SA.type,$D,SA.props,SA._owner,SA._debugStack,SA._debugTask),SA._store&&($D._store.validated=SA._store.validated),$D}function FA(SA){VA(SA)?SA._store&&(SA._store.validated=1):typeof SA==="object"&&SA!==null&&SA.$$typeof===IB&&(SA._payload.status==="fulfilled"?VA(SA._payload.value)&&SA._payload.value._store&&(SA._payload.value._store.validated=1):SA._store&&(SA._store.validated=1))}function VA(SA){return typeof SA==="object"&&SA!==null&&SA.$$typeof===eA}function $A(SA){var $D={"=":"=0",":":"=2"};return"$"+SA.replace(/[=:]/g,function(vD){return $D[vD]})}function rA(SA,$D){return typeof SA==="object"&&SA!==null&&SA.key!=null?(T(SA.key),$A(""+SA.key)):$D.toString(36)}function RA(SA){switch(SA.status){case"fulfilled":return SA.value;case"rejected":throw SA.reason;default:switch(typeof SA.status==="string"?SA.then(y,y):(SA.status="pending",SA.then(function($D){SA.status==="pending"&&(SA.status="fulfilled",SA.value=$D)},function($D){SA.status==="pending"&&(SA.status="rejected",SA.reason=$D)})),SA.status){case"fulfilled":return SA.value;case"rejected":throw SA.reason}}throw SA}function PA(SA,$D,vD,vB,J_){var b_=typeof SA;if(b_==="undefined"||b_==="boolean")SA=null;var a_=!1;if(SA===null)a_=!0;else switch(b_){case"bigint":case"string":case"number":a_=!0;break;case"object":switch(SA.$$typeof){case eA:case oA:a_=!0;break;case IB:return a_=SA._init,PA(a_(SA._payload),$D,vD,vB,J_)}}if(a_){a_=SA,J_=J_(a_);var F0=vB===""?"."+rA(a_,0):vB;return hD(J_)?(vD="",F0!=null&&(vD=F0.replace(k_,"$&/")+"/"),PA(J_,$D,vD,"",function(fI){return fI})):J_!=null&&(VA(J_)&&(J_.key!=null&&(a_&&a_.key===J_.key||T(J_.key)),vD=UA(J_,vD+(J_.key==null||a_&&a_.key===J_.key?"":(""+J_.key).replace(k_,"$&/")+"/")+F0),vB!==""&&a_!=null&&VA(a_)&&a_.key==null&&a_._store&&!a_._store.validated&&(vD._store.validated=2),J_=vD),$D.push(J_)),1}if(a_=0,F0=vB===""?".":vB+":",hD(SA))for(var LQ=0;LQ<SA.length;LQ++)vB=SA[LQ],b_=F0+rA(vB,LQ),a_+=PA(vB,$D,vD,b_,J_);else if(LQ=H(SA),typeof LQ==="function")for(LQ===SA.entries&&(dB||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),dB=!0),SA=LQ.call(SA),LQ=0;!(vB=SA.next()).done;)vB=vB.value,b_=F0+rA(vB,LQ++),a_+=PA(vB,$D,vD,b_,J_);else if(b_==="object"){if(typeof SA.then==="function")return PA(RA(SA),$D,vD,vB,J_);throw $D=String(SA),Error("Objects are not valid as a React child (found: "+($D==="[object Object]"?"object with keys {"+Object.keys(SA).join(", ")+"}":$D)+"). If you meant to render a collection of children, use an array instead.")}return a_}function wA(SA,$D,vD){if(SA==null)return SA;var vB=[],J_=0;return PA(SA,vB,"","",function(b_){return $D.call(vD,b_,J_++)}),vB}function ZA(SA){if(SA._status===-1){var $D=SA._ioInfo;$D!=null&&($D.start=$D.end=performance.now()),$D=SA._result;var vD=$D();if(vD.then(function(J_){if(SA._status===0||SA._status===-1){SA._status=1,SA._result=J_;var b_=SA._ioInfo;b_!=null&&(b_.end=performance.now()),vD.status===void 0&&(vD.status="fulfilled",vD.value=J_)}},function(J_){if(SA._status===0||SA._status===-1){SA._status=2,SA._result=J_;var b_=SA._ioInfo;b_!=null&&(b_.end=performance.now()),vD.status===void 0&&(vD.status="rejected",vD.reason=J_)}}),$D=SA._ioInfo,$D!=null){$D.value=vD;var vB=vD.displayName;typeof vB==="string"&&($D.name=vB)}SA._status===-1&&(SA._status=0,SA._result=vD)}if(SA._status===1)return $D=SA._result,$D===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
40
+ `:"")+(m.startsWith(" ")?m.slice(1):m)}if(!g)continue;try{let h=JSON.parse(g);if(h.id===H)return Z.cancel(),h;this.emit("message",h)}catch{}}}}finally{Z.releaseLock()}throw Error("SSE stream ended without response")}close(){if(this.sessionId)fetch(this.url,{method:"DELETE",headers:{"Mcp-Session-Id":this.sessionId}}).catch(()=>{});this.connected=!1,this.sessionId=null,this.onClose?.(),this.emit("close")}isConnected(){return this.connected}}});async function rL(C,H){if(C.transport==="sse")return pL(C,H);if(C.transport==="http"||C.transport==="streamable-http")return iL(C,H);if(C.url){if(C.url.startsWith("sse://")||C.url.includes("/sse"))return pL(C,H);if(C.url.startsWith("http://")||C.url.startsWith("https://"))return iL(C,H);throw Error(`Unsupported URL scheme: ${C.url}`)}if(C.command)return xR(C);throw Error("Server config must have either command or url")}var pR=lD(()=>{kR();jR();gR();kR();jR();gR()});import MW from"fs";import hl from"path";import H4A from"os";import J4A from"crypto";function hL(C,H){let Z=JSON.stringify({name:C,url:H});return J4A.createHash("sha256").update(Z).digest("hex").slice(0,16)}function iR(){try{if(MW.existsSync(lL))return JSON.parse(MW.readFileSync(lL,"utf-8"))}catch{}return{}}function nl(C){let H=hl.dirname(lL);if(!MW.existsSync(H))MW.mkdirSync(H,{recursive:!0,mode:448});MW.writeFileSync(lL,JSON.stringify(C,null,2),{encoding:"utf-8",mode:384})}function rR(C){return iR()[C]||null}function nL(C,H){let Z=iR();Z[C]=H,nl(Z)}function fl(C){let H=iR();if(H[C])delete H[C],nl(H)}function fL(C){return C.expiresAt>Date.now()+Z4A}function ol(C){return C.expiresAt<=Date.now()}function lR(C){return!!C.refreshToken}var lL,Z4A=300000;var sl=lD(()=>{lL=hl.join(H4A.homedir(),".nilux","mcp-oauth.json")});import nR from"crypto";import tl from"http";import{execFile as hR}from"child_process";async function dW(C){let H=new URL(C).origin,Z=new URL(C).pathname,Y=[`${H}/.well-known/oauth-authorization-server${Z==="/"?"":Z}`,`${H}/.well-known/oauth-authorization-server`,`${H}/.well-known/openid-configuration`];for(let w of Y)try{let W=await fetch(w,{headers:{"MCP-Protocol-Version":U4A}});if(!W.ok)continue;let y=await W.json();if(y.authorization_endpoint&&y.token_endpoint)return{issuer:y.issuer,authorization_endpoint:y.authorization_endpoint,token_endpoint:y.token_endpoint,registration_endpoint:y.registration_endpoint,revocation_endpoint:y.revocation_endpoint,scopes_supported:y.scopes_supported,response_types_supported:y.response_types_supported,code_challenge_methods_supported:y.code_challenge_methods_supported}}catch{}return null}function $4A(){let C=nR.randomBytes(32).toString("base64url"),Z=nR.createHash("sha256").update(C).digest().toString("base64url");return{codeVerifier:C,codeChallenge:Z}}function Y4A(){return nR.randomUUID()}async function X4A(){return new Promise((C,H)=>{let Z=tl.createServer();Z.listen(0,"127.0.0.1",()=>{let Y=Z.address();if(Y&&typeof Y!=="string"){let w=Y.port;Z.close(()=>C(w))}else Z.close(()=>H(Error("Failed to find available port")))}),Z.on("error",H)})}async function u4A(C){let H,Z,Y=new Promise((y,O)=>{H=y,Z=O}),w=tl.createServer((y,O)=>{if(y.url?.split("?")[0]!=="/callback"){O.writeHead(404),O.end("Not found");return}let S=new URL(y.url,`http://localhost:${C}`),g=S.searchParams.get("code"),h=S.searchParams.get("state"),m=S.searchParams.get("error");if(m){O.writeHead(200,{"Content-Type":"text/html"}),O.end("<html><body><h1>Authorization failed</h1><p>You can close this tab.</p></body></html>"),Z(Error(`OAuth error: ${m}`));return}if(!g||!h){O.writeHead(400,{"Content-Type":"text/html"}),O.end("<html><body><h1>Missing parameters</h1></body></html>");return}O.writeHead(200,{"Content-Type":"text/html"}),O.end("<html><body><h1>Authorization successful!</h1><p>You can close this tab and return to the terminal.</p></body></html>"),H({code:g,state:h})});return w.listen(C,"127.0.0.1"),{promise:Y,stop:()=>{try{w.close()}catch{}Z(Error("Callback server stopped"))}}}function z4A(C,H,Z,Y,w,W){let y=new URLSearchParams({response_type:"code",client_id:H,redirect_uri:Z,code_challenge:Y,code_challenge_method:"S256",state:w});if(W&&W.length>0)y.set("scope",W.join(" "));return`${C.authorization_endpoint}?${y.toString()}`}async function w4A(C,H,Z,Y,w,W){let y=new URLSearchParams({grant_type:"authorization_code",code:H,redirect_uri:Y,client_id:w,code_verifier:Z}),O={"Content-Type":"application/x-www-form-urlencoded"};if(W)O.Authorization="Basic "+Buffer.from(`${w}:${W}`).toString("base64");let T=await fetch(C.token_endpoint,{method:"POST",headers:O,body:y.toString()});if(!T.ok){let h=await T.text();throw Error(`Token exchange failed (${T.status}): ${h}`)}let S=await T.json(),g=typeof S.expires_in==="number"&&S.expires_in>0?S.expires_in:3600;return{accessToken:S.access_token,refreshToken:S.refresh_token,expiresAt:Date.now()+g*1000,scope:S.scope,clientId:w,clientSecret:W}}async function fR(C,H,Z,Y){let w=new URLSearchParams({grant_type:"refresh_token",refresh_token:H,client_id:Z}),W={"Content-Type":"application/x-www-form-urlencoded"};if(Y)W.Authorization="Basic "+Buffer.from(`${Z}:${Y}`).toString("base64");let y=await fetch(C.token_endpoint,{method:"POST",headers:W,body:w.toString()});if(!y.ok){let S=await y.text();throw Error(`Token refresh failed (${y.status}): ${S}`)}let O=await y.json(),T=typeof O.expires_in==="number"&&O.expires_in>0?O.expires_in:3600;return{accessToken:O.access_token,refreshToken:O.refresh_token||H,expiresAt:Date.now()+T*1000,scope:O.scope,clientId:Z,clientSecret:Y}}async function W4A(C,H,Z="Nilux AI CLI"){if(!C.registration_endpoint)throw Error("Server does not support dynamic client registration");let Y=await fetch(C.registration_endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_name:Z,redirect_uris:[H],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none"})});if(!Y.ok){let W=await Y.text();throw Error(`Client registration failed (${Y.status}): ${W}`)}let w=await Y.json();return{clientId:w.client_id,clientSecret:w.client_secret}}function V4A(C){let H=(Z)=>{if(Z)console.error("Failed to open browser:",Z.message)};if(process.platform==="win32")hR("rundll32",["url.dll,FileProtocolHandler",C],H);else if(process.platform==="darwin")hR("open",[C],H);else hR("xdg-open",[C],H)}async function Ml(C,H,Z){let Y=await dW(C);if(!Y)throw Error(`OAuth discovery failed for ${C} — no .well-known/oauth-authorization-server found`);let w=await X4A(),W=`http://localhost:${w}/callback`,y,O;if(Y.registration_endpoint){let e=await W4A(Y,W,`Nilux AI — ${H}`);y=e.clientId,O=e.clientSecret}else y="nilux-ai-cli";let{codeVerifier:T,codeChallenge:S}=$4A(),g=Y4A(),h=z4A(Y,y,W,S,g,Z),{promise:m,stop:d}=await u4A(w);V4A(h);try{let e=await Promise.race([m,new Promise((BA,UA)=>setTimeout(()=>UA(Error("OAuth callback timed out after 5 minutes")),300000))]);if(e.state!==g)throw Error("OAuth state mismatch — possible CSRF attack");return{tokens:await w4A(Y,e.code,T,W,y,O),metadata:Y}}finally{d()}}var U4A="2025-03-26";var dl=()=>{};import{EventEmitter as q4A}from"events";function oL(){return++y4A}function M5(){if(!oR)oR=new sL;return oR}async function cl(){let C=M5();return await C.initialize(),C}var y4A=0,sL,oR=null;var bl=lD(()=>{pR();PR();sl();dl();sL=class sL extends q4A{connections=new Map;serverStates=new Map;reconnectAttempts=new Map;intentionalDisconnect=new Set;constructor(){super()}async initialize(C=!0){let H=await au();for(let[Z,Y]of Object.entries(H))this.serverStates.set(Z,{name:Z,config:Y,status:Y.disabled?"disabled":"not-started",tools:[]});if(C)await this.connectAll()}async connectAll(){let C=[];for(let[H,Z]of this.serverStates)if(Z.status==="not-started"&&!Z.config.disabled)C.push(this.connect(H).catch(()=>{}));await Promise.allSettled(C)}async connect(C){if(!this.serverStates.get(C)){let Y=await vY(C);if(!Y)throw Error(`Server ${C} not found`);this.serverStates.set(C,{name:C,config:Y,status:"not-started",tools:[]})}let Z=this.serverStates.get(C);if(Z.config.disabled)return Z.status="disabled",!1;Z.status="pending",this.emit("status-change",C,"pending");try{let Y=await this.resolveAuthProvider(C,Z.config);if(Y==="needs-auth")return Z.status="needs-auth",this.emit("status-change",C,"needs-auth"),!1;let w=await rL(Z.config,Y||void 0);w.onError=(y)=>{this.handleDisconnect(C,y)},w.onClose=()=>{this.handleDisconnect(C)};let W={serverName:C,transport:w,status:"connected"};return this.connections.set(C,W),await this.initializeProtocol(C),await this.loadTools(C),Z.status="connected",Z.error=void 0,Z.lastConnected=Date.now(),this.reconnectAttempts.delete(C),this.emit("status-change",C,"connected"),!0}catch(Y){return Z.status="failed",Z.error=Y.message,this.emit("status-change",C,"failed",Y),!1}}async resolveAuthProvider(C,H){if(!H.url)return null;let Z=hL(C,H.url),Y=rR(Z),w=null;if(!Y){if(w=await dW(H.url).catch(()=>null),!w)return null}if(Y&&fL(Y))return this.buildAuthProvider(Z,Y,H.url);if(Y&&!fL(Y)&&lR(Y))try{if(!w)w=await dW(H.url);if(w&&Y.refreshToken){let W=await fR(w,Y.refreshToken,Y.clientId||"nilux-ai-cli",Y.clientSecret);return nL(Z,W),this.buildAuthProvider(Z,W,H.url)}}catch{}return"needs-auth"}async authenticate(C){let H=this.serverStates.get(C);if(!H?.config.url)return!1;try{let Z=await Ml(H.config.url,C),Y=hL(C,H.config.url);return nL(Y,Z.tokens),this.connect(C)}catch(Z){return!1}}buildAuthProvider(C,H,Z){let Y=H,w=null;return{async getToken(){if(ol(Y))return null;return Y.accessToken},async refreshIfNeeded(){if(fL(Y))return!0;if(!lR(Y)||!Y.refreshToken)return!1;if(w)return w;return w=(async()=>{try{let W=await dW(Z);if(!W)return!1;let y=await fR(W,Y.refreshToken,Y.clientId||"nilux-ai-cli",Y.clientSecret);return Y=y,nL(C,y),!0}catch{return!1}finally{w=null}})(),w}}}async initializeProtocol(C){let H=await this.request(C,{jsonrpc:"2.0",id:oL(),method:"initialize",params:{protocolVersion:"2024-11-05",capabilities:{tools:{}},clientInfo:{name:"nilux-ai",version:"1.0.0"}}});if(H.error)throw Error(`Initialize failed: ${H.error.message}`);await this.notify(C,{jsonrpc:"2.0",id:oL(),method:"notifications/initialized"})}async loadTools(C){let H=await this.request(C,{jsonrpc:"2.0",id:oL(),method:"tools/list"});if(H.error)throw Error(`Failed to load tools: ${H.error.message}`);let Y=(H.result.tools||[]).map((W)=>({...W,serverName:C,originalName:W.name,fullName:`mcp__${C}__${W.name}`})),w=this.serverStates.get(C);if(w)w.tools=Y;return this.emit("tools-loaded",C,Y),Y}async request(C,H){let Z=this.connections.get(C);if(!Z)throw Error(`Not connected to server ${C}`);return Z.transport.send(H)}async notify(C,H){let Z=this.connections.get(C);if(!Z)throw Error(`Not connected to server ${C}`);Z.transport.send(H).catch(()=>{})}async callTool(C,H,Z){let Y=await this.request(C,{jsonrpc:"2.0",id:oL(),method:"tools/call",params:{name:H,arguments:Z}});if(Y.error)return{content:[{type:"text",text:`Error: ${Y.error.message}`}],isError:!0};return Y.result}async callToolByFullName(C,H){let Z=C.split("__");if(Z.length!==3||Z[0]!=="mcp")throw Error(`Invalid MCP tool name: ${C}`);let Y=Z[1],w=Z[2];return this.callTool(Y,w,H)}handleDisconnect(C,H){let Z=this.serverStates.get(C);if(Z)Z.status="failed",Z.error=H?.message;if(this.connections.delete(C),this.emit("disconnected",C,H),this.intentionalDisconnect.has(C)){this.intentionalDisconnect.delete(C);return}this.scheduleReconnect(C)}scheduleReconnect(C){if(this.serverStates.get(C)?.config.disabled)return;let Z=this.reconnectAttempts.get(C)||0;if(Z>=5)return;let Y=Math.min(1000*Math.pow(2,Z),30000);this.reconnectAttempts.set(C,Z+1),setTimeout(()=>{this.connect(C).catch(()=>{})},Y)}disconnect(C){this.reconnectAttempts.delete(C),this.intentionalDisconnect.add(C);let H=this.connections.get(C);if(H)H.transport.close(),this.connections.delete(C);let Z=this.serverStates.get(C);if(Z){let Y=!1;if(Z.config.url){let w=hL(C,Z.config.url);if(rR(w))fl(w),Y=!0}Z.status=Y?"needs-auth":"not-started",Z.tools=[]}this.emit("status-change",C,Z?.status||"not-started")}setDisabled(C,H){let Z=this.serverStates.get(C);if(!Z)return;if(Z.config.disabled=H,H)this.disconnect(C),Z.status="disabled",this.emit("status-change",C,"disabled");else Z.status="not-started",this.emit("status-change",C,"not-started");gL(C).then((Y)=>{if(Y)mL(C,!H,Y).catch(()=>{})}).catch(()=>{})}async reconnect(C){return this.disconnect(C),this.reconnectAttempts.delete(C),this.connect(C)}getServerStates(){return Array.from(this.serverStates.values())}getServerState(C){return this.serverStates.get(C)}getAllTools(){let C=[];for(let H of this.serverStates.values())if(H.status==="connected")C.push(...H.tools);return C}getTools(C){return this.serverStates.get(C)?.tools||[]}findTool(C){for(let H of this.serverStates.values()){let Z=H.tools.find((Y)=>Y.fullName===C);if(Z)return Z}return}searchTools(C){let H=C.toLowerCase();return this.getAllTools().filter((Z)=>Z.name.toLowerCase().includes(H)||Z.description.toLowerCase().includes(H))}isConnected(C){return this.connections.has(C)}disconnectAll(){for(let C of this.connections.keys())this.disconnect(C)}}});var el={};K8(el,{updateMcpServer:()=>OR,setMcpServerEnabled:()=>mL,removeMcpServer:()=>jL,mcpServerExists:()=>il,initializeMcp:()=>cl,getMcpServersByScope:()=>pl,getMcpServerScope:()=>gL,getMcpServer:()=>vY,getMcpClient:()=>M5,getAllMcpServers:()=>au,createTransport:()=>rL,addMcpServer:()=>oW,MCP_TIMEOUT:()=>t6A,MCP_MAX_RECONNECT_DELAY:()=>c6A,MCP_MAX_RECONNECT_ATTEMPTS:()=>b6A,MCP_MAX_OUTPUT_TOKENS:()=>e6A,MCP_INIT_TIMEOUT:()=>M6A,MCP_INITIAL_RECONNECT_DELAY:()=>d6A,MCPClient:()=>sL});var KY=lD(()=>{PR();bl();pR()});var sR;var al=lD(()=>{sR={name:"@nilux-ai/code",version:"1.0.11",description:"An AI engineer that lives in your terminal — reads, writes, runs, and remembers across sessions.",type:"module",main:"dist/cli.js",bin:{nilux:"dist/cli.js"},scripts:{dev:"tsx src/cli-entry.ts",build:"rm -rf dist && bun build src/cli-entry.ts --outfile dist/cli.js --target node --minify --external @vscode/ripgrep --external koffi",check:"tsc --noEmit"},files:["dist"],dependencies:{"@vscode/ripgrep":"^1.17.0",koffi:"^3.1.0"},devDependencies:{"@types/diff-match-patch":"^1.0.36","@types/node":"^24.3.0","@types/react":"^19.2.7","@types/react-reconciler":"^0.33.0","@types/ws":"^8.18.1","@vscode/ripgrep":"^1.17.0",chokidar:"^3.5.3",commander:"^14.0.2","diff-match-patch":"^1.0.5","eventsource-parser":"^3.0.6","find-up":"^7.0.0",glob:"^10.3.0","highlight.js":"^11.11.1",ink:"^6.6.0","ink-spinner":"^5.0.0","ink-text-input":"^6.0.0",react:"^19.2.3","react-devtools-core":"^6.1.5","react-reconciler":"^0.33.0",semidown:"^0.0.3","sql.js":"^1.14.1",tsx:"^4.20.5",typescript:"^5.9.2","web-tree-sitter":"^0.26.8",ws:"^8.17.0"},engines:{node:">=18.0.0"},keywords:["ai","ai-agent","agentic","coding-agent","ai-coding-assistant","code-assistant","cli","terminal","developer-tools","devtools","pair-programming","llm","code-generation","refactoring","mcp","model-context-protocol","nilux"],author:"Nilux",license:"Apache-2.0",homepage:"https://nilux.dev",repository:{type:"git",url:"git+https://github.com/nilux-dev/nilux.git"},bugs:{url:"https://github.com/nilux-dev/nilux/issues"},publishConfig:{access:"public"}}});var xF,TY;var cW=lD(()=>{al();xF=sR.version,TY=sR.name});var IQ=DD((O4A,tL)=>{(function(){function C(SA,$D){Object.defineProperty(Y.prototype,SA,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",$D[0],$D[1])}})}function H(SA){if(SA===null||typeof SA!=="object")return null;return SA=UB&&SA[UB]||SA["@@iterator"],typeof SA==="function"?SA:null}function Z(SA,$D){SA=(SA=SA.constructor)&&(SA.displayName||SA.name)||"ReactClass";var vD=SA+"."+$D;fD[vD]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",$D,SA),fD[vD]=!0)}function Y(SA,$D,vD){this.props=SA,this.context=$D,this.refs=hB,this.updater=vD||AB}function w(){}function W(SA,$D,vD){this.props=SA,this.context=$D,this.refs=hB,this.updater=vD||AB}function y(){}function O(SA){return""+SA}function T(SA){try{O(SA);var $D=!1}catch(J_){$D=!0}if($D){$D=console;var vD=$D.error,vB=typeof Symbol==="function"&&Symbol.toStringTag&&SA[Symbol.toStringTag]||SA.constructor.name||"Object";return vD.call($D,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",vB),O(SA)}}function S(SA){if(SA==null)return null;if(typeof SA==="function")return SA.$$typeof===PB?null:SA.displayName||SA.name||null;if(typeof SA==="string")return SA;switch(SA){case XD:return"Fragment";case uD:return"Profiler";case cD:return"StrictMode";case HD:return"Suspense";case qD:return"SuspenseList";case ND:return"Activity"}if(typeof SA==="object")switch(typeof SA.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),SA.$$typeof){case oA:return"Portal";case mA:return SA.displayName||"Context";case gA:return(SA._context.displayName||"Context")+".Consumer";case BD:var $D=SA.render;return SA=SA.displayName,SA||(SA=$D.displayName||$D.name||"",SA=SA!==""?"ForwardRef("+SA+")":"ForwardRef"),SA;case SD:return $D=SA.displayName||null,$D!==null?$D:S(SA.type)||"Memo";case IB:$D=SA._payload,SA=SA._init;try{return S(SA($D))}catch(vD){}}return null}function g(SA){if(SA===XD)return"<>";if(typeof SA==="object"&&SA!==null&&SA.$$typeof===IB)return"<...>";try{var $D=S(SA);return $D?"<"+$D+">":"<...>"}catch(vD){return"<...>"}}function h(){var SA=oD.A;return SA===null?null:SA.getOwner()}function m(){return Error("react-stack-top-frame")}function d(SA){if(c_.call(SA,"key")){var $D=Object.getOwnPropertyDescriptor(SA,"key").get;if($D&&$D.isReactWarning)return!1}return SA.key!==void 0}function e(SA,$D){function vD(){gB||(gB=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",$D))}vD.isReactWarning=!0,Object.defineProperty(SA,"key",{get:vD,configurable:!0})}function b(){var SA=S(this.type);return JQ[SA]||(JQ[SA]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),SA=this.props.ref,SA!==void 0?SA:null}function BA(SA,$D,vD,vB,J_,b_){var a_=vD.ref;return SA={$$typeof:eA,type:SA,key:$D,props:vD,_owner:vB},(a_!==void 0?a_:null)!==null?Object.defineProperty(SA,"ref",{enumerable:!1,get:b}):Object.defineProperty(SA,"ref",{enumerable:!1,value:null}),SA._store={},Object.defineProperty(SA._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(SA,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(SA,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:J_}),Object.defineProperty(SA,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:b_}),Object.freeze&&(Object.freeze(SA.props),Object.freeze(SA)),SA}function UA(SA,$D){return $D=BA(SA.type,$D,SA.props,SA._owner,SA._debugStack,SA._debugTask),SA._store&&($D._store.validated=SA._store.validated),$D}function FA(SA){VA(SA)?SA._store&&(SA._store.validated=1):typeof SA==="object"&&SA!==null&&SA.$$typeof===IB&&(SA._payload.status==="fulfilled"?VA(SA._payload.value)&&SA._payload.value._store&&(SA._payload.value._store.validated=1):SA._store&&(SA._store.validated=1))}function VA(SA){return typeof SA==="object"&&SA!==null&&SA.$$typeof===eA}function $A(SA){var $D={"=":"=0",":":"=2"};return"$"+SA.replace(/[=:]/g,function(vD){return $D[vD]})}function rA(SA,$D){return typeof SA==="object"&&SA!==null&&SA.key!=null?(T(SA.key),$A(""+SA.key)):$D.toString(36)}function RA(SA){switch(SA.status){case"fulfilled":return SA.value;case"rejected":throw SA.reason;default:switch(typeof SA.status==="string"?SA.then(y,y):(SA.status="pending",SA.then(function($D){SA.status==="pending"&&(SA.status="fulfilled",SA.value=$D)},function($D){SA.status==="pending"&&(SA.status="rejected",SA.reason=$D)})),SA.status){case"fulfilled":return SA.value;case"rejected":throw SA.reason}}throw SA}function PA(SA,$D,vD,vB,J_){var b_=typeof SA;if(b_==="undefined"||b_==="boolean")SA=null;var a_=!1;if(SA===null)a_=!0;else switch(b_){case"bigint":case"string":case"number":a_=!0;break;case"object":switch(SA.$$typeof){case eA:case oA:a_=!0;break;case IB:return a_=SA._init,PA(a_(SA._payload),$D,vD,vB,J_)}}if(a_){a_=SA,J_=J_(a_);var F0=vB===""?"."+rA(a_,0):vB;return hD(J_)?(vD="",F0!=null&&(vD=F0.replace(k_,"$&/")+"/"),PA(J_,$D,vD,"",function(fI){return fI})):J_!=null&&(VA(J_)&&(J_.key!=null&&(a_&&a_.key===J_.key||T(J_.key)),vD=UA(J_,vD+(J_.key==null||a_&&a_.key===J_.key?"":(""+J_.key).replace(k_,"$&/")+"/")+F0),vB!==""&&a_!=null&&VA(a_)&&a_.key==null&&a_._store&&!a_._store.validated&&(vD._store.validated=2),J_=vD),$D.push(J_)),1}if(a_=0,F0=vB===""?".":vB+":",hD(SA))for(var LQ=0;LQ<SA.length;LQ++)vB=SA[LQ],b_=F0+rA(vB,LQ),a_+=PA(vB,$D,vD,b_,J_);else if(LQ=H(SA),typeof LQ==="function")for(LQ===SA.entries&&(dB||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),dB=!0),SA=LQ.call(SA),LQ=0;!(vB=SA.next()).done;)vB=vB.value,b_=F0+rA(vB,LQ++),a_+=PA(vB,$D,vD,b_,J_);else if(b_==="object"){if(typeof SA.then==="function")return PA(RA(SA),$D,vD,vB,J_);throw $D=String(SA),Error("Objects are not valid as a React child (found: "+($D==="[object Object]"?"object with keys {"+Object.keys(SA).join(", ")+"}":$D)+"). If you meant to render a collection of children, use an array instead.")}return a_}function wA(SA,$D,vD){if(SA==null)return SA;var vB=[],J_=0;return PA(SA,vB,"","",function(b_){return $D.call(vD,b_,J_++)}),vB}function ZA(SA){if(SA._status===-1){var $D=SA._ioInfo;$D!=null&&($D.start=$D.end=performance.now()),$D=SA._result;var vD=$D();if(vD.then(function(J_){if(SA._status===0||SA._status===-1){SA._status=1,SA._result=J_;var b_=SA._ioInfo;b_!=null&&(b_.end=performance.now()),vD.status===void 0&&(vD.status="fulfilled",vD.value=J_)}},function(J_){if(SA._status===0||SA._status===-1){SA._status=2,SA._result=J_;var b_=SA._ioInfo;b_!=null&&(b_.end=performance.now()),vD.status===void 0&&(vD.status="rejected",vD.reason=J_)}}),$D=SA._ioInfo,$D!=null){$D.value=vD;var vB=vD.displayName;typeof vB==="string"&&($D.name=vB)}SA._status===-1&&(SA._status=0,SA._result=vD)}if(SA._status===1)return $D=SA._result,$D===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
41
41
 
42
42
  Your code should look like:
43
43
  const MyComponent = lazy(() => import('./MyComponent'))
package/package.json CHANGED
@@ -1,64 +1,84 @@
1
- {
2
- "name": "@nilux-ai/code",
3
- "version": "1.0.10",
4
- "description": "An AI engineer that lives in your terminal — reads, writes, runs, and remembers across sessions.",
5
- "type": "module",
6
- "main": "dist/cli.js",
7
- "bin": {
8
- "nilux": "dist/cli.js"
9
- },
10
- "scripts": {
11
- "dev": "tsx src/cli-entry.ts",
12
- "build": "rm -rf dist && bun build src/cli-entry.ts --outfile dist/cli.js --target node --minify --external @vscode/ripgrep --external koffi",
13
- "check": "tsc --noEmit"
14
- },
15
- "files": [
16
- "dist"
17
- ],
18
- "dependencies": {
19
- "@vscode/ripgrep": "^1.17.0",
20
- "koffi": "^3.1.0"
21
- },
22
- "devDependencies": {
23
- "@types/diff-match-patch": "^1.0.36",
24
- "@types/node": "^24.3.0",
25
- "@types/react": "^19.2.7",
26
- "@types/react-reconciler": "^0.33.0",
27
- "@types/ws": "^8.18.1",
28
- "@vscode/ripgrep": "^1.17.0",
29
- "chokidar": "^3.5.3",
30
- "commander": "^14.0.2",
31
- "diff-match-patch": "^1.0.5",
32
- "eventsource-parser": "^3.0.6",
33
- "find-up": "^7.0.0",
34
- "glob": "^10.3.0",
35
- "highlight.js": "^11.11.1",
36
- "ink": "^6.6.0",
37
- "ink-spinner": "^5.0.0",
38
- "ink-text-input": "^6.0.0",
39
- "react": "^19.2.3",
40
- "react-devtools-core": "^6.1.5",
41
- "react-reconciler": "^0.33.0",
42
- "semidown": "^0.0.3",
43
- "sql.js": "^1.14.1",
44
- "tsx": "^4.20.5",
45
- "typescript": "^5.9.2",
46
- "web-tree-sitter": "^0.26.8",
47
- "ws": "^8.17.0"
48
- },
49
- "engines": {
50
- "node": ">=18.0.0"
51
- },
52
- "keywords": [
53
- "ai",
54
- "code-assistant",
55
- "cli",
56
- "nilux"
57
- ],
58
- "author": "Nilux",
59
- "license": "Apache-2.0",
60
- "homepage": "https://nilux.dev",
61
- "bugs": {
62
- "url": "https://nilux.dev/feedback"
63
- }
64
- }
1
+ {
2
+ "name": "@nilux-ai/code",
3
+ "version": "1.0.11",
4
+ "description": "An AI engineer that lives in your terminal — reads, writes, runs, and remembers across sessions.",
5
+ "type": "module",
6
+ "main": "dist/cli.js",
7
+ "bin": {
8
+ "nilux": "dist/cli.js"
9
+ },
10
+ "scripts": {
11
+ "dev": "tsx src/cli-entry.ts",
12
+ "build": "rm -rf dist && bun build src/cli-entry.ts --outfile dist/cli.js --target node --minify --external @vscode/ripgrep --external koffi",
13
+ "check": "tsc --noEmit"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "dependencies": {
19
+ "@vscode/ripgrep": "^1.17.0",
20
+ "koffi": "^3.1.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/diff-match-patch": "^1.0.36",
24
+ "@types/node": "^24.3.0",
25
+ "@types/react": "^19.2.7",
26
+ "@types/react-reconciler": "^0.33.0",
27
+ "@types/ws": "^8.18.1",
28
+ "@vscode/ripgrep": "^1.17.0",
29
+ "chokidar": "^3.5.3",
30
+ "commander": "^14.0.2",
31
+ "diff-match-patch": "^1.0.5",
32
+ "eventsource-parser": "^3.0.6",
33
+ "find-up": "^7.0.0",
34
+ "glob": "^10.3.0",
35
+ "highlight.js": "^11.11.1",
36
+ "ink": "^6.6.0",
37
+ "ink-spinner": "^5.0.0",
38
+ "ink-text-input": "^6.0.0",
39
+ "react": "^19.2.3",
40
+ "react-devtools-core": "^6.1.5",
41
+ "react-reconciler": "^0.33.0",
42
+ "semidown": "^0.0.3",
43
+ "sql.js": "^1.14.1",
44
+ "tsx": "^4.20.5",
45
+ "typescript": "^5.9.2",
46
+ "web-tree-sitter": "^0.26.8",
47
+ "ws": "^8.17.0"
48
+ },
49
+ "engines": {
50
+ "node": ">=18.0.0"
51
+ },
52
+ "keywords": [
53
+ "ai",
54
+ "ai-agent",
55
+ "agentic",
56
+ "coding-agent",
57
+ "ai-coding-assistant",
58
+ "code-assistant",
59
+ "cli",
60
+ "terminal",
61
+ "developer-tools",
62
+ "devtools",
63
+ "pair-programming",
64
+ "llm",
65
+ "code-generation",
66
+ "refactoring",
67
+ "mcp",
68
+ "model-context-protocol",
69
+ "nilux"
70
+ ],
71
+ "author": "Nilux",
72
+ "license": "Apache-2.0",
73
+ "homepage": "https://nilux.dev",
74
+ "repository": {
75
+ "type": "git",
76
+ "url": "git+https://github.com/nilux-dev/nilux.git"
77
+ },
78
+ "bugs": {
79
+ "url": "https://github.com/nilux-dev/nilux/issues"
80
+ },
81
+ "publishConfig": {
82
+ "access": "public"
83
+ }
84
+ }