icoa-cli 2.19.331 → 2.19.332

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.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Run an interactive child process (nc / ncat / ssh) with the terminal fully
3
+ * released so the user's INPUT and Ctrl-C reach the child.
4
+ *
5
+ * Why this exists (BUG: pwn `connect` could read output but not send input and
6
+ * Ctrl-C was dead): when dispatched IN-PROCESS from the icoa REPL, the main
7
+ * readline holds stdin in RAW mode. A child spawned with `stdio: 'inherit'`
8
+ * then inherits a raw, non-blocking stdin → its reads see no keystrokes, and
9
+ * raw mode means Ctrl-C is delivered as a byte (0x03), never as SIGINT → the
10
+ * session looks frozen and won't quit. `execSync`/`execFileSync` never dropped
11
+ * raw mode, which is the bug.
12
+ *
13
+ * This mirrors repl.ts `runSystemCommand`'s proven TTY dance (pause the rl +
14
+ * `setRawMode(false)` + async spawn + restore), but pulls the active REPL
15
+ * readline via getMainRl() so it works BOTH inside the REPL and standalone
16
+ * (`icoa connect …`, where getMainRl() === null → pause/restore are no-ops).
17
+ *
18
+ * Pass a file + args (no shell — injection-safe, preferred for server-supplied
19
+ * host/port) OR set `shell: true` to run `file` as a full command string.
20
+ *
21
+ * Resolves with the child's exit code (1 on spawn error).
22
+ */
23
+ export declare function runInteractive(file: string, args?: string[], opts?: {
24
+ shell?: boolean;
25
+ }): Promise<number>;
@@ -0,0 +1 @@
1
+ import{spawn as e}from"node:child_process";import{getMainRl as t}from"./main-rl.js";export function runInteractive(o,s=[],i={}){return new Promise(r=>{const n=t(),c=process.stdin,a=!!c.isTTY&&!!c.isRaw;if(n?.pause(),c.isTTY&&"function"==typeof c.setRawMode)try{c.setRawMode(!1)}catch{}const f=i.shell?e(o,{shell:!0,stdio:"inherit"}):e(o,s,{stdio:"inherit"});let d=!1;const l=e=>{if(!d){if(d=!0,c.isTTY&&"function"==typeof c.setRawMode&&a)try{c.setRawMode(!0)}catch{}n?.resume(),r(e)}};f.on("close",e=>l(e??0)),f.on("error",()=>l(1))})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.19.331",
3
+ "version": "2.19.332",
4
4
  "description": "ICOA CLI — The world's first CLI-native cyber & AI security olympiad terminal: AI4CTF (Day 1), CTF4AI (Day 2), VLA4CTF (Pioneer Round — embodied AI)",
5
5
  "type": "module",
6
6
  "bin": {