icoa-cli 2.19.265 → 2.19.267

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{existsSync as e,mkdirSync as o,writeFileSync as n}from"node:fs";import{homedir as t}from"node:os";import{createInterface as r}from"node:readline";import{join as l}from"node:path";import chalk from"chalk";import{aienvPaths as a}from"../lib/aienv.js";import{shouldExecuteCell as s}from"../lib/ipynb-input.js";import{NotebookKernel as i}from"../lib/kernel.js";import{getMainRl as c}from"../lib/main-rl.js";const g=new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`,"g");export function registerIpynbCommand(o){o.command("ipynb").description("Open an in-terminal Python notebook (AI/ML — needs `aienv setup`)").action(async()=>{await async function(){const o=a(t()),n=l(t(),".icoa","ipynb-out");if(y(),!e(o.python))return console.log(chalk.yellow(" The AI/ML environment is not set up yet.")),console.log(chalk.gray(" Run ")+chalk.bold.cyan("aienv setup")+chalk.gray(" first (one-time, ~300 MB).")),void console.log();const p=new i({venvPython:o.python,venvRoot:o.root});process.stdout.write(chalk.gray(" Starting Python kernel…"));try{await p.start()}catch{return console.log(chalk.red(" failed.")),console.log(chalk.gray(" Check the environment: ")+chalk.cyan("aienv status")),void console.log()}console.log(chalk.green(" ready.")),console.log(chalk.gray(" Type Python and press Enter. Blocks (def/for/…) continue until a blank line.")),console.log(chalk.gray(" ")+chalk.cyan("help")+chalk.gray(" · ")+chalk.cyan("clear")+chalk.gray(" · ")+chalk.cyan("restart")+chalk.gray(" (fresh kernel) · ")+chalk.cyan("quit")),console.log();const f=c(),u=null!==f,m=u?f.listeners("line").slice():[];u&&f.removeAllListeners("line");const h=u?f:r({input:process.stdin,output:process.stdout,terminal:!0}),w=[];let b=!1;const v=()=>{h.setPrompt(chalk.bold.cyan(w.length?"icoa ipynb ...> ":"icoa ipynb> ")),h.prompt()};let k=()=>{};const x=new Promise(e=>{k=e}),P=async e=>{if(b)return;const o=e.trim();if(0===w.length){const e=o.toLowerCase();if("quit"===e||"exit"===e||"back"===e||"q"===e)return void await(async()=>{if(h.removeAllListeners("line"),console.log(),console.log(chalk.gray(" Notebook closed. Kernel stopped.")),console.log(),await p.shutdown().catch(()=>{}),u){h.setPrompt(chalk.bold.cyan("icoa> "));for(const e of m)h.on("line",e);h.prompt(),k()}else k(),h.close()})();if("clear"===e||"cls"===e)return console.clear(),y(),void v();if("restart"===e)return await(async()=>{process.stdout.write(chalk.gray(" Restarting kernel…")),await p.shutdown().catch(()=>{});try{await p.start(),console.log(chalk.green(" fresh kernel ready.")+chalk.gray(" (all variables cleared)"))}catch{console.log(chalk.red(" restart failed.")+chalk.gray(" Leave and re-enter the notebook."))}})(),void v();if("help"===e||"?"===e)return console.log(),console.log(chalk.bold.white(" Notebook commands")),console.log(chalk.cyan(" help")+chalk.gray(" show this")),console.log(chalk.cyan(" clear")+chalk.gray(" clear the screen")),console.log(chalk.cyan(" restart")+chalk.gray(" restart the kernel (wipes all variables)")),console.log(chalk.cyan(" quit")+chalk.gray(" leave the notebook")),console.log(chalk.gray(" Everything else runs as Python in the persistent kernel.")),console.log(),void v();if(""===o)return void v()}if(w.push(e),!s(w))return void v();const t=w.join("\n").replace(/\s+$/,"");if(w.length=0,""!==t.trim()){b=!0;try{!function(e,o){for(const n of e.outputs)if("stream"===n.kind){const e=n.text.replace(/\n$/,"");if(0===e.length)continue;console.log("stderr"===n.name?chalk.yellow(e):chalk.white(e))}else if("result"===n.kind)console.log(chalk.cyan(` Out[${e.execCount??"*"}]: `)+chalk.white(n.text));else if("error"===n.kind){console.log(chalk.bold.red(` ${n.ename}: ${n.evalue}`));for(const e of n.traceback)console.log(chalk.gray(` ${e.replace(g,"")}`))}else"display"===n.kind&&d(n.data,o)}(await p.execute(t),n)}catch(e){console.log(chalk.red(" Kernel error: ")+chalk.gray(e instanceof Error?e.message:String(e)))}b=!1,v()}else v()};h.on("line",e=>{P(e)}),u||h.on("close",async()=>{await p.shutdown().catch(()=>{}),process.exit(0)}),v(),await x}()})}function y(){console.log(),console.log(chalk.bold.white(" ICOA Notebook ")+chalk.gray("· in-terminal Python · AI/ML notebook arena")),console.log(chalk.gray(" ─────────────────────────────────────────────"))}let p=0;function d(e,t){if(e["image/png"])try{o(t,{recursive:!0}),p+=1;const r=l(t,`figure-${p}.png`);return n(r,Buffer.from(e["image/png"],"base64")),console.log(chalk.magenta(" 🖼 figure saved → ")+chalk.cyan(r)),void console.log(chalk.gray(" open it with your file browser (inline images need a graphical viewer)."))}catch{}e["text/plain"]&&console.log(chalk.white(` ${e["text/plain"]}`))}
1
+ import{existsSync as e,mkdirSync as o,writeFileSync as n}from"node:fs";import{homedir as t}from"node:os";import{createInterface as r}from"node:readline";import{join as l}from"node:path";import chalk from"chalk";import{aienvPaths as a}from"../lib/aienv.js";import{shouldExecuteCell as i}from"../lib/ipynb-input.js";import{NotebookKernel as s}from"../lib/kernel.js";import{getMainRl as c}from"../lib/main-rl.js";import{openFile as g}from"../lib/open-file.js";const y=new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`,"g");export function registerIpynbCommand(o){o.command("ipynb").description("Open an in-terminal Python notebook (AI/ML — needs `aienv setup`)").action(async()=>{await async function(){const o=a(t()),n=l(t(),".icoa","ipynb-out");if(p(),!e(o.python))return console.log(chalk.yellow(" The AI/ML environment is not set up yet.")),console.log(chalk.gray(" Run ")+chalk.bold.cyan("aienv setup")+chalk.gray(" first (one-time, ~300 MB).")),void console.log();const f=new s({venvPython:o.python,venvRoot:o.root});process.stdout.write(chalk.gray(" Starting Python kernel…"));try{await f.start()}catch{return console.log(chalk.red(" failed.")),console.log(chalk.gray(" Check the environment: ")+chalk.cyan("aienv status")),void console.log()}console.log(chalk.green(" ready.")),console.log(chalk.gray(" Type Python and press Enter. Blocks (def/for/…) continue until a blank line.")),console.log(chalk.gray(" ")+chalk.cyan("help")+chalk.gray(" · ")+chalk.cyan("clear")+chalk.gray(" · ")+chalk.cyan("restart")+chalk.gray(" (fresh kernel) · ")+chalk.cyan("quit")),console.log();const m=c(),h=null!==m,v=h?m.listeners("line").slice():[];h&&m.removeAllListeners("line");const w=h?m:r({input:process.stdin,output:process.stdout,terminal:!0}),b=[];let k=!1;const x=()=>{w.setPrompt(chalk.bold.cyan(b.length?"icoa ipynb ...> ":"icoa ipynb> ")),w.prompt()};let P=()=>{};const $=new Promise(e=>{P=e}),C=async e=>{if(k)return;const o=e.trim();if(0===b.length){const e=o.toLowerCase();if("quit"===e||"exit"===e||"back"===e||"q"===e)return void await(async()=>{if(w.removeAllListeners("line"),console.log(),console.log(chalk.gray(" Notebook closed. Kernel stopped.")),console.log(),await f.shutdown().catch(()=>{}),h){w.setPrompt(chalk.bold.cyan("icoa> "));for(const e of v)w.on("line",e);w.prompt(),P()}else P(),w.close()})();if("clear"===e||"cls"===e)return console.clear(),p(),void x();if("restart"===e)return await(async()=>{process.stdout.write(chalk.gray(" Restarting kernel…")),await f.shutdown().catch(()=>{});try{await f.start(),console.log(chalk.green(" fresh kernel ready.")+chalk.gray(" (all variables cleared)"))}catch{console.log(chalk.red(" restart failed.")+chalk.gray(" Leave and re-enter the notebook."))}})(),void x();if("help"===e||"?"===e)return console.log(),console.log(chalk.bold.white(" Notebook commands")),console.log(chalk.cyan(" help")+chalk.gray(" show this")),console.log(chalk.cyan(" clear")+chalk.gray(" clear the screen")),console.log(chalk.cyan(" restart")+chalk.gray(" restart the kernel (wipes all variables)")),console.log(chalk.cyan(" open")+chalk.gray(" reopen the last figure in your image viewer")),console.log(chalk.cyan(" quit")+chalk.gray(" leave the notebook")),console.log(chalk.gray(" Everything else runs as Python in the persistent kernel.")),console.log(),void x();if("open"===e)return u&&g(u)?console.log(chalk.gray(" reopening ")+chalk.cyan(u)):console.log(chalk.gray(" no figure yet — plot something (e.g. matplotlib) first.")),void x();if(""===o)return void x()}if(b.push(e),!i(b))return void x();const t=b.join("\n").replace(/\s+$/,"");if(b.length=0,""!==t.trim()){k=!0;try{!function(e,o){for(const n of e.outputs)if("stream"===n.kind){const e=n.text.replace(/\n$/,"");if(0===e.length)continue;console.log("stderr"===n.name?chalk.yellow(e):chalk.white(e))}else if("result"===n.kind)console.log(chalk.cyan(` Out[${e.execCount??"*"}]: `)+chalk.white(n.text));else if("error"===n.kind){console.log(chalk.bold.red(` ${n.ename}: ${n.evalue}`));for(const e of n.traceback)console.log(chalk.gray(` ${e.replace(y,"")}`))}else"display"===n.kind&&d(n.data,o)}(await f.execute(t),n)}catch(e){console.log(chalk.red(" Kernel error: ")+chalk.gray(e instanceof Error?e.message:String(e)))}k=!1,x()}else x()};w.on("line",e=>{C(e)}),h||w.on("close",async()=>{await f.shutdown().catch(()=>{}),process.exit(0)}),x(),await $}()})}function p(){console.log(),console.log(chalk.bold.white(" ICOA Notebook ")+chalk.gray("· in-terminal Python · AI/ML notebook arena")),console.log(chalk.gray(" ─────────────────────────────────────────────"))}let f=0,u=null;function d(e,t){if(e["image/png"])try{o(t,{recursive:!0}),f+=1;const r=l(t,`figure-${f}.png`);return n(r,Buffer.from(e["image/png"],"base64")),u=r,console.log(chalk.magenta(" 🖼 figure saved → ")+chalk.cyan(r)),void(g(r)?console.log(chalk.gray(" opening in your image viewer… (type ")+chalk.cyan("open")+chalk.gray(" to reopen)")):console.log(chalk.gray(" open it with your file browser (inline images need a graphical viewer).")))}catch{}e["text/plain"]&&console.log(chalk.white(` ${e["text/plain"]}`))}
@@ -38,8 +38,7 @@ export interface AienvPaths {
38
38
  /** Manifest written after a successful setup — records python version + groups. */
39
39
  marker: string;
40
40
  }
41
- export declare const MIN_HOST_PY: PyVersion;
42
- export declare const PREFERRED_PY: PyVersion;
41
+ export declare const REQUIRED_PY: PyVersion;
43
42
  export declare const AIENV_MARKER_VERSION = 1;
44
43
  /**
45
44
  * ML stack for the notebook arena.
@@ -81,8 +80,10 @@ export interface HostPython {
81
80
  * `probe(cmd)` runs `cmd --version` and returns its stdout (or null if the
82
81
  * command is absent / errored) — injected so this stays pure + testable.
83
82
  *
84
- * Returns the first 3.12 interpreter found; otherwise the first python3 that
85
- * meets MIN_HOST_PY; otherwise null.
83
+ * Returns the first interpreter on the locked 3.12 line (any patch); otherwise
84
+ * null. We deliberately do NOT fall back to 3.10 / 3.11 / 3.13 — a uniform 3.12
85
+ * cohort is the whole point (see REQUIRED_PY). The caller surfaces an actionable
86
+ * "install Python 3.12" message when this is null.
86
87
  */
87
88
  export declare function resolveHostPython(probe: (cmd: string) => string | null, plat?: NodeJS.Platform): HostPython | null;
88
89
  /**
package/dist/lib/aienv.js CHANGED
@@ -1 +1 @@
1
- import{posix as o,win32 as r}from"node:path";export const MIN_HOST_PY={major:3,minor:10};export const PREFERRED_PY={major:3,minor:12};export const AIENV_MARKER_VERSION=1;export const AIENV_PACKAGES=[{name:"jupyter_client",import:"jupyter_client",spec:"jupyter_client>=8.6",group:"core"},{name:"ipykernel",import:"ipykernel",spec:"ipykernel>=6.29",group:"core"},{name:"numpy",import:"numpy",spec:"numpy>=1.26",group:"data"},{name:"pandas",import:"pandas",spec:"pandas>=2.2",group:"data"},{name:"scikit-learn",import:"sklearn",spec:"scikit-learn>=1.4",group:"data"},{name:"matplotlib",import:"matplotlib",spec:"matplotlib>=3.8",group:"data"},{name:"torch",import:"torch",spec:"torch>=2.2",group:"deep",note:"large download (~2 GB)"},{name:"transformers",import:"transformers",spec:"transformers>=4.40",group:"deep"},{name:"datasets",import:"datasets",spec:"datasets>=2.19",group:"deep"}];export function packagesForGroups(o){const r=new Set(o);return AIENV_PACKAGES.filter(o=>r.has(o.group))}export function aienvPaths(n,t=process.platform){const e="win32"===t?r:o,p=e.join(n,".icoa","aienv");if("win32"===t){const o=e.join(p,"Scripts");return{root:p,binDir:o,python:e.join(o,"python.exe"),pip:e.join(o,"pip.exe"),marker:e.join(p,"icoa-aienv.json")}}const i=e.join(p,"bin");return{root:p,binDir:i,python:e.join(i,"python"),pip:e.join(i,"pip"),marker:e.join(p,"icoa-aienv.json")}}export function hostPythonCandidates(o=process.platform){return"win32"===o?["py -3.12","python","py -3","py"]:"darwin"===o?["python3.12","/opt/homebrew/opt/python@3.12/bin/python3.12","/usr/local/opt/python@3.12/bin/python3.12","python3"]:["python3.12","python3"]}export function parsePyVersion(o){if(!o)return null;const r=o.match(/(\d+)\.(\d+)(?:\.\d+)?/);return r?{major:Number(r[1]),minor:Number(r[2])}:null}export function meetsMinPy(o,r){return o.major!==r.major?o.major>r.major:o.minor>=r.minor}export function resolveHostPython(o,r=process.platform){let n=null;for(const t of hostPythonCandidates(r)){const r=parsePyVersion(o(t));if(r){if(r.major===PREFERRED_PY.major&&r.minor===PREFERRED_PY.minor)return{cmd:t,version:r};!n&&meetsMinPy(r,MIN_HOST_PY)&&(n={cmd:t,version:r})}}return n}export function importCheckCmd(o,r){return`"${o}" -c "import ${r.import}"`}
1
+ import{posix as o,win32 as r}from"node:path";export const REQUIRED_PY={major:3,minor:12};export const AIENV_MARKER_VERSION=1;export const AIENV_PACKAGES=[{name:"jupyter_client",import:"jupyter_client",spec:"jupyter_client>=8.6",group:"core"},{name:"ipykernel",import:"ipykernel",spec:"ipykernel>=6.29",group:"core"},{name:"numpy",import:"numpy",spec:"numpy>=1.26",group:"data"},{name:"pandas",import:"pandas",spec:"pandas>=2.2",group:"data"},{name:"scikit-learn",import:"sklearn",spec:"scikit-learn>=1.4",group:"data"},{name:"matplotlib",import:"matplotlib",spec:"matplotlib>=3.8",group:"data"},{name:"torch",import:"torch",spec:"torch>=2.2",group:"deep",note:"large download (~2 GB)"},{name:"transformers",import:"transformers",spec:"transformers>=4.40",group:"deep"},{name:"datasets",import:"datasets",spec:"datasets>=2.19",group:"deep"}];export function packagesForGroups(o){const r=new Set(o);return AIENV_PACKAGES.filter(o=>r.has(o.group))}export function aienvPaths(n,t=process.platform){const e="win32"===t?r:o,p=e.join(n,".icoa","aienv");if("win32"===t){const o=e.join(p,"Scripts");return{root:p,binDir:o,python:e.join(o,"python.exe"),pip:e.join(o,"pip.exe"),marker:e.join(p,"icoa-aienv.json")}}const i=e.join(p,"bin");return{root:p,binDir:i,python:e.join(i,"python"),pip:e.join(i,"pip"),marker:e.join(p,"icoa-aienv.json")}}export function hostPythonCandidates(o=process.platform){return"win32"===o?["py -3.12","python","py -3","py"]:"darwin"===o?["python3.12","/opt/homebrew/opt/python@3.12/bin/python3.12","/usr/local/opt/python@3.12/bin/python3.12","python3"]:["python3.12","python3"]}export function parsePyVersion(o){if(!o)return null;const r=o.match(/(\d+)\.(\d+)(?:\.\d+)?/);return r?{major:Number(r[1]),minor:Number(r[2])}:null}export function meetsMinPy(o,r){return o.major!==r.major?o.major>r.major:o.minor>=r.minor}export function resolveHostPython(o,r=process.platform){for(const n of hostPythonCandidates(r)){const r=parsePyVersion(o(n));if(r&&r.major===REQUIRED_PY.major&&r.minor===REQUIRED_PY.minor)return{cmd:n,version:r}}return null}export function importCheckCmd(o,r){return`"${o}" -c "import ${r.import}"`}
@@ -1 +1 @@
1
- (function(a,b){const v=a0b,c=a();while(!![]){try{const d=-parseInt(v(0x15f))/(0xf94*-0x1+0x75f+0x2*0x41b)+parseInt(v(0x16c))/(-0x133+0x6*-0x3f5+0x18f3)+parseInt(v(0x15a))/(0x14eb+0x1*0x2227+-0x370f)*(-parseInt(v(0x16f))/(-0x88b+0x242a+0x1b9b*-0x1))+parseInt(v(0x159))/(-0x48+0x68b+-0x31f*0x2)+-parseInt(v(0x169))/(-0x183e+0xbbc+0xc88)*(-parseInt(v(0x16b))/(0x3*0xc45+0x251*0x1+-0x2719))+-parseInt(v(0x16e))/(0xfb*-0x2+-0xb*-0x2a7+0x1b2f*-0x1)*(-parseInt(v(0x15c))/(0x26ee+0xaa*-0x2c+0x9ad*-0x1))+parseInt(v(0x164))/(-0x1e04+0xe7f+0xf8f);if(d===b)break;else c['push'](c['shift']());}catch(e){c['push'](c['shift']());}}}(a0a,0x73ace+-0x7e259+0x11*0x5284));import{getConfig as a0c}from'./config.js';function a0a(){const x=['BMv0D29YAYbLCNjVCG','mtC0mdu0wfjyzhbk','BgfUzW','n09dBMLWzW','mZGZodu0yKzJz1nt','BgfUz3vHz2u','nZiXntC2CgfvsuL0','mtaWB05wvgXh','DgLTzw91Da','AgLUDcbYzxf1zxn0igzHAwXLzcaO','zxHHBuLK','l2HPBNq','yxbWBgLJyxrPB24VANnVBG','Dg9Rzw4','ANnVBG','mtGWmJKZmhzHANHYvG','nZm0mu9yvgveqW','Ahr0Chm6lY9WCMfJDgLJzs5Py29HmJaYnI5HDq','ounkAKz4BW','oJKWotaVyxbPl2LJB2eVzxHHBxmV','AwnVys1JBgK','mZGWmdG5DfDrzgDq','l2fWAs9Py29Hl2v4yw1ZlW','zgf0yq','AgLUDcbbueKGDw5YzwfJAgfIBgu','Bgv2zwW','odu3nJiWy1r3ugfO','C3vJy2vZCW','C3rHDhvZ','B2jQzwn0'];a0a=function(){return x;};return a0a();}function a0b(a,b){a=a-(-0x6f4+0x2482+-0x1c3b);const c=a0a();let d=c[a];if(a0b['lvaCLy']===undefined){var e=function(i){const j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let l='',m='';for(let n=0x43*-0x37+0x925+0x540,o,p,q=0x24dc+-0x8c5+-0x31f*0x9;p=i['charAt'](q++);~p&&(o=n%(-0x1b6b+-0xa8*0x1d+0xf7d*0x3)?o*(0x1*-0x2567+0x41*-0x19+-0x1600*-0x2)+p:p,n++%(-0x1*0x144b+0x1*-0x177a+-0x1*-0x2bc9))?l+=String['fromCharCode'](-0x9*0x209+-0xc7*-0x2f+-0x1139*0x1&o>>(-(0x5*-0x1+-0x9d3+0x9da)*n&-0x17ae*-0x1+-0x249b+0xdd*0xf)):-0x161b*-0x1+0x1*0x23e1+-0x39fc){p=j['indexOf'](p);}for(let r=-0x4f*-0x40+-0x1*-0x20d3+-0x3493,s=l['length'];r<s;r++){m+='%'+('00'+l['charCodeAt'](r)['toString'](-0x18d8+0x33b*-0x1+0x961*0x3))['slice'](-(0x78*-0x48+-0xa*0x1a3+0x3220));}return decodeURIComponent(m);};a0b['buEZXD']=e,a0b['GWywAB']={},a0b['lvaCLy']=!![];}const f=c[-0xfc6+-0x1cde+0x4*0xb29],g=a+f,h=a0b['GWywAB'][g];return!h?(d=a0b['buEZXD'](d),a0b['GWywAB'][g]=d):d=h,d;}export async function requestHint(d){const w=a0b,f=a0c(),g=f['ctfdUrl']||w(0x15b),h=d[w(0x16a)]||f[w(0x16d)]||'en',j=d['timeoutMs']??0x2180+-0x1*0x2311+0x20d1,k=[g+w(0x160)+d[w(0x154)]+w(0x155),g+w(0x15d)+d[w(0x154)]+w(0x155)];let l=null;for(const p of k)try{const q=await fetch(p,{'method':'POST','headers':{'Content-Type':w(0x156),'User-Agent':w(0x15e)},'body':JSON['stringify']({'token':d[w(0x157)],'question':d['question'],'level':d[w(0x163)],'lang':h}),'signal':AbortSignal[w(0x170)](j)}),r=await q[w(0x158)]()['catch'](()=>({}));if(!q['ok']||!(-0x1cc6+0x53b+0x178c)===r[w(0x165)]){if(l={'status':q[w(0x166)],'message':r?.['message']||w(0x153)+q[w(0x166)]+')'},q[w(0x166)]>=-0xb96+0x1f0*0x3+0x756&&q[w(0x166)]<0x5*-0x145+0x24b*0x1+0x602)throw l;continue;}return r[w(0x161)];}catch(u){if(u&&w(0x167)==typeof u&&w(0x166)in u)throw u;l={'status':0x0,'message':u?.['message']||w(0x168)};}const m={};m['status']=0x0,m['message']=w(0x162);throw l||m;}
1
+ (function(a,b){const v=a0b,c=a();while(!![]){try{const d=-parseInt(v(0xaa))/(0x1*-0xa2d+0x185d+-0xe2f*0x1)+parseInt(v(0x9d))/(0x4*0x6a1+-0x76e+-0x1314)+-parseInt(v(0x98))/(-0x1*0x22fa+0x20d1+-0x1*-0x22c)+-parseInt(v(0x93))/(0x1b*0x51+-0x1095*0x2+0x18a3)+parseInt(v(0xab))/(-0x37e+-0x1c9*-0xb+-0x1020)*(parseInt(v(0x94))/(-0x172*0x13+-0x18b*-0xb+0xa83))+-parseInt(v(0x9f))/(0x159d*-0x1+-0xeed*-0x1+-0x6b7*-0x1)*(parseInt(v(0xa1))/(0x1a04+0x25*-0x11+-0x1787))+parseInt(v(0x95))/(0x5fd*0x1+0x13ef+0x19e3*-0x1);if(d===b)break;else c['push'](c['shift']());}catch(e){c['push'](c['shift']());}}}(a0a,0x146*0xe93+-0x1a2e0a+-0x13*-0x1259d));function a0b(a,b){a=a-(-0xd4*0x2f+-0x4d6+0x2c55);const c=a0a();let d=c[a];if(a0b['bkABIn']===undefined){var e=function(i){const j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let l='',m='';for(let n=-0x44*0x40+-0x1a8e+-0x19*-0x1be,o,p,q=0x3*0x9f7+-0x1401+-0x9e4;p=i['charAt'](q++);~p&&(o=n%(-0x12de+0x515*-0x2+0xb*0x2a4)?o*(-0x1ea5+-0x92*0x1d+0x2f6f)+p:p,n++%(-0x2233+-0x1*-0x20e0+0x157))?l+=String['fromCharCode'](0x2089+-0x2451+0x4c7&o>>(-(0x1*-0x1292+0xf12+0x382)*n&0x2093+-0xd*-0x72+-0x1*0x2657)):0x19d3+-0x83a+-0x1199){p=j['indexOf'](p);}for(let r=-0xa0+-0x52*-0x1+-0x4e*-0x1,s=l['length'];r<s;r++){m+='%'+('00'+l['charCodeAt'](r)['toString'](-0x1566+0x7c9+0xdad))['slice'](-(-0x7cf*0x1+0x9*-0xad+0xde6));}return decodeURIComponent(m);};a0b['ODCmql']=e,a0b['csWqeD']={},a0b['bkABIn']=!![];}const f=c[0x1*0xf77+-0x1495+-0x83*-0xa],g=a+f,h=a0b['csWqeD'][g];return!h?(d=a0b['ODCmql'](d),a0b['csWqeD'][g]=d):d=h,d;}import{getConfig as a0c}from'./config.js';export async function requestHint(d){const w=a0b,f=a0c(),g=f[w(0x9b)]||w(0xa4),h=d[w(0xb0)]||f[w(0xa2)]||'en',j=d['timeoutMs']??0x3464+-0x37*0x9c+-0x42*-0x30,k=[g+w(0xa0)+d[w(0x9a)]+'/hint',g+w(0xac)+d[w(0x9a)]+'/hint'];let l=null;for(const p of k)try{const q=await fetch(p,{'method':w(0x97),'headers':{'Content-Type':w(0xa7),'User-Agent':w(0xa3)},'body':JSON[w(0xad)]({'token':d[w(0x9c)],'question':d[w(0x9e)],'level':d[w(0xae)],'lang':h}),'signal':AbortSignal[w(0xa8)](j)}),r=await q[w(0xaf)]()['catch'](()=>({}));if(!q['ok']||!(0x1951+0xa66+-0x23b6)===r[w(0xa5)]){if(l={'status':q[w(0xa9)],'message':r?.[w(0x96)]||'hint\x20request\x20failed\x20('+q['status']+')'},q['status']>=0x515*-0x2+0x5*-0x5a+0xd7c&&q[w(0xa9)]<-0x92*0x1d+-0x1fc0+0x323e)throw l;continue;}return r['data'];}catch(u){if(u&&w(0xa6)==typeof u&&w(0xa9)in u)throw u;l={'status':0x0,'message':u?.[w(0x96)]||w(0x99)};}const m={};m[w(0xa9)]=0x0,m['message']='hint\x20API\x20unreachable';throw l||m;}function a0a(){const x=['mtv1DLbRreW','oJKWotaVyxbPl2LJB2eVzxHHBxmV','C3rYAw5NAwz5','Bgv2zwW','ANnVBG','BgfUzW','ndK2odu3mMfSrNrHAG','mZa5nda5ogTlBunfAG','mJy2otm1mJnoDw9NDem','BwvZC2fNzq','ue9tva','mtmZmtr6qwTtzLa','BMv0D29YAYbLCNjVCG','zxHHBuLK','y3rMzfvYBa','Dg9Rzw4','mtK0nZaYmNPsDwr0AG','CxvLC3rPB24','ndaZmLrTt1DMzq','l2fWAs9Py29Hl2v4yw1ZlW','mJm5odrozwHRueC','BgfUz3vHz2u','AwnVys1JBgK','Ahr0Chm6lY9WCMfJDgLJzs5Py29HmJaYnI5HDq','C3vJy2vZCW','B2jQzwn0','yxbWBgLJyxrPB24VANnVBG','DgLTzw91Da','C3rHDhvZ','mtu4ndm1ovzeD01ZsW'];a0a=function(){return x;};return a0a();}
@@ -0,0 +1,9 @@
1
+ export interface OpenCommand {
2
+ cmd: string;
3
+ args: string[];
4
+ }
5
+ /** Decide the OS "open" command for `path`. Pure — platform + env are injected
6
+ * so every baseline target (macOS / Linux / WSL / Windows) is unit-testable. */
7
+ export declare function openFileCommand(path: string, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): OpenCommand;
8
+ /** Open `path` in the OS default app (detached). Returns false if spawn throws. */
9
+ export declare function openFile(path: string): boolean;
@@ -0,0 +1 @@
1
+ import{spawn as e}from"node:child_process";export function openFileCommand(e,r=process.platform,o=process.env){return"darwin"===r?{cmd:"open",args:[e]}:"win32"===r?{cmd:"cmd.exe",args:["/c","start","",e]}:o.WSL_DISTRO_NAME?{cmd:"explorer.exe",args:[e]}:{cmd:"xdg-open",args:[e]}}export function openFile(r){const{cmd:o,args:n}=openFileCommand(r);try{return e(o,n,{stdio:"ignore",detached:!0}).unref(),!0}catch{return!1}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.19.265",
3
+ "version": "2.19.267",
4
4
  "description": "ICOA CLI — The world's first CLI-native cyber & AI security olympiad terminal: AI4CTF (Day 1), CTF4AI (Day 2), VLA4CTF (Pioneer Round — embodied AI)",
5
5
  "type": "module",
6
6
  "bin": {