icoa-cli 2.19.599 → 2.19.601

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{getDeviceFingerprint as e}from"./access.js";import{LEARN_SERVER as t}from"./learn-curricula.js";async function n(n,o,r){const a=t.replace(/\/$/,"")+n;try{const t=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,device_fingerprint:e()}),signal:AbortSignal.timeout(r)}),n=await t.json().catch(()=>({}));return t.ok&&n.success&&void 0!==n.data?{ok:!0,data:n.data}:{ok:!1,message:n.message||`HTTP ${t.status}`,code:n.code}}catch(e){return{ok:!1,message:`Network error: ${e instanceof Error?e.message:String(e)}`}}}export function learnPost(e,t,o){return n(e,t,o)}export function contestStart(e,t,o,r){return n("/api/icoa/learn/contest/start",{token:e.toUpperCase(),phase:t,...null!=o?{slot:o}:{},...r?{practice:!0}:{}},15e3)}export function contestSubmit(e,t,o,r,a,i){return n("/api/icoa/learn/contest/submit",{token:e.toUpperCase(),phase:t,problem_id:o,code:r,...null!=a?{slot:a}:{},...i?{dyn:i}:{}},12e4)}export function contestReset(e,t,o){return n("/api/icoa/learn/contest/reset",{token:e.toUpperCase(),phase:t,...null!=o?{slot:o}:{}},15e3)}export function duckBoard(e,t,o={}){return n("/api/icoa/learn/duck/board",{token:e.toUpperCase(),problem_id:t,...o},15e3)}export function fetchGate(e){return n("/api/icoa/learn/gate",{token:e.toUpperCase()},15e3)}export function learnCheck(e,t){return n("/api/icoa/learn/check",{token:e.toUpperCase(),target:t.toUpperCase()},15e3)}export function linkSuggest(e){return n("/api/icoa/learn/link",{token:e.toUpperCase()},2e4)}export function linkByIndex(e,t){return n("/api/icoa/learn/link",{token:e.toUpperCase(),index:t},2e4)}export function linkToken(e,t){return n("/api/icoa/learn/link",{token:e.toUpperCase(),other_token:t.toUpperCase()},2e4)}export function timeLeft(e){const t=Date.parse(e);if(Number.isNaN(t))return null;const n=t-Date.now();if(n<=0)return null;const o=Math.floor(n/6e4),r=Math.floor(n%6e4/1e3);return`${o}:${String(r).padStart(2,"0")}`}export function arenaSlotAtPos(e){return e%4==0?e/4:10===e?4:0}export function arenaPosInPhase(e){const t=[];for(let n=4;n<=Math.min(e,12);n+=4)t.push(n);return t}export function arenaCadence(e=12){const t=arenaPosInPhase(e);return{cards:t.join(" / "),n:t.length}}export function posForArenaSlot(e){return 4===e?10:4*e}
1
+ import{getDeviceFingerprint as e}from"./access.js";import{LEARN_SERVER as t}from"./learn-curricula.js";async function n(n,o,r){const a=t.replace(/\/$/,"")+n;try{const t=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,device_fingerprint:e()}),signal:AbortSignal.timeout(r)}),n=await t.json().catch(()=>({}));return t.ok&&n.success&&void 0!==n.data?{ok:!0,data:n.data}:{ok:!1,message:n.message||`HTTP ${t.status}`,code:n.code}}catch(e){return{ok:!1,message:`Network error: ${e instanceof Error?e.message:String(e)}`}}}export function learnPost(e,t,o){return n(e,t,o)}export function contestStart(e,t,o,r){return n("/api/icoa/learn/contest/start",{token:e.toUpperCase(),phase:t,...null!=o?{slot:o}:{},...r?{practice:!0}:{}},15e3)}export function contestSubmit(e,t,o,r,a,i){return n("/api/icoa/learn/contest/submit",{token:e.toUpperCase(),phase:t,problem_id:o,code:r,...null!=a?{slot:a}:{},...i?{dyn:i}:{}},12e4)}export function contestReset(e,t,o){return n("/api/icoa/learn/contest/reset",{token:e.toUpperCase(),phase:t,...null!=o?{slot:o}:{}},15e3)}export function duckBoard(e,t,o={}){return n("/api/icoa/learn/duck/board",{token:e.toUpperCase(),problem_id:t,...o},15e3)}export function fetchGate(e){return n("/api/icoa/learn/gate",{token:e.toUpperCase()},3e4)}export function learnCheck(e,t){return n("/api/icoa/learn/check",{token:e.toUpperCase(),target:t.toUpperCase()},15e3)}export function linkSuggest(e){return n("/api/icoa/learn/link",{token:e.toUpperCase()},2e4)}export function linkByIndex(e,t){return n("/api/icoa/learn/link",{token:e.toUpperCase(),index:t},2e4)}export function linkToken(e,t){return n("/api/icoa/learn/link",{token:e.toUpperCase(),other_token:t.toUpperCase()},2e4)}export function timeLeft(e){const t=Date.parse(e);if(Number.isNaN(t))return null;const n=t-Date.now();if(n<=0)return null;const o=Math.floor(n/6e4),r=Math.floor(n%6e4/1e3);return`${o}:${String(r).padStart(2,"0")}`}export function arenaSlotAtPos(e){return e%4==0?e/4:10===e?4:0}export function arenaPosInPhase(e){const t=[];for(let n=4;n<=Math.min(e,12);n+=4)t.push(n);return t}export function arenaCadence(e=12){const t=arenaPosInPhase(e);return{cards:t.join(" / "),n:t.length}}export function posForArenaSlot(e){return 4===e?10:4*e}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.19.599",
3
+ "version": "2.19.601",
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",