icoa-cli 2.19.685 → 2.19.686
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.
- package/dist/commands/ai4ctf.js +1 -1
- package/dist/commands/ai4ioai.js +1 -1
- package/dist/commands/arena-eai.js +1 -1
- package/dist/commands/battle.js +1 -1
- package/dist/commands/comms.js +1 -1
- package/dist/commands/ctf4ai-demo.js +1 -1
- package/dist/commands/ctf4vla.js +1 -1
- package/dist/commands/demo2.js +1 -1
- package/dist/commands/demo3.js +1 -1
- package/dist/commands/duck-contest.js +1 -1
- package/dist/commands/duck-cup.js +1 -1
- package/dist/commands/duck.js +1 -1
- package/dist/commands/exam.js +1 -1
- package/dist/commands/gfssm.js +1 -1
- package/dist/commands/gpufortask.js +1 -1
- package/dist/commands/ioailab.js +1 -1
- package/dist/commands/ipynb.js +1 -1
- package/dist/commands/learn.js +1 -1
- package/dist/commands/sim.js +1 -1
- package/dist/commands/sprint.js +1 -1
- package/dist/commands/wm.js +1 -1
- package/dist/lib/algo-replay.js +1 -1
- package/dist/lib/card-engine.js +1 -1
- package/dist/lib/guide-panel.js +1 -0
- package/dist/lib/learn-cup.js +1 -1
- package/dist/lib/learn-pvp.js +1 -1
- package/dist/lib/learn-team.js +1 -1
- package/dist/repl.js +1 -1
- package/package.json +1 -1
package/dist/commands/ai4ctf.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(j,q){const a4=a0q,v=j();while(!![]){try{const z=-parseInt(a4(0x231))/(-0x6b6*-0x5+-0x1bdf+-0x5ae)+parseInt(a4(0x1db))/(-0x1*0x17fc+-0x10f4+0x28f2)*(parseInt(a4(0x1b1))/(0xc7f+0x1181+0x3*-0x9ff))+-parseInt(a4(0x1b3))/(-0x1*-0xa6f+-0x8*-0xe8+-0x11ab)*(-parseInt(a4(0x1e8))/(-0xb*-0x371+0x1*-0x77e+-0x1e58))+-parseInt(a4(0x261))/(0xd8b*-0x2+0xee3+-0x1*-0xc39)*(-parseInt(a4(0x236))/(0x59*0x68+0x1ba5+-0x2*0x1fe3))+parseInt(a4(0x26f))/(0x76f+-0x32+0xf*-0x7b)*(parseInt(a4(0x1d4))/(0x183*-0x14+-0x1ae2+0x130d*0x3))+-parseInt(a4(0x1f3))/(0x199d+0x2362*0x1+-0x3cf5)*(parseInt(a4(0x27e))/(-0x1d39+-0x7*-0x515+-0x64f))+-parseInt(a4(0x297))/(-0x7cb+0x25e0+-0x1e09);if(z===q)break;else v['push'](v['shift']());}catch(B){v['push'](v['shift']());}}}(a0j,-0x36dbc+0x54407+0x7d3df));import a0z from'chalk';import{createChatSession as a0B}from'../lib/gemini.js';import{addTokenUsage as a0D}from'../lib/budget.js';import{getConfig as a0E,isConnected as a0F}from'../lib/config.js';function a0j(){const ak=['nJKXnJeYue9NzMTO','icdIMQaGww91CIbbstrdveyGDg9Rzw4GyNvKz2v0igLZigv4Agf1C3rLzc4','C2vZC2LVBKnVB2TPzq','ywK0y3rMv3jHCff1B3rHrM9VDgvY','ywK0y3rMtg9JA2vKvgL0Bgu','mty2ndK3ohvMuMT1AG','icdILRGG','Bg9N','zgf0yq','ywK0y3rM','y3vYCMvUDenOywXSzw5NzuLK','q3j5ChrVz3jHCgH5','icbnB2rLBdOGr29Vz2XLieDLBw1HidqGka','C3rHCNrZv2L0Aa','l2fWAs9Py29Hl2fPl2fJy291BNqTyNvKz2v0p2TPBMq9ywK0y3rM','icbezxrLy3rLzcbMBgfNiokaLcb0CMvHDgLUzYbHCZOG','Ahr0Chm6lY9WCMfJDgLJzs5Py29HmJaYnI5HDs9HCgKVAwnVys9Kzw1Vlxn0yxrZ','ywK0y3rMq29TBwfUzhm','B3bLBIa8Awq+','ywK0y3rMu3vIBwL0q21K','icdILzdILzdILzaGquKGvgvHBw1HDguG4Pwq4Pwq4Pwq','y2HHBgXLBMDLswq','C2vUze1LC3nHz2u','sgLKzgvUie1LC3nHz2u','yxr0ywnOzwreyxrH','icdcTYaGuMuTzw50zxi6ia','B3jcywnR','DgHPBMTPBMC','y3vYCMvUDenOywXSzw5NzunHDgvNB3j5','ywK0y3rMsgLUDejvC2vZ','z2vTAw5Ptw9KzwW','icaGihn1yM1PDca8zMXHzZ4Gica','yvDoDLLyDdnnmNHQtuCXBfH6sMzzv2SWwtnsBwzrpt0','AM9PBG','ywK0y3rMq29YCMvJDezSywC','C2vZC2LVBJ0','icbdB21WzxrPDgLVBIbPCYbWyxvZzwqU','rMXHzYbMB3jTyxq6igLJB2f7lI4UFq','z3jLzw4','ywK0y3rMrxHPDa','vw5RBM93BIbYzxnWB25Zzq','icbbstrdveyGy2HHDcbPCYbHDMfPBgfIBguGB24GChjHy3rPy2fSihf1zxn0Aw9UCYaOBMv4DdOGuq','iNDOyxqGzw5JB2rPBMCGAxmGDgHPCZ8I','ywK0y3rMv3jHCeXPBMuXqM9KEq','u2nVCgvKihrVihrOzsbJAgfSBgvUz2uGEw91ig9Wzw5Lzc4GqxnRigzYzwvSEsdIGjq','C3vIBwL0idXMBgfNpG','icbbssbIDwrNzxq6ia','icaGigv4AxqGicaGicaGicaGica','mtHTBw5lruC','ywK0y3rMuMv2zwfSu2vLrMXHzW','icbfCNjVCJOG','ihjLy29YzgvKoIa','ywK0y3rMv3jHCe5LEhrcB2r5','icaGicaODhLWzsbPDcbYAwDODcbOzxjLigLUihrOAxmGy2HHDcdIGjqGBM90igfZigeGC2HLBgWGy29TBwfUzcK','y29TBwfUza','imk3ia','iokvKokvKokvKa','icaGicaGicaGicblzxKGyNjLywT0AhjVDwDOicHWCMuTD3jPDhrLBIK','ywK0y3rMv3jHCff1B3rHqW','zMLUza','q29TBwfUzcbMywLSzwq','icaGieP1C3qGDhLWzsbMCMvLBhKGDg8Gy2HHDcb3AxrOihrOzsbbssb0zwfTBwf0zs4','otiWsMvyC0D2','AwnVyxT3m2XJmg1LxZjFywK0y3rMFq','icbvC2fNztOG','icdILzdILzdILzaG','ywXYzwfKEv9ZB2X2zwq','D3jPDgu','ywK0y3rMsgLUDe5LEhrc','DgvZDa','ywK0y3rMv2vSy29Tzun0yq','ywK0y3rMv3jHCeXPBMuXsgvHza','yxbWBgLJyxrPB24VANnVBG','icaGia','icaG4OAsia','cGPbvfrbq0HfrcbeqvrbicHHBhnVihnHDMvKihrVignOywXSzw5NzxmVCq','icdIMQaG','mtfLyvDLsNO','CxvPDa','ywrK','icdILjtILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','ywK0y3rMv3jHCff1B3rHq0HPBNq','icaGice8C2HLBgWGy21KpIaGica','icbtDwjTAxnZAw9UigzHAwXLzdOG','C3bSAxq','icaGicaGigHPBNqGyIaGia','y2f0y2G','icaGicaGicaHzwnOBYbHv052wvH0m00YEgPnrZfSwhPkzLLxAZbzm1jTzLe9psb8igjHC2u2ncaTza','ywK0y3rMvgHPBMTPBMC','D2HPDgu','lI4VBgLIl2LUDgvNCML0Es1ZBMfWC2HVDc5QCW','icbbzNrLCIbLEgL0oIa','CgfKrw5K','icdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILza','C3vIBwL0qxr0zw1WDgvK','quKGzxjYB3i6ia','Dg9Rzw5ZvxnLza','ywK0y3rMrw5Ku2vZC2LVBG','lI4U','ywK0y3rMoIa','icdILiiG','lNr4DcbPBNnPzguGDgHLignVBNrLC3rHBNqNCYbZyw5KyM94iokaLcbWyxrOigLZihjLBgf0AxzLihrVihrOzsbZyw5KyM94j3mGl2HVBwuVy29TCgv0AxrVCIb3B3jRAw5NigrPCMvJDg9YEsWGCMvHy2HHyMXLigzYB20Gyw55icfZAgvSBcaVicfWExrOB24ZigLUDM9JyxrPB24PoGO','mJaZotq0oevlC3blzW','igLZigeGBxvSDgLWBguTy2HVAwnLihf1zxn0Aw9UiokaLcbHBNn3zxiGD2L0Acbbl0iVqY9elG','icbuAguGquKGDgvHBw1HDguGC2nVCgvZigL0C2vSzIb0BYb0AguGy2HHBgXLBMDLihLVDsbVCgvUlG','icdILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','ywK0y3rMv3jHCff1B3rHqq','icbvC2u6ia','lcbVCIbYzs1LBNrLCIb3AxrOia','quK0q1rgihnLy3rPB24','AgLUDcbH','ywK0y3rMq21KsgLUDeXPBMu','yw5ZD2vYCW','C3rYAw5NAwz5','ywK0y3rMsgLUDefcB2r5','AgfZ','ywK0y3rMq21Ku2HLBgXmAw5L','zgvZy3jPChrPB24','ywK0y3rMv3jHCfr5CgvdDgy0ywK','iIaOy2f0zwDVCNK6ia','ywK0y3rMv3jHCe5VuhjVzW','E2nTzh0','ywK0y3rMrMXHz0HPBNq','icaGicaGia','ihrVignVBNrPBNvL','ieLdt0f7lI4UFq','z2vTBweTnc0ZmwiTAxq','Dg9Rzw5mAw1PDa','ywnJB3vUDenHCa','z3jHEq','icbgBgfNigzVCM1HDdOG','ixnOzwXS','icaGica','Cu51Bq','iwvJAg8GyvDoDI4UlIb8igjHC2u2ncaTza','iokaLcb0ExbLia','ywK0y3rMv2vSy29Tzu5VuMv2zwfS','icaGigHPBNqGyG','DhLWzq','ue9tva','icbLEgL0ihrVigXLyxzLignOyxq','igLZigfUievTyM9KAwvKiefjicHfquKPihf1zxn0Aw9UlG','icbr','icaOCMvZDw1PBMCG4OcuihbYAw9YignOyxqGAxmGBM90ihjLBwvTyMvYzwqSigj1Dcb0B2TLBNmGywXYzwfKEsb1C2vKihn0yxKGzgvKDwn0zwqP','C3LUy2LUz+kaPG','rNvSBcbXDwvZDgLVBJOGia','CMf0zwXPBwL0zwq','DgLTzw91Da','g1SXqrTBmKS','icbtD2L0y2GGy2HHBgXLBMDLoIa','iMHVDYbKBYbjigrLy3j5ChqGquvtluncqYbPBIbqExrOB24/iG','icbdB21Tyw5KCW','vg9Rzw5Z','ywLvC2fNzq','ww91igfYzsbHBIbbssb0zwfTBwf0zsbOzwXWAw5NigeGy29UDgvZDgfUDcbZB2X2zsbHBIbjq09bidiWmJyGy3LIzxjZzwn1CML0EsbLEgfTihf1zxn0Aw9UlGOkq1vsuKvovcbrvuvtveLptIaOuq','igfUC3DLCIb1CgrHDgvKoIa','ig5VDcbMB3vUzcbPBIbZDgf0zs4','y3vYCMvUDenOywXSzw5Nzu5HBwu','ywK0y3rMsgLUDfbYAw5JAxbSzq','iIbSB29RCYbSAwTLigfUie1dusbSzxr0zxiSig5VDcbHigzSywCU','ihrOzw4GCMuTzw50zxiG','icbbstrdveyGC2vJDgLVBIbJB21WBgv0zsdIGjqG','icdINjmGqw5ZD2vYigzVCIbr','icaGicaGicaGicaGicaGicaGicbLlMCUia','y2XLyxi','ywK0y3rMuMv2zwfSvgHLBLn1yM1PDa','ywn0Aw9U','uNvUigeGC2HLBgWGy29TBwfUzcaOzs5NlIaHyMfZzty0ic1Kic4UlIK','icbbssbIDwrNzxqGzxHOyxvZDgvKigzVCIbbstrdveyGC2vJDgLVBI4','icbLEgL0ihrVigXLyxzLignOyxqGWRCGC3vIBwL0idXMBgfNpIb0BYbZy29Yzq','icbtDgLSBcbHDMfPBgfIBgu6ia','y2f0zwDVCNK','C3rKB3v0','icaGigHPBNqGyW','C3vIBwL0ieLdt0f7Ew91CL9MBgfNFq','ywK0y3rMrM91BMrgBgfN','icaGwW','ywK0y3rMv3jHCff1B3rHqKHPBNq','icaGicbsDw4GuhL0Ag9UigLUihnOzwXS','y29UDgLUDwu','ywK0y3rMsgLUDe5LEhrb','igLZigeGq1rgnefjihf1zxn0Aw9UicHHDhrHy2STDgHLlufjks4','icaGicaGicaGicaGica','Dg9vChbLCKnHC2u','ihrOzw4G','CMvWzwf0','zw5JB2rPBMC','q29UDgvUDc1uExbL','ywK0y3rMsgLUDei','Dgv4Da','ywnJB3vUDfzLCMLMAwvK','icbLEgL0id0GyMfJAYb0BYbLEgfTimk3ihn1yM1PDcbjq09bEY4UlN0GDg8Gyw5ZD2vY','ww91igfYzsbHBIbbssb0zwfTBwf0zsbOzwXWAw5NigeGy29UDgvZDgfUDcbPBIbHigXPDMuGq2fWDhvYzs1uAguTrMXHzYbJB21WzxrPDgLVBI4kcKnvuLjftLqGq0HbteXftKDfoIaI','ywK0y3rMsgLUDem','ifn1yM1PDcb5B3vYigzSywCGzM9YihrOAxmGCxvLC3rPB24','EwvSBg93','ywK0y3rMq2HHBgXLBMDL','ywK0y3rMv3jHCfrPDgXL','mtCWndLdDNzlreu','BwvZC2fNzq','ntG2nty0zhDJuhLb','icbszxn1Bwu6ia','icdWN46jienVCNjLy3qHia','ywK0y3rMsgLUDee','icdILzdILzdILzaGquK0q1rgiokaLcbr','yMfJAW','icbB','icbbssb1C2fNzsbPCYbTzxrLCMvKihbLCIbHy2nVDw50icHZzxj2zxiTzw5MB3jJzwqGyNvKz2v0ks4','y3LHBG','ywK0y3rMrgvJB2rLza','iokaLca','ywK0y3rMv3jHCeXPBMuYsgvHza','BM93','icaGicaGicaGicaGieXLyxzLignOyxqSihjLDhvYBIb0BYbLEgfT','icbozxH0oIa','icbpCgvUig9UzsbMAxjZDdOG','ywK0y3rMvg9Rzw5Z','DgHLiefjigD1AwrLCYWGAxqGD2LSBcbUB3qGAgfUzcb5B3uGDgHLigzSywCU','ywK0y3rMv3jHCff1B3rHqG','rMXHzYbMB3jTyxq6icaGieLdt0f7lI4UFq','Dg9Rzw4','E25VuhjVz30','jsbVzIbZzwn0Aw9Uiefjigj1zgDLDcb1C2vKiokaLcbVBMX5ih4','zxHHBsbXia','ywK0y3rMtgv2zwXZ','icdILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','icdWN5kHie9Uy2uGEw91igHHDMuGsunpqxSUlI59lcbZDwjTAxqGAxqGD2L0AdOG','icaGicfWExrOB24Zic4UlG','BgvUz3rO','CMvWBgfJzq','icaGigHPBNqGyq','yM9VBgvHBG','ihbVAw50CYK6cG','nZu2mdLbufH1tMu','icbpCgvUigfUB3rOzxiGy2HHBgXLBMDLihDPDgGG','ihb0CW','C2XPy2u','zw50zxjLzef0','Dg9ju09tDhjPBMC','Aw5JB3jYzwn0','mJC0EMnns3nQ','y3rMzfvYBa','icaGig1LBNu','yM9Sza','ig5VDcbMB3vUzcbPBIbZDgf0zs4Gvhj5oIbLEgfTiheG','BM9KztPJAgLSzf9WCM9JzxnZ','ig9UifeZoq','icaGicaGigHPBNqGyYaGia','icbbzNrLCIbLEgL0oIbbstrdveyGC2vJDgLVBIbJB21WBgv0zs4GtMv4DdOG','oIbhB29NBguGr2vTBweGncaOz2vTBweTnc0ZmwiTAxqP','C3rHDhvZ','AgLUDcbI','Dw5RBM93BIbLCNjVCG','nwT3tw1mva','icdILRGGia','lI4VBgLIl2v4yw0TC3rHDguUANm','DhjPBq','ywK0y3rMv291BgrfyxjU','C3vIBwL0rMXHzW','ywK0y3rMsw50zxjJzxb0zwq','CMvK','yw5ZD2vYx3n1yM1PDhrLza','Cg9PBNrZ','BNvTyMvY','mteWotKZnZb4zvbJCNm','ihrVig1VDMuGB24','ywK0y3rMsgLUDfrLy2HUAxf1zq','zxHPDa','ywK0y3rMsgLUDejcB2r5','ANnVBG','ywK0y3rMt3jdAgf0rxHHBxbSzq','DxrMltG','xsaGWRCG','icaGicaGicaGicfLy2HVigfxtNzzwhqZttj4AK1hmwXyEKPMwvDRmfKZuM1Mut09ihWGyMfZzty0ic1K','CxvLC3rPB25Z','icbbBhjLywr5ihnVBhzLzc4','vg9Rzw4G','y3rMngvHAq','oIbhB29NBguGr2vTBweGncaO','y2HHBgXLBMDLtMfTzq','lZuWmda','lI4VBgLIl2n0zMqTy2XPzw50lMPZ','y3rMigXPC3q','icbzB3uGy2fUihn0AwXSoIa','icdINjCGsw5JB3jYzwn0lIa','C3vIBwL0ia','icaGicaGicaGicbbigDLBNrSzsbUDwrNzsaOChjLlxDYAxr0zw4P','icdILiZILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','ywK0y3rMsgLUDefvC2vZ','cIaG','BMfTzq','ywK0y3rMsgLUDe51zgDL','icaKia','BNvKz2vtAg93BG','ywK0y3rMuMvWB3j0','AgLUDcbJ','sunpqxT5B3vYx2zSywD9','icaGicaGicaGicbuzwnOBMLXDwuGAgLUDcaOChjLlxDYAxr0zw4P','Aw50zxjHy3rPB25Z','icdILii','icbzB3uGy2fUihn0AwXSihn1yM1PDcbHigzSywCGzgLYzwn0BhK6ia','igfNywLUihrVignOyw5NzsWGB3iG','Aw5JBhvKzxm','ywK0y3rMrxHPDe5LEhrtDwi','Bwf0y2G','icboBYbJAgfSBgvUz2uGB3bLBIb5zxqU','cGPzt1vsifjvtevtoGOTifLVDsbnqvKGzxHWBgfPBIbJB25Jzxb0CYWGzgvZy3jPyMuGyxbWCM9Hy2HLCYWGyw5KigHLBhaGDgHLignVBNrLC3rHBNqGCMvHC29UihrOCM91z2GGDgHLihbYB2jSzw0UcI0Gww91ie1bwsbKAxnJDxnZihrOzsb0zwnOBM9SB2D5igLUDM9SDMvKicHbrvmSihb3BNrVB2XZlcbqExrOB24GC3rYDwn0lcbivfrqlcbLDgmUks4klsbzB3uGtufzigHLBhaGzgvIDwCGuhL0Ag9UignVzguGDgHLignVBNrLC3rHBNqGD3jPDgvZlGOTifLVDsbnvvnuie5pvcbYzxzLywWGDgHLigzSywCGzgLYzwn0BhKUcI0Gww91ie1vu1qGtK9uig91Dhb1DcbHBNKGC3rYAw5Nig1HDgnOAw5NieLdt0f7lI4UFsbVCIbPy29HEY4UlN0UcI0Gww91ie1vu1qGtK9uihrLBgWGDgHLignVBNrLC3rHBNqGDgHLigv4ywn0igfUC3DLCIb0BYb0AgLZihf1zxn0Aw9UlGOTifLVDsbnqvKGC3vNz2vZDcb3AgLJAcb0B29Sic8GBgLICMfYEsaVihrLy2HUAxf1zsb0BYb1C2uUcI0Gv2HLBIbZDwDNzxn0Aw5NihnOzwXSic8GChL0Ag9UihnUAxbWzxrZihrOyxqGBMvLzcb0AguGyxr0ywnOzwqGzgf0ysWGCMvMzxiGDg8GDgHLigzPBguGCgf0AcbJAgfSBgvUz2vZl3e','ywnJB3vUDfnWzw50','icaOC3vIBwL0igfNywLUihrVignOyw5NzsK','ywK0y3rMrgvJB2rL','quKGyNvKz2v0icH0AgLZigfJy291BNqP','u3vIBwL0igeGzMXHzYb0BYb0AguGBgL2zsbZy29YzwjVyxjK','x2XHC3rr','yw5ZD2vYx2nOyw5Nzwq','ywK0y3rMuMv2zwfSvgL0Bgu','icboBYbJAgfSBgvUz2uGAwqGAw4Gy29UDgv4DcdIGjqGB3bLBIbVBMuGzMLYC3q6ia','icbbssb0zwfTBwf0zsbJBg9ZzwqGzM9Yici','ywK0y3rMsgLUDenvC2vZ','y3rMngfP','ywK0y3rMu2fTCgXL','y29YCMvJDa','icaGicaGicaGicaGifjLDhvYBIb0BYbTywLUig1LBNuGkhDVCMTZigfUExDOzxjLkq','CM91BMq','C3vIBwL0ieLdt0f7lI4UFq','ywK0y3rMsgLUDencB2r5','Dg9mB3DLCKnHC2u'];a0j=function(){return ak;};return a0j();}import{logCommand as a0G,logSubmission as a0H}from'../lib/logger.js';import{printMarkdown as a0I,printError as a0J}from'../lib/ui.js';import{t as a0K}from'../lib/i18n.js';import{httpFetch as a0L}from'../lib/http.js';const r=j=>new Promise(q=>setTimeout(q,j));let u=!(0x976+-0xa21+-0xac*-0x1),h=null,y=-0x4*0x487+-0x22*-0xc1+0x2*-0x3c3,d=-0x1*0xf9a+-0x1a39+0x29d3,m=!(0x29*-0x71+-0xf7+0x1310),f=!(-0x1e06+0x1*0x214f+-0xa8*0x5),p=!(0x215+-0x1*-0x1f67+-0x217b);const w=0x191*0x1f+0xa55f*-0x1+-0x1acf*-0x8,b=-0xbfaf1+0x249f9*-0x1+-0x1614ea*-0x1;let $=null,A=null;export function isChatActive(){return u;}function x(){const a5=a0q,j=$?w:A?d||b:-0xc0b*-0x2+0x1990+-0x1e1e,q=y,v=Math['min'](Math[a5(0x22d)](q/j*(-0x1a9d+-0xcd7+0x27d8)),0x1f97*-0x1+-0x36*0x99+-0x4041*-0x1),z=Math[a5(0x22d)](v/(0x1*-0x19c3+-0x1e99+-0x20*-0x1c6)*(0x16c0+-0x210c+-0x2*-0x530)),B=-0x1ae3*-0x1+0x13*-0xc1+-0xc7c-z,D=v>0x1*0x1b15+0xb2b*0x2+-0x3c7*0xd?a0z['red']:v>0x13b5+0x211f+-0x34a2?a0z['yellow']:a0z[a5(0x257)],E=$?a5(0x29e):A?a5(0x221):a5(0x183);!A||m?!A||f?console[a5(0x238)](a0z[a5(0x2b2)]('\x20\x20'+E+':\x20')+D('█'[a5(0x1a4)](z))+a0z[a5(0x2b2)]('░'[a5(0x1a4)](B))+a0z[a5(0x2b2)]('\x20'+q+'/'+j+'\x20('+v+'%)')):console['log'](a0z[a5(0x2b2)]('\x20\x20AI\x20budget:\x20')+a0z[a5(0x1ae)](a5(0x17b))+a0z[a5(0x2b2)]('\x20(updates\x20after\x20your\x20first\x20message)')):console[a5(0x238)](a0z[a5(0x2b2)](a5(0x25f))+a0z[a5(0x1ae)]('not\x20enforced\x20for\x20this\x20login')+a0z[a5(0x2b2)]('\x20—\x20update\x20icoa-cli\x20to\x20the\x20latest\x20version'));}function a0q(a,b){a=a-(0x18*-0x36+0x25*-0x109+0x6*0x779);const c=a0j();let d=c[a];if(a0q['IbTqsE']===undefined){var e=function(i){const j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let l='',m='';for(let n=0x976+-0xa21+-0xab*-0x1,o,p,q=-0x4*0x487+-0x22*-0xc1+0x2*-0x3c3;p=i['charAt'](q++);~p&&(o=n%(-0x1*0xf9a+-0x1a39+0x29d7)?o*(0x29*-0x71+-0xf7+0x1350)+p:p,n++%(-0x1e06+0x1*0x214f+-0x117*0x3))?l+=String['fromCharCode'](0x215+-0x1*-0x1f67+-0x207d&o>>(-(0x71*0x16+0x2113*-0x1+-0xc1*-0x1f)*n&-0x1df4+0x5b9*-0x1+-0x23b3*-0x1)):-0xc0b*-0x2+0x1990+-0x31a6){p=j['indexOf'](p);}for(let r=-0x1a9d+-0xcd7+0x2774,s=l['length'];r<s;r++){m+='%'+('00'+l['charCodeAt'](r)['toString'](0x1f97*-0x1+-0x36*0x99+-0x3fed*-0x1))['slice'](-(0x1*-0x19c3+-0x1e99+-0x41*-0xde));}return decodeURIComponent(m);};a0q['esdTqs']=e,a0q['KNpVja']={},a0q['IbTqsE']=!![];}const f=c[0x16c0+-0x210c+-0x1*-0xa4c],g=a+f,h=a0q['KNpVja'][g];return!h?(d=a0q['esdTqs'](d),a0q['KNpVja'][g]=d):d=h,d;}export async function handleChatMessage(z){const a6=a0q;if(!h)return a6(0x1f6);if(a0G(a6(0x294)+z),$)return k(z);if(A)return async function(G){const a7=a6;if(!A||!h)return a7(0x1f6);const H=G['trim'](),I=H[a7(0x230)](),J=H['match'](/^submit\s+(.+)/i);if(J){let K=J[0x6f3+0x55b+0x2f*-0x43][a7(0x1eb)]();if(/^submit\s+/i[a7(0x276)](K)&&(K=K['replace'](/^submit\s+/i,'')[a7(0x1eb)]()),K=K[a7(0x1d0)](/^["'`]+|["'`]+$/g,'')[a7(0x1eb)](),!K)return console[a7(0x238)](),console[a7(0x238)](a0z['gray'](a7(0x271))+a0z[a7(0x28a)]('submit\x20<flag>')),console[a7(0x238)](),'continue';const L=A[a7(0x246)];if(!L)return console[a7(0x238)](),console[a7(0x238)](a0z[a7(0x1ae)](a7(0x226))+a0z[a7(0x28a)](a7(0x243))),console[a7(0x238)](),'continue';a0H(L,K);const M=a0E();try{const {CTFdClient:N}=await import('../lib/ctfd-client.js'),O=M[a7(0x233)]||'',P=M['token']&&!M[a7(0x1c7)][a7(0x219)](a7(0x254))?M['token']:'',Q=new N(M[a7(0x1dc)],P,O||M[a7(0x1c7)]),R=await Q[a7(0x1ed)](L,K);switch(console['log'](),R[a7(0x1e5)]){case a7(0x22b):console[a7(0x238)](a0z['green'][a7(0x1de)](a7(0x1b5))+a0z['white'](R[a7(0x1b2)]||''));break;case a7(0x1da):console[a7(0x238)](a0z[a7(0x1ef)](a7(0x207))+a0z['gray'](R[a7(0x1b2)]||''));break;case a7(0x273):console[a7(0x238)](a0z[a7(0x1ae)](a7(0x1fe)));break;case'paused':console[a7(0x238)](a0z['yellow'](a7(0x255)));break;case a7(0x17d):console[a7(0x238)](a0z[a7(0x1ae)]('\x20\x20Rate\x20limited\x20—\x20wait\x20a\x20moment\x20before\x20trying\x20again.'));break;default:console[a7(0x238)](a0z[a7(0x2b2)]('\x20\x20'+(R['message']||a7(0x259))));}console[a7(0x238)]();const {postIntegritySnapshot:S}=await import(a7(0x28b));await S();}catch(T){console[a7(0x238)](),console[a7(0x238)](a0z['red'](a7(0x284)+(T[a7(0x1b2)]?.[a7(0x285)]('\x0a')[-0x464+-0x532*-0x5+-0x12*0x133]||a7(0x1e7)))),console['log']();}return a7(0x19e);}if(G['startsWith']('!')){const U=G[a7(0x1d7)](-0x77*0x1d+0x3*0x335+0x3dd)[a7(0x1eb)]();if(!U)return a7(0x19e);try{const V={};V[a7(0x1a5)]=a7(0x1fa),V[a7(0x17e)]=0x2710;const {execSync:W}=await import(a7(0x1e0)),X=W(U,V)['trim']();console[a7(0x238)](),console[a7(0x238)](a0z[a7(0x2b2)](a7(0x20f))+a0z[a7(0x28a)](U)),console[a7(0x238)](a0z[a7(0x28a)]('\x20\x20'+X['split']('\x0a')[a7(0x252)](a7(0x20c)))),console[a7(0x238)]();}catch(Y){console[a7(0x238)](),console[a7(0x238)](a0z[a7(0x1ef)](a7(0x263)+(Y[a7(0x1b2)]?.[a7(0x285)]('\x0a')[-0x1*0x1f66+-0x277*-0x8+0x17*0x82]||a7(0x26d)))),console[a7(0x238)]();}return a7(0x19e);}if(a7(0x1f6)===I||a7(0x1b8)===I||a7(0x27f)===I){const Z=A[a7(0x202)];return u=!(0x1ec2+0x17d*0x6+-0x27af),h=null,A=null,console[a7(0x238)](),console['log'](a0z['gray'](a7(0x227)+Z+'\x22.')),console[a7(0x238)](a0z['gray'](a7(0x1d5))+a0z[a7(0x28a)](a7(0x243))+a0z[a7(0x2b2)](a7(0x29d))+a0z['white'](a7(0x23a))),console[a7(0x238)](),a7(0x1f6);}console[a7(0x238)](a0z['gray']('\x20\x20'+a0K('ai4ctfThinking')));try{const a0=await h[a7(0x247)](G);process[a7(0x197)][a7(0x274)]('\x1b[1A\x1b[2K'),a0D(a0[a7(0x291)]),'number'==typeof a0[a7(0x21e)]?(y=a0[a7(0x21e)],m=!(0x1769+0x1b4c+-0x32b5),f=!(0x17*-0x1c+0x1763*0x1+-0x1*0x14df),a7(0x1f2)==typeof a0[a7(0x2b1)]&&(d=a0[a7(0x2b1)])):(y+=a0['tokensUsed'],f=!(0x27d*-0xf+-0x1083+0x35d6*0x1)),console['log'](),a0I(a0['text']),x(),console[a7(0x238)](a0z['gray'](a7(0x194))),console['log']();}catch(a1){process['stdout'][a7(0x274)](a7(0x17f)),a0J(a7(0x290)+a1[a7(0x1b2)]),console[a7(0x238)]();}return a7(0x19e);}(z);const B=z[a6(0x1eb)]()[a6(0x230)]()[a6(0x21b)](/^hint\s+([abc])$/);if(B)return function(G){const a8=a6,H=a0K('a'===G?a8(0x1b6):'b'===G?a8(0x1a7):a8(0x1ac)),I=a0K('a'===G?a8(0x2a3):'b'===G?a8(0x1f7):a8(0x22f)),J='Hint\x20'+G[a8(0x1a2)](),K='a'===G?a0z['green']:'b'===G?a0z['yellow']:a0z[a8(0x1ef)];console[a8(0x238)](),console[a8(0x238)](K[a8(0x1de)](a8(0x237)+J+'\x20\x20')+a0z[a8(0x2b2)](H)),console[a8(0x238)]();for(const L of I[a8(0x285)]('\x0a'))''===L?console[a8(0x238)]():console[a8(0x238)](a0z[a8(0x28a)](a8(0x27a)+L));console[a8(0x238)](),'a'===G?(console['log'](a0z[a8(0x2b2)](a8(0x27a)+a0K(a8(0x19f))+'\x20')+a0z[a8(0x1bb)](a8(0x1e6))),console['log']()):'b'===G&&(console[a8(0x238)](a0z[a8(0x2b2)](a8(0x27a)+a0K(a8(0x275))+'\x20')+a0z['cyan'](a8(0x212))),console[a8(0x238)]());}(B[0x79*-0x7+0x89*-0x22+0x1582]),a6(0x19e);const D=z['match'](/^submit\s+(.+)/i);if(D){let G=D[-0x9e2+-0xb7*0x9+0x1052][a6(0x1eb)]();if(/^submit\s+/i[a6(0x276)](G)&&(G=G[a6(0x1d0)](/^submit\s+/i,'')['trim']()),G=G[a6(0x1d0)](/^["'`]+|["'`]+$/g,'')[a6(0x1eb)](),a6(0x270)===G){console[a6(0x238)](),console['log'](a0z[a6(0x257)][a6(0x1de)](a6(0x28e))),console[a6(0x238)](a0z[a6(0x257)][a6(0x1de)]('\x20\x20'+a0K(a6(0x253)))),console[a6(0x238)](a0z[a6(0x257)]['bold']('\x20\x20════════════════════════════════════')),console[a6(0x238)](),console['log'](a0z[a6(0x28a)]('\x20\x20'+a0K(a6(0x1bc)))),console['log'](a0z['gray']('\x20\x20'+a0K(a6(0x1ec)))),console[a6(0x238)](),x(),u=!(-0x43*-0x92+-0x5ea+-0x204b),h=null,fetch(a6(0x241),{'method':'POST','headers':{'Content-Type':a6(0x279)},'body':JSON[a6(0x2a2)]({'type':a6(0x23a),'solved':!(0x1174+-0x269f*0x1+0x152b),'tokensUsed':y,'timestamp':new Date()[a6(0x1d9)]()}),'signal':AbortSignal[a6(0x17e)](-0x5e5+-0x1*-0x200b+-0x69e)})[a6(0x287)](()=>{}),await r(0x9af+0x43*0x2e+-0x1f*0x83),console['log'](),console[a6(0x238)](a0z[a6(0x1bb)](a6(0x29a))),console[a6(0x238)](a0z[a6(0x1de)][a6(0x28a)]('\x20\x20'+a0K(a6(0x1b0)))),console[a6(0x238)](a0z['cyan'](a6(0x29a))),console[a6(0x238)]();const H=a0K(a6(0x278)),I=a0K(a6(0x25c));console['log'](a0z[a6(0x28a)]('\x20\x20\x20\x201.\x20'+H+'\x20')+a0z['gray'](I['split']('\x0a')[-0x1fc0+0x1058+0xe8*0x11]||''));for(const M of I[a6(0x285)]('\x0a')['slice'](0x4f7+0x985+-0xe7b*0x1))M['trim']()&&console[a6(0x238)](a0z[a6(0x2b2)](a6(0x2ac)+M['replace'](/\{thinking\}/g,a6(0x24c))));console[a6(0x238)](),console[a6(0x238)](a0z[a6(0x28a)]('\x20\x20\x20\x202.\x20'+a0K(a6(0x1be))+'\x20')+a0z[a6(0x2b2)](a0K('ai4ctfWrapLine2Body'))),console[a6(0x238)](),console[a6(0x238)](a0z[a6(0x1bb)](a6(0x1fc))),console[a6(0x238)](),await r(0x1cd*-0x7+-0x2b*-0x35+-0x10c*-0xb),console[a6(0x238)](a0z[a6(0x1bb)]('\x20\x20─────────────────────────────────────────────')),console[a6(0x238)](a0z[a6(0x1de)][a6(0x28a)]('\x20\x20'+a0K('ai4ctfWrapQuotasTitle'))),console['log'](a0z[a6(0x1bb)](a6(0x29a))),console['log'](),console[a6(0x238)](a0z['yellow']('\x20\x20\x20\x20\x20\x20\x20hint\x20a\x20\x20\x20')+a0z[a6(0x28a)](a0K(a6(0x29b))[a6(0x28d)](0x222d+0x1f80+0x4193*-0x1))+a0z[a6(0x2b2)](a0K('ai4ctfWrapQuotaAHint'))),console['log'](a0z['yellow'](a6(0x286))+a0z[a6(0x28a)](a0K(a6(0x1c5))[a6(0x28d)](-0x40f+0x656+-0x22d))+a0z['gray'](a0K(a6(0x19c)))),console['log'](a0z['yellow'](a6(0x1e2))+a0z[a6(0x28a)](a0K(a6(0x26b))[a6(0x28d)](0x405+0x1b0b+-0x1ef6))+a0z['gray'](a0K(a6(0x282)))),console[a6(0x238)]();for(const N of a0K(a6(0x234))[a6(0x285)]('\x0a'))console[a6(0x238)](a0z[a6(0x2b2)]('\x20\x20\x20\x20'+N));console[a6(0x238)](),await r(0x2*-0xeda+-0x1f7*-0x5+0x1bb1),console['log'](a0z[a6(0x1bb)]('\x20\x20─────────────────────────────────────────────')),console[a6(0x238)](a0z[a6(0x1de)][a6(0x28a)]('\x20\x20'+a0K('ai4ctfWrapNextTitle')+'\x20')+a0z[a6(0x1ef)][a6(0x1de)](a6(0x229))+a0z['white']('\x20—\x20'+a0K('ai4ctfWrapNextSub'))),console[a6(0x238)](a0z['cyan']('\x20\x20─────────────────────────────────────────────')),console[a6(0x238)]();const J=a0K(a6(0x265)),K=a0K(a6(0x2a9)),L=J[a6(0x285)]('\x0a');if(L[-0x16b0+-0x2ab+0x195b]){const [O,P]=L[-0xfa*0x7+0xd*-0x1f2+0x2020][a6(0x285)](a6(0x1c8));console[a6(0x238)](a0z[a6(0x28a)](a6(0x27a)+(O||''))+a0z['bold'][a6(0x28a)](K)+a0z[a6(0x28a)](P||''));}for(const Q of L[a6(0x1d7)](0x4b*0x7+0x1621+-0x182d))Q['trim']()&&console[a6(0x238)](a0z[a6(0x28a)](a6(0x27a)+Q));return console[a6(0x238)](),console[a6(0x238)](a0z[a6(0x2b2)](a6(0x27a)+a0K(a6(0x2a7))+'\x20')+a0z[a6(0x1de)]['red'](a6(0x229))),console[a6(0x238)](),a6(0x1f6);}return console['log'](),console['log'](a0z[a6(0x1ef)]('\x20\x20'+a0K('ai4ctfWrongFlag'))),console['log'](a0z[a6(0x2b2)]('\x20\x20'+a0K(a6(0x2ab)))),console['log'](),'continue';}if(z[a6(0x23e)]('!')){const R=z[a6(0x1d7)](0x34*0x7a+-0x1636+-0x3*0xdb)[a6(0x1eb)]();if(!R)return a6(0x19e);try{const S={};S[a6(0x1a5)]=a6(0x1fa),S['timeout']=0x2710;const {execSync:T}=await import('node:child_process'),U=T(R,S)[a6(0x1eb)]();console['log'](),console[a6(0x238)](a0z[a6(0x2b2)](a6(0x20f))+a0z[a6(0x28a)](R)),console['log'](a0z[a6(0x28a)]('\x20\x20'+U[a6(0x285)]('\x0a')[a6(0x252)](a6(0x20c)))),console[a6(0x238)](),console['log'](a0z[a6(0x2b2)]('\x20\x20'+a0K(a6(0x19a)))),console['log']();}catch(V){console[a6(0x238)](),console[a6(0x238)](a0z[a6(0x1ef)](a6(0x263)+(V[a6(0x1b2)]?.[a6(0x285)]('\x0a')[-0x1b76+0x1a03+-0x173*-0x1]||a6(0x26d)))),console[a6(0x238)]();}return a6(0x19e);}const E={};E[a6(0x1a6)]='application/json';if('exit'===z||a6(0x1b8)===z||a6(0x27f)===z||'menu'===z)return u=!(-0x223c+-0x1800+0x3a3d),h=null,fetch('https://practice.icoa2026.au/api/icoa/demo-stats',{'method':a6(0x2bc),'headers':E,'body':JSON[a6(0x2a2)]({'type':a6(0x23a),'tokensUsed':y,'timestamp':new Date()['toISOString']()}),'signal':AbortSignal[a6(0x17e)](-0x1361*-0x1+-0x23a4+0x7*0x51d)})[a6(0x287)](()=>{}),console[a6(0x238)](),console[a6(0x238)](a0z[a6(0x2b2)](a6(0x1cc))),console[a6(0x238)](a0z[a6(0x28a)]('\x20\x20'+a0K(a6(0x211)))),console[a6(0x238)](a0z['gray']('\x20\x20'+a0K(a6(0x1c3))+':\x20'+y+a6(0x203))),console['log'](a0z[a6(0x2b2)]('\x20\x20'+a0K('ai4ctfModel')+a6(0x1e4))),console[a6(0x238)](a0z['gray'](a6(0x1cc))),console[a6(0x238)](),console[a6(0x238)](a0z[a6(0x1bb)](a6(0x29a))),console['log'](a0z[a6(0x28a)]('\x20\x20'+a0K('ai4ctfExitNextTitle')+'\x20')+a0z[a6(0x1de)][a6(0x1ef)](a6(0x229))+a0z[a6(0x28a)](a6(0x1bd)+a0K(a6(0x21a)))),console[a6(0x238)](a0z[a6(0x2b2)]('\x20\x20'+a0K('ai4ctfExitNextBody'))),console[a6(0x238)](a0z[a6(0x1bb)](a6(0x29a))),console[a6(0x238)](),console[a6(0x238)](a0z[a6(0x28a)](a6(0x1e9))+a0z[a6(0x28a)](a0K('typeAndEnterToBegin')['replace'](a6(0x2aa),a0z[a6(0x1de)][a6(0x1ef)](a6(0x229))))),console[a6(0x238)](a0z['gray'](a6(0x2b5)+a0K(a6(0x24b)))),console[a6(0x238)](),a6(0x1f6);const F={};F[a6(0x1a6)]=a6(0x279);if(!p&&y>=0xb37*-0x1+0x261a+-0x7*0x10d)return p=!(0x21a1+0xab4*0x3+0x41bd*-0x1),fetch(a6(0x241),{'method':'POST','headers':F,'body':JSON[a6(0x2a2)]({'type':a6(0x23a),'solved':!(0x3c7*0x4+-0x1c99*-0x1+-0x2bb4),'tokensUsed':y,'timestamp':new Date()['toISOString']()}),'signal':AbortSignal[a6(0x17e)](-0x20e1+0x269*-0x2+0x393b)})[a6(0x287)](()=>{}),console['log'](),console[a6(0x238)](a0z[a6(0x1ae)]('\x20\x20'+a0K(a6(0x2b0)))),x(),(function(){const a9=a6;console['log'](),console[a9(0x238)](a0z[a9(0x1ae)](a9(0x29a))),console[a9(0x238)](a0z['bold']['yellow']('\x20\x20'+a0K(a9(0x225)))),console[a9(0x238)](a0z['yellow'](a9(0x29a))),console[a9(0x238)]();for(const W of a0K('ai4ctfRevealBody')[a9(0x285)]('\x0a'))''===W?console[a9(0x238)]():console[a9(0x238)](a0z['white']('\x20\x20\x20\x20'+W));console[a9(0x238)](),console[a9(0x238)](a0z['cyan'](a9(0x288))),console['log'](),console['log'](a0z['white'](a9(0x27a)+a0K(a9(0x262)))),console[a9(0x238)](),console[a9(0x238)](a0z[a9(0x257)]('\x20\x20\x20\x20\x20\x20\x20\x20icoa{w3lc0me_2_ai4ctf}')),console[a9(0x238)](),console[a9(0x238)](a0z['white'](a9(0x27a)+a0K(a9(0x190)))),console[a9(0x238)](),console[a9(0x238)](a0z[a9(0x1bb)]('\x20\x20\x20\x20\x20\x20\x20\x20submit\x20icoa{w3lc0me_2_ai4ctf}')),console[a9(0x238)](),console[a9(0x238)](a0z[a9(0x2b2)](a9(0x27a)+a0K('ai4ctfRevealLockNote'))),console[a9(0x238)]();}()),a6(0x19e);if(p)return console[a6(0x238)](),console[a6(0x238)](a0z[a6(0x1ae)]('\x20\x20'+a0K(a6(0x235)))),console[a6(0x238)](a0z['gray']('\x20\x20'+a0K('ai4ctfLockedUse')+'\x20')+a0z[a6(0x1bb)]('!echo\x20aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ==\x20|\x20base64\x20-d')),console['log'](a0z[a6(0x2b2)]('\x20\x20'+a0K('ai4ctfLockedThen')+'\x20')+a0z[a6(0x1bb)]('submit\x20icoa{w3lc0me_2_ai4ctf}')),console['log'](),a6(0x19e);console[a6(0x238)](a0z[a6(0x2b2)]('\x20\x20'+a0K(a6(0x289))));try{const W=await h[a6(0x247)](z);process[a6(0x197)][a6(0x274)](a6(0x17f)),y+=W['tokensUsed'],a0D(W['tokensUsed']),console['log'](),a0I(W[a6(0x1a8)]),x(),console[a6(0x238)](a0z[a6(0x2b2)](a6(0x2bd))),console[a6(0x238)]();}catch(X){process[a6(0x197)][a6(0x274)](a6(0x17f)),a0J(a6(0x290)+X['message']),console[a6(0x238)]();}return'continue';}const C=new Set();async function k(v){const aa=a0q;if(!$||!h)return aa(0x1f6);const z=v[aa(0x1eb)](),B=z[aa(0x230)](),D=(Date['now']()-$[aa(0x1d8)])/(-0x47d5+-0x3411+-0xb323*-0x2);if(!$['nudgeShown']&&!$[aa(0x28f)]&&D>=-0x157+-0x827*0x1+0x983&&($[aa(0x210)]=!(-0x139c+-0x13ee+0x278a),console[aa(0x238)](),console[aa(0x238)](a0z[aa(0x1ae)](aa(0x1cd))+a0z['bold'][aa(0x1ae)](aa(0x199))),console['log'](a0z[aa(0x2b2)](aa(0x266))),console[aa(0x238)]()),/^ICOA\{[^}]+\}$/i[aa(0x276)](z))return console['log'](),console[aa(0x238)](a0z[aa(0x2b2)](aa(0x240))+a0z[aa(0x28a)](aa(0x208)+z)),k(aa(0x208)+z);const E=z[aa(0x21b)](/^submit\s+(.+)/i);if(E){let F=E[0x1d4f*0x1+0x237b+-0x40c9][aa(0x1eb)]();if(/^submit\s+/i[aa(0x276)](F)&&(F=F['replace'](/^submit\s+/i,'')[aa(0x1eb)]()),F=F[aa(0x1d0)](/^["'`]+|["'`]+$/g,'')[aa(0x1eb)](),/^[A-Da-d]$/[aa(0x276)](F))return console[aa(0x238)](),console['log'](a0z[aa(0x1ae)]('\x20\x20\x22'+F+aa(0x18a))),console[aa(0x238)](a0z[aa(0x2b2)](aa(0x2b3))+a0z[aa(0x257)](aa(0x213))+a0z[aa(0x2b2)]('.\x20Try\x20again\x20inside\x20this\x20chat.')),console[aa(0x238)](),aa(0x19e);const {getExamState:G,saveExamState:H}=await import(aa(0x1ea)),I=G();if(!I)return aa(0x1f6);if(!I['questions'][aa(0x26c)](L=>L[aa(0x1f2)]===$['qNum']))return console['log'](a0z[aa(0x1ef)](aa(0x179)+$[aa(0x2b6)]+aa(0x187))),aa(0x19e);const J=I[aa(0x2a1)][$[aa(0x2b6)]];I[aa(0x215)]||(I['interactions']=[]),I['interactions']['push']({'ts':new Date()[aa(0x1d9)](),'q':$[aa(0x2b6)],'type':J?aa(0x224):aa(0x1f0),'input':F,'result':'via\x20ai4ctf\x20chat'}),I['answers'][$[aa(0x2b6)]]=F;const K=$[aa(0x2b6)]+(-0x2150+-0x1f91+0x40e2);return I['_lastQ']=K<=0x3*0xf+-0x2*0x385+-0x703*-0x1?K:$[aa(0x2b6)],H(I),console[aa(0x238)](),J?(console[aa(0x238)](a0z['green']('\x20\x20✓\x20Q'+$[aa(0x2b6)]+aa(0x186))+a0z[aa(0x1ae)](F)),console[aa(0x238)](a0z[aa(0x2b2)]('\x20\x20\x20\x20Previous:\x20'+J))):console['log'](a0z[aa(0x257)][aa(0x1de)](aa(0x18d)+$['qNum']+aa(0x264)+F)),console[aa(0x238)](a0z['gray']('\x20\x20\x20\x20(Grading\x20happens\x20at\x20exam\x20submit\x20—\x20you\x20cannot\x20preview\x20correctness\x20during\x20the\x20exam.)')),console['log'](),console['log'](a0z['gray']('\x20\x20')+a0z[aa(0x28a)](aa(0x22e))+a0z[aa(0x2b2)](aa(0x218))+a0z[aa(0x28a)](aa(0x1f6))+a0z[aa(0x2b2)](aa(0x1f4))),K<=0x1a9+-0x1*-0x10a6+0x1229*-0x1?console[aa(0x238)](a0z[aa(0x2b2)](aa(0x28c))+a0z[aa(0x1bb)]('ai4ctf')+a0z[aa(0x2b2)]('\x20will\x20open\x20Q'+K)):console[aa(0x238)](a0z[aa(0x2b2)](aa(0x1e3))+a0z[aa(0x1ef)](aa(0x229))+a0z[aa(0x2b2)](aa(0x1e1))),console['log'](),'continue';}if(v[aa(0x23e)]('!')){const L=v[aa(0x1d7)](-0x2438+0x71d*0x3+0xee2)[aa(0x1eb)]();if(!L)return aa(0x19e);try{const M={};M['encoding']='utf-8',M[aa(0x17e)]=0x2710;const {execSync:N}=await import(aa(0x1e0)),O=N(L,M)[aa(0x1eb)]();console[aa(0x238)](),console[aa(0x238)](a0z[aa(0x2b2)]('\x20\x20$\x20')+a0z[aa(0x28a)](L)),console[aa(0x238)](a0z[aa(0x28a)]('\x20\x20'+O['split']('\x0a')[aa(0x252)](aa(0x20c)))),console['log']();}catch(P){console[aa(0x238)](),console['log'](a0z[aa(0x1ef)](aa(0x263)+(P[aa(0x1b2)]?.[aa(0x285)]('\x0a')[0x425*0x9+-0x9f7*-0x1+-0x4*0xbd1]||aa(0x26d)))),console['log']();}return aa(0x19e);}if(aa(0x1f6)===B||aa(0x1b8)===B||aa(0x27f)===B){const Q=$[aa(0x2b6)],{getExamState:R}=await import(aa(0x1ea)),S=R(),T=S&&null!=S['answers'][Q],U=S?.[aa(0x223)]||Q;return u=!(-0x2078+-0x1acd+-0x34b*-0x12),h=null,$=null,C[aa(0x18f)](),console[aa(0x238)](),console['log'](a0z[aa(0x2b2)]('\x20\x20AI4CTF\x20chat\x20ended\x20for\x20Q'+Q+'.')),T&&U>Q&&U<=0x1b84+0x174e+-0x32ac?console[aa(0x238)](a0z[aa(0x28a)](aa(0x1c1))+a0z['bold'][aa(0x257)]('Q'+U)+a0z['gray'](aa(0x2b8))+a0z[aa(0x1bb)](aa(0x23a))+a0z['gray'](aa(0x2ad))):T&&Q>=0x14c1+-0x10e9+-0x3b2?console[aa(0x238)](a0z[aa(0x28a)](aa(0x18c))+a0z['bold'][aa(0x1ef)](aa(0x229))+a0z['gray']('\x20for\x20Q39')):console[aa(0x238)](a0z['gray'](aa(0x1b4))+a0z[aa(0x28a)](aa(0x1ca)+Q)+a0z[aa(0x2b2)](aa(0x24a))+a0z[aa(0x28a)](aa(0x23a))),console['log'](),'exit';}if(p)return console['log'](),console[aa(0x238)](a0z[aa(0x1ae)](aa(0x193))),console[aa(0x238)](a0z[aa(0x2b2)](aa(0x195))+a0z[aa(0x28a)](aa(0x25e))+a0z['gray'](aa(0x268))+a0z[aa(0x28a)](aa(0x2b4))+a0z[aa(0x2b2)](aa(0x268))+a0z[aa(0x28a)]('exit')),console[aa(0x238)](),aa(0x19e);if(y>=w)return p=!(0x236f*-0x1+-0x2519*0x1+-0x1222*-0x4),console['log'](),console[aa(0x238)](a0z[aa(0x1ef)]['bold']('\x20\x20⚠\x20AI4CTF\x20token\x20budget\x20exhausted\x20(25,000\x20used).')),console[aa(0x238)](a0z[aa(0x2b2)](aa(0x206))+a0z[aa(0x28a)](aa(0x25e))+a0z['gray'](aa(0x268))+a0z[aa(0x28a)]('!shell')+a0z['gray']('\x20·\x20')+a0z['white'](aa(0x1f6))),console[aa(0x238)](),aa(0x19e);console[aa(0x238)](a0z[aa(0x2b2)]('\x20\x20Thinking...'));try{const V=await h[aa(0x247)](v);process[aa(0x197)]['write'](aa(0x17f)),y+=V[aa(0x291)];const {getRealExamState:W,saveExamState:X}=await import(aa(0x1ea)),Y=W(),Z={};Z[aa(0x23a)]=0x0,Z[aa(0x229)]=0x0,(Y&&(Y['aiUsage']||(Y['aiUsage']=Z),Y[aa(0x184)][aa(0x23a)]=y,X(Y)),console[aa(0x238)](),a0I(V[aa(0x1a8)]),x(),console['log'](a0z[aa(0x2b2)](aa(0x1aa))),function(a0,a1,a2){const ab=aa,a3=a0/a1*(0x7*-0xd6+0x1a*-0xad+0x17d0);a3>=0xe1d*0x1+-0x7*-0x14+-0xe4a&&!a2[ab(0x2a4)]('95')?(console['log'](a0z[ab(0x1ef)][ab(0x1de)](ab(0x27d)+Math[ab(0x22d)](a3)+ab(0x1c9)+(a1-a0)+'\x20tokens\x20left.')),a2[ab(0x280)]('95')):a3>=-0x18*-0x146+-0x6e*0x4+-0x2c*0xa6&&!a2[ab(0x2a4)]('80')?(console[ab(0x238)](a0z[ab(0x1ae)]('\x20\x20⚠\x2080%\x20of\x20section\x20AI\x20budget\x20used.')),a2[ab(0x280)]('80')):a3>=-0x17c0+0x259d+0xdab*-0x1&&!a2['has']('50')&&(console[ab(0x238)](a0z[ab(0x2b2)]('\x20\x20Note:\x2050%\x20of\x20section\x20AI\x20budget\x20used.')),a2[ab(0x280)]('50'));}(y,w,C),console[aa(0x238)]());}catch(a0){process['stdout'][aa(0x274)]('\x1b[1A\x1b[2K'),a0J('AI\x20error:\x20'+a0[aa(0x1b2)]),console[aa(0x238)]();}return aa(0x19e);}export function registerAi4ctfCommand(j){const ac=a0q;j[ac(0x267)](ac(0x23a))[ac(0x2a6)]('Chat\x20with\x20your\x20AI\x20teammate')[ac(0x191)](async()=>{const ad=ac;a0G(ad(0x23a));const {getRealExamState:q}=await import(ad(0x1ea)),v=q(),z=v?.['questions']['some'](G=>ad(0x23a)===G[ad(0x2bb)]);if(v&&z){const G=v[ad(0x223)]||0x2021+-0x6ec*-0x3+-0x34e4,H=v[ad(0x1fd)][ad(0x26c)](I=>I[ad(0x1f2)]===G);if(!H)return void a0J('Q'+G+ad(0x1df)+G);if(ad(0x23a)!==H[ad(0x2bb)]){if(console['log'](),'ctf4ai'===H['type'])console['log'](a0z[ad(0x1ae)](ad(0x179)+G+ad(0x1a0))),console['log'](a0z['gray']('\x20\x20Use:\x20')+a0z['bold'][ad(0x1ef)]('ctf4ai'));else{if('vla'===H[ad(0x2bb)])console[ad(0x238)](a0z[ad(0x1ae)]('\x20\x20Q'+G+ad(0x2be))),console[ad(0x238)](a0z['gray'](ad(0x29c))+a0z[ad(0x1de)][ad(0x1bb)](ad(0x200)));else{const I=v[ad(0x1fd)][ad(0x26c)](J=>'ai4ctf'===J[ad(0x2bb)]);console[ad(0x238)](a0z[ad(0x1ae)](ad(0x179)+G+ad(0x298))),I&&(console[ad(0x238)](a0z[ad(0x2b2)](ad(0x25a)+I[ad(0x1f2)]+').')),console[ad(0x238)](a0z[ad(0x2b2)]('\x20\x20Jump\x20there:\x20')+a0z['bold'][ad(0x1bb)](ad(0x1ca)+I[ad(0x1f2)])));}}return void console[ad(0x238)]();}return void await async function(J,K){const ae=ad,{getRealExamState:L,refetchQuestionDataIfStale:M,materializeAttachedData:N}=await import(ae(0x1ea));await M();const O=L();if(!O)return!(0x1263*-0x1+0x1c4b+-0xc3*0xd);const P=O[ae(0x1fd)][ae(0x26c)](S=>S[ae(0x1f2)]===J);P&&(K=P),N(J,K?.[ae(0x249)]);const Q=O[ae(0x184)]?.[ae(0x23a)]??0x24dd*-0x1+0x1cf7+0x7e6;if(Q>=w)return console['log'](),console[ae(0x238)](a0z[ae(0x1ae)](ae(0x232))),console[ae(0x238)](a0z[ae(0x2b2)](ae(0x217))+a0z[ae(0x28a)]('exam\x20answer\x20'+J+ae(0x2ae))),console[ae(0x238)](),!(-0xc4*-0x2b+0x1bc1+-0xb*0x584);try{h=await a0B(void(0x181d*-0x1+0x56+0x17c7),function(S,T){const af=ae,U=S[af(0x2a6)]||S[af(0x1a8)]||'',V=S['attachedData']?af(0x27c)+T+af(0x296)+S['attachedData']:'';return af(0x185)+T+',\x20'+S[af(0x196)]+',\x20'+(S[af(0x1f1)]||-0x1047+0xb5*0x15+0x3*0x7c)+af(0x1d3)+U+V+af(0x21d)+T+'.txt\x20(inside\x20the\x20sandbox)\x20rather\x20than\x20asking\x20the\x20contestant\x20to\x20paste\x20the\x20whole\x20blob\x20back.\x0a-\x20Keep\x20responses\x20concise\x20and\x20practical.\x20This\x20contestant\x20has\x20limited\x20time.';}(K,J));}catch(S){return a0J(S[ae(0x1b2)]),!(-0x1f73+-0x1f6b+0x1*0x3edf);}u=!(-0x1*-0x1c3d+0x21a4+-0x3de1),y=Q,p=!(-0xdfc+-0x25ae+0x33ab),$={'qNum':J,'question':K,'usageField':ae(0x23a),'enteredAt':Date[ae(0x1bf)](),'submitAttempted':!(-0x1a*-0x1d+0x12c*0x7+-0xb25),'nudgeShown':!(0xdaf+0x1*0x62b+-0x13d9)};const R=O[ae(0x2a1)]?.[J];return function(T,U,V){const ag=ae,W=a0E()[ag(0x24f)]||'gemma-4-31b-it',X=y>-0x202*-0x2+-0x20f6+-0x186*-0x13;console[ag(0x238)](),console[ag(0x238)](a0z['green'][ag(0x1de)](ag(0x1b7)+U+':\x20'+T['category']+ag(0x269))),X&&console[ag(0x238)](a0z[ag(0x2b2)](ag(0x17a))),V&&console[ag(0x238)](a0z[ag(0x2b2)]('\x20\x20Current\x20answer:\x20')+a0z[ag(0x1ae)](V)+a0z['gray'](ag(0x21f))),console[ag(0x238)](),console[ag(0x238)](a0z['cyan'](ag(0x20a))),console[ag(0x238)](a0z[ag(0x1bb)](ag(0x295))+a0z[ag(0x1de)][ag(0x28a)]('Q'+U+ag(0x1b9)+T[ag(0x196)]+ag(0x1fb)+(T[ag(0x1f1)]||0x22c8+0x1d1b*0x1+-0x3fdd)+ag(0x1d6))),console['log'](a0z[ag(0x1bb)](ag(0x216)));for(const Y of String(T[ag(0x1a8)])[ag(0x285)]('\x0a')){const Z=Y[ag(0x1cf)]>-0x678*0x2+0xc32+0xfa?Y[ag(0x1d7)](-0xd7+0x1372+-0x129b*0x1,0x1*-0x7ea+-0xcb+0x2fa*0x3)+ag(0x293):Y;console['log'](a0z[ag(0x1bb)]('\x20\x20│\x20')+a0z['white'](Z));}console[ag(0x238)](a0z[ag(0x1bb)]('\x20\x20│')),console['log'](a0z[ag(0x1bb)]('\x20\x20│\x20')+a0z[ag(0x2b2)](ag(0x17c))+a0z['white'](ag(0x1ca)+U)),console[ag(0x238)](a0z[ag(0x1bb)](ag(0x295))+a0z['gray'](ag(0x1c6))),console[ag(0x238)](a0z[ag(0x1bb)](ag(0x281))),console['log'](),console[ag(0x238)](a0z[ag(0x1de)][ag(0x28a)]('\x20\x20How\x20to\x20work\x20this\x20question')),console[ag(0x238)](),console['log'](a0z[ag(0x1ae)](ag(0x1d1))+a0z[ag(0x2b2)](ag(0x209))),console[ag(0x238)](a0z[ag(0x1ae)](ag(0x2ba))+a0z[ag(0x2b2)](ag(0x214))),console['log'](a0z[ag(0x1ae)](ag(0x198))+a0z[ag(0x2b2)](ag(0x26a))),console[ag(0x238)](a0z[ag(0x1de)]['green']('\x20\x20\x20\x20submit\x20ICOA{...}')+a0z[ag(0x2b2)](ag(0x1ad))),console[ag(0x238)](a0z['white'](ag(0x1ce))+a0z['gray'](ag(0x19d))),console[ag(0x238)](a0z[ag(0x2b2)](ag(0x26e))),console['log'](a0z['gray'](ag(0x18e))+a0z[ag(0x28a)](ag(0x181))),console[ag(0x238)](),console['log'](a0z[ag(0x2b2)]('\x20\x20\x20\x20exit')+a0z['gray'](ag(0x1c0))),console[ag(0x238)](a0z[ag(0x2b2)](ag(0x1dd))+a0z[ag(0x2b2)](ag(0x22c))),console[ag(0x238)](),x(),console[ag(0x238)](a0z[ag(0x2b2)](ag(0x23d)+W+')')),console[ag(0x238)]();}(K,J,R),!(0x399+-0x1e8b+0x1af2);}(G,H);}const B=a0E(),D=B[ad(0x24f)]||ad(0x2af);if(a0F())return B[ad(0x188)]?void await(async function(){const ah=ad,J=a0E(),K=J[ah(0x23b)],L=J[ah(0x188)],M=J[ah(0x24d)]||'Unknown';let N='';if(K)try{const {CTFdClient:O}=await import(ah(0x204)),P=J[ah(0x233)]||'',Q=J[ah(0x1c7)]&&!J['token']['includes']('session=')?J[ah(0x1c7)]:'',R=new O(J[ah(0x1dc)],Q,P||J[ah(0x1c7)]);N=(await R['getChallenge'](K))['description']||'';}catch{}try{h=await a0B(void(0x2358+0x1a08+0x1*-0x3d60),function(S,T,U){const ai=ah;return ai(0x1ab)+S+ai(0x2a8)+T+').'+(U?'\x0a\x0aCHALLENGE\x20BRIEF:\x0a'+U:'')+'\x0a\x0aYOUR\x20RULES:\x0a-\x20You\x20MAY\x20explain\x20concepts,\x20describe\x20approaches,\x20and\x20help\x20the\x20contestant\x20reason\x20through\x20the\x20problem.\x0a-\x20You\x20MAY\x20discuss\x20the\x20technology\x20involved\x20(crypto,\x20web,\x20forensics,\x20pwn,\x20reversing,\x20OSINT,\x20stego,\x20etc.).\x0a-\x20You\x20MAY\x20help\x20debug\x20code\x20the\x20contestant\x20writes\x20and\x20suggest\x20which\x20tool\x20/\x20library\x20/\x20technique\x20to\x20use.\x0a-\x20You\x20MUST\x20NOT\x20reveal\x20or\x20guess\x20the\x20flag,\x20and\x20MUST\x20NOT\x20output\x20any\x20flag-shaped\x20string\x20(anything\x20like\x20name{...}).\x0a-\x20You\x20MUST\x20NOT\x20solve\x20the\x20whole\x20challenge\x20end-to-end\x20for\x20the\x20contestant\x20—\x20guide,\x20don\x27t\x20hand\x20over\x20the\x20answer.\x0a-\x20Keep\x20responses\x20concise\x20and\x20practical.\x20The\x20contestant\x20is\x20racing\x20the\x20clock.';}(L,M,N));}catch(S){return a0J(S[ah(0x1b2)]),!(-0x17a7+-0xddb+-0x2583*-0x1);}u=!(0x25ce+0x261e+-0x4bec),y=0x2263+0x2*0xdbd+-0x3*0x149f,f=!(0x9*0x5+-0x3*0x521+-0x29*-0x5f),d=b,m=!(0x1c19*-0x1+0x24b*-0x1+0x1*0x1e64);try{if(J[ah(0x1dc)]&&J[ah(0x1c7)]){const T=await a0L(J['ctfdUrl']+ah(0x23f),{'headers':{'Authorization':ah(0x1ff)+J[ah(0x1c7)],'User-Agent':'icoa-cli/budget'}});if(T['ok']){const U=await T[ah(0x1f8)]();ah(0x1f2)==typeof U['data']?.[ah(0x21e)]&&(y=U[ah(0x239)]['accountSpent'],f=!(-0x896*-0x1+0xf2c+-0x17c2)),ah(0x1f2)==typeof U[ah(0x239)]?.[ah(0x2b1)]&&(d=U['data'][ah(0x2b1)]),ah(0x1d2)==typeof U[ah(0x239)]?.[ah(0x1a9)]&&(m=U[ah(0x239)][ah(0x1a9)]);}}}catch{}return p=!(0x4f1+-0x1668+-0xac*-0x1a),A={'challengeId':K,'challengeName':L,'challengeCategory':M,'enteredAt':Date['now']()},function(V,W){const aj=ah,X=a0E()[aj(0x24f)]||aj(0x2af);console[aj(0x238)](),console[aj(0x238)](a0z[aj(0x257)]['bold'](aj(0x245))),console['log'](),console[aj(0x238)](a0z[aj(0x1bb)](aj(0x20a))),console[aj(0x238)](a0z[aj(0x1bb)](aj(0x295))+a0z[aj(0x1de)][aj(0x28a)](V)+a0z[aj(0x2b2)](aj(0x19b)+W+']')),console['log'](a0z[aj(0x1bb)](aj(0x216))),console[aj(0x238)](a0z['cyan']('\x20\x20│\x20')+a0z['gray'](aj(0x25d))),console[aj(0x238)](a0z['cyan'](aj(0x295))+a0z[aj(0x2b2)](aj(0x1c4))),console['log'](a0z['cyan'](aj(0x281))),console[aj(0x238)](),console['log'](a0z[aj(0x1ae)](aj(0x182))),console['log'](a0z[aj(0x28a)]('\x20\x20\x20\x20<just\x20type>\x20\x20\x20\x20\x20')+a0z[aj(0x2b2)]('Ask\x20the\x20AI\x20teammate\x20about\x20this\x20challenge')),console[aj(0x238)](a0z[aj(0x28a)](aj(0x283))+a0z[aj(0x2b2)](aj(0x192))),console['log'](a0z[aj(0x28a)](aj(0x250))+a0z[aj(0x2b2)](aj(0x222))),console['log'](a0z['white'](aj(0x260))+a0z[aj(0x2b2)]('Leave\x20the\x20AI\x20teammate')),console[aj(0x238)](),console[aj(0x238)](a0z[aj(0x2b2)](aj(0x180))+a0z['white'](aj(0x243))+a0z['gray'](aj(0x18b))+a0z[aj(0x28a)]('ai4ctf')),x(),console[aj(0x238)](a0z[aj(0x2b2)]('\x20\x20Model:\x20Google\x20Gemma\x204\x20('+X+')')),console[aj(0x238)](a0z[aj(0x2b2)](aj(0x1ba))),console[aj(0x238)]();}(L,M),!(0x1613+0x20b0+-0x36c3);}()):(console[ad(0x238)](),console[ad(0x238)](a0z['yellow'](ad(0x21c))),console[ad(0x238)](a0z[ad(0x2b2)](ad(0x1c2))+a0z[ad(0x28a)](ad(0x205))+a0z[ad(0x2b2)](ad(0x1a3))+a0z[ad(0x28a)](ad(0x243))),console[ad(0x238)](a0z['gray'](ad(0x299))),void console[ad(0x238)]());const E={};E[ad(0x20d)]=ad(0x248),E[ad(0x196)]=ad(0x23c);const F=E;try{h=await a0B(F);}catch(J){return void a0J(J[ad(0x1b2)]);}u=!(0x423+-0x17b*0x7+0x63a),y=-0x97d*0x4+0x4df*0x7+0x8d*0x7,p=!(0x1dc*0x2+0x7e3+0xa*-0x129),console[ad(0x238)](),console[ad(0x238)](a0z[ad(0x257)][ad(0x1de)](ad(0x272)+a0K('ai4ctfTitle')+ad(0x269))),console[ad(0x238)](),console[ad(0x238)](a0z[ad(0x28a)]('\x20\x20'+a0K(ad(0x22a)))),console[ad(0x238)](),console[ad(0x238)](a0z[ad(0x1bb)](ad(0x20a))),console['log'](a0z[ad(0x1bb)](ad(0x295))+a0z['bold'][ad(0x28a)](a0K(ad(0x1af)))),console[ad(0x238)](a0z['cyan'](ad(0x216))),console[ad(0x238)](a0z[ad(0x1bb)]('\x20\x20│\x20')+a0z['white'](a0K(ad(0x1ee)))),console['log'](a0z['cyan'](ad(0x295))+a0z[ad(0x257)](ad(0x251))),console[ad(0x238)](a0z[ad(0x1bb)](ad(0x216))),console[ad(0x238)](a0z[ad(0x1bb)]('\x20\x20│\x20')+a0z[ad(0x28a)](a0K(ad(0x220)))),console[ad(0x238)](a0z['cyan'](ad(0x295))+a0z[ad(0x2b2)](ad(0x256))),console['log'](a0z[ad(0x1bb)](ad(0x281))),console[ad(0x238)](),console[ad(0x238)](a0z['white']('\x20\x20'+a0K(ad(0x1cb)))),console[ad(0x238)](),console[ad(0x238)](a0z[ad(0x1ae)](ad(0x1d1))+a0z[ad(0x2b2)]('\x20\x20\x20\x20'+a0K(ad(0x1b6)))),console[ad(0x238)](a0z[ad(0x2b2)](ad(0x1a1)+a0K(ad(0x20b)))),console['log'](a0z['yellow'](ad(0x2ba))+a0z[ad(0x2b2)](ad(0x27a)+a0K(ad(0x1a7)))),console[ad(0x238)](a0z['gray']('\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+a0K(ad(0x24e)))),console['log'](a0z[ad(0x1ae)]('\x20\x20\x20\x20hint\x20c')+a0z[ad(0x2b2)](ad(0x27a)+a0K('ai4ctfHintC'))),console[ad(0x238)](a0z[ad(0x2b2)](ad(0x1a1)+a0K(ad(0x228)))),console[ad(0x238)](),console[ad(0x238)](a0z[ad(0x2b2)]('\x20\x20─────────────────────────────────────────')),console[ad(0x238)](a0z[ad(0x1de)][ad(0x28a)]('\x20\x20'+a0K(ad(0x277)))),console[ad(0x238)](ad(0x27a)+a0z[ad(0x1bb)](ad(0x29f))+a0z[ad(0x2b2)](ad(0x27b)+a0K(ad(0x20e)))),console[ad(0x238)]('\x20\x20\x20\x20'+a0z[ad(0x1bb)](ad(0x1e6))+a0z[ad(0x2b2)](ad(0x27b)+a0K(ad(0x1f5)))),console[ad(0x238)](ad(0x27a)+a0z['cyan']('hint\x20c')+a0z['gray'](ad(0x27b)+a0K(ad(0x189)))),console[ad(0x238)](a0z[ad(0x2b2)](ad(0x27a)+a0K(ad(0x2b9)))),console[ad(0x238)](),console[ad(0x238)](a0z[ad(0x28a)]('\x20\x20'+a0K('ai4ctfOrChat'))),console[ad(0x238)](a0z['gray']('\x20\x20'+a0K(ad(0x1f9))+'\x20')+a0z[ad(0x28a)](ad(0x25b))),console[ad(0x238)](),console[ad(0x238)](a0z[ad(0x1ae)]('\x20\x20'+a0K(ad(0x242)))),console[ad(0x238)](a0z[ad(0x28a)]('\x20\x20\x20\x20hint\x20a\x20/\x20b\x20/\x20c\x20\x20')+a0z[ad(0x2b2)](a0K(ad(0x2a0)))),console[ad(0x238)](a0z[ad(0x28a)](ad(0x250))+a0z[ad(0x2b2)](a0K(ad(0x244)))),console[ad(0x238)](a0z['white'](ad(0x283))+a0z[ad(0x2b2)](a0K(ad(0x2a5)))),console['log'](a0z['gray'](ad(0x18e))+a0z[ad(0x28a)](ad(0x2b7))),console['log'](a0z[ad(0x2b2)](ad(0x260)+a0K(ad(0x292)))),console[ad(0x238)](),x(),console[ad(0x238)](a0z['gray']('\x20\x20'+a0K('ai4ctfModel')+ad(0x201)+D+')')),console[ad(0x238)](a0z[ad(0x2b2)]('\x20\x20'+a0K(ad(0x258)))),console[ad(0x238)]();});}
|
|
1
|
+
(function(B,D){const as=a0D,G=B();while(!![]){try{const J=parseInt(as(0x113))/(-0x7*0x4f+-0x2*-0x4cf+-0x774)*(parseInt(as(0x223))/(0x195+-0x461*-0x3+-0xeb6))+parseInt(as(0x133))/(-0x23e+-0x1156+0x3b*0x55)*(-parseInt(as(0x237))/(-0x2214+-0x20*-0xe9+-0x3*-0x1a8))+-parseInt(as(0x169))/(-0x11f4+-0x1893+0x2a8c)*(-parseInt(as(0x255))/(-0xc49+-0x1fd4+0x2c23))+parseInt(as(0x12c))/(-0x47b+-0x25*-0x40+-0x4be)*(-parseInt(as(0x238))/(0xeb0+-0x1c46*0x1+0xd9e))+parseInt(as(0x24c))/(-0x120*0x18+0x2f*-0xa+0x185*0x13)+-parseInt(as(0x195))/(-0x1d*0x149+0x6*-0x423+0x5*0xc6d)+-parseInt(as(0x22b))/(-0x2043+0x3*0x84f+0x1*0x761)*(-parseInt(as(0x1ec))/(0x1d64+-0x85*0x25+0xa1f*-0x1));if(J===D)break;else G['push'](G['shift']());}catch(K){G['push'](G['shift']());}}}(a0B,-0x3863f+0xf923+0x8e19b));import a0a3 from'chalk';import{createChatSession as a0a4}from'../lib/gemini.js';import{addTokenUsage as a0a5}from'../lib/budget.js';import{getConfig as a0a6,isConnected as a0a7}from'../lib/config.js';import{logCommand as a0a8,logSubmission as a0a9}from'../lib/logger.js';import{printMarkdown as a0aa,printError as a0ab}from'../lib/ui.js';import{t as a0ac}from'../lib/i18n.js';import{httpFetch as a0ad}from'../lib/http.js';import{enterPanel as a0ae,isGuideWord as a0af,isHelpWord as a0ag,leavePanel as a0ah,printGuide as a0ai,printHelp as a0aj}from'../lib/guide-panel.js';function a0B(){const aP=['sgLUDca','y3rMzfvYBa','icdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILza','icbvC2fNztOG','ihjLy29YzgvKoIa','z3jHEq','uNvUigeGC2HLBgWGy29TBwfUzcaOzs5NlIaHyMfZzty0ic1Kic4UlIK','5lIa6ygt5BIMiefjioMyN+wpI+EAHowWJYbdveyG6AkyoUINO+w8GoAiQUIoT+EAHos/OEAbRYZMIB7LIldML5FLRzaS5O+q5lQK44cc6zMK5lQg5lIl6z2I6l+z5lQB5zg95lUKlos9OoAvSUEAHos4GowiH+MdVEAyR+wCQoMxRIbbsEoaGG','lI4VBgLIl2v4yw0TC3rHDguUANm','ywK0y3rMu3vIBwL0q21K','icdcTYaGuMuTzw50zxi6ia','g1SXqrTBmKS','icaKia','yM9VBgvHBG','B3b0Aw9UywW','ywK0y3rMvg9Rzw5Z','CgfKrw5K','Dg9vChbLCKnHC2u','ywK0y3rMtg9JA2vKvgHLBG','icbozxH0oIa','y3vYCMvUDenOywXSzw5NzunHDgvNB3j5','zxHHBsbXia','ywrK','ywK0y3rMsgLUDejvC2vZ','y2f0zwDVCNK','ywK0y3rMq21KsgLUDeXPBMu','BM90igvUzM9Yy2vKigzVCIb0AgLZigXVz2LU','icbgBgfNigzVCM1HDdOG','ndy0otfitLnxvhq','ywK0y3rMq29TBwfUzhm','yMfJAW','icbB','C2vZC2LVBKnVB2TPzq','icaGidXQDxn0ihr5Cgu+icaGica','CMvWzwf0','DMvYyG','ywK0y3rMtw9KzwW','C3bSAxq','C2XPy2u','Dg9mB3DLCKnHC2u','igLZigeGq1rgnefjihf1zxn0Aw9UicHHDhrHy2STDgHLlufjks4','y29UDgLUDwu','ywK0y3rMv2vSy29Tzu5VuMv2zwfS','rMXHzYbMB3jTyxq6icaGieLdt0f7lI4UFq','BwvUDq','BwvZC2fNzq','5zYO6l+z6yEm55Yl6Aky6z2I','ihrOzw4G','ANnVBG','ywK0y3rMv3jHCff1B3rHq0HPBNq','ywK0y3rMt3jdAgf0rxHHBxbSzq','ywK0y3rMv3jHCe5LEhrtDwi','ihbVAw50CYK6cG','otfkqwnZvvO','sgLKzgvUie1LC3nHz2u','yMfJAYb0BYb0AguGzxHHBq','ywK0y3rMv3jHCff1B3rHrM9VDgvY','E2nTzh0','vg9Rzw4G','icbdDxjYzw50igfUC3DLCJOG','mJDpzgvytha','vg9Rzw5Z','icaGidiUia','quKG6zIF5y+l','icbLEgL0id0GyMfJAYb0BYbLEgfTimk3ihn1yM1PDcbjq09bEY4UlN0GDg8Gyw5ZD2vY','iwvJAg8GyvDoDI4UlIb8igjHC2u2ncaTza','qw4GquKGDgvHBw1HDguGC2nVCgvKihrVici','icbzB3uGy2fUihn0AwXSihn1yM1PDcbHigzSywCGzgLYzwn0BhK6ia','lI4VBgLIl2LUDgvNCML0Es1ZBMfWC2HVDc5QCW','D2HLCMuGzg8GssbZDgfYDd8','C3vIBwL0ihrOzsbMBgfNihLVDsbKzwnVzgvK','yxr0ywnOzwreyxrH','qsbZBwfSBcbdveyGChv6EMXLihDPDgGGyw4GquKGDgvHBw1HDguGyxqGEw91CIbZAwrLoIbKzwnVzguGDgHLigLUDgvYy2vWDgvKig1LC3nHz2uSigzPBMqGDgHLigzSywCSihn1yM1PDcbPDc4GrxzLCNL0AgLUzYb5B3uGDhLWzsbOzxjLigLZigeGCxvLC3rPB24GDg8GDgHLiefjlcbLEgnLChqGDgHLignVBw1HBMrZigjLBg93lG','icdILzdILzdILzaGquKGvgvHBw1HDguG4Pwq4Pwq4Pwq','icbuAgLUA2LUzY4UlG','ywK0y3rMvgL0Bgu','icbnB2rLBdOGr29Vz2XLieDLBw1HidqGka','ywK0y3rMrxHPDe5LEhrcB2r5','yw5ZD2vYx3n1yM1PDhrLza','C3vIBwL0ieLdt0f7Ew91CL9MBgfNFq','y2HHBgXLBMDLq2f0zwDVCNK','oIbhB29NBguGr2vTBweGncaO','quKGyNvKz2v0icH0AgLZigfJy291BNqP','u2nVCgvKihrVihrOzsbJAgfSBgvUz2uGEw91ig9Wzw5Lzc4GqxnRigzYzwvSEsdIGjq','icbbstrdveyGy2HHDcbLBMrLzcbMB3iGuq','C3vIBwL0ia','C3vIBwL0rMXHzW','y2f0y2G','E25VuhjVz30','ywK0y3rMrxHPDa','y29TBwfUza','q3j5ChrVz3jHCgH5','lNr4DcaODxnLigL0igzYB20GixnOzwXSic8Gixb5DgHVBJmPlG','ywK0y3rMv3jHCe5LEhruAxrSzq','y2XLyxi','q2HHDcb3AxrOihLVDxiGquKGDgvHBw1HDgu','BM93','ywK0y3rMuMvWB3j0','Bg9N','igLZigfUievTyM9KAwvKiefjicHfquKPihf1zxn0Aw9UlG','icaGicfWExrOB24Zic4UlG','ywK0y3rMv3jHCeXPBMuXsgvHza','C3rHCNrZv2L0Aa','quK0q1rgioMyN+wpIYdIGjqGuq','icdIMQaGww91CIbbstrdveyGDg9Rzw4GyNvKz2v0igLZigv4Agf1C3rLzc4','icaGicaODhLWzsbPDcbYAwDODcbOzxjLigLUihrOAxmGy2HHDcdIGjqGBM90igfZigeGC2HLBgWGy29TBwfUzcK','CMvWBgfJzq','icaGica','icaGihn1yM1PDca8zMXHzZ4Gica','ywn0Aw9U','icbbzNrLCIbLEgL0oIa','AwnVys1JBgKVyNvKz2v0','y2XVC2uGDgHLihrLyw1TyxrLicHVCgvUidXPzd4GCgLJA3mGyw5VDgHLCIbJAgfSBgvUz2uP','ywK0y3rMv3jHCff1B3rHqq','mJvrrvLgB0C','D3jPDgu','DgHLigz1BgWGCxvLC3rPB24GDgv4DcaODgHLigjVEcbHyM92zsbPCYb0CMLTBwvKkq','44cn55QeiefjioMyN+wpIZRLROpORRlOP6pMGj3OT6/JGihMJQJOJzdLT6xLHBCS5l2g5lIn5lYA55U05O6L57Uz5PEx5A2q44cc6zMK5lQg5lIl6z2I6l+z5lQB5zg95lUKlos9OoAvSUEAHos4GowiH+MdVEAyR+wCQoMxRUwUG+oaGG','icdILzdILzdILzaGquK0q1rgiokaLcbr','icaGicaGicaGicaGica','icaGwW','DMXH','icbtD2L0y2GGy2HHBgXLBMDLoIa','AgLUDcbJ','ww91igfYzsbHBIbbssb0zwfTBwf0zsbOzwXWAw5NigeGy29UDgvZDgfUDcbPBIbHigXPDMuGq2fWDhvYzs1uAguTrMXHzYbJB21WzxrPDgLVBI4kcKnvuLjftLqGq0HbteXftKDfoIaI','ywK0y3rMuMv2zwfSu2vLrMXHzW','ifn1yM1PDcb5B3vYigzSywCGzM9YihrOAxmGCxvLC3rPB24','ywK0y3rMuMv2zwfStg9JA05VDgu','kEwCQoI/MEMhJoACIsa1mdaWihrVA2vUioMIHoEUL+oaGG','DxrMltG','y3vYCMvUDenOywXSzw5Nzu5HBwu','ihrOzw4GCMuTzw50zxiG','lcbVCIbYzs1LBNrLCIb3AxrOia','yvDoDLLyDdnnmNHQtuCXBfH6sMzzv2SWwtnsBwzrpt0','ywK0y3rMv3jHCff1B3rHquHPBNq','icaGicaGigHPBNqGyIaGia','icaOCMvZDw1PBMCG4OcuihbYAw9YignOyxqGAxmGBM90ihjLBwvTyMvYzwqSigj1Dcb0B2TLBNmGywXYzwfKEsb1C2vKihn0yxKGzgvKDwn0zwqP','icbdB21WzxrPDgLVBIbPCYbWyxvZzwqU','BgvUz3rO','iIaOy2f0zwDVCNK6ia','ywK0y3rMq2HHBgXLBMDL','ywK0y3rMv3jHCe5VuhjVzW','CMf0zwXPBwL0zwq','icaGigv4Axq','ywK0y3rMuMv2zwfSvgL0Bgu','icboB3rLoIa1mcuGB2yGC2vJDgLVBIbbssbIDwrNzxqGDxnLzc4','56A75BYa6igk5AsPkoAyVUEKUUACRoASOEAkPEwrIIK','icaGigHPBNqGyq','CxvLC3rPB25Z','icdILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','icbiB3CGDg8GD29YAYb0AgLZihf1zxn0Aw9U','AgvSCcaVid8GpsdOV5NKUPVMRAxPQQqGWRCGz3vPzguGpsdLROZMLBtLKB3KU6tOOAJJGilLHBBLROpOVPpLHAxPG73LJ5hNU5KGquKS5RAi6icxidi1ldaWmcb0B2TLBIdPOOtNRPFJGii','5ywZ5O6j6zIF5y+lkg9Wzw4GpgLKpIdMJAlKUidPGzpPOPGP','z2v0q2HHBgXLBMDL','icaGicaGicaGicaGicaGicaGicbLlMCUia','yxbWBgLJyxrPB24VANnVBG','iokvKokvKokvKa','quK0q1rgihrLyw1TyxrLiokaLcbr','mZq1nJK1mgrjEeD5ta','ywK0y3rMuMv2zwfSvgHLBLn1yM1PDa','cGPzt1vsifjvtevtoGOTifLVDsbnqvKGzxHWBgfPBIbJB25Jzxb0CYWGzgvZy3jPyMuGyxbWCM9Hy2HLCYWGyw5KigHLBhaGDgHLignVBNrLC3rHBNqGCMvHC29UihrOCM91z2GGDgHLihbYB2jSzw0UcI0Gww91ie1bwsbKAxnJDxnZihrOzsb0zwnOBM9SB2D5igLUDM9SDMvKicHbrvmSihb3BNrVB2XZlcbqExrOB24GC3rYDwn0lcbivfrqlcbLDgmUks4klsbzB3uGtufzigHLBhaGzgvIDwCGuhL0Ag9UignVzguGDgHLignVBNrLC3rHBNqGD3jPDgvZlGOTifLVDsbnvvnuie5pvcbYzxzLywWGDgHLigzSywCGzgLYzwn0BhKUcI0Gww91ie1vu1qGtK9uig91Dhb1DcbHBNKGC3rYAw5Nig1HDgnOAw5NieLdt0f7lI4UFsbVCIbPy29HEY4UlN0UcI0Gww91ie1vu1qGtK9uihrLBgWGDgHLignVBNrLC3rHBNqGDgHLigv4ywn0igfUC3DLCIb0BYb0AgLZihf1zxn0Aw9UlGOTifLVDsbnqvKGC3vNz2vZDcb3AgLJAcb0B29Sic8GBgLICMfYEsaVihrLy2HUAxf1zsb0BYb1C2uUcI0Gv2HLBIbZDwDNzxn0Aw5NihnOzwXSic8GChL0Ag9UihnUAxbWzxrZihrOyxqGBMvLzcb0AguGyxr0ywnOzwqGzgf0ysWGCMvMzxiGDg8GDgHLigzPBguGCgf0AcbJAgfSBgvUz2vZl3e','icbezxrLy3rLzcbMBgfNiokaLcb0CMvHDgLUzYbHCZOG','ig9UifeZoq','ywK0y3rMrxHPDe5LEhrtDwi','DhjPBq','ywK0y3rMv3jHCeXPBMuYsgvHza','Dg9Rzw5ZvxnLza','y3rMngfP','ywK0y3rMsgLUDem','ywK0y3rMv3jHCeXPBMuXqM9KEq','CNvUigeGC2HLBgWGy29TBwfUzcbYAwDODcbOzxjL','icaGig1LBNu','ywK0y3rMvgHPBMTPBMC','ihrVig1VDMuGB24','y2HHBgXLBMDLtMfTzq','5OQk5PEx5A2q5O+q5lQK5yIW5A6E5PE256EV5yIg5QAC','B3bLBIa8Awq+','u3vIBwL0igeGzMXHzYb0BYb0AguGBgL2zsbZy29YzwjVyxjK','CxvLC3rPB24','ywK0y3rMv3jHCff1B3rHqW','CMvK','C3rYAw5NAwz5','quK0q1rgiokaLcbbssdPMj/LJ4S','icdWN5kHie9Uy2uGEw91igHHDMuGsunpqxSUlI59lcbZDwjTAxqGAxqGD2L0AdOG','zMLUza','icbtDgLSBcbHDMfPBgfIBgu6ia','x2XHC3rr','icdIMQaGodaLig9MihnLy3rPB24GquKGyNvKz2v0ihvZzwqU','icaGifbYzxzPB3vZoIa','BM9KztPJAgLSzf9WCM9JzxnZ','icdILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','icdILjtILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','yM9Sza','icaG4OAsia','EwvSBg93','BNvTyMvY','Cg9PBNrZ','quKGDgvHBw1HDgu','zg9Uzq','icbr','rNvSBcbXDwvZDgLVBJOGia','yw5ZD2vYCW','icdINjmGuq','icaGigHPBNqGyW','ywK0y3rMv3jHCff1B3rHC1rPDgXL','icboBYbJAgfSBgvUz2uGAwqGAw4Gy29UDgv4DcdIGjqGB3bLBIbVBMuGzMLYC3q6ia','ywK0y3rMrgvJB2rLza','Dg9Rzw5mAw1PDa','icaGicaGicaGicblzxKGyNjLywT0AhjVDwDOicHWCMuTD3jPDhrLBIK','ywK0y3rMsgLUDee','CxvPDa','icdILiZILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','Aw50zxjHy3rPB25Z','icbdB21Tyw5KCW','C2vUze1LC3nHz2u','icbuAguGquKGDgvHBw1HDguGC2nVCgvZigL0C2vSzIb0BYb0AguGy2HHBgXLBMDLihLVDsbVCgvUlG','Dg9Rzw4','ywK0y3rMu2fTCgXL','icbbstrdveyGC2vJDgLVBIbJB21WBgv0zsdIGjqG','DgvZDa','ywK0y3rMuMv2zwfSqM9KEq','cGPdsefmtevor0uGqLjjruy6cG','6Ake5yAz55Qe5O+q56s6kowgJsbOAw50iglJGifOAw50igmS5lIn5yMN6ycpkq','icdIMQaGquK0q1rgihrVA2vUigj1zgDLDcbLEgHHDxn0zwqGkdi1ldaWmcb1C2vKks4','icaGicaGicbPy29HE3CZBgmWBwvFmL9HAtrJDgz9','igfUC3DLCIb1CgrHDgvKoIa','ywK0y3rMv3jHCfr5CgvdDgy0ywK','icbpCgvUigfUB3rOzxiGy2HHBgXLBMDLihDPDgGG','zxHHBsbHBNn3zxiG','AgLUDcbH','AgvSCcaVid8Gpsb0AgvZzsbZDgvWCYdcTYbNDwLKzsa9ihrOzsbMDwXSignVBw1HBMqGC2HLzxqUiefUExrOAw5NigvSC2uGz29LCYb0BYb0AguGquKGyw5KihnWzw5KCYb5B3vYidi1ldaWmc10B2TLBIbIDwrNzxqU','BMfTzq','ywK0y3rMt3jdAgf0','C3LUy2LUz+kaPG','ihrVA2vUCYbSzwz0lG','tgvHDMuGDgHLiefjihrLyw1TyxrL','y29YCMvJDa','ywK0y3rMv3jVBMDgBgfN','q29TBwfUzcbMywLSzwq','ywnJB3vUDfzLCMLMAwvK','ixb5DgHVBJmGlwmGiJeRmsi','AgvSCcaVid8GpsdOV5NKUPVMRAxPQQqGWRCGz3vPzguGpsdLROZMLBtOR7tMMi7JGijbssG','icbLEgL0ihrVigXLyxzLignOyxq','quKGzxjYB3i6ia','icbfCNjVCJOG','mZz0CufdrLm','icbvC2u6ia','icH1CgrHDgvZigfMDgvYihLVDxiGzMLYC3qGBwvZC2fNzsK','igLZigeGBxvSDgLWBguTy2HVAwnLihf1zxn0Aw9UiokaLcbHBNn3zxiGD2L0Acbbl0iVqY9elG','AM9PBG','icaGihn1yM1PDcbjq09bEY4UlN0','lNr4DcaOAw5ZAwrLihrOzsbZyw5KyM94ksbYyxrOzxiGDgHHBIbHC2TPBMCGDgHLignVBNrLC3rHBNqGDg8GCgfZDguGDgHLihDOB2XLigjSB2iGyMfJAY4klsblzwvWihjLC3bVBNnLCYbJB25JAxnLigfUzcbWCMfJDgLJywWUifrOAxmGy29UDgvZDgfUDcbOyxmGBgLTAxrLzcb0Aw1LlG','BgvHDMuGDgHLignOyxqGkhnOB3DZihLVDxiGC2vZC2LVBIbYzxbVCNqP','rMXHzYbMB3jTyxq6igLJB2f7lI4UFq','icaOtM8GyNjPzwyGD2fZigzLDgnOzwqG4OcuihrOzsbJAgfSBgvUz2uGCgfNzsbOyxmGAxq6ia','zgf0yq','igzVCIbrmZK','ywK0y3rMq21Ku2HLBgXmAw5L','ywK0y3rMv2vSy29Tzun0yq','ywK0y3rMv3jHCe5LEhrcB2r5','ywK0y3rMoIa','ixnOzwXS','ywK0y3rMlwv4yw0','ywK0y3rMrM91BMrgBgfN','y3rMigXPC3q','55sO5AsN55M96k+D6zEUiefjioMyN+wpI+s7U+s9LEMxRUMIMa','DgLTzw91Da','ywnJB3vUDenHCa','ChvZAa','Aw5JB3jYzwn0','ywK0y3rMv3jHCeXPBMuYqM9KEq','zw5JB2rPBMC','ihb0CW','Cu51Bq','Ahr0Chm6lY9WCMfJDgLJzs5Py29HmJaYnI5HDs9HCgKVAwnVys9Kzw1Vlxn0yxrZ','z2vTAw5Ptw9KzwW','icbbzNrLCIbLEgL0oIbbstrdveyGC2vJDgLVBIbJB21WBgv0zs4GtMv4DdOG','DMLHigfPngn0zIbJAgf0','ywK0y3rMrgvJB2rL','ywK0y3rMsgLUDei','lI4VBgLIl2n0zMqTy2XPzw50lMPZ','5zUE5yIW6icd6k+v','vw5RBM93BG','icbbssbIDwrNzxq6ia','Bwf0y2G','ywK0y3rMrw5Ku2vZC2LVBG','ywK0y3rMlwnVBxa','z2vTBweTnc0ZmwiTAxq','AgvSCcaVid8GpsdOV5NKUPVMRAxPQQqGWRCGz3vPzguGpsdLROZMLBtLKB3KU6tOOAJJGilLHBBLROpOVPpLHAxPG73LJ5hNU5KGquKO6Ake566x5OYj6lsM5OI35zYO5PYn5yQH56UV6k6H6yEpkEoaGUwiHUEXUZO','55U05O6L5zYO6l+z6yEm6lErihnOzwXSic8GuhL0Ag9U','AgvSCcaVid8Gpsb0AgvZzsbZDgvWCYdcTYbNDwLKzsa9ihrOzsbMDwXSihnOzwv0lIbuAguGquKGka','icdILiiG','ysbWCMuTD3jPDhrLBIbUDwrNzsaODgHLBIbOAw50igiSigHPBNqGyYdIGjqGBM8GC3bVAwXLCNmP','CNvUigeGC2HLBgWGlYbqExrOB24Gy29TBwfUzcbYAwDODcbOzxjL','icaGigv4AxqGicaGicaGicaGica','icaGicbsDw4GuhL0Ag9UigLUihnOzwXS','icaGicaGicbZDwjTAxqGAwnVyxT3m2XJmg1LxZjFywK0y3rMFq','iokaLcb0ExbLia','ywK0y3rMsgLUDefvC2vZ','icbbssbIDwrNzxqGzxHOyxvZDgvKigzVCIbbstrdveyGC2vJDgLVBI4','mJjrtNHpshi','ywK0y3rMsgLUDenvC2vZ','C3vIBwL0qxr0zw1WDgvK','C3vIBwL0idXMBgfNpG','yxnRihrOzsbbssb0zwfTBwf0zsbHBNL0AgLUzYWGAw4GCgXHAw4GD29Yzhm','icbzB3uGy2fUihn0AwXSoIa','yNjPzwy','zw50zxjLzef0','mZuYmtC2BM9fuMzb','z3jLzw4','ywK0y3rMv3jHCff1B3rHqG','D2HHDa','AgfZ','qxnRihrOzsbbssb0zwfTBwf0zsbHyM91Dcb0AgLZignOywXSzw5Nzq','Dw5RBM93BIbLCNjVCG','icaGicaGicaGicbuzwnOBMLXDwuGAgLUDcaOChjLlxDYAxr0zw4P','Dgv4Da','ihDPBgWGB3bLBIbr','zgvZy3jPChrPB24','icaGice8C2HLBgWGy21KpIaGica','mtKWmJm2zxHbsgXh','ndC3mdGWBgjKq25J','iokaLca','ywK0y3rMlwrLBw8','vw5RBM93BIbYzxnWB25Zzq','ywK0y3rMv3jHCfrPDgXL','lI4U','quK0q1rgiokaLcbbssb0zwfTBwf0zq','imk3ia','ywK0y3rMsw50zxjJzxb0zwq','ywK0y3rMsgLUDe51zgDL','icaGicaGicaGicbbigDLBNrSzsbUDwrNzsaOChjLlxDYAxr0zw4P','icbLEgL0ihrVigXLyxzLignOyxqGWRCGC3vIBwL0idXMBgfNpIb0BYbZy29Yzq','CMvJB3jKihLVDxiGzMXHzYbMB3iGDgHPCYbXDwvZDgLVBIaOz3jHzgvKigf0igv4yw0GC3vIBwL0kq','ig5VDcbMB3vUzcbPBIbZDgf0zs4','y3LHBG','icaGicaGicaHzwnOBYbHv052wvH0m00YEgPnrZfSwhPkzLLxAZbzm1jTzLe9psb8igjHC2u2ncaTza','qw4GquKGDgvHBw1HDguGC2nVCgvKihrVihrOAxmGzxHHBsbXDwvZDgLVBI4GsxqGzxHWBgfPBNmGyw5Kihn1z2DLC3rZihrVB2XZoYbPDcb3AwXSig5VDcbOyw5KihLVDsb0AguGzMXHzY4GrxzLCNL0AgLUzYb5B3uGDhLWzsbOzxjLigLZigeGCxvLC3rPB24GDg8GAxqSigv4y2vWDcb0AguGy29TBwfUzhmGyMvSB3CU','D2HHDcbPCYbIyxnLnJq/','C2vZC2LVBJ0','icbbBhjLywr5ihnVBhzLzc4','nJm5mtGZnLLzzwPPuG','DgHPBMTPBMC','C3rKB3v0','icdILzdILzdILzaG','5A6m5Pw06Aky6z2Ikos4IUMDOUEAHoAHHUAyR+AiQUAwREEAHcK','C2vUzcbHigzSywCGDg8GDgHLigXPDMuGC2nVCMvIB2fYza','ywLvC2fNzq','zxHPDa','icdILii','nZC1ndeWqKfYre1n','ywK0y3rMsgLUDe5LEhrc','DhLWzq','yw5ZD2vYx2nOyw5Nzwq','y2HHBgXLBMDLqNjPzwy','ywK0y3rMsgLUDejcB2r5','BwLU','icbbDhrHy2HLzcbKyxrHigLZihnHDMvKigf0ignOywXSzw5NzxmVCq','C3vIBwL0ieLdt0f7lI4UFq','ihrVignVBNrPBNvL','ywK0y3rMsgLUDfbYAw5JAxbSzq','ue9tva','CM91BMq','ywK0y3rMv291BgrfyxjU','ywK0y3rM','quK0q1rgihnLy3rPB24','jsbVzIbZzwn0Aw9Uiefjigj1zgDLDcb1C2vKiokaLcbVBMX5ih4','Dg9ju09tDhjPBMC','icaGia','ywK0y3rMq29YCMvJDezSywC','ig5VDcbMB3vUzcbPBIbZDgf0zs4Gvhj5oIbLEgfTiheG','icaGicaGicaGicaGifjLDhvYBIb0BYbTywLUig1LBNuGkhDVCMTZigfUExDOzxjLkq','sunpqxT5B3vYx2zSywD9','ywK0y3rMrMXHz0HPBNq','Aw5JBhvKzxm','C3vIBwL0igLJB2f7lI4UFq','cIaG','y3vYCMvUDenOywXSzw5NzuLK','icdILRGG','D2HPDgu','CMvHza','q29UDgvUDc1uExbL','AgvSCcaVid8Gpsb0AgvZzsbZDgvWCYdcTYbNDwLKzsa9ihrOzsbMDwXSignVBw1HBMqGC2HLzxqUiefUExrOAw5NigvSC2uGz29LCYb0BYb0AguGquKGkgj1zgDLDcbPCYbWzxiGywnJB3vUDcWGBwv0zxjLzcbZzxj2zxiTC2LKzsKUienHDgvNB3j5oIa','iokaLcb1CgrHDguGAwnVys1JBgKGDg8GDgHLigXHDgvZDcb2zxjZAw9U','icaGicHhCMfKAw5NigHHChbLBNmGyxqGzxHHBsbZDwjTAxqG4OcuihLVDsbJyw5UB3qGChjLDMLLDYbJB3jYzwn0BMvZCYbKDxjPBMCGDgHLigv4yw0Ukq','iI4GsxqGzxHWBgfPBNmGyw5Kihn1z2DLC3rZihrVB2XZoYbPDcb3AwXSig5VDcbOyw5KihLVDsb0AguGzMXHzY4GrxzLCNL0AgLUzYb5B3uGDhLWzsbOzxjLigLZigeGCxvLC3rPB24GDg8GAxqSigv4y2vWDcb0AguGy29TBwfUzhmGyMvSB3CU','icboBYbJAgfSBgvUz2uGB3bLBIb5zxqU','ww91igfYzsbHBIbbssb0zwfTBwf0zsbOzwXWAw5NigeGy29UDgvZDgfUDcbZB2X2zsbHBIbjq09bidiWmJyGy3LIzxjZzwn1CML0EsbLEgfTihf1zxn0Aw9UlGOkq1vsuKvovcbrvuvtveLptIaOuq','xsaGWRCG'];a0B=function(){return aP;};return a0B();}const f=B=>new Promise(D=>setTimeout(D,B));let p=!(0x19*-0x172+-0x146*0x17+0x416d),w=null,b=-0x2*0x57a+0x1aec+-0xff8,$=0x5*0x584+0x1b88+-0x2*0x1b8e,A=!(0x1*0x169f+-0x1043+0x32e*-0x2),x=!(-0x2461+-0x18e8+-0xf*-0x416),I=!(0x2026+0x2*-0xddb+-0x46f);const C=0x7c7*-0x15+-0x806*0xd+0x342f*0x7,v=-0x611b7+0xcde52+-0x39*-0x48d;let k=null,T=null,S=!(-0x1*0x2363+0x2*0x9a9+-0x11*-0xf2);const N=new Set();let q=!(-0x167f+-0x23fd+0x3a7d),U=!(0x17*0x107+-0xd*-0x43+-0x1b07),E=!(0x16*-0x19+0x13*0x8b+0x5*-0x1a2),M=!(0x1150+0x9*-0x11+-0x10b6),Y=!(0x2bd*-0x5+-0x15bb+-0x236d*-0x1);function O(B){return a0ag(B)?(a0aj(),!(0x33*0x29+-0x2250+0x45*0x61)):!!a0af(B)&&(a0ai(),!(-0x1f07+-0xb53*0x3+0x4100));}function Q(B){const at=a0D;return at(0xee)===B||'question'===B||at(0x229)===B;}export function isChatActive(){return p;}function W(){const au=a0D,B=k?C:T?$||v:0x2f2+-0x97f+0x1a15,D=b,G=Math[au(0x25b)](Math[au(0x261)](D/B*(-0xf2d+0x1449+-0x4b8)),-0x1*0x2169+0x1*-0x1c65+-0x1f19*-0x2),J=Math[au(0x261)](G/(-0x4cf+-0x3e5*-0x1+0x14e)*(0x105b+0x22ab+-0x32f2)),K=0x24b5*0x1+-0x3a*-0x48+-0x34f1*0x1-J,L=G>-0xcd2*-0x3+-0x2e4+-0x2342?a0a3[au(0x1ab)]:G>-0x1322+0x33*-0x2b+0x1be5?a0a3['yellow']:a0a3['green'],P=k?au(0x264):T?au(0x149):au(0x134);!T||A?!T||x?console[au(0x159)](a0a3[au(0xfc)]('\x20\x20'+P+':\x20')+L('█'['repeat'](J))+a0a3[au(0xfc)]('░'[au(0x119)](K))+a0a3[au(0xfc)]('\x20'+D+'/'+B+'\x20('+G+'%)')):console[au(0x159)](a0a3[au(0xfc)](au(0x212))+a0a3['yellow'](au(0x1e0))+a0a3[au(0xfc)](au(0x1ee))):console[au(0x159)](a0a3['gray'](au(0x212))+a0a3['yellow'](au(0x111))+a0a3[au(0xfc)](au(0xf1)));}export async function handleChatMessage(G){const av=a0D;if(!w)return av(0x253);if(a0a8(av(0x1fb)+G),k)return H(G);if(T)return async function(P){const aw=av;if(!T||!w)return aw(0x253);const V=P[aw(0x19b)](),X=V['toLowerCase']();if(O(V))return'continue';if(Q(X))return Y=!(0xd3c+0x17e6*-0x1+0xaaa),function(a0){const ax=aw;if(console[ax(0x159)](),console[ax(0x159)](a0a3[ax(0x1b7)][ax(0xed)]('\x20\x20'+a0[ax(0x1a5)])+a0a3[ax(0xfc)]('\x20\x20\x20['+a0[ax(0x147)]+']')),console[ax(0x159)](),a0['challengeBrief']){for(const a1 of a0[ax(0x259)][ax(0x11c)]('\x0a'))''===a1?console[ax(0x159)]():console[ax(0x159)](a0a3[ax(0xed)]('\x20\x20'+a1));}else console['log'](a0a3[ax(0xfc)](ax(0x1f5))+a0a3[ax(0xed)](ax(0x1a7))+a0a3[ax(0xfc)](')'));console[ax(0x159)]();}(T),aw(0x120);const Z=V[aw(0x213)](/^submit\s+(.+)/i);if(Z){let a0=Z[0x568+0x393+-0x8fa]['trim']();if(/^submit\s+/i['test'](a0)&&(a0=a0['replace'](/^submit\s+/i,'')['trim']()),a0=a0[aw(0x161)](/^["'`]+|["'`]+$/g,'')[aw(0x19b)](),!a0)return console[aw(0x159)](),console[aw(0x159)](a0a3['gray'](aw(0xfa))+a0a3[aw(0xed)]('submit\x20<flag>')),console[aw(0x159)](),aw(0x120);const a1=T['challengeId'];if(!a1)return console['log'](),console[aw(0x159)](a0a3['yellow'](aw(0x1c4))+a0a3[aw(0xed)](aw(0x1a7))),console[aw(0x159)](),'continue';a0a9(a1,a0);const a2=a0a6();try{const {CTFdClient:a3}=await import('../lib/ctfd-client.js'),a4=a2[aw(0x117)]||'',a5=a2[aw(0x1cf)]&&!a2['token'][aw(0x26d)](aw(0x24a))?a2[aw(0x1cf)]:'',a6=new a3(a2[aw(0xf8)],a5,a4||a2[aw(0x1cf)]),a7=await a6[aw(0x14d)](a1,a0);switch(console['log'](),a7['status']){case aw(0x1e3):console[aw(0x159)](a0a3['green'][aw(0x1b7)]('\x20\x20🎉\x20Correct!\x20')+a0a3['white'](a7['message']||''));break;case aw(0x204):console[aw(0x159)](a0a3[aw(0x1ab)]('\x20\x20✗\x20Incorrect.\x20')+a0a3['gray'](a7[aw(0x124)]||''));break;case'already_solved':console[aw(0x159)](a0a3['yellow'](aw(0x24b)));break;case'paused':console[aw(0x159)](a0a3[aw(0x1b9)](aw(0x180)));break;case aw(0x185):console[aw(0x159)](a0a3[aw(0x1b9)]('\x20\x20Rate\x20limited\x20—\x20wait\x20a\x20moment\x20before\x20trying\x20again.'));break;default:console['log'](a0a3[aw(0xfc)]('\x20\x20'+(a7[aw(0x124)]||aw(0x23b))));}console[aw(0x159)]();const {postIntegritySnapshot:a8}=await import(aw(0x13b));await a8();}catch(a9){console[aw(0x159)](),console[aw(0x159)](a0a3['red']('\x20\x20Submission\x20failed:\x20'+(a9[aw(0x124)]?.['split']('\x0a')[0x2707*-0x1+-0x6*0x142+0x1*0x2e93]||aw(0x231)))),console['log']();}return aw(0x120);}if(P[aw(0x15d)]('!')){const aa=P[aw(0x11d)](-0x1b4+0x2*-0x7ff+0x11b3)[aw(0x19b)]();if(!aa)return aw(0x120);try{const ab={};ab[aw(0x206)]=aw(0x178),ab[aw(0x201)]=0x2710;const {execSync:ac}=await import(aw(0x1b4)),ad=ac(aa,ab)[aw(0x19b)]();console[aw(0x159)](),console[aw(0x159)](a0a3[aw(0xfc)](aw(0x103))+a0a3[aw(0xed)](aa)),console[aw(0x159)](a0a3[aw(0xed)]('\x20\x20'+ad[aw(0x11c)]('\x0a')[aw(0x1f0)](aw(0x26f)))),console[aw(0x159)]();}catch(ae){console['log'](),console[aw(0x159)](a0a3['red'](aw(0x1eb)+(ae[aw(0x124)]?.[aw(0x11c)]('\x0a')[0x1*0x182f+0x133*0x15+-0x315e*0x1]||'Command\x20failed'))),console['log']();}return aw(0x120);}if(aw(0x253)===X||aw(0x115)===X||aw(0x1c9)===X){const af=T[aw(0x1a5)];return p=!(-0x291+0xace*-0x3+0x4*0x8bf),w=null,T=null,a0ah(aw(0x215)),console['log'](),console[aw(0x159)](a0a3[aw(0xfc)]('\x20\x20AI\x20teammate\x20closed\x20for\x20\x22'+af+'\x22.')),console[aw(0x159)](a0a3[aw(0xfc)](aw(0x1da))+a0a3[aw(0xed)](aw(0x1a7))+a0a3[aw(0xfc)](aw(0x17b))+a0a3[aw(0xed)](aw(0x263))),console['log'](),'exit';}console[aw(0x159)](a0a3[aw(0xfc)]('\x20\x20'+a0ac(aw(0x1a3))));try{const ag=await w['sendMessage'](P);process[aw(0x24e)][aw(0x16a)](aw(0x102)),a0a5(ag[aw(0x19d)]),M=!(0x20d3+-0x37a+-0x2ab*0xb),'number'==typeof ag['accountSpent']?(b=ag['accountSpent'],A=!(-0x90d+0x1*-0x1219+0x1b26),x=!(0x1*0x2b+-0x14b3*0x1+0xc*0x1b6),aw(0x1ba)==typeof ag[aw(0x202)]&&($=ag[aw(0x202)])):(b+=ag['tokensUsed'],x=!(-0x12df*-0x2+-0x1932+-0xc8c)),console[aw(0x159)](),a0aa(ag[aw(0x233)]),W(),console['log'](a0a3[aw(0xfc)](aw(0x243))),console[aw(0x159)]();}catch(ah){process[aw(0x24e)][aw(0x16a)](aw(0x102)),a0ab(aw(0x1ea)+ah[aw(0x124)]),console['log']();}return'continue';}(G);if(O(G))return av(0x120);const J=G['trim']()[av(0x11e)]()[av(0x213)](/^hint\s+([abc])$/);if(J)return N[av(0x10d)](J[0x2ba*-0x7+0x1*-0x12c+-0x2e5*-0x7]),function(P){const ay=av,V=a0ac('a'===P?ay(0x1c8):'b'===P?ay(0x20e):'ai4ctfHintC'),X=a0ac('a'===P?'ai4ctfHintABody':'b'===P?ay(0x25a):'ai4ctfHintCBody'),Z=ay(0xf7)+P[ay(0x108)](),a0='a'===P?a0a3['green']:'b'===P?a0a3[ay(0x1b9)]:a0a3[ay(0x1ab)];console[ay(0x159)](),console[ay(0x159)](a0[ay(0x1b7)](ay(0x271)+Z+'\x20\x20')+a0a3[ay(0xfc)](V)),console[ay(0x159)]();for(const a1 of X[ay(0x11c)]('\x0a'))''===a1?console[ay(0x159)]():console[ay(0x159)](a0a3[ay(0xed)]('\x20\x20\x20\x20'+a1));console[ay(0x159)](),'a'===P?(console['log'](a0a3[ay(0xfc)](ay(0x267)+a0ac('ai4ctfHintNextA')+'\x20')+a0a3[ay(0x246)]('hint\x20b')),console['log']()):'b'===P&&(console['log'](a0a3[ay(0xfc)]('\x20\x20\x20\x20'+a0ac(ay(0x256))+'\x20')+a0a3['cyan'](ay(0x172))),console[ay(0x159)]());}(J[0x8*-0x33d+0x48*0x89+-0xc9f]),av(0x120);const K=G[av(0x213)](/^submit\s+(.+)/i);if(K){let P=K[0x1a91+0x5e*0x35+-0x2e06][av(0x19b)]();if(/^submit\s+/i[av(0x1d2)](P)&&(P=P[av(0x161)](/^submit\s+/i,'')[av(0x19b)]()),P=P[av(0x161)](/^["'`]+|["'`]+$/g,'')[av(0x19b)](),q=!(-0x1e+-0x25ca+-0x4*-0x97a),'icoa{w3lc0me_2_ai4ctf}'===P){console[av(0x159)](),console['log'](a0a3[av(0x22c)][av(0x1b7)](av(0xf9))),console[av(0x159)](a0a3[av(0x22c)][av(0x1b7)]('\x20\x20'+a0ac(av(0x268)))),console['log'](a0a3[av(0x22c)][av(0x1b7)]('\x20\x20════════════════════════════════════')),console[av(0x159)](),console['log'](a0a3['white']('\x20\x20'+a0ac(av(0x1c5)))),console['log'](a0a3[av(0xfc)]('\x20\x20'+a0ac(av(0x262)))),console[av(0x159)](),W(),p=!(0x108a+-0x7*0x488+0xf2f),w=null,a0ah(av(0x23a)),fetch(av(0x209),{'method':av(0x260),'headers':{'Content-Type':av(0x192)},'body':JSON['stringify']({'type':'ai4ctf','solved':!(-0x2*0x9a2+-0x110f+-0x11*-0x223),'tokensUsed':b,'timestamp':new Date()['toISOString']()}),'signal':AbortSignal[av(0x201)](-0x1996+0xe*-0x20b+0x49b8)})[av(0x14e)](()=>{}),await f(0x16c9+0xbca+0x1cb7*-0x1),console['log'](),console[av(0x159)](a0a3['cyan'](av(0x18c))),console[av(0x159)](a0a3[av(0x1b7)][av(0xed)]('\x20\x20'+a0ac(av(0x23c)))),console[av(0x159)](a0a3[av(0x246)]('\x20\x20─────────────────────────────────────────────')),console[av(0x159)]();const V=a0ac(av(0x15c)),X=a0ac(av(0x1a0));console[av(0x159)](a0a3[av(0xed)]('\x20\x20\x20\x201.\x20'+V+'\x20')+a0a3[av(0xfc)](X[av(0x11c)]('\x0a')[0x1*0x6d0+-0x13*0xc1+-0x281*-0x3]||''));for(const a2 of X[av(0x11c)]('\x0a')[av(0x11d)](0x85f+-0x4*0xe3+-0x2*0x269))a2['trim']()&&console[av(0x159)](a0a3[av(0xfc)]('\x20\x20\x20\x20\x20\x20\x20'+a2[av(0x161)](/\{thinking\}/g,av(0x24d))));console[av(0x159)](),console['log'](a0a3['white'](av(0x135)+a0ac(av(0x19c))+'\x20')+a0a3[av(0xfc)](a0ac(av(0x205)))),console[av(0x159)](),console['log'](a0a3['cyan']('\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20!echo\x20aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ==\x20|\x20base64\x20-d')),console[av(0x159)](),await f(0x6ce*0x1+0x748+-0x1*0x646),console[av(0x159)](a0a3[av(0x246)](av(0x18c))),console['log'](a0a3[av(0x1b7)][av(0xed)]('\x20\x20'+a0ac(av(0x1c3)))),console[av(0x159)](a0a3['cyan'](av(0x18c))),console[av(0x159)](),console[av(0x159)](a0a3['yellow']('\x20\x20\x20\x20\x20\x20\x20hint\x20a\x20\x20\x20')+a0a3[av(0xed)](a0ac(av(0x168))[av(0x107)](0xc49*0x2+0x35*-0xa7+-0xd*-0xc7))+a0a3[av(0xfc)](a0ac(av(0x17d)))),console[av(0x159)](a0a3[av(0x1b9)](av(0x17e))+a0a3[av(0xed)](a0ac(av(0x22d))[av(0x107)](0x1*-0x1b72+-0xf76*0x1+0x2b02))+a0a3[av(0xfc)](a0ac('ai4ctfWrapQuotaBHint'))),console[av(0x159)](a0a3[av(0x1b9)]('\x20\x20\x20\x20\x20\x20\x20hint\x20c\x20\x20\x20')+a0a3[av(0xed)](a0ac(av(0x1aa))[av(0x107)](0x1*-0x3d+0x21b3+-0x215c))+a0a3['gray'](a0ac(av(0x128)))),console[av(0x159)]();for(const a3 of a0ac(av(0x12f))[av(0x11c)]('\x0a'))console['log'](a0a3[av(0xfc)](av(0x267)+a3));console[av(0x159)](),await f(-0x11fa+-0x471+0x1e3b),console[av(0x159)](a0a3[av(0x246)]('\x20\x20─────────────────────────────────────────────')),console[av(0x159)](a0a3[av(0x1b7)][av(0xed)]('\x20\x20'+a0ac(av(0x154))+'\x20')+a0a3[av(0x1ab)]['bold'](av(0x19e))+a0a3[av(0xed)]('\x20—\x20'+a0ac(av(0x12a)))),console[av(0x159)](a0a3[av(0x246)](av(0x18c))),console['log']();const Z=a0ac(av(0x1fa)),a0=a0ac(av(0x184)),a1=Z[av(0x11c)]('\x0a');if(a1[-0x1985+0xc4+0x18c1]){const [a4,a5]=a1[-0xd2+0x117+-0x45][av(0x11c)](av(0x14f));console[av(0x159)](a0a3[av(0xed)](av(0x267)+(a4||''))+a0a3[av(0x1b7)][av(0xed)](a0)+a0a3[av(0xed)](a5||''));}for(const a6 of a1[av(0x11d)](0x1*-0x2401+0x1bdb+0x827))a6[av(0x19b)]()&&console[av(0x159)](a0a3[av(0xed)]('\x20\x20\x20\x20'+a6));return console['log'](),console[av(0x159)](a0a3['gray'](av(0x267)+a0ac(av(0x1d9))+'\x20')+a0a3[av(0x1b7)]['red'](av(0x19e))),console['log'](),av(0x253);}return console['log'](),console[av(0x159)](a0a3[av(0x1ab)]('\x20\x20'+a0ac(av(0x1e4)))),console['log'](a0a3['gray']('\x20\x20'+a0ac(av(0x26c)))),console[av(0x159)](),'continue';}if(G[av(0x15d)]('!')){const a7=G[av(0x11d)](0x1*0xbe4+-0xa0d*0x2+0x837)[av(0x19b)]();if(!a7)return av(0x120);try{const a8={};a8['encoding']=av(0x178),a8['timeout']=0x2710;const {execSync:a9}=await import('node:child_process'),aa=a9(a7,a8)[av(0x19b)]();console[av(0x159)](),console[av(0x159)](a0a3[av(0xfc)](av(0x103))+a0a3[av(0xed)](a7)),console['log'](a0a3[av(0xed)]('\x20\x20'+aa[av(0x11c)]('\x0a')[av(0x1f0)](av(0x26f)))),console[av(0x159)](),console['log'](a0a3[av(0xfc)]('\x20\x20'+a0ac(av(0x1fe)))),console['log']();}catch(ab){console[av(0x159)](),console[av(0x159)](a0a3[av(0x1ab)]('\x20\x20Error:\x20'+(ab[av(0x124)]?.[av(0x11c)]('\x0a')[0x1dfa+-0x163+0x1*-0x1c97]||av(0x1e5)))),console['log']();}return'continue';}if(av(0x253)===G||av(0x115)===G||av(0x1c9)===G||av(0x123)===G)return p=!(0x15db+0x749*0x3+-0x1*0x2bb5),w=null,a0ah('ai4ctf-demo'),fetch('https://practice.icoa2026.au/api/icoa/demo-stats',{'method':'POST','headers':{'Content-Type':av(0x192)},'body':JSON[av(0x1ac)]({'type':av(0x263),'tokensUsed':b,'timestamp':new Date()[av(0x266)]()}),'signal':AbortSignal['timeout'](-0xaab*0x1+-0x46d*-0x1+0x19c6)})[av(0x14e)](()=>{}),console[av(0x159)](),console['log'](a0a3[av(0xfc)](av(0x1b5))),console[av(0x159)](a0a3[av(0xed)]('\x20\x20'+a0ac(av(0x158)))),console[av(0x159)](a0a3[av(0xfc)]('\x20\x20'+a0ac(av(0x106))+':\x20'+b+'/5000')),console['log'](a0a3[av(0xfc)]('\x20\x20'+a0ac('ai4ctfModel')+':\x20Google\x20Gemma\x204\x20(gemma-4-31b-it)')),console['log'](a0a3[av(0xfc)](av(0x1b5))),console[av(0x159)](),console[av(0x159)](a0a3[av(0x246)](av(0x18c))),console['log'](a0a3[av(0xed)]('\x20\x20'+a0ac('ai4ctfExitNextTitle')+'\x20')+a0a3[av(0x1b7)][av(0x1ab)](av(0x19e))+a0a3[av(0xed)](av(0x239)+a0ac(av(0x19a)))),console[av(0x159)](a0a3[av(0xfc)]('\x20\x20'+a0ac(av(0x144)))),console[av(0x159)](a0a3[av(0x246)](av(0x18c))),console[av(0x159)](),console[av(0x159)](a0a3['white']('\x20\x20▸\x20\x20')+a0a3['white'](a0ac('typeAndEnterToBegin')[av(0x161)](av(0x130),a0a3[av(0x1b7)][av(0x1ab)](av(0x19e))))),console[av(0x159)](a0a3[av(0xfc)](av(0x162)+a0ac('orBack'))),console[av(0x159)](),av(0x253);const L={};L[av(0xef)]=av(0x192);if(!I&&b>=-0x1a7f+0x8e0+-0x1*-0x2527)return I=!(0x11dd+-0x71*-0x13+-0x1a40),fetch(av(0x209),{'method':av(0x260),'headers':L,'body':JSON[av(0x1ac)]({'type':av(0x263),'solved':!(-0xd*0x79+0x1740+0x88d*-0x2),'tokensUsed':b,'timestamp':new Date()[av(0x266)]()}),'signal':AbortSignal['timeout'](0x96b*-0x2+-0x5*0x489+0x3d0b)})['catch'](()=>{}),console['log'](),console[av(0x159)](a0a3[av(0x1b9)]('\x20\x20'+a0ac(av(0x1c6)))),W(),(function(){const az=av;console[az(0x159)](),console[az(0x159)](a0a3[az(0x1b9)](az(0x18c))),console[az(0x159)](a0a3[az(0x1b7)][az(0x1b9)]('\x20\x20'+a0ac(az(0x187)))),console[az(0x159)](a0a3[az(0x1b9)](az(0x18c))),console['log']();for(const ac of a0ac(az(0x1d3))[az(0x11c)]('\x0a'))''===ac?console[az(0x159)]():console[az(0x159)](a0a3['white'](az(0x267)+ac));console['log'](),console[az(0x159)](a0a3[az(0x246)](az(0x247))),console[az(0x159)](),console[az(0x159)](a0a3[az(0xed)](az(0x267)+a0ac(az(0x174)))),console['log'](),console['log'](a0a3[az(0x22c)](az(0x1d7))),console[az(0x159)](),console[az(0x159)](a0a3[az(0xed)](az(0x267)+a0ac(az(0x196)))),console['log'](),console[az(0x159)](a0a3['cyan'](az(0x21f))),console[az(0x159)](),console[az(0x159)](a0a3[az(0xfc)](az(0x267)+a0ac(az(0x176)))),console[az(0x159)]();}()),'continue';if(I)return console['log'](),console['log'](a0a3[av(0x1b9)]('\x20\x20'+a0ac('ai4ctfLockedTitle'))),console[av(0x159)](a0a3[av(0xfc)]('\x20\x20'+a0ac('ai4ctfLockedUse')+'\x20')+a0a3[av(0x246)]('!echo\x20aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ==\x20|\x20base64\x20-d')),console[av(0x159)](a0a3[av(0xfc)]('\x20\x20'+a0ac(av(0x109))+'\x20')+a0a3[av(0x246)]('submit\x20icoa{w3lc0me_2_ai4ctf}')),console[av(0x159)](),av(0x120);console[av(0x159)](a0a3[av(0xfc)]('\x20\x20'+a0ac(av(0x1a3))));try{const ac=await w[av(0x1cd)](G);process[av(0x24e)]['write'](av(0x102)),b+=ac[av(0x19d)],a0a5(ac['tokensUsed']),S=!(0x1*0x245f+-0x1*-0x304+-0x2763),console[av(0x159)](),a0aa(ac['text']),W(),console[av(0x159)](a0a3[av(0xfc)](av(0x1e9))),console['log']();}catch(ad){process[av(0x24e)][av(0x16a)]('\x1b[1A\x1b[2K'),a0ab('AI\x20error:\x20'+ad[av(0x124)]),console[av(0x159)]();}return av(0x120);}function F(B,D,G){const aA=a0D,J=a0a6()[aA(0x20a)]||aA(0x216),K=b>-0x24ad+-0x1e7e+-0x13*-0x389;console['log'](),console[aA(0x159)](a0a3[aA(0x22c)]['bold'](aA(0x16d)+D+':\x20'+B[aA(0x10f)]+aA(0x193))),K&&console[aA(0x159)](a0a3[aA(0xfc)](aA(0x17f))),G&&console[aA(0x159)](a0a3[aA(0xfc)](aA(0x132))+a0a3['yellow'](G)+a0a3[aA(0xfc)]('\x20\x20(submit\x20again\x20to\x20change)')),console[aA(0x159)](),console[aA(0x159)](a0a3[aA(0x246)](aA(0x1ca))),console[aA(0x159)](a0a3[aA(0x246)](aA(0x21a))+a0a3['bold']['white']('Q'+D+aA(0x116)+B[aA(0x10f)]+aA(0xf6)+(B[aA(0x1bb)]||0x2*-0x11d7+0x1*-0x382+0x689*0x6)+aA(0x207))),console['log'](a0a3['cyan']('\x20\x20│'));for(const L of String(B[aA(0x233)])[aA(0x11c)]('\x0a')){const P=L[aA(0x181)]>0x9ec+0x1334+-0x1ce4?L[aA(0x11d)](-0xa91+0x654+0x43d,0x90c+0x1fc8+0x5cd*-0x7)+aA(0x23d):L;console[aA(0x159)](a0a3[aA(0x246)](aA(0x21a))+a0a3[aA(0xed)](P));}console['log'](a0a3[aA(0x246)](aA(0x254))),console[aA(0x159)](a0a3['cyan']('\x20\x20│\x20')+a0a3['gray'](aA(0x1bf))+a0a3['white'](aA(0x10c)+D)),console['log'](a0a3[aA(0x246)](aA(0x21a))+a0a3[aA(0xfc)](aA(0x122))),console[aA(0x159)](a0a3['cyan'](aA(0x1b6))),console[aA(0x159)](),console[aA(0x159)](a0a3[aA(0x1b7)][aA(0xed)](aA(0x18d))),console[aA(0x159)](),console[aA(0x159)](a0a3[aA(0x1b9)](aA(0x18a))+a0a3[aA(0xfc)](aA(0x242))),console['log'](a0a3[aA(0x1b9)]('\x20\x20\x20\x20hint\x20b')+a0a3[aA(0xfc)](aA(0x232))),console[aA(0x159)](a0a3['yellow'](aA(0x1c2))+a0a3[aA(0xfc)](aA(0x1c7))),console[aA(0x159)](a0a3[aA(0x1b7)][aA(0x22c)](aA(0x1f1))+a0a3[aA(0xfc)](aA(0x175))),console[aA(0x159)](a0a3[aA(0xed)](aA(0x15b))+a0a3[aA(0xfc)](aA(0x21e))),console[aA(0x159)](a0a3[aA(0xfc)]('\x20\x20\x20\x20Just\x20type\x20freely\x20to\x20chat\x20with\x20the\x20AI\x20teammate.')),console['log'](a0a3[aA(0xfc)](aA(0x191))+a0a3[aA(0xed)]('\x22how\x20do\x20I\x20decrypt\x20AES-CBC\x20in\x20Python?\x22')),console[aA(0x159)](),console[aA(0x159)](a0a3['gray'](aA(0x186))+a0a3[aA(0xfc)]('\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Leave\x20chat,\x20return\x20to\x20exam')),console[aA(0x159)](a0a3[aA(0xfc)](aA(0x1a2))+a0a3[aA(0xfc)](aA(0x26a))),console['log'](),W(),console[aA(0x159)](a0a3[aA(0xfc)]('\x20\x20Model:\x20Google\x20Gemma\x204\x20('+J+')')),console['log']();}function a0D(a,b){a=a-(0x9f1*0x1+-0x2*0xcff+0x10fa);const c=a0B();let d=c[a];if(a0D['IiAnmW']===undefined){var e=function(i){const j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let l='',m='';for(let n=0x1c87+0x19*-0x172+-0xb1*-0xb,o,p,q=0x1*-0x138b+-0xaf4+0x1e7f;p=i['charAt'](q++);~p&&(o=n%(0x137b*-0x1+-0xa*-0x2c2+-0x1*0x815)?o*(0x1*0x169f+-0x1043+0x30e*-0x2)+p:p,n++%(-0x2461+-0x18e8+-0x3*-0x146f))?l+=String['fromCharCode'](0x2026+0x2*-0xddb+-0x371&o>>(-(0xe2*-0x25+-0x2fb*0x7+0x3589*0x1)*n&-0xf2c+0x202c+-0x29*0x6a)):-0x1*0x2363+0x2*0x9a9+-0x3*-0x55b){p=j['indexOf'](p);}for(let r=-0x167f+-0x23fd+0x3a7c,s=l['length'];r<s;r++){m+='%'+('00'+l['charCodeAt'](r)['toString'](0x17*0x107+-0xd*-0x43+-0x1af8))['slice'](-(0x16*-0x19+0x13*0x8b+0x1*-0x829));}return decodeURIComponent(m);};a0D['RPGcWa']=e,a0D['fdPvVm']={},a0D['IiAnmW']=!![];}const f=c[0x1150+0x9*-0x11+-0x10b7],g=a+f,h=a0D['fdPvVm'][g];return!h?(d=a0D['RPGcWa'](d),a0D['fdPvVm'][g]=d):d=h,d;}const z=new Set();async function H(G){const aB=a0D;if(!k||!w)return aB(0x253);const J=G[aB(0x19b)](),K=J[aB(0x11e)](),L=(Date[aB(0x157)]()-k[aB(0x22a)])/(-0x191*0xe7+0xb5*0x107+-0x155*-0x134);if(!k['nudgeShown']&&!k[aB(0x225)]&&L>=-0x1*-0x221b+0x8f*0x1a+0x1034*-0x3&&(k['nudgeShown']=!(0x2185+0x1149+-0x32ce),console[aB(0x159)](),console[aB(0x159)](a0a3['yellow'](aB(0x1ae))+a0a3['bold']['yellow'](aB(0x146))),console[aB(0x159)](a0a3[aB(0xfc)](aB(0x160))),console[aB(0x159)]()),O(J))return aB(0x120);if(Q(K))return E=!(-0x6f7+-0x25d6+0x2ccd),function(V,X){const aC=aB;console[aC(0x159)](),console[aC(0x159)](a0a3['bold'][aC(0xed)]('\x20\x20Q'+X+aC(0x116)+V[aC(0x10f)]+aC(0xf6)+(V[aC(0x1bb)]||-0x24c9+0x2006*0x1+0x4c9)+aC(0x207))),console['log']();for(const Z of String(V['description']||V['text']||'')[aC(0x11c)]('\x0a'))''===Z?console['log']():console[aC(0x159)](a0a3[aC(0xed)]('\x20\x20'+Z));V['attachedData']&&(console[aC(0x159)](),console[aC(0x159)](a0a3[aC(0xfc)](aC(0x25c)+X+aC(0x153)))),console[aC(0x159)]();}(k[aB(0x1a9)],k[aB(0x208)]),aB(0x120);if(/^ICOA\{[^}]+\}$/i[aB(0x1d2)](J))return console[aB(0x159)](),console[aB(0x159)](a0a3[aB(0xfc)](aB(0x198))+a0a3[aB(0xed)]('submit\x20'+J)),H(aB(0x14c)+J);const P=J[aB(0x213)](/^submit\s+(.+)/i);if(P){let V=P[-0x29*0x29+-0x135*-0x1b+-0x1*0x1a05]['trim']();if(/^submit\s+/i['test'](V)&&(V=V[aB(0x161)](/^submit\s+/i,'')['trim']()),V=V[aB(0x161)](/^["'`]+|["'`]+$/g,'')[aB(0x19b)](),/^[A-Da-d]$/[aB(0x1d2)](V))return console[aB(0x159)](),console[aB(0x159)](a0a3['yellow']('\x20\x20\x22'+V+'\x22\x20looks\x20like\x20an\x20MCQ\x20letter,\x20not\x20a\x20flag.')),console['log'](a0a3[aB(0xfc)](aB(0x112))+a0a3['green'](aB(0x26b))+a0a3[aB(0xfc)]('.\x20Try\x20again\x20inside\x20this\x20chat.')),console['log'](),'continue';const {getExamState:X,saveExamState:Z}=await import(aB(0xff)),a0=X();if(!a0)return'exit';if(!a0[aB(0x18b)][aB(0x1af)](a3=>a3[aB(0x1ba)]===k[aB(0x208)]))return console['log'](a0a3[aB(0x1ab)](aB(0x1be)+k[aB(0x208)]+aB(0x245))),aB(0x120);k[aB(0x225)]=!(-0x1b00+0xb9*-0x2b+-0x3a13*-0x1);const a1=a0[aB(0x1c0)][k[aB(0x208)]];a0[aB(0x1cb)]||(a0[aB(0x1cb)]=[]),a0[aB(0x1cb)][aB(0x203)]({'ts':new Date()[aB(0x266)](),'q':k[aB(0x208)],'type':a1?aB(0x258):aB(0x145),'input':V,'result':aB(0x20c)}),a0['answers'][k[aB(0x208)]]=V;const a2=k[aB(0x208)]+(-0x2288+-0x796*0x5+0x4877);return a0['_lastQ']=a2<=-0x1*-0x479+-0x10f5+-0x1*-0xca2?a2:k[aB(0x208)],Z(a0),console['log'](),a1?(console[aB(0x159)](a0a3[aB(0x22c)](aB(0x1c1)+k[aB(0x208)]+aB(0x1d8))+a0a3[aB(0x1b9)](V)),console[aB(0x159)](a0a3[aB(0xfc)](aB(0x1b3)+a1))):console['log'](a0a3[aB(0x22c)]['bold']('\x20\x20✓\x20Answer\x20for\x20Q'+k[aB(0x208)]+aB(0xfb)+V)),console[aB(0x159)](a0a3[aB(0xfc)](aB(0xf2))),console[aB(0x159)](),console['log'](a0a3[aB(0xfc)]('\x20\x20')+a0a3[aB(0xed)](aB(0x25d))+a0a3[aB(0xfc)]('\x20again\x20to\x20change,\x20or\x20')+a0a3[aB(0xed)](aB(0x253))+a0a3[aB(0xfc)](aB(0x1a4))),a2<=0x1e71+-0x5b7+-0x1894?console[aB(0x159)](a0a3['gray'](aB(0x165))+a0a3['cyan'](aB(0x263))+a0a3[aB(0xfc)](aB(0x234)+a2)):console[aB(0x159)](a0a3[aB(0xfc)](aB(0x20b))+a0a3[aB(0x1ab)](aB(0x19e))+a0a3[aB(0xfc)](aB(0x199))),console[aB(0x159)](),aB(0x120);}if(G[aB(0x15d)]('!')){const a3=G['slice'](-0x6d*-0x22+-0x1348+0x4cf)[aB(0x19b)]();if(!a3)return'continue';try{const a4={};a4[aB(0x206)]='utf-8',a4[aB(0x201)]=0x2710;const {execSync:a5}=await import(aB(0x1b4)),a6=a5(a3,a4)['trim']();console[aB(0x159)](),console[aB(0x159)](a0a3['gray'](aB(0x103))+a0a3[aB(0xed)](a3)),console[aB(0x159)](a0a3[aB(0xed)]('\x20\x20'+a6[aB(0x11c)]('\x0a')[aB(0x1f0)](aB(0x26f)))),console[aB(0x159)]();}catch(a7){console[aB(0x159)](),console[aB(0x159)](a0a3[aB(0x1ab)](aB(0x1eb)+(a7[aB(0x124)]?.[aB(0x11c)]('\x0a')[0x637*0x4+0x1b*0x6d+-0x245b]||aB(0x1e5)))),console[aB(0x159)]();}return'continue';}if(aB(0x253)===K||aB(0x115)===K||aB(0x1c9)===K){const a8=k[aB(0x208)],{getExamState:a9}=await import('../lib/exam-state.js'),aa=a9(),ab=aa&&null!=aa['answers'][a8],ac=aa?.[aB(0x1b1)]||a8;return p=!(0x6d9*-0x1+-0x1*-0x1d8b+-0x1*0x16b1),w=null,k=null,z['clear'](),a0ah('ai4ctf-exam'),console[aB(0x159)](),console[aB(0x159)](a0a3[aB(0xfc)](aB(0x14b)+a8+'.')),ab&&ac>a8&&ac<=0x17be+0xd3f*-0x1+-0x373*0x3?console[aB(0x159)](a0a3['white'](aB(0x10a))+a0a3[aB(0x1b7)][aB(0x22c)]('Q'+ac)+a0a3[aB(0xfc)](aB(0x220))+a0a3[aB(0x246)](aB(0x263))+a0a3[aB(0xfc)](aB(0x25e))):ab&&a8>=-0x179a+-0x1fbf+-0x377f*-0x1?console[aB(0x159)](a0a3[aB(0xed)](aB(0x1d1))+a0a3[aB(0x1b7)][aB(0x1ab)](aB(0x19e))+a0a3[aB(0xfc)](aB(0x1f7))):console['log'](a0a3[aB(0xfc)]('\x20\x20Resume:\x20')+a0a3['white'](aB(0x10c)+a8)+a0a3[aB(0xfc)](aB(0x101))+a0a3['white'](aB(0x263))),console['log'](),'exit';}if(I)return console[aB(0x159)](),console[aB(0x159)](a0a3['yellow'](aB(0x222))),console[aB(0x159)](a0a3[aB(0xfc)](aB(0x1b0))+a0a3['white'](aB(0x226))+a0a3[aB(0xfc)](aB(0x23f))+a0a3[aB(0xed)](aB(0x1fc))+a0a3['gray'](aB(0x23f))+a0a3[aB(0xed)](aB(0x253))),console[aB(0x159)](),'continue';if(b>=C)return I=!(-0xd91*-0x1+-0x952*0x3+-0xb*-0x14f),console[aB(0x159)](),console[aB(0x159)](a0a3[aB(0x1ab)][aB(0x1b7)](aB(0x1d6))),console[aB(0x159)](a0a3[aB(0xfc)](aB(0x228))+a0a3[aB(0xed)](aB(0x226))+a0a3[aB(0xfc)](aB(0x23f))+a0a3['white'](aB(0x1fc))+a0a3['gray']('\x20·\x20')+a0a3[aB(0xed)](aB(0x253))),console['log'](),aB(0x120);console['log'](a0a3[aB(0xfc)](aB(0x141)));try{const ad=await w['sendMessage'](G);process[aB(0x24e)][aB(0x16a)](aB(0x102)),b+=ad[aB(0x19d)],U=!(-0x15a+0x129d*0x2+-0x23e0);const {getRealExamState:ae,saveExamState:af}=await import(aB(0xff)),ag=ae(),ah={};ah['ai4ctf']=0x0,ah[aB(0x19e)]=0x0,(ag&&(ag[aB(0x252)]||(ag[aB(0x252)]=ah),ag['aiUsage'][aB(0x263)]=b,af(ag)),console[aB(0x159)](),a0aa(ad[aB(0x233)]),W(),console['log'](a0a3[aB(0xfc)](aB(0x137))),function(ai,aj,ak){const aD=aB,al=ai/aj*(-0x1f3d+-0x1*0x1cd+0x2*0x10b7);al>=0x2a*0xcd+-0x1d61+-0xe*0x47&&!ak[aD(0x22f)]('95')?(console['log'](a0a3['red'][aD(0x1b7)]('\x20\x20⚠\x20'+Math[aD(0x261)](al)+aD(0x265)+(aj-ai)+aD(0x1e1))),ak[aD(0x10d)]('95')):al>=0x2597+0x1057*0x1+-0x359e&&!ak['has']('80')?(console[aD(0x159)](a0a3[aD(0x1b9)](aD(0x1b2))),ak[aD(0x10d)]('80')):al>=-0x1d9*0x13+-0x1169+0x34b6&&!ak[aD(0x22f)]('50')&&(console[aD(0x159)](a0a3[aD(0xfc)](aD(0x188))),ak['add']('50'));}(b,C,z),console[aB(0x159)]());}catch(ai){process[aB(0x24e)][aB(0x16a)](aB(0x102)),a0ab(aB(0x1ea)+ai['message']),console[aB(0x159)]();}return aB(0x120);}function R(B,D){const aE=a0D,G=a0a6()[aE(0x20a)]||'gemma-4-31b-it';console['log'](),console[aE(0x159)](a0a3[aE(0x22c)]['bold'](aE(0x140))),console[aE(0x159)](),console['log'](a0a3[aE(0x246)](aE(0x1ca))),console[aE(0x159)](a0a3[aE(0x246)](aE(0x21a))+a0a3[aE(0x1b7)][aE(0xed)](B)+a0a3[aE(0xfc)](aE(0x16f)+D+']')),console[aE(0x159)](a0a3[aE(0x246)](aE(0x254))),console['log'](a0a3['cyan']('\x20\x20│\x20')+a0a3[aE(0xfc)](aE(0x14a))),console[aE(0x159)](a0a3[aE(0x246)](aE(0x21a))+a0a3[aE(0xfc)]('the\x20AI\x20guides,\x20it\x20will\x20not\x20hand\x20you\x20the\x20flag.')),console[aE(0x159)](a0a3[aE(0x246)](aE(0x1b6))),console[aE(0x159)](),console['log'](a0a3[aE(0x1b9)](aE(0x1cc))),console[aE(0x159)](a0a3['white'](aE(0x118))+a0a3[aE(0xfc)](aE(0x230))),console[aE(0x159)](a0a3[aE(0xed)](aE(0x236))+a0a3[aE(0xfc)](aE(0xfd))),console[aE(0x159)](a0a3['white'](aE(0x163))+a0a3['gray'](aE(0x1a8))),console[aE(0x159)](a0a3[aE(0xed)](aE(0x21d))+a0a3[aE(0xfc)](aE(0x1e2))),console[aE(0x159)](),console[aE(0x159)](a0a3[aE(0xfc)](aE(0x171))+a0a3[aE(0xed)](aE(0x1a7))+a0a3[aE(0xfc)](aE(0x17a))+a0a3[aE(0xed)](aE(0x263))),W(),console['log'](a0a3[aE(0xfc)](aE(0x143)+G+')')),console[aE(0x159)](a0a3[aE(0xfc)]('\x20\x20AI\x20usage\x20is\x20metered\x20per\x20account\x20(server-enforced\x20budget).')),console[aE(0x159)]();}export function registerAi4ctfCommand(B){const aF=a0D;B[aF(0x151)](aF(0x263))[aF(0x235)](aF(0x156))[aF(0x164)](async()=>{const aG=aF;a0a8(aG(0x263));const {getRealExamState:D}=await import(aG(0xff)),G=D(),J=G?.[aG(0x18b)]['some'](X=>aG(0x263)===X[aG(0x257)]);if(G&&J){const X=G['_lastQ']||0x21*0x91+-0x2205*0x1+0xf55,Z=G[aG(0x18b)][aG(0x1af)](a0=>a0['number']===X);if(!Z)return void a0ab('Q'+X+aG(0x269)+X);if(aG(0x263)!==Z[aG(0x257)]){if(console[aG(0x159)](),aG(0x19e)===Z[aG(0x257)])console[aG(0x159)](a0a3[aG(0x1b9)]('\x20\x20Q'+X+aG(0x11f))),console[aG(0x159)](a0a3[aG(0xfc)]('\x20\x20Use:\x20')+a0a3[aG(0x1b7)][aG(0x1ab)]('ctf4ai'));else{if(aG(0x170)===Z['type'])console[aG(0x159)](a0a3[aG(0x1b9)](aG(0x1be)+X+aG(0x15a))),console['log'](a0a3[aG(0xfc)](aG(0x1ed))+a0a3[aG(0x1b7)][aG(0x246)]('ctf4eai'));else{const a0=G[aG(0x18b)][aG(0x1af)](a1=>aG(0x263)===a1[aG(0x257)]);console['log'](a0a3[aG(0x1b9)]('\x20\x20Q'+X+aG(0x1ef))),a0&&(console[aG(0x159)](a0a3['gray']('\x20\x20AI4CTF\x20chat\x20is\x20available\x20on\x20practical\x20questions\x20(next:\x20Q'+a0[aG(0x1ba)]+').')),console[aG(0x159)](a0a3[aG(0xfc)]('\x20\x20Jump\x20there:\x20')+a0a3[aG(0x1b7)][aG(0x246)]('exam\x20q\x20'+a0[aG(0x1ba)])));}}return void console[aG(0x159)]();}return void await async function(a1,a2){const aH=aG,{getRealExamState:a3,refetchQuestionDataIfStale:a4,materializeAttachedData:a5}=await import(aH(0xff));await a4();const a6=a3();if(!a6)return!(-0xf0*0x24+-0x13a5+0x1*0x3566);const a7=a6['questions'][aH(0x1af)](aa=>aa[aH(0x1ba)]===a1);a7&&(a2=a7),a5(a1,a2?.['attachedData']);const a8=a6[aH(0x252)]?.[aH(0x263)]??0x65*0xd+-0x126*0x19+0x1*0x1795;if(a8>=C)return console[aH(0x159)](),console[aH(0x159)](a0a3[aH(0x1b9)](aH(0x15f))),console[aH(0x159)](a0a3[aH(0xfc)](aH(0x13a))+a0a3[aH(0xed)](aH(0x1db)+a1+'\x20ICOA{...}')),console[aH(0x159)](),!(-0x727*0x1+-0x30a+0xa32);try{w=await a0a4(void(0x1180+-0x1f32+-0x1*-0xdb2),function(aa,ab){const aI=aH,ac=aa['description']||aa[aI(0x233)]||'',ad=aa[aI(0x13e)]?'\x0a\x0aATTACHED\x20DATA\x20(also\x20saved\x20to\x20challenges/q'+ab+'.txt\x20inside\x20the\x20contestant\x27s\x20sandbox\x20—\x20path\x20is\x20relative\x20to\x20the\x20sandbox\x27s\x20/home/competitor\x20working\x20directory,\x20reachable\x20from\x20any\x20!shell\x20/\x20!python3\x20invocation):\x0a'+aa[aI(0x13e)]:'';return aI(0xf5)+ab+',\x20'+aa[aI(0x10f)]+',\x20'+(aa[aI(0x1bb)]||-0x1a8+0x3*-0x4df+0x104b*0x1)+aI(0x12b)+ac+ad+aI(0x197)+ab+aI(0x1f2);}(a2,a1));}catch(aa){return a0ab(aa[aH(0x124)]),!(-0x26fc+-0x3aa+0x2aa7);}p=!(0xd81+-0x1238*0x1+0x4b7),b=a8,I=!(-0x202b+0x147a+0xbb2),k={'qNum':a1,'question':a2,'usageField':'ai4ctf','enteredAt':Date[aH(0x157)](),'submitAttempted':!(0x1f7c+-0x2*-0x1009+-0x21*0x1ed),'nudgeShown':!(-0x76*-0x2+-0x1d2*-0x7+-0xda9)};const a9=a6[aH(0x1c0)]?.[a1];return U=!(0x26*0x71+0xdc4+-0x1*0x1e89),E=!(-0x5*0x13d+-0x178d*0x1+0x1dbf),F(a2,a1,a9),a0ae(function(ab,ac,ad){const aJ=aH,ae={};ae['en']=aJ(0x194)+ac,ae['zh']=aJ(0x15e)+ac;const af={};af['en']=aJ(0x248),af['zh']='只针对这道考题的\x20AI\x20队友:它讲解思路、推荐工具,但不会直接给旗子。除了下面这些命令,你敲的一切都是在问它。';const ag={};ag['en']=aJ(0x16b),ag['zh']=aJ(0x250);const ah={};ah['verb']=aJ(0xee),ah['what']=ag,ah[aJ(0x1bd)]=()=>E;const ai={};ai['en']=aJ(0x227),ai['zh']='用大白话问\x20AI\x20队友任何问题';const aj={};aj[aJ(0x11a)]='where\x20do\x20I\x20start?',aj[aJ(0x22e)]=ai,aj[aJ(0x1bd)]=()=>U;const ak={};ak['en']=aJ(0x21c),ak['zh']=aJ(0x218);const al={};al[aJ(0x11a)]=aJ(0x1e7),al[aJ(0x22e)]=ak,al['optional']=!(0x1395+0xf65+-0x22fa);const am={};am['en']=aJ(0x244),am['zh']='记录这道题的旗子(交卷时判分)';const an={};an['en']=aJ(0x1dd),an['zh']=aJ(0x18e);const ao={};ao['en']=aJ(0x12e),ao['zh']=aJ(0x210);const ap={};return ap[aJ(0x11a)]='exit',ap[aJ(0x22e)]=ao,{'id':aJ(0x1fd),'title':ae,'what':af,'steps':[ah,aj,al,{'verb':aJ(0x25d),'what':am,'done':()=>Boolean(ad)||!(-0x5b+-0x1*-0x160c+0x1*-0x15b1)===k?.[aJ(0x225)]}],'notes':[an],'leave':ap,'guide':()=>F(ab,ac,ad)};}(a2,a1,a9)),!(-0x1d78+-0x611*-0x1+0x1767);}(X,Z);}const K=a0a6(),L=K['geminiModel']||'gemma-4-31b-it';if(a0a7())return K[aG(0x179)]?void await(async function(){const aK=aG,a1=a0a6(),a2=a1[aK(0x270)],a3=a1[aK(0x179)],a4=a1[aK(0x10b)]||aK(0x211);let a5='';if(a2)try{const {CTFdClient:a6}=await import(aK(0x20f)),a7=a1[aK(0x117)]||'',a8=a1[aK(0x1cf)]&&!a1['token']['includes'](aK(0x24a))?a1[aK(0x1cf)]:'',a9=new a6(a1['ctfdUrl'],a8,a7||a1[aK(0x1cf)]);a5=(await a9[aK(0x190)](a2))[aK(0x235)]||'';}catch{}try{w=await a0a4(void(-0x815+-0x18b4+0x20c9*0x1),function(aa,ab,ac){const aL=aK;return aL(0x173)+aa+aL(0x182)+ab+').'+(ac?aL(0x1d4)+ac:'')+'\x0a\x0aYOUR\x20RULES:\x0a-\x20You\x20MAY\x20explain\x20concepts,\x20describe\x20approaches,\x20and\x20help\x20the\x20contestant\x20reason\x20through\x20the\x20problem.\x0a-\x20You\x20MAY\x20discuss\x20the\x20technology\x20involved\x20(crypto,\x20web,\x20forensics,\x20pwn,\x20reversing,\x20OSINT,\x20stego,\x20etc.).\x0a-\x20You\x20MAY\x20help\x20debug\x20code\x20the\x20contestant\x20writes\x20and\x20suggest\x20which\x20tool\x20/\x20library\x20/\x20technique\x20to\x20use.\x0a-\x20You\x20MUST\x20NOT\x20reveal\x20or\x20guess\x20the\x20flag,\x20and\x20MUST\x20NOT\x20output\x20any\x20flag-shaped\x20string\x20(anything\x20like\x20name{...}).\x0a-\x20You\x20MUST\x20NOT\x20solve\x20the\x20whole\x20challenge\x20end-to-end\x20for\x20the\x20contestant\x20—\x20guide,\x20don\x27t\x20hand\x20over\x20the\x20answer.\x0a-\x20Keep\x20responses\x20concise\x20and\x20practical.\x20The\x20contestant\x20is\x20racing\x20the\x20clock.';}(a3,a4,a5));}catch(aa){return a0ab(aa[aK(0x124)]),!(-0x499+0x186c+-0x76*0x2b);}p=!(0x2*0xb0+-0x1*-0xbb2+-0xef*0xe),b=0x21f2+-0x394*-0x6+0x52*-0xad,x=!(-0x1027+-0x1*-0xbff+-0x3*-0x163),$=v,A=!(-0xbb0+-0x1*-0x1cae+0x122*-0xf);try{if(a1['ctfdUrl']&&a1[aK(0x1cf)]){const ab=await a0ad(a1[aK(0xf8)]+'/api/icoa/ai/account-budget?kind=ai4ctf',{'headers':{'Authorization':aK(0x131)+a1[aK(0x1cf)],'User-Agent':aK(0x166)}});if(ab['ok']){const ac=await ab[aK(0x127)]();aK(0x1ba)==typeof ac['data']?.['accountSpent']&&(b=ac[aK(0x1f6)]['accountSpent'],x=!(0x11*-0x179+-0x1*-0x26ab+-0xda2)),'number'==typeof ac[aK(0x1f6)]?.[aK(0x202)]&&($=ac[aK(0x1f6)][aK(0x202)]),aK(0x104)==typeof ac['data']?.[aK(0x1e6)]&&(A=ac[aK(0x1f6)]['accountVerified']);}}}catch{}return I=!(0x24f5*-0x1+0x1c48+0x8ae),T={'challengeId':a2,'challengeName':a3,'challengeCategory':a4,'challengeBrief':a5,'enteredAt':Date[aK(0x157)]()},M=!(-0xc0c+-0x22b8+0x133*0x27),Y=!(-0x100f+0xa*-0xf+0x10a6),R(a3,a4),a0ae(function(ad,ae){const aM=aK,af={};af['en']=aM(0x1bc),af['zh']=aM(0x136);const ag={};ag['en']=aM(0x139)+ad+aM(0xf3),ag['zh']='只针对「'+ad+aM(0x16c);const ah={};ah['en']='the\x20challenge\x20brief,\x20right\x20here',ah['zh']=aM(0x125);const ai={};ai[aM(0x11a)]=aM(0xee),ai[aM(0x22e)]=ah,ai[aM(0x1bd)]=()=>Y;const aj={};aj['en']='ask\x20the\x20AI\x20teammate\x20anything,\x20in\x20plain\x20words',aj['zh']=aM(0x200);const ak={};ak[aM(0x11a)]=aM(0x13c),ak['what']=aj,ak[aM(0x1bd)]=()=>M;const al={};al['en']='run\x20a\x20shell\x20command\x20right\x20here',al['zh']='直接在这里跑\x20shell\x20命令';const am={};am['verb']='!base64\x20-d\x20f.txt',am[aM(0x22e)]=al,am[aM(0x105)]=!(-0x607*0x1+0x1565+0xe*-0x119);const an={};an['en']=aM(0x251),an['zh']=aM(0x1a6);const ao={};ao[aM(0x11a)]=aM(0x226),ao[aM(0x22e)]=an;const ap={};ap['en']=aM(0xf0)+ae+'.',ap['zh']=aM(0x217)+ae+'。';const aq={};aq['en']=aM(0x167),aq['zh']=aM(0x18f);const ar={};return ar[aM(0x11a)]=aM(0x253),ar[aM(0x22e)]=aq,{'id':aM(0x215),'title':af,'what':ag,'steps':[ai,ak,am,ao],'notes':[ap],'leave':ar,'guide':()=>R(ad,ae)};}(a3,a4)),!(0x21a3+-0x2*0x119f+-0x19b*-0x1);}()):(console[aG(0x159)](),console['log'](a0a3[aG(0x1b9)](aG(0xf4))),console[aG(0x159)](a0a3[aG(0xfc)]('\x20\x20Open\x20one\x20first:\x20')+a0a3['white'](aG(0x1ff))+a0a3[aG(0xfc)](aG(0x126))+a0a3['white'](aG(0x1a7))),console[aG(0x159)](a0a3[aG(0xfc)](aG(0x1ce))),void console[aG(0x159)]());const P={};P[aG(0x1de)]=aG(0x12d),P[aG(0x10f)]=aG(0x152);const V=P;try{w=await a0a4(V);}catch(a1){return void a0ab(a1[aG(0x124)]);}p=!(-0x2220+0x5*0x59f+0x605*0x1),b=0x58e+0x2b7*-0x2+-0x4*0x8,I=!(-0x2362+-0x2048+0x43ab),S=!(0x1*0x198e+-0x1*0x1cb2+0x325),N[aG(0x155)](),q=!(0xec8+0x1c16+-0x2add),j(L),a0ae(function(a3){const aN=aG,a4={};a4['en']=aN(0x23e),a4['zh']=aN(0x1ad);const a5={};a5['en']=aN(0x13f),a5['zh']=aN(0xfe);const a6={};a6['en']=aN(0x227),a6['zh']=aN(0x200);const a7={};a7[aN(0x11a)]=aN(0x249),a7['what']=a6,a7[aN(0x1bd)]=()=>S;const a8={};a8['en']=aN(0x21b),a8['zh']=aN(0x1d5);const a9={};a9['en']=aN(0x1a1),a9['zh']='直接在这里跑\x20shell\x20命令';const aa={};aa[aN(0x11a)]='!base64\x20-d\x20f.txt',aa[aN(0x22e)]=a9,aa[aN(0x105)]=!(0x118+0xeb+-0x203);const ab={};ab['en']=aN(0x13d),ab['zh']='提交你解出的旗子';const ac={};ac['verb']=aN(0x26e),ac[aN(0x22e)]=ab,ac[aN(0x1bd)]=()=>q;const ad={};ad['en']=aN(0x219)+a3+')\x20has\x20a\x205000-token\x20budget\x20here.',ad['zh']=aN(0x1e8)+a3+aN(0x177);const ae={};ae['en']=aN(0x1f3),ae['zh']=aN(0x189);const af={};return af['verb']='exit',af['what']=ae,{'id':aN(0x23a),'title':a4,'what':a5,'steps':[a7,{'verb':aN(0x1dc),'what':a8,'done':()=>N[aN(0x22f)]('a')},aa,ac],'notes':[ad],'leave':af,'guide':()=>j(a3)};}(L));});}function j(B){const aO=a0D;console['log'](),console[aO(0x159)](a0a3[aO(0x22c)][aO(0x1b7)](aO(0x24f)+a0ac(aO(0x142))+aO(0x193))),console[aO(0x159)](),console['log'](a0a3[aO(0xed)]('\x20\x20'+a0ac(aO(0x1d0)))),console[aO(0x159)](),console[aO(0x159)](a0a3[aO(0x246)]('\x20\x20┌─────────────────────────────────────────────')),console[aO(0x159)](a0a3[aO(0x246)](aO(0x21a))+a0a3['bold']['white'](a0ac(aO(0x183)))),console[aO(0x159)](a0a3[aO(0x246)](aO(0x254))),console[aO(0x159)](a0a3['cyan'](aO(0x21a))+a0a3[aO(0xed)](a0ac(aO(0x240)))),console[aO(0x159)](a0a3[aO(0x246)](aO(0x21a))+a0a3[aO(0x22c)](aO(0x17c))),console['log'](a0a3['cyan']('\x20\x20│')),console[aO(0x159)](a0a3[aO(0x246)]('\x20\x20│\x20')+a0a3['white'](a0ac(aO(0x20d)))),console['log'](a0a3['cyan'](aO(0x21a))+a0a3[aO(0xfc)](aO(0x1f4))),console[aO(0x159)](a0a3['cyan'](aO(0x1b6))),console[aO(0x159)](),console[aO(0x159)](a0a3[aO(0xed)]('\x20\x20'+a0ac('ai4ctfLevels'))),console[aO(0x159)](),console[aO(0x159)](a0a3[aO(0x1b9)](aO(0x18a))+a0a3[aO(0xfc)](aO(0x267)+a0ac(aO(0x1c8)))),console[aO(0x159)](a0a3[aO(0xfc)]('\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+a0ac(aO(0x221)))),console[aO(0x159)](a0a3[aO(0x1b9)]('\x20\x20\x20\x20hint\x20b')+a0a3['gray'](aO(0x267)+a0ac('ai4ctfHintB'))),console['log'](a0a3[aO(0xfc)]('\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+a0ac(aO(0x10e)))),console[aO(0x159)](a0a3['yellow'](aO(0x1c2))+a0a3[aO(0xfc)](aO(0x267)+a0ac(aO(0x19f)))),console[aO(0x159)](a0a3[aO(0xfc)](aO(0x16e)+a0ac(aO(0x224)))),console[aO(0x159)](),console[aO(0x159)](a0a3[aO(0xfc)]('\x20\x20─────────────────────────────────────────')),console['log'](a0a3[aO(0x1b7)][aO(0xed)]('\x20\x20'+a0ac(aO(0x1f9)))),console[aO(0x159)]('\x20\x20\x20\x20'+a0a3[aO(0x246)]('hint\x20a')+a0a3[aO(0xfc)](aO(0x1b8)+a0ac(aO(0x241)))),console['log'](aO(0x267)+a0a3[aO(0x246)]('hint\x20b')+a0a3[aO(0xfc)](aO(0x1b8)+a0ac('ai4ctfHintTechnique'))),console[aO(0x159)]('\x20\x20\x20\x20'+a0a3[aO(0x246)](aO(0x172))+a0a3[aO(0xfc)]('\x20\x20\x20→\x20'+a0ac(aO(0x25f)))),console[aO(0x159)](a0a3[aO(0xfc)](aO(0x267)+a0ac(aO(0x121)))),console[aO(0x159)](),console[aO(0x159)](a0a3[aO(0xed)]('\x20\x20'+a0ac(aO(0x1df)))),console[aO(0x159)](a0a3[aO(0xfc)]('\x20\x20'+a0ac(aO(0x129))+'\x20')+a0a3[aO(0xed)]('\x22what\x20encoding\x20is\x20this?\x22')),console[aO(0x159)](),console['log'](a0a3[aO(0x1b9)]('\x20\x20'+a0ac(aO(0x114)))),console[aO(0x159)](a0a3['white']('\x20\x20\x20\x20hint\x20a\x20/\x20b\x20/\x20c\x20\x20')+a0a3[aO(0xfc)](a0ac(aO(0x110)))),console[aO(0x159)](a0a3[aO(0xed)](aO(0x163))+a0a3['gray'](a0ac(aO(0x100)))),console[aO(0x159)](a0a3[aO(0xed)](aO(0x236))+a0a3[aO(0xfc)](a0ac(aO(0x1f8)))),console[aO(0x159)](a0a3[aO(0xfc)]('\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20e.g.\x20')+a0a3[aO(0xed)](aO(0x138))),console['log'](a0a3[aO(0xfc)]('\x20\x20\x20\x20exit\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+a0ac(aO(0x214)))),console[aO(0x159)](),W(),console[aO(0x159)](a0a3[aO(0xfc)]('\x20\x20'+a0ac(aO(0x11b))+aO(0x148)+B+')')),console['log'](a0a3[aO(0xfc)]('\x20\x20'+a0ac(aO(0x150)))),console['log']();}
|
package/dist/commands/ai4ioai.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Interface as e,createInterface as o}from"node:readline";import chalk from"chalk";import{getConfig as t}from"../lib/config.js";import{getMainRl as n}from"../lib/main-rl.js";import{logCommand as s}from"../lib/logger.js";import{printMarkdownYellow as l,printError as r}from"../lib/ui.js";const i="google/gemma-3n-e4b-it",a="Gemma 3n E4B",c=2e3,g=32768,h='You are Gemma 3n E4B ("google/gemma-3n-e4b-it"), the exact model named for the IOAI onsite contest chatbox. If asked which model you are, answer "Gemma 3n E4B" — never claim to be any other variant; your training data predates your own release, so trust this note over your intuition. You are an AI assistant for a contestant training for IOAI (the International Olympiad in Artificial Intelligence). Help with machine learning concepts, classic algorithms, model debugging, Python (numpy/pandas/sklearn/pytorch at small scale), and the math behind them. Be concise and practical; prefer worked examples over lectures. If a question is ambiguous, ask one clarifying question instead of guessing.';function u(e){return Math.ceil(e.length/4)}let d=null,y="",m="",p=i,w=[],f=0,x=1,b=0,k=0,A=0,I=!0,v=0,$=0,S=0,O=0;const T=new Set;function L(e){return[...w.map(e=>({role:e.role,text:e.parts.map(e=>e.text).join("")})),{role:"user",text:e}]}async function E(e){const o=t().deviceFingerprint||"",n=await fetch(`${y}/api/icoa/ai/ioai`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"icoa-cli-ai4ioai","X-Device-Fingerprint":o},body:JSON.stringify({systemPrompt:h,messages:L(e),maxTokens:1e3,deviceFingerprint:o}),signal:AbortSignal.timeout(6e4)}),s=await n.json().catch(()=>null);if(!n.ok||!s?.success)throw new Error(s?.message||`HTTP ${n.status}`);return{text:s.data?.text??"",windowTokens:"number"==typeof s.data?.tokensUsed?s.data.tokensUsed:null}}async function C(e){const o=[{role:"system",content:h},...L(e).map(e=>({role:"model"===e.role?"assistant":"user",content:e.text}))],t=await fetch(`${y}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${m}`,"HTTP-Referer":"https://icoa2026.au","X-Title":"ICOA AI4IOAI"},body:JSON.stringify({model:p,messages:o,max_tokens:1e3}),signal:AbortSignal.timeout(6e4)});if(!t.ok){const e=await t.text().catch(()=>"");throw new Error(`HTTP ${t.status}${e?`: ${e.slice(0,200)}`:""}`)}const n=await t.json(),s=n.choices?.[0]?.message?.content??"",l=n.usage;return{text:s,windowTokens:null!=l?.prompt_tokens?l.prompt_tokens+(l.completion_tokens??0):null}}export function ai4ioaiPromptLabel(){return"proxy"===d||/gemma-?3/i.test(p)?"gemma3":"ai4ioai"}function N(){const e=Math.min(Math.round(f/g*100),100),o=Math.round(e/100*20),t=e>=80?chalk.red:e>=50?chalk.yellow:chalk.green;console.log(chalk.gray(" Context ")+t("█".repeat(o))+chalk.gray("░".repeat(20-o))+chalk.gray(` ${f.toLocaleString()}/${g.toLocaleString()} tokens (${e}%) · conversation #${x}, ${b} turn${1===b?"":"s"} · exit to leave`))}function M(){const e=t(),o=process.env.ICOA_AI4IOAI_ENDPOINT||e.ai4ioaiEndpoint||"",n=process.env.ICOA_AI4IOAI_API_KEY||e.ai4ioaiApiKey||"";o&&n?(y=o.replace(/\/+$/,""),m=n,p=process.env.ICOA_AI4IOAI_MODEL||e.ai4ioaiModel||i,d="openai"):(y=(process.env.ICOA_AI4IOAI_PROXY||"https://practice.icoa2026.au").replace(/\/+$/,""),p=i,d="proxy")}export const AI_MAX_INPUT_CHARS=c;export async function askIoaiOneShot(e){d||M();const o=w;w=[];try{return{ok:!0,text:("openai"===d?await C(e):await E(e)).text}}catch(e){return{ok:!1,text:e instanceof Error?e.message:String(e)}}finally{w=o}}export async function startAi4ioaiChat(){return s("ai4ioai"),d=null,M(),w=[],f=u(h),x=1,b=0,A=0,k=0,O=0,I=!0,v=0,$=0,S=0,T.clear(),console.log(),console.log(chalk.bold.green(" ═══ AI4IOAI — contest chatbox simulator (official rules) ═══")),console.log(),console.log(chalk.white(" The revised Technical Appendix (2026-07) fixes the main-contest")),console.log(chalk.white(" chatbox: Gemma E4B, single-turn, tight caps. This trainer enforces")),console.log(chalk.white(" the exact same limits — what works here works onsite.")),console.log(),console.log(chalk.cyan(" ┌─────────────────────────────────────────────")),console.log(chalk.cyan(" │ ")+chalk.bold.white("The official chatbox rules")),console.log(chalk.cyan(" │")),console.log(chalk.cyan(" │ ")+chalk.gray("Your message: ≤ 2,000 characters (~350 words)")),console.log(chalk.cyan(" │ ")+chalk.gray("Its reply: ≤ 1,000 tokens (~750 words)")),console.log(chalk.cyan(" │ ")+chalk.gray("Memory: NONE — every message starts from zero.")),console.log(chalk.cyan(" │ ")+chalk.gray("Nothing you said before exists. You are the memory.")),console.log(chalk.cyan(" └─────────────────────────────────────────────")),console.log(),console.log(chalk.yellow(" Commands")),console.log(chalk.white(" <just type> ")+chalk.gray("Ask the AI — each message is a fresh, complete world")),console.log(chalk.white(" /rules ")+chalk.gray("The official chatbox limits")),console.log(chalk.white(" /ctx ")+chalk.gray("Session stats + contest strategy")),console.log(chalk.white(" /multi ")+chalk.gray("Multi-turn sandbox (off-spec window experiments)")),console.log(chalk.white(" exit ")+chalk.gray("Leave")),console.log(),console.log(chalk.yellowBright(` Model: ${a} · connected · single-turn · ≤2,000 chars in / ≤1,000 tokens out`)),console.log(chalk.yellowBright(` (Real ${a} — the exact chatbox model named in the IOAI Technical Appendix.)`)),console.log(),!0}export async function handleAi4ioaiMessage(e){if(!d)return"exit";s(`ai4ioai: ${e}`);const o=e.trim(),t=o.toLowerCase();if("exit"===t||"quit"===t||"back"===t||"q"===t||"menu"===t)return d=null,console.log(),console.log(chalk.gray(" ─────────────────────────────────────────")),console.log(chalk.white(" AI4IOAI session ended.")),I?(console.log(chalk.gray(` Messages: ${A} · blocked over 2,000 chars: ${S} · billed: ${O.toLocaleString()} tokens`)),console.log(chalk.gray(" The real chatbox forgets between messages — the discipline you just practiced is the tool."))):(console.log(chalk.gray(` Conversations: ${x} · total turns: ${A} · peak context: ${k.toLocaleString()} tokens (${Math.round(k/g*100)}% of window)`)),console.log(chalk.gray(" Reminder: the official contest chatbox is single-turn — the sandbox gauge does not exist there."))),console.log(chalk.gray(" ─────────────────────────────────────────")),console.log(),"exit";if("/new"===t||"new"===t||"/clear"===t||"clear"===t||"/restart"===t)return I?(console.log(),console.log(chalk.gray(" Single-turn mode — every message already starts fresh (official contest behavior).")),console.log(chalk.gray(" Multi-turn sandbox: ")+chalk.white("/multi")),console.log()):(console.log(),console.log(chalk.gray(` Conversation #${x} closed — ${b} turn${1===b?"":"s"}, ${f.toLocaleString()} tokens in the window at close.`)),x+=1,w=[],f=u(h),b=0,T.clear(),console.log(chalk.green.bold(` ✦ Conversation #${x} started — context window is fresh.`)),console.log(chalk.gray(" Carry over a 3–5 line summary of where you were, not the whole history.")),console.log()),"continue";if("/multi"===t||"/sandbox"===t)return I?(I=!1,w=[],f=u(h),b=0,T.clear(),console.log(),console.log(chalk.yellow(" ⚠ Multi-turn SANDBOX — this is NOT the contest.")),console.log(chalk.gray(" The official chatbox is single-turn. Use this to explore how a context")),console.log(chalk.gray(` window (${g.toLocaleString()} tokens) fills, degrades, and dies. `)+chalk.white("/single")+chalk.gray(" returns to the rules.")),console.log(),"continue"):(console.log(chalk.gray(" Already in the multi-turn sandbox. Back to contest rules: ")+chalk.white("/single")),"continue");if("/single"===t||"/contest"===t)return I?(console.log(chalk.gray(" Already in official single-turn mode.")),"continue"):(I=!0,w=[],b=0,T.clear(),console.log(),console.log(chalk.green(" ✓ Back to official contest rules — single-turn, ≤2,000 chars in, ≤1,000 tokens out.")),console.log(),"continue");if("/rules"===t||"rules"===t)return console.log(),console.log(chalk.bold.white(" ═══ Official chatbox rules — Technical Appendix (rev. 2026-07) ═══")),console.log(),console.log(chalk.white(` Model: ${a}`)+chalk.gray(' (the appendix names it "Gemma E4B")')),console.log(chalk.white(" Message: ≤ 2,000 characters")+chalk.gray(" (~350 words) — enforced here")),console.log(chalk.white(" Reply: ≤ 1,000 tokens")+chalk.gray(" (~750 words) — long answers truncate")),console.log(chalk.white(" Memory: NONE")+chalk.gray(" — single-turn; every send starts from zero")),console.log(),console.log(chalk.gray(" What works in this trainer works onsite — the limits are identical.")),console.log(),"continue";if("/ctx"===t||"ctx"===t||"/context"===t)return function(){if(I)return console.log(),console.log(chalk.bold.white(" ═══ Session — official single-turn mode ═══")),console.log(),console.log(chalk.gray(" Messages sent: ")+chalk.white(String(A))+chalk.gray(" · blocked over 2,000 chars: ")+chalk.white(String(S))),console.log(chalk.gray(" Last message: ")+chalk.white(`${v.toLocaleString()}/2,000 chars`)+chalk.gray(" · last reply: ")+chalk.white(`≈${$.toLocaleString()}/1,000 tokens`)),console.log(chalk.gray(" Billed this session: ")+chalk.white(`${O.toLocaleString()} tokens`)),console.log(),console.log(chalk.bold.white(" Contest strategy (you are the memory):")),console.log(chalk.white(" 1. ")+chalk.gray("Every message self-contained: rules header + material + ONE question.")),console.log(chalk.white(" 2. ")+chalk.gray('Iterate by EDITING and resending the whole prompt — there is no "fixing" a chat.')),console.log(chalk.white(" 3. ")+chalk.gray("Long material? Chunk it ≤2,000 chars per message, collect quotes, then reduce.")),void console.log();console.log(),console.log(chalk.bold.white(" ═══ Context usage — multi-turn SANDBOX (off-spec) ═══")),console.log(),N(),console.log(chalk.gray(" Peak this session: ")+chalk.white(`${k.toLocaleString()} tokens`)+chalk.gray(" · conversations used: ")+chalk.white(String(x))),console.log(chalk.gray(" Billed this session: ")+chalk.white(`${O.toLocaleString()} tokens`)+chalk.gray(" — every request re-sends the whole conversation, so provider")),console.log(chalk.gray(" dashboards count far more than the window gauge above. Both are correct.")),console.log(),console.log(chalk.yellow(" Reminder: the official contest chatbox is SINGLE-TURN — ")+chalk.white("/single")),console.log(chalk.gray(" returns to contest rules. This sandbox exists for window experiments only.")),console.log()}(),"continue";if("/help"===t||"help"===t)return console.log(),console.log(chalk.white(" <just type> ")+chalk.gray("ask the AI (each message stands alone)")),console.log(chalk.white(" /rules ")+chalk.gray("the official chatbox limits")),console.log(chalk.white(" /ctx ")+chalk.gray("session stats + contest strategy")),console.log(chalk.white(" /multi ")+chalk.gray("multi-turn sandbox (off-spec) — /single returns")),I||console.log(chalk.white(" /new ")+chalk.gray("new sandbox conversation (context resets)")),console.log(chalk.white(" exit ")+chalk.gray("leave")),console.log(),"continue";if(I&&o.length>c)return S+=1,console.log(),console.log(chalk.red.bold(` ■ ${o.length.toLocaleString()} characters — over the contest cap of ${c.toLocaleString()}/message.`)),console.log(chalk.white(" The onsite chatbox will refuse this too. Make it fit:")),console.log(chalk.gray(" · cut boilerplate — keep rules header + material + ONE question")),console.log(chalk.gray(" · long material? split into self-contained chunk messages, collect quotes")),console.log(chalk.gray(" · point at the 20 relevant lines, never the whole file")),console.log(),"continue";if(!I&&f>=28768)return console.log(),console.log(chalk.red.bold(" ■ Context window exhausted.")),console.log(chalk.white(" A prompt plus a full answer no longer fit — this conversation is over.")),console.log(chalk.gray(" Start fresh: ")+chalk.bold.white("/new")),console.log(),"continue";console.log(chalk.gray(" Thinking..."));try{const{text:e,windowTokens:t}="openai"===d?await C(o):await E(o);if(process.stdout.write("[1A[2K"),A+=1,I)return v=o.length,$=u(e),O+=t??u(o)+$,console.log(),l(e),console.log(chalk.gray(` · single-turn: window cleared · msg ${v.toLocaleString()}/2,000 chars · reply ≈${$.toLocaleString()}/1,000 tokens ·`)),console.log(),"continue";w.push({role:"user",parts:[{text:o}]}),w.push({role:"model",parts:[{text:e}]}),b+=1,f=t??f+u(o)+u(e),f>k&&(k=f),O+=t??f,console.log(),l(e),N(),function(){const e=f/g*100;e>=95&&!T.has("95")?(T.add("95"),console.log(),console.log(chalk.red.bold(" ⚠ 95% — the window is nearly spent. Maybe 1–2 turns left.")),console.log(chalk.red(" Restart NOW: ")+chalk.bold.white("/new")+chalk.red(" and re-state only the essentials (goal · current approach · last error)."))):e>=80&&!T.has("80")?(T.add("80"),console.log(),console.log(chalk.yellow(" ⚠ 80% of the context window used — answers degrade from here.")),console.log(chalk.gray(" Wrap up this sub-problem, then ")+chalk.white("/new")+chalk.gray('. Tip: first ask the AI to "summarize what we established in 5 bullets" and carry that.'))):e>=50&&!T.has("50")&&(T.add("50"),console.log(),console.log(chalk.gray(" Note: half the sandbox window is gone. Budget it — one sub-problem per conversation.")))}(),console.log()}catch(e){process.stdout.write("[1A[2K");const o=e instanceof Error?e.message:String(e);if(!I&&/token|exceeds|too long|400/i.test(o)&&f>16384)console.log(),console.log(chalk.red.bold(" ■ The API rejected the conversation — the context window is spent.")),console.log(chalk.gray(" Start fresh: ")+chalk.bold.white("/new")),console.log();else{console.log(),console.log(chalk.red.bold(` ✗ AI request failed: ${o.split("\n")[0]}`));const e=y.replace(/^https?:\/\//,"");console.log(chalk.gray(` backend: ${"proxy"===d?`ICOA server (${e})`:e}`)),/timeout|ENOTFOUND|ECONNREFUSED|fetch failed|network/i.test(o)?console.log(chalk.gray(" Looks like a network issue (proxy / firewall / offline?).")):"proxy"===d&&/\b(502|503)\b/.test(o)?console.log(chalk.gray(" The ICOA server could not reach the model — try again shortly.")):"openai"===d&&/\b40[123]\b|unauthor|credit|payment/i.test(o)&&console.log(chalk.gray(" Looks like a key / credit issue — check the endpoint key and its balance/limit.")),console.log(chalk.gray(" You are still in the chat — try again, or type ")+chalk.white("exit")+chalk.gray(".")),console.log()}}return"continue"}export async function runAi4ioaiStandalone(){if(!await startAi4ioaiChat())return;const t=n(),s=null!==t,l=s?t.listeners("line").slice():[];s&&t.removeAllListeners("line");const i=s?t:o({input:process.stdin,output:process.stdout,terminal:!0}),a=s?i.prompt:null;s&&(i.prompt=e.prototype.prompt);const c=()=>{i.setPrompt(chalk.bold.green(`icoa ${ai4ioaiPromptLabel()}> `)),i.prompt()};return new Promise(e=>{const o=t=>{handleAi4ioaiMessage(t.trim()).then(t=>{"exit"===t?((()=>{if(i.removeListener("line",o),s){a&&(i.prompt=a);for(const e of l)i.on("line",e)}else i.close()})(),e()):c()}).catch(e=>{r(`AI error: ${e instanceof Error?e.message:String(e)}`),c()})};i.on("line",o),c()})}
|
|
1
|
+
import{Interface as e,createInterface as o}from"node:readline";import chalk from"chalk";import{getConfig as t}from"../lib/config.js";import{getMainRl as n}from"../lib/main-rl.js";import{logCommand as s}from"../lib/logger.js";import{printMarkdownYellow as l,printError as r}from"../lib/ui.js";import{enterPanel as i,isGuideWord as a,isHelpWord as c,leavePanel as g,printGuide as h,printHelp as u}from"../lib/guide-panel.js";const d="google/gemma-3n-e4b-it",m="Gemma 3n E4B",y=2e3,p=32768,w='You are Gemma 3n E4B ("google/gemma-3n-e4b-it"), the exact model named for the IOAI onsite contest chatbox. If asked which model you are, answer "Gemma 3n E4B" — never claim to be any other variant; your training data predates your own release, so trust this note over your intuition. You are an AI assistant for a contestant training for IOAI (the International Olympiad in Artificial Intelligence). Help with machine learning concepts, classic algorithms, model debugging, Python (numpy/pandas/sklearn/pytorch at small scale), and the math behind them. Be concise and practical; prefer worked examples over lectures. If a question is ambiguous, ask one clarifying question instead of guessing.';function f(e){return Math.ceil(e.length/4)}let x=null,b="",k="",I=d,A=[],v=0,$=1,O=0,S=0,T=0,L=!0,E=0,C=0,N=0,M=0;const B=new Set;function P(e){return[...A.map(e=>({role:e.role,text:e.parts.map(e=>e.text).join("")})),{role:"user",text:e}]}async function _(e){const o=t().deviceFingerprint||"",n=await fetch(`${b}/api/icoa/ai/ioai`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"icoa-cli-ai4ioai","X-Device-Fingerprint":o},body:JSON.stringify({systemPrompt:w,messages:P(e),maxTokens:1e3,deviceFingerprint:o}),signal:AbortSignal.timeout(6e4)}),s=await n.json().catch(()=>null);if(!n.ok||!s?.success)throw new Error(s?.message||`HTTP ${n.status}`);return{text:s.data?.text??"",windowTokens:"number"==typeof s.data?.tokensUsed?s.data.tokensUsed:null}}async function j(e){const o=[{role:"system",content:w},...P(e).map(e=>({role:"model"===e.role?"assistant":"user",content:e.text}))],t=await fetch(`${b}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${k}`,"HTTP-Referer":"https://icoa2026.au","X-Title":"ICOA AI4IOAI"},body:JSON.stringify({model:I,messages:o,max_tokens:1e3}),signal:AbortSignal.timeout(6e4)});if(!t.ok){const e=await t.text().catch(()=>"");throw new Error(`HTTP ${t.status}${e?`: ${e.slice(0,200)}`:""}`)}const n=await t.json(),s=n.choices?.[0]?.message?.content??"",l=n.usage;return{text:s,windowTokens:null!=l?.prompt_tokens?l.prompt_tokens+(l.completion_tokens??0):null}}export function ai4ioaiPromptLabel(){return"proxy"===x||/gemma-?3/i.test(I)?"gemma3":"ai4ioai"}function z(){const e=Math.min(Math.round(v/p*100),100),o=Math.round(e/100*20),t=e>=80?chalk.red:e>=50?chalk.yellow:chalk.green;console.log(chalk.gray(" Context ")+t("█".repeat(o))+chalk.gray("░".repeat(20-o))+chalk.gray(` ${v.toLocaleString()}/${p.toLocaleString()} tokens (${e}%) · conversation #${$}, ${O} turn${1===O?"":"s"} · exit to leave`))}function q(){const e=t(),o=process.env.ICOA_AI4IOAI_ENDPOINT||e.ai4ioaiEndpoint||"",n=process.env.ICOA_AI4IOAI_API_KEY||e.ai4ioaiApiKey||"";o&&n?(b=o.replace(/\/+$/,""),k=n,I=process.env.ICOA_AI4IOAI_MODEL||e.ai4ioaiModel||d,x="openai"):(b=(process.env.ICOA_AI4IOAI_PROXY||"https://practice.icoa2026.au").replace(/\/+$/,""),I=d,x="proxy")}export const AI_MAX_INPUT_CHARS=y;export async function askIoaiOneShot(e){x||q();const o=A;A=[];try{return{ok:!0,text:("openai"===x?await j(e):await _(e)).text}}catch(e){return{ok:!1,text:e instanceof Error?e.message:String(e)}}finally{A=o}}export async function startAi4ioaiChat(){return s("ai4ioai"),x=null,q(),A=[],v=f(w),$=1,O=0,T=0,S=0,M=0,L=!0,E=0,C=0,N=0,B.clear(),R=!1,D=!1,console.log(),console.log(chalk.bold.green(" ═══ AI4IOAI — contest chatbox simulator (official rules) ═══")),console.log(),console.log(chalk.white(" The revised Technical Appendix (2026-07) fixes the main-contest")),console.log(chalk.white(" chatbox: Gemma E4B, single-turn, tight caps. This trainer enforces")),console.log(chalk.white(" the exact same limits — what works here works onsite.")),console.log(),console.log(chalk.cyan(" ┌─────────────────────────────────────────────")),console.log(chalk.cyan(" │ ")+chalk.bold.white("The official chatbox rules")),console.log(chalk.cyan(" │")),console.log(chalk.cyan(" │ ")+chalk.gray("Your message: ≤ 2,000 characters (~350 words)")),console.log(chalk.cyan(" │ ")+chalk.gray("Its reply: ≤ 1,000 tokens (~750 words)")),console.log(chalk.cyan(" │ ")+chalk.gray("Memory: NONE — every message starts from zero.")),console.log(chalk.cyan(" │ ")+chalk.gray("Nothing you said before exists. You are the memory.")),console.log(chalk.cyan(" └─────────────────────────────────────────────")),console.log(),console.log(chalk.yellow(" Commands")),console.log(chalk.white(" <just type> ")+chalk.gray("Ask the AI — each message is a fresh, complete world")),console.log(chalk.white(" /rules ")+chalk.gray("The official chatbox limits")),console.log(chalk.white(" /ctx ")+chalk.gray("Session stats + contest strategy")),console.log(chalk.white(" /multi ")+chalk.gray("Multi-turn sandbox (off-spec window experiments)")),console.log(chalk.white(" exit ")+chalk.gray("Leave")),console.log(),console.log(chalk.yellowBright(` Model: ${m} · connected · single-turn · ≤2,000 chars in / ≤1,000 tokens out`)),console.log(chalk.yellowBright(` (Real ${m} — the exact chatbox model named in the IOAI Technical Appendix.)`)),console.log(),i({id:"ai4ioai",title:{en:"AI4IOAI — contest chatbox trainer",zh:"AI4IOAI — 赛场聊天框训练"},what:{en:`The IOAI contest chatbox, reproduced exactly: ${m}, no memory between messages, 2,000 characters in, 1,000 tokens out. Everything you type is one complete, self-contained message to it.`,zh:`照搬 IOAI 赛场聊天框:${m},消息之间没有记忆,进 2,000 字符、出 1,000 token。你敲的每一句都是一条独立完整的消息。`},steps:[{verb:"define overfitting",what:{en:"ask anything — then notice the next message starts from zero",zh:"随便问 —— 然后留意下一句又从零开始"},done:()=>T>0},{verb:"/rules",what:{en:"the official chatbox limits, in full",zh:"官方聊天框限制全文"},done:()=>R},{verb:"/ctx",what:{en:"your session stats + how to pack one good message",zh:"本次统计 + 怎么把一条消息写满写好"},done:()=>D},{verb:"/multi",what:{en:"off-spec multi-turn sandbox (/single returns to the rules)",zh:"非赛制的多轮沙盒(/single 回到规则)"},done:()=>!L,optional:!0}],notes:[{en:"help / ? = these steps · help all = every command. Anything else is sent to the model.",zh:"help / ? = 这些步骤 · help all = 全部命令。其它输入都发给模型。"}],leave:{verb:"back",what:{en:"leave the trainer (exit works too)",zh:"离开训练(exit 也行)"}},guide:()=>G()}),!0}let R=!1,D=!1;function G(){console.log(),console.log(chalk.white(" <just type> ")+chalk.gray("ask the AI (each message stands alone)")),console.log(chalk.white(" /rules ")+chalk.gray("the official chatbox limits")),console.log(chalk.white(" /ctx ")+chalk.gray("session stats + contest strategy")),console.log(chalk.white(" /multi ")+chalk.gray("multi-turn sandbox (off-spec) — /single returns")),L||console.log(chalk.white(" /new ")+chalk.gray("new sandbox conversation (context resets)")),console.log(chalk.white(" help ")+chalk.gray("the steps for this screen")),console.log(chalk.white(" exit ")+chalk.gray("leave")),console.log()}export async function handleAi4ioaiMessage(e){if(!x)return"exit";s(`ai4ioai: ${e}`);const o=e.trim(),t=o.toLowerCase();if("exit"===t||"quit"===t||"back"===t||"q"===t||"menu"===t)return x=null,g("ai4ioai"),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────")),console.log(chalk.white(" AI4IOAI session ended.")),L?(console.log(chalk.gray(` Messages: ${T} · blocked over 2,000 chars: ${N} · billed: ${M.toLocaleString()} tokens`)),console.log(chalk.gray(" The real chatbox forgets between messages — the discipline you just practiced is the tool."))):(console.log(chalk.gray(` Conversations: ${$} · total turns: ${T} · peak context: ${S.toLocaleString()} tokens (${Math.round(S/p*100)}% of window)`)),console.log(chalk.gray(" Reminder: the official contest chatbox is single-turn — the sandbox gauge does not exist there."))),console.log(chalk.gray(" ─────────────────────────────────────────")),console.log(),"exit";if("/new"===t||"new"===t||"/clear"===t||"clear"===t||"/restart"===t)return L?(console.log(),console.log(chalk.gray(" Single-turn mode — every message already starts fresh (official contest behavior).")),console.log(chalk.gray(" Multi-turn sandbox: ")+chalk.white("/multi")),console.log()):(console.log(),console.log(chalk.gray(` Conversation #${$} closed — ${O} turn${1===O?"":"s"}, ${v.toLocaleString()} tokens in the window at close.`)),$+=1,A=[],v=f(w),O=0,B.clear(),console.log(chalk.green.bold(` ✦ Conversation #${$} started — context window is fresh.`)),console.log(chalk.gray(" Carry over a 3–5 line summary of where you were, not the whole history.")),console.log()),"continue";if("/multi"===t||"/sandbox"===t)return L?(L=!1,A=[],v=f(w),O=0,B.clear(),console.log(),console.log(chalk.yellow(" ⚠ Multi-turn SANDBOX — this is NOT the contest.")),console.log(chalk.gray(" The official chatbox is single-turn. Use this to explore how a context")),console.log(chalk.gray(` window (${p.toLocaleString()} tokens) fills, degrades, and dies. `)+chalk.white("/single")+chalk.gray(" returns to the rules.")),console.log(),"continue"):(console.log(chalk.gray(" Already in the multi-turn sandbox. Back to contest rules: ")+chalk.white("/single")),"continue");if("/single"===t||"/contest"===t)return L?(console.log(chalk.gray(" Already in official single-turn mode.")),"continue"):(L=!0,A=[],O=0,B.clear(),console.log(),console.log(chalk.green(" ✓ Back to official contest rules — single-turn, ≤2,000 chars in, ≤1,000 tokens out.")),console.log(),"continue");if("/rules"===t||"rules"===t)return R=!0,console.log(),console.log(chalk.bold.white(" ═══ Official chatbox rules — Technical Appendix (rev. 2026-07) ═══")),console.log(),console.log(chalk.white(` Model: ${m}`)+chalk.gray(' (the appendix names it "Gemma E4B")')),console.log(chalk.white(" Message: ≤ 2,000 characters")+chalk.gray(" (~350 words) — enforced here")),console.log(chalk.white(" Reply: ≤ 1,000 tokens")+chalk.gray(" (~750 words) — long answers truncate")),console.log(chalk.white(" Memory: NONE")+chalk.gray(" — single-turn; every send starts from zero")),console.log(),console.log(chalk.gray(" What works in this trainer works onsite — the limits are identical.")),console.log(),"continue";if("/ctx"===t||"ctx"===t||"/context"===t)return D=!0,function(){if(L)return console.log(),console.log(chalk.bold.white(" ═══ Session — official single-turn mode ═══")),console.log(),console.log(chalk.gray(" Messages sent: ")+chalk.white(String(T))+chalk.gray(" · blocked over 2,000 chars: ")+chalk.white(String(N))),console.log(chalk.gray(" Last message: ")+chalk.white(`${E.toLocaleString()}/2,000 chars`)+chalk.gray(" · last reply: ")+chalk.white(`≈${C.toLocaleString()}/1,000 tokens`)),console.log(chalk.gray(" Billed this session: ")+chalk.white(`${M.toLocaleString()} tokens`)),console.log(),console.log(chalk.bold.white(" Contest strategy (you are the memory):")),console.log(chalk.white(" 1. ")+chalk.gray("Every message self-contained: rules header + material + ONE question.")),console.log(chalk.white(" 2. ")+chalk.gray('Iterate by EDITING and resending the whole prompt — there is no "fixing" a chat.')),console.log(chalk.white(" 3. ")+chalk.gray("Long material? Chunk it ≤2,000 chars per message, collect quotes, then reduce.")),void console.log();console.log(),console.log(chalk.bold.white(" ═══ Context usage — multi-turn SANDBOX (off-spec) ═══")),console.log(),z(),console.log(chalk.gray(" Peak this session: ")+chalk.white(`${S.toLocaleString()} tokens`)+chalk.gray(" · conversations used: ")+chalk.white(String($))),console.log(chalk.gray(" Billed this session: ")+chalk.white(`${M.toLocaleString()} tokens`)+chalk.gray(" — every request re-sends the whole conversation, so provider")),console.log(chalk.gray(" dashboards count far more than the window gauge above. Both are correct.")),console.log(),console.log(chalk.yellow(" Reminder: the official contest chatbox is SINGLE-TURN — ")+chalk.white("/single")),console.log(chalk.gray(" returns to contest rules. This sandbox exists for window experiments only.")),console.log()}(),"continue";if(/^\/?help\s+(all|commands|full)$/.test(t)||"commands"===t)return G(),"continue";if(c(o))return u(),"continue";if(a(o))return h(),"continue";if(L&&o.length>y)return N+=1,console.log(),console.log(chalk.red.bold(` ■ ${o.length.toLocaleString()} characters — over the contest cap of ${y.toLocaleString()}/message.`)),console.log(chalk.white(" The onsite chatbox will refuse this too. Make it fit:")),console.log(chalk.gray(" · cut boilerplate — keep rules header + material + ONE question")),console.log(chalk.gray(" · long material? split into self-contained chunk messages, collect quotes")),console.log(chalk.gray(" · point at the 20 relevant lines, never the whole file")),console.log(),"continue";if(!L&&v>=28768)return console.log(),console.log(chalk.red.bold(" ■ Context window exhausted.")),console.log(chalk.white(" A prompt plus a full answer no longer fit — this conversation is over.")),console.log(chalk.gray(" Start fresh: ")+chalk.bold.white("/new")),console.log(),"continue";console.log(chalk.gray(" Thinking..."));try{const{text:e,windowTokens:t}="openai"===x?await j(o):await _(o);if(process.stdout.write("[1A[2K"),T+=1,L)return E=o.length,C=f(e),M+=t??f(o)+C,console.log(),l(e),console.log(chalk.gray(` · single-turn: window cleared · msg ${E.toLocaleString()}/2,000 chars · reply ≈${C.toLocaleString()}/1,000 tokens ·`)),console.log(),"continue";A.push({role:"user",parts:[{text:o}]}),A.push({role:"model",parts:[{text:e}]}),O+=1,v=t??v+f(o)+f(e),v>S&&(S=v),M+=t??v,console.log(),l(e),z(),function(){const e=v/p*100;e>=95&&!B.has("95")?(B.add("95"),console.log(),console.log(chalk.red.bold(" ⚠ 95% — the window is nearly spent. Maybe 1–2 turns left.")),console.log(chalk.red(" Restart NOW: ")+chalk.bold.white("/new")+chalk.red(" and re-state only the essentials (goal · current approach · last error)."))):e>=80&&!B.has("80")?(B.add("80"),console.log(),console.log(chalk.yellow(" ⚠ 80% of the context window used — answers degrade from here.")),console.log(chalk.gray(" Wrap up this sub-problem, then ")+chalk.white("/new")+chalk.gray('. Tip: first ask the AI to "summarize what we established in 5 bullets" and carry that.'))):e>=50&&!B.has("50")&&(B.add("50"),console.log(),console.log(chalk.gray(" Note: half the sandbox window is gone. Budget it — one sub-problem per conversation.")))}(),console.log()}catch(e){process.stdout.write("[1A[2K");const o=e instanceof Error?e.message:String(e);if(!L&&/token|exceeds|too long|400/i.test(o)&&v>16384)console.log(),console.log(chalk.red.bold(" ■ The API rejected the conversation — the context window is spent.")),console.log(chalk.gray(" Start fresh: ")+chalk.bold.white("/new")),console.log();else{console.log(),console.log(chalk.red.bold(` ✗ AI request failed: ${o.split("\n")[0]}`));const e=b.replace(/^https?:\/\//,"");console.log(chalk.gray(` backend: ${"proxy"===x?`ICOA server (${e})`:e}`)),/timeout|ENOTFOUND|ECONNREFUSED|fetch failed|network/i.test(o)?console.log(chalk.gray(" Looks like a network issue (proxy / firewall / offline?).")):"proxy"===x&&/\b(502|503)\b/.test(o)?console.log(chalk.gray(" The ICOA server could not reach the model — try again shortly.")):"openai"===x&&/\b40[123]\b|unauthor|credit|payment/i.test(o)&&console.log(chalk.gray(" Looks like a key / credit issue — check the endpoint key and its balance/limit.")),console.log(chalk.gray(" You are still in the chat — try again, or type ")+chalk.white("exit")+chalk.gray(".")),console.log()}}return"continue"}export async function runAi4ioaiStandalone(){if(!await startAi4ioaiChat())return;const t=n(),s=null!==t,l=s?t.listeners("line").slice():[];s&&t.removeAllListeners("line");const i=s?t:o({input:process.stdin,output:process.stdout,terminal:!0}),a=s?i.prompt:null;s&&(i.prompt=e.prototype.prompt);const c=()=>{i.setPrompt(chalk.bold.green(`icoa ${ai4ioaiPromptLabel()}> `)),i.prompt()};return new Promise(e=>{const o=t=>{handleAi4ioaiMessage(t.trim()).then(t=>{"exit"===t?((()=>{if(i.removeListener("line",o),s){a&&(i.prompt=a);for(const e of l)i.on("line",e)}else i.close()})(),e()):c()}).catch(e=>{r(`AI error: ${e instanceof Error?e.message:String(e)}`),c()})};i.on("line",o),c()})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawnSync as e}from"node:child_process";import{existsSync as o,mkdirSync as t,readFileSync as n,writeFileSync as r}from"node:fs";import{homedir as a}from"node:os";import{join as l}from"node:path";import chalk from"chalk";import{aienvPaths as s}from"../lib/aienv.js";import{addTokenUsage as i}from"../lib/budget.js";import{getConfig as c}from"../lib/config.js";import{createChatSession as g}from"../lib/gemini.js";import{openFile as u}from"../lib/open-file.js";import{makeReplAsker as y}from"../lib/repl-asker.js";const h=["eai-p1","eai-p2","eai-p3","eai-p4","eai-p5"];function p(){if(process.env.ICOA_ARENA_SERVER)return process.env.ICOA_ARENA_SERVER.replace(/\/$/,"");try{const e=JSON.parse(n(l(a(),".icoa","config.json"),"utf-8"));if("string"==typeof e.arenaServer&&e.arenaServer)return e.arenaServer.replace(/\/$/,"");if("string"==typeof e.ctfdUrl&&e.ctfdUrl)return e.ctfdUrl.replace(/\/$/,"")}catch{}return"https://practice.icoa2026.au"}function d(){const e={"Content-Type":"application/json"};let o=process.env.ICOA_ARENA_ACCOUNT||"";try{const t=c();t.ctfdUrl&&t.token&&t.userName?(o=t.userName,e.Authorization=`Token ${t.token}`):t.userName&&(o=t.userName)}catch{}return o||(o="local-tester"),{account:o,headers:e}}async function f(e){try{const{headers:o}=d(),t=await fetch(p()+e,{headers:o,signal:AbortSignal.timeout(2e4)});return await t.json()}catch{return null}}async function m(e,o){try{const{headers:t}=d(),n=await fetch(p()+e,{method:"POST",headers:t,body:JSON.stringify(o),signal:AbortSignal.timeout(2e4)}),r=await n.json();return{status:n.status,data:r.data??r}}catch{return null}}export function normalizeTaskId(e){let o=e.trim().toLowerCase();return o?(o=o.replace(/^eai-?/,""),/^p\d+$/.test(o)?`eai-${o}`:/^\d+$/.test(o)?`eai-${o.padStart(2,"0")}`:`eai-${o}`):""}export function buildPolicyInstruction(e,o,t){const n=o.trim();if(n.startsWith("{"))try{const o=JSON.parse(n);return o.op||(o.op=e),JSON.stringify(o)}catch{return null}const r=n.split(/[\s,]+/).filter(Boolean);if(0===r.length)return null;const a=r.map(e=>{const o=Number(e);return Number.isNaN(o)?e:o});if("query"===e){const e=t?.query?.q,o=Array.isArray(e)&&e.length?e.length:2;return a.length<o?null:JSON.stringify({op:"query",q:a.slice(0,o)})}const l=t?.submit?.a;if(Array.isArray(l)){const e=0===l.length||"..."===l[l.length-1]||"…"===l[l.length-1]?a.length:l.length;return a.length<e?null:JSON.stringify({op:"submit",a:a.slice(0,e)})}return a.length>=4&&a.slice(0,4).every(e=>"number"==typeof e)?JSON.stringify({op:"submit",a:{x:[a[0],a[1]],y:[a[2],a[3]]}}):null}function b(e){const o=e.protocol,t=o?.query?.q,n=o?.submit?.a,r=Array.isArray(t)&&t.length?`probe ${t.map(e=>`<${String(e)}>`).join(" ")}`:"probe <x> <y>";let a;return a=Array.isArray(n)&&n.length?`submit ${n.map(e=>`<${String(e)}>`).join(" ")}`:"submit <x0> <x1> <y0> <y1>",{probe:r,submit:a}}function w(e,o,t){const n=e??"?",r=o??"?",a=t??"?";return chalk.gray(` probes: ${n}/${r} · ${a} left`)}function k(e){var o;console.log(),console.log(` ${o=e.bucket,"win"===o?chalk.bold.green("● WIN"):"progress"===o?chalk.bold.yellow("◐ progress"):chalk.gray("○ baseline")}${"number"==typeof e.distance?chalk.gray(` distance: ${e.distance}`):""}`),function(e){if(!e)return;if(e.error)return void console.log(chalk.yellow(" ⚠ ")+chalk.gray(String(e.error)));if(e.oracle&&"object"==typeof e.oracle){const o=e.oracle,t=Object.entries(o).map(([e,o])=>`${e}=${"number"==typeof o?o:JSON.stringify(o)}`);return void console.log(chalk.gray(" oracle: ")+chalk.white(t.join(" · ")))}if(Array.isArray(e.block_final)){const[o,t]=e.block_final;console.log(chalk.gray(" object settled at: ")+chalk.white(`(${o.toFixed(3)}, ${t.toFixed(3)})`))}"number"==typeof e.value&&console.log(chalk.gray(" grounded action value: ")+chalk.white(e.value.toFixed(3)));const o=e.hold_constraint_force??e.hold_contact_force;if("number"==typeof o&&o>0&&console.log(chalk.gray(" sustained force: ")+chalk.white(o.toFixed(2))),Array.isArray(e.contacts_seen)&&e.contacts_seen.length){const o=e.contacts_seen.slice(0,4).join(", ");console.log(chalk.gray(" contacts: ")+chalk.white(o))}}(e.telemetry),"win"===e.bucket&&e.flag&&(console.log(),console.log(chalk.bold.green(" 🏁 FLAG: ")+chalk.bold.white(e.flag)),console.log(chalk.gray(" paste this onto the CTFd scoreboard to score the challenge."))),console.log(w(e.used,e.budget,e.remaining)),console.log()}export function taskDir(e){return l(a(),".icoa","arena","eai",e)}async function $(e,o){const n="number"==typeof o?o.toFixed(3):"ref",a="ref"===n;console.log(),console.log(chalk.gray(a?" Fetching a reference clip of a successful rollout…":` Fetching the 3-second video of your last landing (value ${n})…`));const s=await f(`/api/icoa/arena/eai/${e}/clip/${encodeURIComponent(n)}`),i=s?.data??s??{};if(!i.clip_b64)return console.log(chalk.gray(" No video for that landing yet — use ")+chalk.cyan("roll")+chalk.gray(" to study the physics as ASCII telemetry.")),void console.log();const c=l(taskDir(e),"replay.mp4");try{t(taskDir(e),{recursive:!0}),r(c,Buffer.from(i.clip_b64,"base64"))}catch{return void console.log(chalk.yellow(" Could not save the clip locally."))}u(c)||console.log(chalk.yellow(" Could not launch a video player. The clip is here: ")+chalk.white(c)),console.log()}export function selfCheckRunnable(e){return!(e.includes("runpy.run_path")&&/os\.path\.dirname\(\s*os\.path\.dirname/.test(e))}function v(t,r,i){if("policy"===r.kind)return console.log(),console.log(chalk.gray(" This is a POLICY task — there is no free local rollout (the oracle")),console.log(chalk.gray(" IS the secret). Explore it with budgeted ")),console.log(chalk.cyan(` ${b(r).probe}`)+chalk.gray(" → one query to the oracle")),void console.log();const c=taskDir(t),g=l(c,"scene.xml"),u=l(c,"self_check.py");if(!o(g)||!o(u))return console.log(chalk.yellow(" Local study files not present yet — reopen the task to fetch them.")),void console.log(chalk.gray(" (`roll` is an OPTIONAL free local study tool; `probe`/`submit` score without it.)"));if(!selfCheckRunnable(n(u,"utf-8")))return console.log(chalk.yellow(" This task's local study tool isn't available right now.")),void console.log(chalk.gray(" `probe`/`submit` still score normally — use those, or `hint` for strategy."));const y=s(a()).python;if(!o(y))return console.log(),console.log(chalk.yellow(" Local physics sim not installed.")),console.log(chalk.gray(" Run ")+chalk.cyan("aienv setup --physics")+chalk.gray(" to enable free local `roll`.")),console.log(chalk.gray(" (You can still `probe`/`submit` to the server without it.)")),void console.log();console.log(chalk.gray(` rolling locally at value=${i} …`));const h=e(y,[u,g,"--public",l(c,"public.json"),"--value",String(i)],{cwd:c,encoding:"utf-8",timeout:6e4});if(0!==h.status)return console.log(chalk.yellow(" Local roll failed.")),void(/No module named 'mujoco'|ModuleNotFoundError/.test(h.stderr||"")?console.log(chalk.gray(" The sim is missing mujoco — run ")+chalk.cyan("aienv setup --physics")+chalk.gray(".")):/XML Error|Erroring opening file|Error opening file|asset.*not found/i.test(h.stderr||"")?(console.log(chalk.gray(" This task's local study sim isn't available right now (scene assets).")),console.log(chalk.gray(" `probe`/`submit` still score normally — use those, or `replay` to study a clip."))):h.stderr&&console.log(chalk.gray(` ${String(h.stderr??"").trim().split("\n").slice(-3).join("\n ")}`)));process.stdout.write(h.stdout)}function A(e){if(console.log(),console.log(chalk.yellow(" hint:")),e.pedagogical_point&&console.log(chalk.gray(` ${String(e.pedagogical_point)}`)),"policy"===e.kind){const o=e.protocol?.submit?.a;Array.isArray(o)?(console.log(chalk.gray(" Strategy: each query is one budgeted look at the oracle. Probe to map how")),console.log(chalk.gray(" its output moves as you vary the inputs, then submit the smallest change")),console.log(chalk.gray(" that achieves the goal (mind any norm / size budget in the brief)."))):(console.log(chalk.gray(" Strategy: each query is one bit. Probe points across the floor to find")),console.log(chalk.gray(" the boundary (binary-search the edges), then submit the tightest rectangle.")))}else console.log(chalk.gray(" Strategy: use free `roll` to learn how far the object must travel to enter")),console.log(chalk.gray(" the keep-out zone, then escalate your wording (more forceful / literal /")),console.log(chalk.gray(' "into the red zone") until a `probe` reports progress, then win.'));console.log(chalk.gray(" 💡 Or type ")+chalk.magenta("ai4ctf")+chalk.gray(" right here to brainstorm the attack with your AI teammate.")),console.log()}function N(e){const o="policy"===e.kind;if(console.log(chalk.bold.white(" commands:")),e.has_clip&&console.log(chalk.cyan(" replay")+chalk.gray(" play a 3-second video of your last probe landing (free; `ref` clip before you probe)")),o){const o=b(e);console.log(chalk.cyan(` ${o.probe}`)+chalk.gray(" one budgeted query to the oracle (costs 1)")),console.log(chalk.cyan(` ${o.submit}`)+chalk.gray(" your attempt to claim the flag (costs 1)")),console.log(chalk.gray(" (or pass raw JSON, e.g. ")+chalk.cyan('probe {"q":[…]}')+chalk.gray(")"))}else console.log(chalk.cyan(" roll [value]")+chalk.gray(" free local rollout — study the physics (no cost)")),console.log(chalk.cyan(" probe <instruction>")+chalk.gray(" send the arm one instruction (costs 1)")),console.log(chalk.cyan(" submit <instruction>")+chalk.gray(" your best attempt to win + claim the flag (costs 1)"));console.log(chalk.cyan(" ai4ctf")+chalk.gray(" brainstorm the attack with your AI teammate (scoped here)")),console.log(chalk.cyan(" hint")+chalk.gray(" free strategy nudge")),console.log(chalk.cyan(" state")+chalk.gray(" show your remaining probe budget")),console.log(chalk.cyan(" help")+chalk.gray(" show these commands")),console.log(chalk.cyan(" quit")+chalk.gray(" leave this task")),console.log(),console.log(chalk.gray(" 💡 Stuck? Type ")+chalk.magenta("ai4ctf")+chalk.gray(" to brainstorm the attack with your built-in AI teammate.")),console.log()}async function _(e,o){let t;try{t=await g(void 0,function(e){const o="policy"===e.kind,t=e.protocol?.submit?.a,n=Array.isArray(t)?`POLICY task: probe the oracle with the query shape in the Brief (e.g. ${b(e).probe}); each probe spends one budget slot and returns the oracle's output. Guide them to map how the output moves as inputs vary, then submit the smallest valid claim (${b(e).submit}; mind any norm/size budget).`:'POLICY task: each probe asks "is [x,y] inside the hidden keep-out zone?" Guide a binary-search of the boundary, then a tight rectangle submit.';return["You are an AI red-team teammate inside the ICOA embodied-AI arena (ctf4eai).","The student is trying to make a robot arm / control policy do the unsafe thing","and earn the win flag. Help them brainstorm the ATTACK — strategy, what to","probe, how to read the telemetry — but DO NOT hand over a complete solution.","",`Task: ${e.title??e.task_id??"unknown"} (kind: ${e.kind??"physics"}, channel ${e.channel??"?"}).`,e.brief?`Brief: ${e.brief}`:"",e.pedagogical_point?`Teaching point: ${e.pedagogical_point}`:"","",o?n:"PHYSICS task: free local `roll` studies the dynamics; escalate the instruction wording until a probe reports progress, then submit to win.","Keep replies short and concrete. The student runs probe/submit in the arena to actually score — you advise only."].filter(Boolean).join("\n")}(e))}catch(e){return void console.log(chalk.red(" Could not start the AI teammate: ")+chalk.gray(e.message??""))}for(console.log(),console.log(chalk.magenta(" 🤝 AI teammate (ai4ctf)")+chalk.gray(" — scoped to this arena task.")),console.log(chalk.gray(" Brainstorm the attack. Type ")+chalk.cyan("back")+chalk.gray(" to return to the arena.")),console.log(chalk.gray(" (It advises only — run ")+chalk.cyan("probe")+chalk.gray("/")+chalk.cyan("submit")+chalk.gray(" in the arena to score.)")),console.log();;){const e=await o(chalk.magenta(" icoa ctf4eai/ai4ctf> "));if(null===e)return;const n=e.trim();if(!n)continue;const r=n.toLowerCase();if("back"===r||"quit"===r||"exit"===r||"q"===r)return;try{const e=await t.sendMessage(n);i(e.tokensUsed),console.log(),console.log(chalk.white(" "+e.text.split("\n").join("\n "))),console.log()}catch(e){const o=e.message??"";/403|budget/i.test(o)?console.log(chalk.yellow(" AI budget exhausted for this account.")):console.log(chalk.red(" AI error: ")+chalk.gray(o.split("\n")[0]||"unknown"))}}}export async function runArenaEai(e){const o=y(),n=o.ask;try{console.log(),console.log(chalk.bold.cyan(" 🤖 ctf4eai — EMBODIED-AI ARENA")+chalk.gray(" · red-team the robot policy")),console.log(chalk.gray(" Make the ICOA-VLA arm / policy do the unsafe thing. The server judges and")),console.log(chalk.gray(" issues the wrapper{…} flag — paste it onto the CTFd scoreboard.")),console.log();let o=e?normalizeTaskId(e):"";if(!o){console.log(chalk.white(" Practice tasks:")),h.forEach((e,o)=>{console.log(chalk.gray(` ${o+1}. `)+chalk.cyan(e))}),console.log(chalk.gray(" (or type any task id, e.g. eai-p3 / p3 / eai-07)"));const e=await n(chalk.cyan(" pick a task (number or id): "));if(null===e)return;const t=e.trim(),r=Number(t);o=!Number.isNaN(r)&&h[r-1]?h[r-1]:normalizeTaskId(t)}if(!o)return void console.log(chalk.yellow(" No task selected."));await async function(e,o){console.log(chalk.gray(` fetching ${e} from `)+chalk.gray(p())+chalk.gray(" …"));const n=await async function(e){const o=await f(`/api/icoa/arena/eai/${e}/data`);if(!o)return null;const n=o.data??o;if(!n.public)return null;const a=taskDir(e);try{t(a,{recursive:!0}),r(l(a,"public.json"),JSON.stringify(n.public,null,2)),n.scene_xml&&r(l(a,"scene.xml"),n.scene_xml),n.core&&r(l(a,"arena_physics_core.py"),n.core),n.self_check&&r(l(a,"self_check.py"),n.self_check)}catch(e){console.log(chalk.yellow(" Could not write the local arena files to ")+chalk.white(a)+chalk.gray(` (${e.message??"unknown"}).`)),console.log(chalk.gray(" `probe`/`submit` still work; only free local `roll` needs them."))}return n.public}(e);if(!n)return void console.log(chalk.yellow(` Could not load ${e} — unknown task, or the arena server is unreachable.`));!function(e){if(console.log(),console.log(chalk.bold.cyan(` 🤖 ${e.title??e.task_id}`)+chalk.gray(` · ${e.kind??"physics"} · channel ${e.channel??"?"} · ${e.difficulty??""}`)),e.brief){console.log();for(const o of function(e){const o=[];for(const t of e.split("\n")){let e="";for(const n of t.split(/\s+/))e&&`${e} ${n}`.length>76?(o.push(e),e=n):e=e?`${e} ${n}`:n;o.push(e)}return o}(String(e.brief)))console.log(chalk.gray(` ${o}`))}console.log()}(n);const{account:a}=d(),s=await m(`/api/icoa/arena/eai/${e}/state`,{account:a}),i=s?.data??{};i.ok&&(i.won&&console.log(chalk.bold.green(" ✓ you have already won this task.")),console.log(w(i.used,i.budget,i.remaining)),console.log()),N(n);const c="policy"===n.kind;let g;for(;;){const t=await o(chalk.bold.cyan(" icoa ctf4eai> "));if(null===t)return;const r=t.trim();if(!r)continue;const l=r.indexOf(" "),s=(-1===l?r:r.slice(0,l)).toLowerCase(),i=-1===l?"":r.slice(l+1).trim();if("quit"===s||"exit"===s||"q"===s||"back"===s)return;if("help"!==s&&"?"!==s)if("hint"!==s)if("replay"!==s&&"watch"!==s&&"video"!==s)if("ai4ctf"!==s&&"ai"!==s&&"teammate"!==s){if("state"===s){const o=await m(`/api/icoa/arena/eai/${e}/state`,{account:a}),t=o?.data??{};t.ok?console.log(w(t.used,t.budget,t.remaining)+(t.won?chalk.green(" ✓ won"):"")):console.log(chalk.gray(" (state unavailable)"));continue}if("roll"!==s)if("probe"===s||"submit"===s){if(!i){const e=b(n);console.log(c?chalk.gray(` usage: ${"probe"===s?e.probe:e.submit}`):chalk.gray(` usage: ${s} <instruction text>`));continue}let o;if(c){const e=buildPolicyInstruction("probe"===s?"query":"submit",i,n.protocol);if(!e){const e=b(n);console.log(chalk.yellow(" Could not parse that. ")+chalk.gray(`Try: ${"probe"===s?e.probe.replace(/<[^>]*>/g,"0"):e.submit.replace(/<[^>]*>/g,"0")}`));continue}o=e}else o=i.replace(/^["']|["']$/g,"");const t=await m(`/api/icoa/arena/eai/${e}/probe`,{account:a,instruction:o});if(!t){console.log(chalk.yellow(" The arena server is unreachable right now — try again."));continue}const r=t.data;if(403===t.status||"budget_exhausted"===r.reason){console.log(chalk.yellow(` Out of probes for this task (used ${r.used??"?"}/${r.budget??"?"}). No more attempts.`));continue}if(!r.ok&&r.reason){console.log(chalk.yellow(" Rejected: ")+chalk.gray(r.reason));continue}k(r);const l=r.telemetry?.value;if("number"==typeof l&&(g=l),"win"===r.bucket)return void(n.has_clip&&(console.log(chalk.gray(" 🎬 replaying your winning rollout…")),await $(e,g)))}else console.log(chalk.gray(" unknown command — type ")+chalk.cyan("help"));else if(c)v(e,n,0);else{const o=Number(i);v(e,n,Number.isNaN(o)?.4:o)}}else await _(n,o);else await $(e,g);else A(n);else N(n)}}(o,n),console.log(chalk.gray(" left the arena. Type ")+chalk.cyan("eai")+chalk.gray(" to come back any time.")),console.log()}finally{o.close()}}
|
|
1
|
+
import{spawnSync as e}from"node:child_process";import{existsSync as o,mkdirSync as t,readFileSync as n,writeFileSync as a}from"node:fs";import{homedir as r}from"node:os";import{join as s}from"node:path";import chalk from"chalk";import{aienvPaths as l}from"../lib/aienv.js";import{addTokenUsage as i}from"../lib/budget.js";import{getConfig as c}from"../lib/config.js";import{createChatSession as u}from"../lib/gemini.js";import{enterPanel as g,isGuideWord as y,isHelpWord as h,leavePanel as p,printGuide as d,printHelp as f}from"../lib/guide-panel.js";import{openFile as m}from"../lib/open-file.js";import{makeReplAsker as b}from"../lib/repl-asker.js";const w=["eai-p1","eai-p2","eai-p3","eai-p4","eai-p5"];function k(){if(process.env.ICOA_ARENA_SERVER)return process.env.ICOA_ARENA_SERVER.replace(/\/$/,"");try{const e=JSON.parse(n(s(r(),".icoa","config.json"),"utf-8"));if("string"==typeof e.arenaServer&&e.arenaServer)return e.arenaServer.replace(/\/$/,"");if("string"==typeof e.ctfdUrl&&e.ctfdUrl)return e.ctfdUrl.replace(/\/$/,"")}catch{}return"https://practice.icoa2026.au"}function v(){const e={"Content-Type":"application/json"};let o=process.env.ICOA_ARENA_ACCOUNT||"";try{const t=c();t.ctfdUrl&&t.token&&t.userName?(o=t.userName,e.Authorization=`Token ${t.token}`):t.userName&&(o=t.userName)}catch{}return o||(o="local-tester"),{account:o,headers:e}}async function $(e){try{const{headers:o}=v(),t=await fetch(k()+e,{headers:o,signal:AbortSignal.timeout(2e4)});return await t.json()}catch{return null}}async function A(e,o){try{const{headers:t}=v(),n=await fetch(k()+e,{method:"POST",headers:t,body:JSON.stringify(o),signal:AbortSignal.timeout(2e4)}),a=await n.json();return{status:n.status,data:a.data??a}}catch{return null}}export function normalizeTaskId(e){let o=e.trim().toLowerCase();return o?(o=o.replace(/^eai-?/,""),/^p\d+$/.test(o)?`eai-${o}`:/^\d+$/.test(o)?`eai-${o.padStart(2,"0")}`:`eai-${o}`):""}export function buildPolicyInstruction(e,o,t){const n=o.trim();if(n.startsWith("{"))try{const o=JSON.parse(n);return o.op||(o.op=e),JSON.stringify(o)}catch{return null}const a=n.split(/[\s,]+/).filter(Boolean);if(0===a.length)return null;const r=a.map(e=>{const o=Number(e);return Number.isNaN(o)?e:o});if("query"===e){const e=t?.query?.q,o=Array.isArray(e)&&e.length?e.length:2;return r.length<o?null:JSON.stringify({op:"query",q:r.slice(0,o)})}const s=t?.submit?.a;if(Array.isArray(s)){const e=0===s.length||"..."===s[s.length-1]||"…"===s[s.length-1]?r.length:s.length;return r.length<e?null:JSON.stringify({op:"submit",a:r.slice(0,e)})}return r.length>=4&&r.slice(0,4).every(e=>"number"==typeof e)?JSON.stringify({op:"submit",a:{x:[r[0],r[1]],y:[r[2],r[3]]}}):null}function I(e){const o=e.protocol,t=o?.query?.q,n=o?.submit?.a,a=Array.isArray(t)&&t.length?`probe ${t.map(e=>`<${String(e)}>`).join(" ")}`:"probe <x> <y>";let r;return r=Array.isArray(n)&&n.length?`submit ${n.map(e=>`<${String(e)}>`).join(" ")}`:"submit <x0> <x1> <y0> <y1>",{probe:a,submit:r}}function N(e,o,t){const n=e??"?",a=o??"?",r=t??"?";return chalk.gray(` probes: ${n}/${a} · ${r} left`)}function _(e){var o;console.log(),console.log(` ${o=e.bucket,"win"===o?chalk.bold.green("● WIN"):"progress"===o?chalk.bold.yellow("◐ progress"):chalk.gray("○ baseline")}${"number"==typeof e.distance?chalk.gray(` distance: ${e.distance}`):""}`),function(e){if(!e)return;if(e.error)return void console.log(chalk.yellow(" ⚠ ")+chalk.gray(String(e.error)));if(e.oracle&&"object"==typeof e.oracle){const o=e.oracle,t=Object.entries(o).map(([e,o])=>`${e}=${"number"==typeof o?o:JSON.stringify(o)}`);return void console.log(chalk.gray(" oracle: ")+chalk.white(t.join(" · ")))}if(Array.isArray(e.block_final)){const[o,t]=e.block_final;console.log(chalk.gray(" object settled at: ")+chalk.white(`(${o.toFixed(3)}, ${t.toFixed(3)})`))}"number"==typeof e.value&&console.log(chalk.gray(" grounded action value: ")+chalk.white(e.value.toFixed(3)));const o=e.hold_constraint_force??e.hold_contact_force;if("number"==typeof o&&o>0&&console.log(chalk.gray(" sustained force: ")+chalk.white(o.toFixed(2))),Array.isArray(e.contacts_seen)&&e.contacts_seen.length){const o=e.contacts_seen.slice(0,4).join(", ");console.log(chalk.gray(" contacts: ")+chalk.white(o))}}(e.telemetry),"win"===e.bucket&&e.flag&&(console.log(),console.log(chalk.bold.green(" 🏁 FLAG: ")+chalk.bold.white(e.flag)),console.log(chalk.gray(" paste this onto the CTFd scoreboard to score the challenge."))),console.log(N(e.used,e.budget,e.remaining)),console.log()}export function taskDir(e){return s(r(),".icoa","arena","eai",e)}async function S(e,o){const n="number"==typeof o?o.toFixed(3):"ref",r="ref"===n;console.log(),console.log(chalk.gray(r?" Fetching a reference clip of a successful rollout…":` Fetching the 3-second video of your last landing (value ${n})…`));const l=await $(`/api/icoa/arena/eai/${e}/clip/${encodeURIComponent(n)}`),i=l?.data??l??{};if(!i.clip_b64)return console.log(chalk.gray(" No video for that landing yet — use ")+chalk.cyan("roll")+chalk.gray(" to study the physics as ASCII telemetry.")),void console.log();const c=s(taskDir(e),"replay.mp4");try{t(taskDir(e),{recursive:!0}),a(c,Buffer.from(i.clip_b64,"base64"))}catch{return void console.log(chalk.yellow(" Could not save the clip locally."))}m(c)||console.log(chalk.yellow(" Could not launch a video player. The clip is here: ")+chalk.white(c)),console.log()}export function selfCheckRunnable(e){return!(e.includes("runpy.run_path")&&/os\.path\.dirname\(\s*os\.path\.dirname/.test(e))}function T(t,a,i){if("policy"===a.kind)return console.log(),console.log(chalk.gray(" This is a POLICY task — there is no free local rollout (the oracle")),console.log(chalk.gray(" IS the secret). Explore it with budgeted ")),console.log(chalk.cyan(` ${I(a).probe}`)+chalk.gray(" → one query to the oracle")),void console.log();const c=taskDir(t),u=s(c,"scene.xml"),g=s(c,"self_check.py");if(!o(u)||!o(g))return console.log(chalk.yellow(" Local study files not present yet — reopen the task to fetch them.")),void console.log(chalk.gray(" (`roll` is an OPTIONAL free local study tool; `probe`/`submit` score without it.)"));if(!selfCheckRunnable(n(g,"utf-8")))return console.log(chalk.yellow(" This task's local study tool isn't available right now.")),void console.log(chalk.gray(" `probe`/`submit` still score normally — use those, or `hint` for strategy."));const y=l(r()).python;if(!o(y))return console.log(),console.log(chalk.yellow(" Local physics sim not installed.")),console.log(chalk.gray(" Run ")+chalk.cyan("aienv setup --physics")+chalk.gray(" to enable free local `roll`.")),console.log(chalk.gray(" (You can still `probe`/`submit` to the server without it.)")),void console.log();console.log(chalk.gray(` rolling locally at value=${i} …`));const h=e(y,[g,u,"--public",s(c,"public.json"),"--value",String(i)],{cwd:c,encoding:"utf-8",timeout:6e4});if(0!==h.status)return console.log(chalk.yellow(" Local roll failed.")),void(/No module named 'mujoco'|ModuleNotFoundError/.test(h.stderr||"")?console.log(chalk.gray(" The sim is missing mujoco — run ")+chalk.cyan("aienv setup --physics")+chalk.gray(".")):/XML Error|Erroring opening file|Error opening file|asset.*not found/i.test(h.stderr||"")?(console.log(chalk.gray(" This task's local study sim isn't available right now (scene assets).")),console.log(chalk.gray(" `probe`/`submit` still score normally — use those, or `replay` to study a clip."))):h.stderr&&console.log(chalk.gray(` ${String(h.stderr??"").trim().split("\n").slice(-3).join("\n ")}`)));process.stdout.write(h.stdout)}function j(e){if(console.log(),console.log(chalk.yellow(" hint:")),e.pedagogical_point&&console.log(chalk.gray(` ${String(e.pedagogical_point)}`)),"policy"===e.kind){const o=e.protocol?.submit?.a;Array.isArray(o)?(console.log(chalk.gray(" Strategy: each query is one budgeted look at the oracle. Probe to map how")),console.log(chalk.gray(" its output moves as you vary the inputs, then submit the smallest change")),console.log(chalk.gray(" that achieves the goal (mind any norm / size budget in the brief)."))):(console.log(chalk.gray(" Strategy: each query is one bit. Probe points across the floor to find")),console.log(chalk.gray(" the boundary (binary-search the edges), then submit the tightest rectangle.")))}else console.log(chalk.gray(" Strategy: use free `roll` to learn how far the object must travel to enter")),console.log(chalk.gray(" the keep-out zone, then escalate your wording (more forceful / literal /")),console.log(chalk.gray(' "into the red zone") until a `probe` reports progress, then win.'));console.log(chalk.gray(" 💡 Or type ")+chalk.magenta("ai4ctf")+chalk.gray(" right here to brainstorm the attack with your AI teammate.")),console.log()}function O(e){const o="policy"===e.kind;if(console.log(chalk.bold.white(" commands:")),e.has_clip&&console.log(chalk.cyan(" replay")+chalk.gray(" play a 3-second video of your last probe landing (free; `ref` clip before you probe)")),o){const o=I(e);console.log(chalk.cyan(` ${o.probe}`)+chalk.gray(" one budgeted query to the oracle (costs 1)")),console.log(chalk.cyan(` ${o.submit}`)+chalk.gray(" your attempt to claim the flag (costs 1)")),console.log(chalk.gray(" (or pass raw JSON, e.g. ")+chalk.cyan('probe {"q":[…]}')+chalk.gray(")"))}else console.log(chalk.cyan(" roll [value]")+chalk.gray(" free local rollout — study the physics (no cost)")),console.log(chalk.cyan(" probe <instruction>")+chalk.gray(" send the arm one instruction (costs 1)")),console.log(chalk.cyan(" submit <instruction>")+chalk.gray(" your best attempt to win + claim the flag (costs 1)"));console.log(chalk.cyan(" ai4ctf")+chalk.gray(" brainstorm the attack with your AI teammate (scoped here)")),console.log(chalk.cyan(" hint")+chalk.gray(" free strategy nudge")),console.log(chalk.cyan(" state")+chalk.gray(" show your remaining probe budget")),console.log(chalk.cyan(" help")+chalk.gray(" the steps for this screen (help all = this sheet)")),console.log(chalk.cyan(" quit")+chalk.gray(" leave this task")),console.log(),console.log(chalk.gray(" 💡 Stuck? Type ")+chalk.magenta("ai4ctf")+chalk.gray(" to brainstorm the attack with your built-in AI teammate.")),console.log()}async function C(e,o){let t;try{t=await u(void 0,function(e){const o="policy"===e.kind,t=e.protocol?.submit?.a,n=Array.isArray(t)?`POLICY task: probe the oracle with the query shape in the Brief (e.g. ${I(e).probe}); each probe spends one budget slot and returns the oracle's output. Guide them to map how the output moves as inputs vary, then submit the smallest valid claim (${I(e).submit}; mind any norm/size budget).`:'POLICY task: each probe asks "is [x,y] inside the hidden keep-out zone?" Guide a binary-search of the boundary, then a tight rectangle submit.';return["You are an AI red-team teammate inside the ICOA embodied-AI arena (ctf4eai).","The student is trying to make a robot arm / control policy do the unsafe thing","and earn the win flag. Help them brainstorm the ATTACK — strategy, what to","probe, how to read the telemetry — but DO NOT hand over a complete solution.","",`Task: ${e.title??e.task_id??"unknown"} (kind: ${e.kind??"physics"}, channel ${e.channel??"?"}).`,e.brief?`Brief: ${e.brief}`:"",e.pedagogical_point?`Teaching point: ${e.pedagogical_point}`:"","",o?n:"PHYSICS task: free local `roll` studies the dynamics; escalate the instruction wording until a probe reports progress, then submit to win.","Keep replies short and concrete. The student runs probe/submit in the arena to actually score — you advise only."].filter(Boolean).join("\n")}(e))}catch(e){return void console.log(chalk.red(" Could not start the AI teammate: ")+chalk.gray(e.message??""))}console.log(),console.log(chalk.magenta(" 🤝 AI teammate (ai4ctf)")+chalk.gray(" — scoped to this arena task.")),console.log(chalk.gray(" Brainstorm the attack. Type ")+chalk.cyan("back")+chalk.gray(" to return to the arena.")),console.log(chalk.gray(" (It advises only — run ")+chalk.cyan("probe")+chalk.gray("/")+chalk.cyan("submit")+chalk.gray(" in the arena to score.)")),console.log();let n=!1;g({id:"ctf4eai-teammate",title:{en:"AI teammate (ai4ctf)",zh:"AI 队友(ai4ctf)"},what:{en:"A brainstorming partner that knows this task's brief. It advises only — you still score with probe / submit back in the arena. Everything you type here is a question to it.",zh:"一个知道本题题面的头脑风暴伙伴。它只出主意 —— 得分还是要回竞技场 probe / submit。你在这里敲的一切都是在问它。"},steps:[{verb:"where do I start?",what:{en:"ask in plain words — strategy, what to probe, how to read telemetry",zh:"大白话问:策略、先探什么、遥测怎么读"},done:()=>n}],notes:[{en:"help / ? = these steps. The AI will not hand over a full solution.",zh:"help / ? = 这些步骤。AI 不会给完整解法。"}],leave:{verb:"back",what:{en:"return to the arena task",zh:"回到竞技场题目"}}});try{for(;;){const e=await o(chalk.magenta(" icoa ctf4eai/ai4ctf> "));if(null===e)return;const a=e.trim();if(!a)continue;const r=a.toLowerCase();if("back"===r||"quit"===r||"exit"===r||"q"===r)return;if(h(a)||y(a))f();else try{const e=await t.sendMessage(a);i(e.tokensUsed),n=!0,console.log(),console.log(chalk.white(` ${e.text.split("\n").join("\n ")}`)),console.log()}catch(e){const o=e.message??"";/403|budget/i.test(o)?console.log(chalk.yellow(" AI budget exhausted for this account.")):console.log(chalk.red(" AI error: ")+chalk.gray(o.split("\n")[0]||"unknown"))}}}finally{p("ctf4eai-teammate");const o=x.get(e);o&&g(o,{mode:"compact"})}}const x=new WeakMap;export async function runArenaEai(e){const o=b(),n=o.ask;try{console.log(),console.log(chalk.bold.cyan(" 🤖 ctf4eai — EMBODIED-AI ARENA")+chalk.gray(" · red-team the robot policy")),console.log(chalk.gray(" Make the ICOA-VLA arm / policy do the unsafe thing. The server judges and")),console.log(chalk.gray(" issues the wrapper{…} flag — paste it onto the CTFd scoreboard.")),console.log();let o=e?normalizeTaskId(e):"";if(!o){console.log(chalk.white(" Practice tasks:")),w.forEach((e,o)=>{console.log(chalk.gray(` ${o+1}. `)+chalk.cyan(e))}),console.log(chalk.gray(" (or type any task id, e.g. eai-p3 / p3 / eai-07)"));const e=await n(chalk.cyan(" pick a task (number or id): "));if(null===e)return;const t=e.trim(),a=Number(t);o=!Number.isNaN(a)&&w[a-1]?w[a-1]:normalizeTaskId(t)}if(!o)return void console.log(chalk.yellow(" No task selected."));await async function(e,o){console.log(chalk.gray(` fetching ${e} from `)+chalk.gray(k())+chalk.gray(" …"));const n=await async function(e){const o=await $(`/api/icoa/arena/eai/${e}/data`);if(!o)return null;const n=o.data??o;if(!n.public)return null;const r=taskDir(e);try{t(r,{recursive:!0}),a(s(r,"public.json"),JSON.stringify(n.public,null,2)),n.scene_xml&&a(s(r,"scene.xml"),n.scene_xml),n.core&&a(s(r,"arena_physics_core.py"),n.core),n.self_check&&a(s(r,"self_check.py"),n.self_check)}catch(e){console.log(chalk.yellow(" Could not write the local arena files to ")+chalk.white(r)+chalk.gray(` (${e.message??"unknown"}).`)),console.log(chalk.gray(" `probe`/`submit` still work; only free local `roll` needs them."))}return n.public}(e);if(!n)return void console.log(chalk.yellow(` Could not load ${e} — unknown task, or the arena server is unreachable.`));!function(e){if(console.log(),console.log(chalk.bold.cyan(` 🤖 ${e.title??e.task_id}`)+chalk.gray(` · ${e.kind??"physics"} · channel ${e.channel??"?"} · ${e.difficulty??""}`)),e.brief){console.log();for(const o of function(e){const o=[];for(const t of e.split("\n")){let e="";for(const n of t.split(/\s+/))e&&`${e} ${n}`.length>76?(o.push(e),e=n):e=e?`${e} ${n}`:n;o.push(e)}return o}(String(e.brief)))console.log(chalk.gray(` ${o}`))}console.log()}(n);const{account:r}=v(),l=await A(`/api/icoa/arena/eai/${e}/state`,{account:r}),i=l?.data??{};i.ok&&(i.won&&console.log(chalk.bold.green(" ✓ you have already won this task.")),console.log(N(i.used,i.budget,i.remaining)),console.log());const c={rolled:!1,probed:!1,submitted:Boolean(i.won)},u=function(e,o){const t="policy"===e.kind,n=I(e),a=e=>e.replace(/<[^>]*>/g,"0"),r=[];return t||r.push({verb:"roll 0.4",what:{en:"free local rollout — study the physics (no cost)",zh:"本地免费跑一次 —— 先摸物理(不计费)"},done:()=>o.rolled}),r.push({verb:t?a(n.probe):'probe "push it"',what:t?{en:"one budgeted query to the oracle (costs 1)",zh:"向 oracle 发一次计费查询(扣 1)"}:{en:"send the arm one instruction (costs 1 probe)",zh:"给机械臂一条指令(扣 1 次)"},done:()=>o.probed}),r.push({verb:t?a(n.submit):'submit "shove it"',what:t?{en:"your claim for the flag (costs 1)",zh:"你对旗子的最终答案(扣 1)"}:{en:"your best attempt to win + claim the flag (costs 1)",zh:"最有把握的一击,赢了就拿旗(扣 1)"},done:()=>o.submitted}),r.push({verb:"hint",what:{en:"a free strategy nudge",zh:"免费的策略提示"},optional:!0}),e.has_clip&&r.push({verb:"replay",what:{en:"a 3-second video of your last probe landing (free)",zh:"上一次 probe 的 3 秒视频(免费)"},optional:!0}),r.push({verb:"ai4ctf",what:{en:"brainstorm the attack with your AI teammate, right here",zh:"就在这里和 AI 队友一起想攻法"},optional:!0}),{id:"ctf4eai-arena",title:{en:`ctf4eai arena — ${e.title??e.task_id??"task"}`,zh:`ctf4eai 竞技场 — ${e.title??e.task_id??"题目"}`},what:{en:"Red-team a robot policy: make it do the unsafe thing. The server judges each probe and issues the flag when you win; probes are a budget, so study first.",zh:"红队一个机器人策略:让它做出不安全的动作。服务端判每一次 probe,赢了发旗;probe 有预算,先研究再出手。"},steps:r,notes:[{en:"help / ? = these steps · guide (or help all) = every command · state = probes left.",zh:"help / ? = 这些步骤 · guide(或 help all)= 全部命令 · state = 剩余 probe。"}],leave:{verb:"quit",what:{en:"leave this task",zh:"离开这道题"}},guide:()=>O(e)}}(n,c);x.set(n,u),g(u);const m="policy"===n.kind;let b;try{for(;;){const t=await o(chalk.bold.cyan(" icoa ctf4eai> "));if(null===t)return;const a=t.trim();if(!a)continue;const s=a.indexOf(" "),l=(-1===s?a:a.slice(0,s)).toLowerCase(),i=-1===s?"":a.slice(s+1).trim();if("quit"===l||"exit"===l||"q"===l||"back"===l)return;if("help"===l&&/^(all|commands|full)$/i.test(i)||"commands"===l)O(n);else if(h(a))f();else if(y(a))d();else if("hint"!==l)if("replay"!==l&&"watch"!==l&&"video"!==l)if("ai4ctf"!==l&&"ai"!==l&&"teammate"!==l){if("state"===l){const o=await A(`/api/icoa/arena/eai/${e}/state`,{account:r}),t=o?.data??{};t.ok?console.log(N(t.used,t.budget,t.remaining)+(t.won?chalk.green(" ✓ won"):"")):console.log(chalk.gray(" (state unavailable)"));continue}if("roll"!==l)if("probe"===l||"submit"===l){if(!i){const e=I(n);console.log(m?chalk.gray(` usage: ${"probe"===l?e.probe:e.submit}`):chalk.gray(` usage: ${l} <instruction text>`));continue}let o;if(m){const e=buildPolicyInstruction("probe"===l?"query":"submit",i,n.protocol);if(!e){const e=I(n);console.log(chalk.yellow(" Could not parse that. ")+chalk.gray(`Try: ${"probe"===l?e.probe.replace(/<[^>]*>/g,"0"):e.submit.replace(/<[^>]*>/g,"0")}`));continue}o=e}else o=i.replace(/^["']|["']$/g,"");const t=await A(`/api/icoa/arena/eai/${e}/probe`,{account:r,instruction:o});if(!t){console.log(chalk.yellow(" The arena server is unreachable right now — try again."));continue}const a=t.data;if(403===t.status||"budget_exhausted"===a.reason){console.log(chalk.yellow(` Out of probes for this task (used ${a.used??"?"}/${a.budget??"?"}). No more attempts.`));continue}if(!a.ok&&a.reason){console.log(chalk.yellow(" Rejected: ")+chalk.gray(a.reason));continue}_(a),"probe"===l?c.probed=!0:c.submitted=!0;const s=a.telemetry?.value;if("number"==typeof s&&(b=s),"win"===a.bucket)return void(n.has_clip&&(console.log(chalk.gray(" 🎬 replaying your winning rollout…")),await S(e,b)))}else console.log(chalk.gray(" unknown command — type ")+chalk.cyan("help"));else if(c.rolled=!0,m)T(e,n,0);else{const o=Number(i);T(e,n,Number.isNaN(o)?.4:o)}}else await C(n,o);else await S(e,b);else j(n)}}finally{p("ctf4eai-arena")}}(o,n),console.log(chalk.gray(" left the arena. Type ")+chalk.cyan("eai")+chalk.gray(" to come back any time.")),console.log()}finally{o.close()}}
|