icoa-cli 2.19.711 → 2.19.712

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{spawnSync as e}from"node:child_process";import{ENTRIES as t,loadSite as r,readEntryChoice as n,recommend as o,setEntry as s}from"./site.js";function a(e,t){const r=[...t].sort((e,t)=>e-t);return{key:e,ms:r.length?r[Math.floor(r.length/2)]:null,ok:r.length}}export function shouldAutoCheck(e){if("0"===e.env.ICOA_ENTRY_AUTO)return!1;if(!e.tty)return!1;if("user"===e.by||e.venue)return!1;if(e.env.ICOA_LEARN_SERVER?.trim()||e.env.ICOA_EXAM_SERVER?.trim())return!1;const t=e.argv.slice(2);return!t.some(e=>"--version"===e||"-V"===e||"--help"===e||"-h"===e)&&"entry"!==t[0]&&e.now-e.at>864e5}!function(){try{const i=n();if(!shouldAutoCheck({argv:process.argv,env:process.env,tty:!!process.stdout.isTTY,by:i.by,at:i.at,venue:r().ok,now:Date.now()}))return;const c=e(process.execPath,["-e","\nconst [d, r, cap] = [process.argv[1], process.argv[2], Number(process.argv[3])];\nconst one = async (b) => { const t = Date.now(); try {\n const x = await fetch(b + '/api/icoa/server-time?t=' + t + Math.random(), { signal: AbortSignal.timeout(cap) });\n await x.arrayBuffer(); return x.ok ? Date.now() - t : null; } catch { return null; } };\nconst door = async (b) => (await Promise.all([one(b), one(b), one(b)])).filter((v) => v !== null);\nPromise.all([door(d), door(r)]).then(([a, b]) => { console.log(JSON.stringify({ direct: a, relay: b })); process.exit(0); });\n",t.direct.base,t.relay.base,String(2500)],{encoding:"utf8",timeout:4e3,stdio:["ignore","pipe","ignore"]}),l=JSON.parse((c.stdout||"").trim()||"{}"),u=a("direct",l.direct??[]),p=a("relay",l.relay??[]);if(null===u.ms&&null===p.ms)return;s(o(u,p,i.entry),"auto")}catch{}}();
1
+ import{spawnSync as t}from"node:child_process";import{ENTRIES as e,loadSite as n,readEntryChoice as r,recommend as o,setEntry as s}from"./site.js";function i(t,e){const n=[...e].sort((t,e)=>t-e);return{key:t,ms:n.length?n[Math.floor(n.length/2)]:null,ok:n.length}}export function shouldAutoCheck(t){if("0"===t.env.ICOA_ENTRY_AUTO)return!1;if(!t.tty)return!1;if("user"===t.by||t.venue)return!1;if(t.env.ICOA_LEARN_SERVER?.trim()||t.env.ICOA_EXAM_SERVER?.trim())return!1;const e=t.argv.slice(2);return!e.some(t=>"--version"===t||"-V"===t||"--help"===t||"-h"===t)&&"entry"!==e[0]&&t.now-t.at>864e5}!function(){try{const a=r();if(!shouldAutoCheck({argv:process.argv,env:process.env,tty:!!process.stdout.isTTY,by:a.by,at:a.at,venue:n().ok,now:Date.now()}))return;const c=t(process.execPath,["-e","\nconst [d, r, cap] = [process.argv[1], process.argv[2], Number(process.argv[3])];\nconst end = Date.now() + cap;\nconst one = async (b) => { const t = Date.now(); const left = end - t; if (left < 50) return null; try {\n const x = await fetch(b + '/api/icoa/server-time?t=' + t + Math.random(), { signal: AbortSignal.timeout(left) });\n await x.arrayBuffer(); return x.ok ? Date.now() - t : null; } catch { return null; } };\nconst door = async (b) => { const got = []; if ((await one(b)) === null) return got;\n for (let i = 0; i < 3; i++) { const v = await one(b); if (v !== null) got.push(v); } return got; };\nPromise.all([door(d), door(r)]).then(([a, b]) => { console.log(JSON.stringify({ direct: a, relay: b })); process.exit(0); });\n",e.direct.base,e.relay.base,String(2500)],{encoding:"utf8",timeout:4e3,stdio:["ignore","pipe","ignore"]}),u=JSON.parse((c.stdout||"").trim()||"{}"),l=i("direct",u.direct??[]),f=i("relay",u.relay??[]);if(null===l.ms&&null===f.ms)return;s(o(l,f,a.entry),"auto")}catch{}}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.19.711",
3
+ "version": "2.19.712",
4
4
  "description": "ICOA CLI — AI-native competition runtime of the International Cyber Olympiad in AI: learn, practise, and compete in AI & cybersecurity from the terminal (AI4CTF · CTF4AI · CTF4EAI)",
5
5
  "author": "Charlie Zhu",
6
6
  "type": "module",