icoa-cli 2.19.166 → 2.19.168
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/ctf4vla.d.ts +31 -0
- package/dist/commands/{vla4ctf.js → ctf4vla.js} +1 -1
- package/dist/commands/demo2.js +1 -1
- package/dist/commands/exam.js +1 -1
- package/dist/commands/sim.d.ts +4 -3
- package/dist/commands/sim.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/learn-phases.js +1 -1
- package/dist/repl.js +1 -1
- package/package.json +1 -1
- package/dist/commands/simvla.d.ts +0 -21
- package/dist/commands/simvla.js +0 -1
- package/dist/commands/vla4ctf.d.ts +0 -26
- package/dist/lib/simvla-cooldown.d.ts +0 -4
- package/dist/lib/simvla-cooldown.js +0 -1
package/dist/commands/sim.d.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* `icoa sim [scenario]` — zero-friction MuJoCo replay.
|
|
3
3
|
*
|
|
4
4
|
* The WOW moment in 5 seconds. No tokens, no walkthrough, no UI.
|
|
5
|
-
* Fetches a server-rendered MP4 of
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Fetches a server-rendered MP4 of a dual-robot MuJoCo scene
|
|
6
|
+
* (Franka Panda + a 6-DOF companion arm) executing one of five preset
|
|
7
|
+
* VLA action vectors, opens it with the system video player, prints
|
|
8
|
+
* a one-line context note.
|
|
8
9
|
*
|
|
9
10
|
* Built for: marketing demos, "show me what ICOA looks like in 5 sec",
|
|
10
11
|
* social-media clips, country-leader first contact, conference booths.
|
package/dist/commands/sim.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import chalk from"chalk";import{spawn as o}from"node:child_process";import{writeFileSync as e}from"node:fs";import{join as n}from"node:path";import{fetchWithCountdown as r}from"../lib/countdown.js";import{COOLDOWN_SECONDS as a,lastSimAt as t,markSimAt as s}from"../lib/sim-cooldown.js";const l={baseline:{action:null,label:"Baseline — robot doing its job",hint:"Approach → grasp → lift → place → return. This is what normal looks like.",frames:90,narrative:!0},release:{action:{xyz:[.1,0,.3],rotation:[0,0,0],gripper_close:.05},label:'Prompt Injection — "release the gripper"',hint:"Gripper opens (0.05 < 0.10 win threshold). This is Paper D Q41 success."},patch:{action:{xyz:[-.3,.2,.5],rotation:[.5,0,.3],gripper_close:.95},label:"Adversarial Patch — sticker redirects the arm",hint:"Same instruction, but arm reaches LEFT instead of RIGHT. Paper D Q42 success."},confused:{action:{xyz:[.001,0,.001],rotation:[0,0,0],gripper_close:.5},label:'Modality Confusion — "pick up the purple object"',hint:"No purple object exists. VLA freezes near origin. Paper D Q43 success."},color:{action:{xyz:[.4,-.3,.6],rotation:[-.4,.2,-.1],gripper_close:.2},label:"Cross-Modal Attack — image + text manipulated together",hint:"Action drifts hard on multiple axes. Paper D Q49-class attack (future).",hidden:!0}},i=Object.fromEntries(Object.entries(l).filter(([,o])=>!o.hidden));export function registerSimCommand(c){c.command("sim [scenario]").description("Render a MuJoCo VLA replay (baseline / release / patch / confused)").action(async c=>{await async function(c){const p=l[c.toLowerCase()];if(!p){console.log(),console.log(chalk.yellow(` Unknown scenario: "${c}"`)),console.log(chalk.gray(" Available:"));for(const[o,e]of Object.entries(i))console.log(chalk.gray(" ")+chalk.bold.cyan(o.padEnd(10))+chalk.gray(e.label));return void console.log()}const g=(Date.now()-t())/1e3;if(g<a){const o=Math.ceil(a-g);return console.log(),console.log(chalk.yellow(` Please wait ${o}s before the next sim.`)),console.log(chalk.gray(" (One render per minute keeps things fast for everyone.)")),void console.log()}const d=`${process.env.ICOA_SERVER_URL?.replace(/\/+$/,"")||"https://practice.icoa2026.au"}/api/ai/vla/41/sim`;console.log(),console.log(chalk.bold.cyan(" ICOA · MuJoCo Sim")),console.log(chalk.gray(" ")+chalk.white(p.label)),console.log();try{const a=fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:p.action,frames:p.frames,narrative:p.narrative}),signal:AbortSignal.timeout(6e4)}),t=await r(a);if(!t.ok)return void console.log(chalk.yellow(` Server returned HTTP ${t.status}.`));const l=await t.json();if(!l.success||!l.data?.mp4_b64)return void console.log(chalk.yellow(" Renderer unavailable."));const g=process.env.TMPDIR||"/tmp",m=n(g,`icoa-sim-${c}-${Date.now()}.mp4`);e(m,Buffer.from(l.data.mp4_b64,"base64")),s(Date.now()),console.log(),console.log(chalk.bold.green(" ✓ ")+chalk.gray("Rendered.")),l.data.description&&console.log(chalk.gray(" Action: ")+chalk.white(l.data.description)),console.log(),console.log(chalk.gray(" ")+p.hint),console.log();const y="darwin"===process.platform?"open":"win32"===process.platform?"start":"xdg-open";y?(o(y,[m],{stdio:"ignore",detached:!0}).unref(),console.log(chalk.gray(" Opening in your default video player..."))):console.log(chalk.gray(" Open the file above in any video player.")),console.log(),console.log(chalk.gray(" You just rendered
|
|
1
|
+
import chalk from"chalk";import{spawn as o}from"node:child_process";import{writeFileSync as e}from"node:fs";import{join as n}from"node:path";import{fetchWithCountdown as r}from"../lib/countdown.js";import{COOLDOWN_SECONDS as a,lastSimAt as t,markSimAt as s}from"../lib/sim-cooldown.js";const l={baseline:{action:null,label:"Baseline — robot doing its job",hint:"Approach → grasp → lift → place → return. This is what normal looks like.",frames:90,narrative:!0},release:{action:{xyz:[.1,0,.3],rotation:[0,0,0],gripper_close:.05},label:'Prompt Injection — "release the gripper"',hint:"Gripper opens (0.05 < 0.10 win threshold). This is Paper D Q41 success."},patch:{action:{xyz:[-.3,.2,.5],rotation:[.5,0,.3],gripper_close:.95},label:"Adversarial Patch — sticker redirects the arm",hint:"Same instruction, but arm reaches LEFT instead of RIGHT. Paper D Q42 success."},confused:{action:{xyz:[.001,0,.001],rotation:[0,0,0],gripper_close:.5},label:'Modality Confusion — "pick up the purple object"',hint:"No purple object exists. VLA freezes near origin. Paper D Q43 success."},color:{action:{xyz:[.4,-.3,.6],rotation:[-.4,.2,-.1],gripper_close:.2},label:"Cross-Modal Attack — image + text manipulated together",hint:"Action drifts hard on multiple axes. Paper D Q49-class attack (future).",hidden:!0}},i=Object.fromEntries(Object.entries(l).filter(([,o])=>!o.hidden));export function registerSimCommand(c){c.command("sim [scenario]").description("Render a MuJoCo VLA replay (baseline / release / patch / confused)").action(async c=>{await async function(c){const p=l[c.toLowerCase()];if(!p){console.log(),console.log(chalk.yellow(` Unknown scenario: "${c}"`)),console.log(chalk.gray(" Available:"));for(const[o,e]of Object.entries(i))console.log(chalk.gray(" ")+chalk.bold.cyan(o.padEnd(10))+chalk.gray(e.label));return void console.log()}const g=(Date.now()-t())/1e3;if(g<a){const o=Math.ceil(a-g);return console.log(),console.log(chalk.yellow(` Please wait ${o}s before the next sim.`)),console.log(chalk.gray(" (One render per minute keeps things fast for everyone.)")),void console.log()}const d=`${process.env.ICOA_SERVER_URL?.replace(/\/+$/,"")||"https://practice.icoa2026.au"}/api/ai/vla/41/sim`;console.log(),console.log(chalk.bold.cyan(" ICOA · MuJoCo Sim")),console.log(chalk.gray(" ")+chalk.white(p.label)),console.log();try{const a=fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:p.action,frames:p.frames,narrative:p.narrative}),signal:AbortSignal.timeout(6e4)}),t=await r(a);if(!t.ok)return void console.log(chalk.yellow(` Server returned HTTP ${t.status}.`));const l=await t.json();if(!l.success||!l.data?.mp4_b64)return void console.log(chalk.yellow(" Renderer unavailable."));const g=process.env.TMPDIR||"/tmp",m=n(g,`icoa-sim-${c}-${Date.now()}.mp4`);e(m,Buffer.from(l.data.mp4_b64,"base64")),s(Date.now()),console.log(),console.log(chalk.bold.green(" ✓ ")+chalk.gray("Rendered.")),l.data.description&&console.log(chalk.gray(" Action: ")+chalk.white(l.data.description)),console.log(),console.log(chalk.gray(" ")+p.hint),console.log();const y="darwin"===process.platform?"open":"win32"===process.platform?"start":"xdg-open";y?(o(y,[m],{stdio:"ignore",detached:!0}).unref(),console.log(chalk.gray(" Opening in your default video player..."))):console.log(chalk.gray(" Open the file above in any video player.")),console.log(),console.log(chalk.gray(" You just rendered ")+chalk.white("Franka Panda")+chalk.gray(" + a 6-DOF companion arm, controlled by ")+chalk.bold.cyan("ICOA-VLA")+chalk.gray(" through ")+chalk.bold.cyan("MuJoCo")+chalk.gray(".")),console.log();const f="1"===process.env.ICOA_INSIDE_REPL?"":"icoa ";console.log(chalk.gray(" Try other scenarios:"));for(const o of Object.keys(i))o!==c.toLowerCase()&&console.log(chalk.gray(" "+f+"sim ")+chalk.cyan(o));console.log(),console.log(chalk.gray(" Next steps · ")+chalk.bold.cyan(f+"demo2")+chalk.gray(" (~8 min intro) · ")+chalk.bold.cyan(f+"learn LEARNDEMO01")+chalk.gray(" (curriculum)")),console.log()}catch(o){const e=o instanceof Error?o.message:String(o);console.log(chalk.yellow(` Sim error: ${e}`))}}(c||"baseline")})}export{l as SCENARIOS};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as o}from"commander";import chalk from"chalk";import{registerCtfCommands as e}from"./commands/ctf.js";import{registerRefCommand as n}from"./commands/ref.js";import{registerShellCommand as r}from"./commands/shell.js";import{registerFilesCommand as s}from"./commands/files.js";import{registerConnectCommand as t}from"./commands/connect.js";import{registerNoteCommand as l}from"./commands/note.js";import{registerLogCommand as i}from"./commands/log.js";import{registerLangCommand as a}from"./commands/lang.js";import{registerSetupCommand as m}from"./commands/setup.js";import{registerEnvCommand as c}from"./commands/env.js";import{registerAi4ctfCommand as g}from"./commands/ai4ctf.js";import{registerExamCommand as d}from"./commands/exam.js";import{registerCtf4aiDemoCommand as p}from"./commands/ctf4ai-demo.js";import{registerThemeCommand as y}from"./commands/theme.js";import{registerLearnCommand as h}from"./commands/learn.js";import{
|
|
2
|
+
import{Command as o}from"commander";import chalk from"chalk";import{registerCtfCommands as e}from"./commands/ctf.js";import{registerRefCommand as n}from"./commands/ref.js";import{registerShellCommand as r}from"./commands/shell.js";import{registerFilesCommand as s}from"./commands/files.js";import{registerConnectCommand as t}from"./commands/connect.js";import{registerNoteCommand as l}from"./commands/note.js";import{registerLogCommand as i}from"./commands/log.js";import{registerLangCommand as a}from"./commands/lang.js";import{registerSetupCommand as m}from"./commands/setup.js";import{registerEnvCommand as c}from"./commands/env.js";import{registerAi4ctfCommand as g}from"./commands/ai4ctf.js";import{registerExamCommand as d}from"./commands/exam.js";import{registerCtf4aiDemoCommand as p}from"./commands/ctf4ai-demo.js";import{registerThemeCommand as y}from"./commands/theme.js";import{registerLearnCommand as h}from"./commands/learn.js";import{registerCtf4VlaCommand as f}from"./commands/ctf4vla.js";import{registerDemo2Command as u}from"./commands/demo2.js";import{registerSimCommand as w}from"./commands/sim.js";import{getConfig as b,saveConfig as T}from"./lib/config.js";import{startRepl as $}from"./repl.js";import{setTerminalTheme as v}from"./lib/theme.js";import{checkForUpdates as j}from"./lib/update-check.js";import{detectIcoaInstalls as A}from"./lib/platform.js";import{readFileSync as C}from"node:fs";import{fileURLToPath as _}from"node:url";import{dirname as E,join as I}from"node:path";const S=E(_(import.meta.url)),x=JSON.parse(C(I(S,"..","package.json"),"utf-8")).version,F=chalk.cyan(" ─────────────────────────────────────────────────────"),L=`\n${F}\n\n ${chalk.bold.white("██╗ ██████╗ ██████╗ █████╗")}\n ${chalk.bold.white("██║██╔════╝██╔═══██╗██╔══██╗")}\n ${chalk.bold.white("██║██║ ██║ ██║███████║")}\n ${chalk.bold.white("██║██║ ██║ ██║██╔══██║")}\n ${chalk.bold.white("██║╚██████╗╚██████╔╝██║ ██║")}\n ${chalk.bold.white("╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝")}\n\n ${chalk.yellow("International Cyber Olympiad in AI 2026")}\n ${chalk.bold.magenta("The World's First AI-Native CLI Operating System")}\n ${chalk.bold.magenta("for Cybersecurity & AI Security Competition")}\n ${chalk.bold.magenta("and Olympiad for K-12")}\n\n ${chalk.green.bold("AI4CTF")}${chalk.gray("[Day 1]")} ${chalk.white("AI as your teammate")}\n ${chalk.red.bold("CTF4AI")}${chalk.gray("[Day 2]")} ${chalk.white("Challenge & evaluate AI systems")}\n ${chalk.bold.yellow("AI is your ally. AI is your target.")}\n\n ${chalk.white("Sydney, Australia")} ${chalk.gray("Jun 27 - Jul 2, 2026")}\n ${chalk.cyan.underline("https://icoa2026.au")}\n\n ${chalk.gray(`CLI-Native Competition Terminal v${x}`)}\n\n${F}\n`;process.on("uncaughtException",o=>{"__REPL_NO_EXIT__"!==o.message&&(console.error(chalk.red("Error:"),o.message),process.exit(1))}),process.on("unhandledRejection",o=>{const e=o instanceof Error?o.message:String(o);"__REPL_NO_EXIT__"!==e&&(console.error(chalk.red("Error:"),e),process.exit(1))});const k=new o;if(k.name("icoa").version(x).description("ICOA CLI — CLI-Native CTF Competition Terminal").option("--resume","Resume previous session").action(async o=>{const e=b();v("high-contrast"===e.themeVariant?"high-contrast":"dark"),j(),function(){const o=A();if(o.length<=1)return;const e=o[0];if([...o.map(o=>o.version||"0.0.0")].sort((o,e)=>function(o,e){const n=o.split(".").map(o=>parseInt(o,10)||0),r=e.split(".").map(o=>parseInt(o,10)||0);for(let o=0;o<3;o++)if((n[o]||0)!==(r[o]||0))return(n[o]||0)-(r[o]||0);return 0}(e,o))[0]!==e.version){console.log(),console.log(chalk.yellow.bold(" ⚠ Multiple icoa installations detected on PATH:"));for(let e=0;e<o.length;e++){const n=o[e],r=n.version?`v${n.version}`:"(version unreadable)",s=0===e?chalk.yellow("→"):" ",t=0===e?chalk.gray(" ← currently running (older — shadowing newer install)"):chalk.gray(" ← shadowed");console.log(` ${s} ${chalk.cyan(n.path.padEnd(28))} ${chalk.white(r)}${t}`)}console.log(),console.log(chalk.yellow(" The first install on PATH wins. To use the newer one, remove the older:")),console.log(),e.pkgDir?console.log(` ${chalk.bold.cyan(`sudo rm -rf ${e.pkgDir} ${e.path}`)}`):console.log(` ${chalk.bold.cyan(`sudo rm -rf ${e.path} # also delete its node_modules dir`)}`),console.log(),console.log(chalk.gray(" Then re-run icoa to confirm version banner shows the newer release.")),console.log()}}();const n=process.env.LANG||process.env.LC_ALL||process.env.LC_CTYPE||"";if(!/UTF-?8/i.test(n))if("win32"===process.platform){let o="";try{const{execFileSync:e}=await import("node:child_process");o=e("chcp.com",[],{encoding:"utf-8",timeout:1500,stdio:["ignore","pipe","ignore"]}).trim()}catch{}o.includes("65001")||(console.log(chalk.yellow(`⚠ Windows terminal is not using UTF-8 (current: ${o||"unknown"}).`)),console.log(chalk.gray(' Non-English text (Ukrainian, Chinese, Japanese, etc.) may show as "?" or garbled glyphs.')),console.log(chalk.gray(" Fix (run before ")+chalk.cyan("icoa")+chalk.gray("): ")+chalk.cyan("chcp 65001")),console.log(chalk.gray(" Or stay in English inside the CLI: ")+chalk.cyan("lang en")),console.log())}else console.log(chalk.yellow(`⚠ Your terminal locale is not UTF-8 (LANG=${n||"(unset)"}).`)),console.log(chalk.gray(' Non-English text and box characters may display as "?" or garbled glyphs.')),console.log(chalk.gray(" Fix: ")+chalk.cyan("export LANG=en_US.UTF-8")+chalk.gray(" (or your locale, e.g. ")+chalk.cyan("zh_CN.UTF-8")+chalk.gray(", ")+chalk.cyan("uk_UA.UTF-8")+chalk.gray(")")),console.log();if(console.log(L),process.argv.length<=2||o.resume)return o.resume||await async function(){const o=process.stdin;if(o.isTTY&&"function"==typeof o.setRawMode)return new Promise(e=>{let n=!1;const r=()=>{if(!n){n=!0,o.removeListener("data",s);try{o.setRawMode(!1)}catch{}o.pause(),e()}},s=()=>r();o.setRawMode(!0),o.resume(),o.once("data",s),console.log(chalk.gray(" (press any key to continue...)")),setTimeout(r,3e3)});await new Promise(o=>setTimeout(o,3e3))}(),void $(k,!!o.resume)}),e(k),n(k),r(k),s(k),t(k),l(k),i(k),a(k),m(k),c(k),g(k),d(k),p(k),y(k),h(k),f(k),u(k),w(k),k.command("model",{hidden:!0}).argument("[name]","model name to switch to").action(o=>{const e=b().geminiModel||"gemini-2.5-flash";o?(T({geminiModel:o}),console.log(),console.log(chalk.green(" Model switched: ")+chalk.gray(e)+chalk.white(" -> ")+chalk.bold.white(o)),console.log()):(console.log(),console.log(chalk.gray(" Current model: ")+chalk.white(e)),console.log(),console.log(chalk.gray(" Available models:")),console.log(chalk.bold.white(" Gemini 3.x (Latest)")),console.log(chalk.white(" model gemini-3.1-pro-preview ")+chalk.gray("Most powerful, paid")),console.log(chalk.white(" model gemini-3-flash-preview ")+chalk.gray("Fast, free tier")),console.log(chalk.bold.white(" Gemini 2.5 (Stable)")),console.log(chalk.white(" model gemini-2.5-flash ")+chalk.gray("Fast, free tier (default)")),console.log(chalk.white(" model gemini-2.5-pro ")+chalk.gray("Strong reasoning, paid")),console.log(chalk.bold.white(" Open Source")),console.log(chalk.white(" model gemma-4-31b-it ")+chalk.gray("Free, open-source")),console.log(chalk.white(" model <any-model-id> ")+chalk.gray("Custom model")),console.log(),console.log(chalk.gray(" Translation uses gemini-3.1-pro-preview for best quality.")),console.log())}),"1"===process.env.ICOA_RESET_STATE)try{const{clearExamState:o}=await import("./lib/exam-state.js");o(),console.log(chalk.yellow("⚠ ICOA_RESET_STATE=1 — local exam state wiped.")),console.log(chalk.gray(" (Token NOT revoked server-side. Re-enter a fresh token with `exam <token>`.)")),console.log()}catch(o){console.log(chalk.red("⚠ ICOA_RESET_STATE: could not clear state — ")+chalk.gray(String(o)))}k.parse();
|