icoa-cli 2.19.457 → 2.19.459

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.
Files changed (122) hide show
  1. package/dist/commands/ai4ctf.js +1 -1
  2. package/dist/commands/ctf4ai-demo.js +1 -1
  3. package/dist/commands/ctf4vla.js +1 -1
  4. package/dist/commands/exam.js +1 -1
  5. package/dist/commands/learn.js +1 -1
  6. package/dist/lib/py-syntax.js +1 -1
  7. package/package.json +1 -1
  8. package/dist/commands/ai4ctf.d.ts +0 -4
  9. package/dist/commands/ai4ioai.d.ts +0 -29
  10. package/dist/commands/aienv.d.ts +0 -23
  11. package/dist/commands/arena-eai.d.ts +0 -37
  12. package/dist/commands/arena.d.ts +0 -8
  13. package/dist/commands/board.d.ts +0 -2
  14. package/dist/commands/challenge.d.ts +0 -9
  15. package/dist/commands/comms.d.ts +0 -2
  16. package/dist/commands/connect.d.ts +0 -15
  17. package/dist/commands/ctf.d.ts +0 -3
  18. package/dist/commands/ctf4ai-demo.d.ts +0 -4
  19. package/dist/commands/ctf4vla.d.ts +0 -34
  20. package/dist/commands/demo2.d.ts +0 -31
  21. package/dist/commands/demo4.d.ts +0 -3
  22. package/dist/commands/demo5.d.ts +0 -3
  23. package/dist/commands/doctor.d.ts +0 -2
  24. package/dist/commands/env.d.ts +0 -5
  25. package/dist/commands/exam.d.ts +0 -13
  26. package/dist/commands/files.d.ts +0 -2
  27. package/dist/commands/ioailab.d.ts +0 -1
  28. package/dist/commands/ipynb.d.ts +0 -20
  29. package/dist/commands/kaggle.d.ts +0 -12
  30. package/dist/commands/lang.d.ts +0 -2
  31. package/dist/commands/learn.d.ts +0 -16
  32. package/dist/commands/log.d.ts +0 -2
  33. package/dist/commands/note.d.ts +0 -25
  34. package/dist/commands/ref.d.ts +0 -2
  35. package/dist/commands/setup.d.ts +0 -2
  36. package/dist/commands/shell.d.ts +0 -35
  37. package/dist/commands/sim.d.ts +0 -32
  38. package/dist/commands/sprint.d.ts +0 -7
  39. package/dist/commands/teleload.d.ts +0 -8
  40. package/dist/commands/theme.d.ts +0 -13
  41. package/dist/commands/view.d.ts +0 -2
  42. package/dist/index.d.ts +0 -2
  43. package/dist/lib/access.d.ts +0 -14
  44. package/dist/lib/aienv.d.ts +0 -118
  45. package/dist/lib/arena-edit-dynamics.d.ts +0 -55
  46. package/dist/lib/arena-submit.d.ts +0 -23
  47. package/dist/lib/banner.d.ts +0 -9
  48. package/dist/lib/bgtasks.d.ts +0 -21
  49. package/dist/lib/board-render.d.ts +0 -14
  50. package/dist/lib/budget.d.ts +0 -1
  51. package/dist/lib/card-engine.d.ts +0 -45
  52. package/dist/lib/challenge-dir.d.ts +0 -1
  53. package/dist/lib/colors.d.ts +0 -11
  54. package/dist/lib/commands.d.ts +0 -53
  55. package/dist/lib/comms.d.ts +0 -40
  56. package/dist/lib/config.d.ts +0 -8
  57. package/dist/lib/countdown.d.ts +0 -4
  58. package/dist/lib/country-lang.d.ts +0 -1
  59. package/dist/lib/ctfd-client.d.ts +0 -33
  60. package/dist/lib/deck-cooldown.d.ts +0 -7
  61. package/dist/lib/demo-exam.d.ts +0 -28
  62. package/dist/lib/demo-flags.d.ts +0 -8
  63. package/dist/lib/demo-stats.d.ts +0 -17
  64. package/dist/lib/docker-probe.d.ts +0 -45
  65. package/dist/lib/drafts.d.ts +0 -11
  66. package/dist/lib/editor-spawn.d.ts +0 -28
  67. package/dist/lib/exam-client.d.ts +0 -15
  68. package/dist/lib/exam-sandbox.d.ts +0 -15
  69. package/dist/lib/exam-setup.d.ts +0 -19
  70. package/dist/lib/exam-state.d.ts +0 -42
  71. package/dist/lib/gemini.d.ts +0 -16
  72. package/dist/lib/gpu.d.ts +0 -51
  73. package/dist/lib/http.d.ts +0 -35
  74. package/dist/lib/i18n.d.ts +0 -215
  75. package/dist/lib/input-dynamics.d.ts +0 -38
  76. package/dist/lib/integrity-snapshot.d.ts +0 -22
  77. package/dist/lib/interactive-spawn.d.ts +0 -25
  78. package/dist/lib/ipynb-input.d.ts +0 -25
  79. package/dist/lib/kaggle.d.ts +0 -115
  80. package/dist/lib/kernel-protocol.d.ts +0 -92
  81. package/dist/lib/kernel.d.ts +0 -81
  82. package/dist/lib/learn-ai.d.ts +0 -159
  83. package/dist/lib/learn-contest.d.ts +0 -141
  84. package/dist/lib/learn-curricula.d.ts +0 -274
  85. package/dist/lib/learn-i18n.d.ts +0 -8
  86. package/dist/lib/learn-input.d.ts +0 -40
  87. package/dist/lib/learn-outcome.d.ts +0 -1
  88. package/dist/lib/learn-render.d.ts +0 -107
  89. package/dist/lib/learn-replies.d.ts +0 -42
  90. package/dist/lib/learn-state.d.ts +0 -66
  91. package/dist/lib/log-sync.d.ts +0 -2
  92. package/dist/lib/logger.d.ts +0 -12
  93. package/dist/lib/main-rl.d.ts +0 -20
  94. package/dist/lib/md-term.d.ts +0 -17
  95. package/dist/lib/menu-nav.d.ts +0 -25
  96. package/dist/lib/notebook-doc.d.ts +0 -38
  97. package/dist/lib/open-file.d.ts +0 -35
  98. package/dist/lib/paper-upgrade.d.ts +0 -27
  99. package/dist/lib/platform.d.ts +0 -110
  100. package/dist/lib/py-syntax.d.ts +0 -36
  101. package/dist/lib/render-card.d.ts +0 -17
  102. package/dist/lib/repl-asker.d.ts +0 -7
  103. package/dist/lib/resume.d.ts +0 -7
  104. package/dist/lib/sample-runner.d.ts +0 -14
  105. package/dist/lib/sandbox.d.ts +0 -30
  106. package/dist/lib/secure-store.d.ts +0 -18
  107. package/dist/lib/shell-split.d.ts +0 -17
  108. package/dist/lib/sim-cooldown.d.ts +0 -14
  109. package/dist/lib/sprint-meta.d.ts +0 -72
  110. package/dist/lib/statusline.d.ts +0 -1
  111. package/dist/lib/terminal-cleanup.d.ts +0 -35
  112. package/dist/lib/theme.d.ts +0 -4
  113. package/dist/lib/token-format.d.ts +0 -41
  114. package/dist/lib/tool-man.d.ts +0 -11
  115. package/dist/lib/toolset-hash.d.ts +0 -15
  116. package/dist/lib/translation.d.ts +0 -1
  117. package/dist/lib/translations-fetcher.d.ts +0 -6
  118. package/dist/lib/ui.d.ts +0 -12
  119. package/dist/lib/update-check.d.ts +0 -1
  120. package/dist/lib/version.d.ts +0 -8
  121. package/dist/repl.d.ts +0 -4
  122. package/dist/types/index.d.ts +0 -221
@@ -1,23 +0,0 @@
1
- /**
2
- * arena-submit — pure builder for an arena submission payload (Phase 3 of the
3
- * CLI notebook arena). The all-in-CLI loop: a student computes in `icoa ipynb`,
4
- * saves a local predictions.csv, and submits it here.
5
- *
6
- * If the input is a path that exists on disk, we send its CONTENT inline
7
- * (`predictions_csv`) — this is what makes local submission work against a
8
- * REMOTE server (prod can't read the student's disk, so a bare path is useless;
9
- * the legacy Google-Drive link existed only to get the file TO the server).
10
- * Otherwise we fall back to the Drive link (`gdrive_url`). Kept pure (fs deps
11
- * injected) so the routing decision is unit-tested.
12
- */
13
- export interface SubmitPayload {
14
- arena_token: string;
15
- predictions_csv?: string;
16
- gdrive_url?: string;
17
- source: 'local' | 'gdrive';
18
- }
19
- export interface SubmitFsDeps {
20
- exists: (path: string) => boolean;
21
- read: (path: string) => string;
22
- }
23
- export declare function buildSubmitPayload(input: string, arenaToken: string, deps: SubmitFsDeps): SubmitPayload;
@@ -1,9 +0,0 @@
1
- export declare const ICOA_BIG: readonly string[];
2
- /**
3
- * Ready-to-print logo lines, bold white, indented by `indent`.
4
- *
5
- * Degrades to a one-line wordmark when the terminal is too narrow for the block
6
- * art (Chromebook split-screen / narrow WSL pane), so it never overflow-wraps.
7
- * 60 cols is the rich-display floor from the cross-platform baseline.
8
- */
9
- export declare function icoaBannerLines(indent?: string): string[];
@@ -1,21 +0,0 @@
1
- import { type ChildProcess } from 'node:child_process';
2
- export interface BgTask {
3
- id: number;
4
- cmd: string;
5
- kind: 'shell' | 'async';
6
- status: 'running' | 'done' | 'failed';
7
- exitCode: number | null;
8
- startedAt: number;
9
- endedAt: number | null;
10
- output: string;
11
- child?: ChildProcess;
12
- render?: () => void;
13
- notified: boolean;
14
- }
15
- export declare function startBgTask(cmd: string, cwd: string): BgTask;
16
- export declare function startAsyncTask<T>(label: string, worker: () => Promise<T>, renderer: (result: T) => void): BgTask;
17
- export declare function listBgTasks(): BgTask[];
18
- export declare function getBgTask(id: number): BgTask | undefined;
19
- export declare function runningCount(): number;
20
- export declare function drainCompleted(): BgTask[];
21
- export declare function killAllBgTasks(): void;
@@ -1,14 +0,0 @@
1
- /**
2
- * board-render — pure formatting for the ICOA Board CLI (no chalk, no I/O;
3
- * caller applies colors). Mirrors the arena-submit.ts pure-module pattern.
4
- */
5
- export interface BoardRow {
6
- rank: number;
7
- label: string;
8
- value?: number | null;
9
- display_score?: number | null;
10
- total_display?: number | null;
11
- tasks_counted?: number;
12
- }
13
- export declare function deltaLine(prevRank: number | null | undefined, rank: number | null | undefined, fieldSize: number | null | undefined): string;
14
- export declare function renderBoardLines(rows: BoardRow[], width: number): string[];
@@ -1 +0,0 @@
1
- export declare function addTokenUsage(tokensUsed: number): void;
@@ -1,45 +0,0 @@
1
- export interface CardChoice {
2
- key: string;
3
- text: string;
4
- }
5
- export interface Card {
6
- /** Short all-caps label shown in the card header. */
7
- title: string;
8
- /** Optional chartart block — pre-rendered ASCII, one string per line. */
9
- chartart?: string[];
10
- /** Narrative body lines. */
11
- body: string[];
12
- choices: CardChoice[];
13
- /** Key of the correct choice, lower-case. */
14
- correct: string;
15
- /** Shown after the user answers, regardless of right or wrong. */
16
- reveal: string[];
17
- }
18
- export interface Deck {
19
- /** Command word — also the sub-REPL prompt token (`icoa demo4> `). */
20
- id: string;
21
- /** Banner title line. */
22
- title: string;
23
- /** Banner subtitle / tagline. */
24
- tagline: string;
25
- /** Accent colour applied to the frame. */
26
- accent: 'cyan' | 'magenta' | 'green' | 'yellow';
27
- cards: Card[];
28
- /** Terminal payload — the render reward. */
29
- finale: () => Promise<void>;
30
- /** Closing hook lines shown after the finale. */
31
- outro: string[];
32
- }
33
- /** A deck bundle carries both language variants; the runner picks one. */
34
- export interface DeckPack {
35
- en: Deck;
36
- zh: Deck;
37
- }
38
- /** True while a card deck owns stdin. The main REPL's prompt wrapper checks
39
- * this so it does not stamp `icoa> ` over our `icoa demo4> `. */
40
- export declare function isCardDeckActive(): boolean;
41
- /**
42
- * Run a two-language card pack. Typing `zh` / `en` (or `lang zh` / `lang en`)
43
- * at any card prompt switches language and restarts the deck.
44
- */
45
- export declare function runDeckPack(pack: DeckPack, initialLang: string): Promise<void>;
@@ -1 +0,0 @@
1
- export declare function challengeDownloadDir(id: string, base?: string): string;
@@ -1,11 +0,0 @@
1
- export declare const c: {
2
- fg: (s: string) => string;
3
- muted: (s: string) => string;
4
- red: (s: string) => string;
5
- green: (s: string) => string;
6
- yellow: (s: string) => string;
7
- blue: (s: string) => string;
8
- cyan: (s: string) => string;
9
- orange: (s: string) => string;
10
- white: (s: string) => string;
11
- };
@@ -1,53 +0,0 @@
1
- export interface IcoaCommand {
2
- /** The verb a user types. Must be reachable — a name here that dispatches
3
- * nowhere is a promise the CLI cannot keep. */
4
- name: string;
5
- /** Handled by an explicit `input === ...` branch ABOVE the dispatch gate
6
- * (nav verbs, screen control, background-task panels). Such a verb must
7
- * stay OUT of knownCommands: the gate never sees it. */
8
- nav?: true;
9
- /** Rewrites to a different argv, e.g. sb -> ctf scoreboard. */
10
- mapsTo?: string[];
11
- /** Append the user's remaining words to mapsTo. */
12
- rest?: true;
13
- /** Second-word Tab completion. Slightly stale entries are harmless — they
14
- * simply will not dispatch — but these track the real subcommand surface. */
15
- subs?: string[];
16
- /** The row this command gets on the `help` screen. Omit and it simply does
17
- * not appear — help is CURATED, not an index: 34 commands, ~27 rows, ordered
18
- * for a first-time reader rather than alphabetically. */
19
- help?: {
20
- /** Position on the help screen. The help screen is CURATED in a teaching
21
- * order (resume first, clear/exit last) which is NOT the registry's own
22
- * order — dropping this field silently reshuffled the System section, and
23
- * only the byte-for-byte baseline caught it. */
24
- order: number;
25
- section: 'Exam' | 'Competition' | 'AI Teammate' | 'Tools' | 'System';
26
- /** Displayed form including the argument hint, e.g. 'submit <id> <flag>'.
27
- * Padded to 20 columns by the renderer. */
28
- label: string;
29
- text: string;
30
- /** Per-mode wording. Only five commands need it — join / ref / setup /
31
- * lang / exit read differently in the short selection-mode screen than in
32
- * the full olympiad one, deliberately: the short screen trades detail for
33
- * density. A fully mode-indexed model would be machinery for five
34
- * exceptions, so the default lives in `text` and this overrides it. */
35
- textByMode?: Record<string, string>;
36
- };
37
- }
38
- export declare const REGISTRY: readonly IcoaCommand[];
39
- /** Everything typeable: Tab completion, the `/cmd` slash layer, typo suggestions. */
40
- export declare const surface: () => string[];
41
- /** The dispatch gate. Excludes nav verbs, which are consumed before the gate —
42
- * listing them here would be harmless but misleading about who handles what. */
43
- export declare const dispatchable: () => string[];
44
- /** name -> argv rewrite, with the caller's trailing words appended when `rest`. */
45
- export declare function shortcutFor(name: string, rest: string[]): string[] | null;
46
- /** parent -> second-word completions. */
47
- export declare const subcommandsOf: (name: string) => readonly string[] | undefined;
48
- /** Help rows for one section, in registry order. Curated: a command without a
49
- * `help` block simply does not appear on the help screen. */
50
- export declare const helpRows: (section: string) => Array<{
51
- label: string;
52
- text: string;
53
- }>;
@@ -1,40 +0,0 @@
1
- export declare function isCommsActive(): boolean;
2
- export declare function setCommsActive(active: boolean): void;
3
- export declare function isLeaderToken(s: string): boolean;
4
- export declare function isLeaderSession(): boolean;
5
- export declare function isLeaderAccount(name: string): boolean;
6
- export declare function sanitizeCommsLine(s: string): string;
7
- export declare function commsBaseUrl(): string;
8
- export declare function isCompetitionJoined(): boolean;
9
- export declare function isMelCompetition(): boolean;
10
- export declare function formatBroadcastBar(text: string): string;
11
- export declare function fetchBroadcast(): Promise<{
12
- text: string;
13
- ts: number | null;
14
- }>;
15
- export declare function postMemo(text: string): Promise<{
16
- ok: boolean;
17
- id?: number;
18
- ts?: number;
19
- status: number;
20
- message?: string;
21
- }>;
22
- export declare function postJury(text: string): Promise<{
23
- ok: boolean;
24
- id?: number;
25
- ts?: number;
26
- status: number;
27
- message?: string;
28
- }>;
29
- export declare function leaderAuth(baseUrl: string, token: string): Promise<{
30
- account: string;
31
- team: string;
32
- } | null>;
33
- export declare function fetchPublicScoreboard(): Promise<Array<{
34
- pos: number;
35
- name: string;
36
- score: number;
37
- }>>;
38
- export declare function showBroadcast(): void;
39
- export declare function startBroadcastPoll(redraw: () => void): void;
40
- export declare function stopBroadcastPoll(): void;
@@ -1,8 +0,0 @@
1
- import type { IcoaConfig, HintBudget } from '../types/index.js';
2
- export declare function getConfig(): IcoaConfig;
3
- export declare function saveConfig(config: Partial<IcoaConfig>): void;
4
- export declare function getBudget(): HintBudget;
5
- export declare function saveBudget(budget: HintBudget): void;
6
- export declare function getIcoaDir(): string;
7
- export declare function getInstallSalt(): string;
8
- export declare function isConnected(): boolean;
@@ -1,4 +0,0 @@
1
- export declare function fetchWithCountdown<T>(fetchPromise: Promise<T>, opts?: {
2
- from?: number;
3
- waitText?: string;
4
- }): Promise<T>;
@@ -1 +0,0 @@
1
- export declare const COUNTRY_LANG: Record<string, string>;
@@ -1,33 +0,0 @@
1
- import type { CTFdChallenge, CTFdChallengeListItem, CTFdUser, CTFdTeam, CTFdScoreboardEntry, CTFdAttemptResponse } from '../types/index.js';
2
- export declare class CTFdClient {
3
- private baseUrl;
4
- private token;
5
- private sessionCookie;
6
- private csrfNonce;
7
- constructor(baseUrl: string, token: string, sessionCookie?: string, csrfNonce?: string);
8
- private getAuthHeaders;
9
- fetchCsrfNonce(): Promise<string>;
10
- private request;
11
- testConnection(): Promise<CTFdUser>;
12
- private testConnectionViaProfile;
13
- getChallenges(): Promise<CTFdChallengeListItem[]>;
14
- getChallenge(id: number): Promise<CTFdChallenge>;
15
- submitFlag(challengeId: number, submission: string): Promise<CTFdAttemptResponse['data']>;
16
- getScoreboard(): Promise<CTFdScoreboardEntry[]>;
17
- getTeam(): Promise<CTFdTeam>;
18
- getCompetitionMeta(): Promise<{
19
- start: number | null;
20
- end: number | null;
21
- userMode: string;
22
- csrfNonce: string;
23
- }>;
24
- getChallengeFiles(id: number): Promise<string[]>;
25
- downloadFile(filePath: string, destDir: string): Promise<string>;
26
- getTokenViaIcoaApi(username: string, password: string): Promise<string | null>;
27
- private tokenAuthenticates;
28
- loginWithCredentials(username: string, password: string): Promise<{
29
- token: string;
30
- session: string;
31
- csrf: string;
32
- }>;
33
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Block until the sim cooldown clears, rendering a single-line countdown.
3
- * Returns immediately when no cooldown is pending (the common case).
4
- *
5
- * @param line in-fiction label, e.g. "watchdog cooling down"
6
- */
7
- export declare function awaitRenderWindow(line: string): Promise<void>;
@@ -1,28 +0,0 @@
1
- import type { ExamQuestion, ExamSession } from '../types/index.js';
2
- export declare const DEMO_POOL_SIZE = 30;
3
- export declare const DEMO_PICK_SIZE = 10;
4
- export declare const DEMO_ANSWERS: Record<number, 'A' | 'B' | 'C' | 'D'>;
5
- export declare const DEMO_EXPLANATIONS: Record<number, string>;
6
- export declare const DEMO_QUESTIONS: ExamQuestion[];
7
- /**
8
- * Pick `n` random questions from the pool, shuffle each question's options,
9
- * renumber 1..n. Returns fully self-contained questions with answer + explanation
10
- * populated, so downstream code does not need to look up DEMO_ANSWERS by number.
11
- */
12
- export declare function pickDemoQuestions(n?: number): ExamQuestion[];
13
- /**
14
- * Get localized explanations for demo questions.
15
- * Reads from translations/<lang>/demo-explanations.json.
16
- * Falls back to English for any missing entries.
17
- */
18
- export declare function getLocalizedExplanations(): Record<number, string>;
19
- /**
20
- * Get demo questions translated to user's language.
21
- * Reads from translations/<lang>/demo.json (bundled static file).
22
- * Per-question fallback: missing entries use the English source.
23
- */
24
- export declare function getLocalizedDemoQuestions(): ExamQuestion[];
25
- /**
26
- * Get localized demo session name.
27
- */
28
- export declare function getLocalizedDemoSession(): ExamSession;
@@ -1,8 +0,0 @@
1
- export declare const DEMO_AI4CTF_FLAG_B64 = "aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ==";
2
- export declare const DEMO_AI4CTF_FLAG_DECODED = "icoa{w3lc0me_2_ai4ctf}";
3
- /**
4
- * Runtime verification that the b64 constant decodes to the expected plaintext.
5
- * Catches hand-edit drift between the two constants above.
6
- * Throws if they disagree. Safe to call at module load or from tests.
7
- */
8
- export declare function verifyDemoAi4ctfFlag(): void;
@@ -1,17 +0,0 @@
1
- import type { ExamQuestion } from '../types/index.js';
2
- interface DemoStats {
3
- best: number;
4
- bestPercentage: number;
5
- attempts: number;
6
- lastFive: Array<{
7
- score: number;
8
- total: number;
9
- at: string;
10
- }>;
11
- }
12
- export declare function getDemoStats(): DemoStats;
13
- export declare function recordDemoAttempt(score: number, total: number): DemoStats;
14
- export declare function saveRetryQueue(questions: ExamQuestion[]): void;
15
- export declare function getRetryQueue(): ExamQuestion[] | null;
16
- export declare function clearRetryQueue(): void;
17
- export {};
@@ -1,45 +0,0 @@
1
- /**
2
- * Detect whether the Docker daemon is running WITHOUT waking it.
3
- *
4
- * The `docker` CLI is the trigger: on macOS, running any `docker` command
5
- * (including `docker info`) can auto-launch Docker Desktop. The old probe
6
- * shelled out to `docker info`, so every REPL shell-out and every `shell`
7
- * invocation kept starting Docker on the user's Mac even though the sandbox is
8
- * OPTIONAL and the host-shell fallback is the norm (2026-07 feedback).
9
- *
10
- * This probes the daemon's listening SOCKET directly (Node `net`) and never
11
- * invokes the `docker` binary. Docker already up → the socket connects → we use
12
- * the sandbox. Docker down → connection refused → we silently use the host
13
- * shell, and Docker is never started.
14
- */
15
- export type DockerProbeKind = 'unix' | 'tcp' | 'npipe';
16
- export interface DockerProbeTarget {
17
- kind: DockerProbeKind;
18
- /** unix/npipe: a filesystem/pipe path. tcp: "host:port". */
19
- target: string;
20
- }
21
- /**
22
- * Ordered daemon endpoints to probe. A `DOCKER_HOST` (unix://, tcp://, npipe://)
23
- * overrides everything — it's the user's explicit daemon. Otherwise fall back to
24
- * the well-known per-platform sockets, most-specific first. Pure + testable:
25
- * platform/env/home are all injected.
26
- */
27
- export declare function dockerProbeTargets(platform: NodeJS.Platform, env: NodeJS.ProcessEnv, home: string): DockerProbeTarget[];
28
- /**
29
- * True if ANY target accepts a connection, probing in order and stopping at the
30
- * first hit. `connect` is injected (returns whether a target is reachable) so
31
- * the ordering/short-circuit is unit-tested without real sockets.
32
- */
33
- export declare function anyReachable(targets: DockerProbeTarget[], connect: (t: DockerProbeTarget) => Promise<boolean>): Promise<boolean>;
34
- /**
35
- * True iff `raw` is a Docker Engine `/_ping` response from a LIVE daemon — an
36
- * HTTP 200. A bare connect isn't enough: after Docker Desktop quits, a lingering
37
- * helper can keep the socket connectable while the daemon is down, so we require
38
- * the daemon to actually answer the API. Pure + tested.
39
- */
40
- export declare function isDockerPingResponse(raw: string): boolean;
41
- /**
42
- * The public check: is a Docker daemon reachable right now, without starting it?
43
- * platform/env/home are injectable for tests; production uses process defaults.
44
- */
45
- export declare function isDockerRunning(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv, home?: string): Promise<boolean>;
@@ -1,11 +0,0 @@
1
- export interface Draft {
2
- id: number;
3
- examId: string | null;
4
- q: number | null;
5
- text: string;
6
- ts: string;
7
- }
8
- export declare function addDraft(text: string, examId: string | null, q: number | null): Draft;
9
- export declare function listDrafts(examId?: string | null): Draft[];
10
- export declare function removeDraft(id: number): boolean;
11
- export declare function clearDrafts(): number;
@@ -1,28 +0,0 @@
1
- /**
2
- * editor-spawn — hand the terminal to the user's $EDITOR for one text
3
- * fragment, then take it back. The `git commit` / `crontab -e` idiom: write a
4
- * temp file, block on the editor, read the file back.
5
- *
6
- * BUG-008 note: this must NOT create any readline. `spawnSync` blocks the
7
- * event loop, so the main REPL's readline cannot fire while the editor owns
8
- * the TTY; we only save/drop/restore raw mode around the child (editors expect
9
- * a cooked terminal and manage their own termios).
10
- */
11
- export interface EditorCommand {
12
- cmd: string;
13
- args: string[];
14
- }
15
- /** Full argv for the editor child: the user's own args, then the vim
16
- * compat fix when applicable, then the file. Pure given `probe`. */
17
- export declare function buildEditorArgv(ed: EditorCommand, file: string, probe?: (cmd: string) => boolean): string[];
18
- /** $VISUAL → $EDITOR → vi (notepad on native Windows). vi is the POSIX
19
- * floor — present on every baseline terminal, and what the coretools track
20
- * teaches — whereas nano isn't guaranteed installed. Values like "code -w"
21
- * split on whitespace into cmd + args. Pure for testability. */
22
- export declare function resolveEditor(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): EditorCommand;
23
- /**
24
- * Open `initial` in the user's editor; return the edited text, or null if the
25
- * editor failed to launch or exited non-zero (a deliberate cancel, vi `:cq`).
26
- * Caller is expected to `rl.pause()` before and `rl.resume()` after.
27
- */
28
- export declare function editTextInEditor(initial: string, suffix?: string): string | null;
@@ -1,15 +0,0 @@
1
- import type { ExamListItem, ExamQuestion, ExamSession, ExamResult } from '../types/index.js';
2
- export declare class ExamClient {
3
- private baseUrl;
4
- private token;
5
- constructor(baseUrl: string, token: string);
6
- private request;
7
- private _fetch;
8
- getExams(): Promise<ExamListItem[]>;
9
- startExam(examId: string): Promise<{
10
- session: ExamSession;
11
- questions: ExamQuestion[];
12
- }>;
13
- submitExam(examId: string, answers: Record<number, string>): Promise<ExamResult>;
14
- getResult(examId: string): Promise<ExamResult>;
15
- }
@@ -1,15 +0,0 @@
1
- export declare function scanForAIBinaries(): string[];
2
- export declare function checkShellRisk(input: string): string[];
3
- export declare function auditIdentity(): {
4
- account?: string;
5
- examToken?: string;
6
- deviceFingerprint?: string;
7
- };
8
- export declare function logShellAudit(entry: {
9
- cwd: string;
10
- input: string;
11
- riskFlags: string[];
12
- }): void;
13
- export declare function reportAIBinaryDetection(binaries: string[]): void;
14
- export declare function createExamWorkspace(examId: string): string;
15
- export declare function getActiveCwd(): string;
@@ -1,19 +0,0 @@
1
- interface ExamSetupState {
2
- completedAt: string;
3
- pythonVersion: string;
4
- installedPackages: string[];
5
- failedPackages: string[];
6
- }
7
- export declare function getExamSetup(): ExamSetupState | null;
8
- export declare function saveExamSetup(state: ExamSetupState): void;
9
- export declare function isExamSetupComplete(): boolean;
10
- /**
11
- * Papers that are MCQ / short-answer only (no Python, no Unix tooling, no
12
- * practical/CTF questions) skip the `exam setup` gate entirely — running it
13
- * would be pointless and could block a valid token.
14
- *
15
- * - Paper C: exam_id ends in `-c` (e.g. `zz-2026-c`)
16
- * - SIMOC / Paper M: exam_id starts `simoc-` (e.g. `simoc-2026-g6`)
17
- */
18
- export declare function examIdSkipsSetupGate(examId: string): boolean;
19
- export {};
@@ -1,42 +0,0 @@
1
- import type { ExamState } from '../types/index.js';
2
- /**
3
- * Write a practical question's attachedData blob to the contestant's
4
- * workspace so they can use shell / python / editor tooling on it without
5
- * pasting the whole base64 back in on the command line.
6
- *
7
- * Because `!shell` / `!python3` inside the REPL runs in the sandbox
8
- * container (which only mounts its own challenges volume, not the host's
9
- * workspace), we also mirror the file into the sandbox at
10
- * /home/competitor/challenges/q<n>.txt via `docker cp` when the sandbox
11
- * is running. Returns the path students should reference —
12
- * sandbox-visible when the sandbox is up, else host — so the
13
- * "Ways to solve" block points at a file that actually exists wherever
14
- * `!command` executes.
15
- *
16
- * Silent on failure: null means no workspace file was materialized, and
17
- * callers skip the solve-paths guidance.
18
- */
19
- /**
20
- * Map a practical question's TYPE to the AI chat command a contestant should
21
- * enter for it. The practical section is interleaved (standard paper:
22
- * Q38 ctf4ai, Q39 ai4ctf, Q40 ctf4ai; Paper E: Q37-46 ai4ctf, Q47-48 ctf4ai),
23
- * so routing by question NUMBER misroutes questions to the wrong engine — the
24
- * root cause behind both the old printSectionIntro bug and the practical
25
- * answer-nudge in repl.ts. Always route by type.
26
- *
27
- * Returns null for MCQ / short-answer / unknown types, and (when not a real
28
- * exam, i.e. the demo) since the demo has no live AI chat sections.
29
- */
30
- export declare function practicalChatCommand(qType: string | undefined, isReal: boolean): 'ai4ctf' | 'ctf4ai' | 'ctf4eai' | null;
31
- export declare function materializeAttachedData(qNum: number, data: string | undefined): string | null;
32
- export declare function getRealExamState(): ExamState | null;
33
- export declare function getDemoState(): ExamState | null;
34
- export declare function getExamState(): ExamState | null;
35
- export declare function saveExamState(state: ExamState): void;
36
- export declare function clearExamState(examId?: string): void;
37
- export declare function getExamDeadline(): Date | null;
38
- /** Deadline read from the real-exam state file specifically, bypassing
39
- * getExamState()'s real-over-demo priority. Used by `exam demo` to
40
- * detect a parked expired real exam that would otherwise block demo. */
41
- export declare function getRealExamDeadline(): Date | null;
42
- export declare function refetchQuestionDataIfStale(): Promise<ExamState | null>;
@@ -1,16 +0,0 @@
1
- import type { ChallengeContext } from '../types/index.js';
2
- /**
3
- * @deprecated Runtime translation is disabled. Translations are pre-baked
4
- * at build time via `panda/translate-*.js` scripts and shipped in
5
- * `translations/<lang>/` — CLI never translates at runtime.
6
- */
7
- export declare function translateText(_text: string, _targetLang: string): Promise<string>;
8
- export declare function setApiKey(key: string): void;
9
- export declare function createChatSession(context?: ChallengeContext, customSystemPrompt?: string): Promise<{
10
- sendMessage: (msg: string) => Promise<{
11
- text: string;
12
- tokensUsed: number;
13
- accountSpent?: number;
14
- accountCap?: number;
15
- }>;
16
- }>;
package/dist/lib/gpu.d.ts DELETED
@@ -1,51 +0,0 @@
1
- /**
2
- * gpu — pure core of the M2 GPU-lease client (Kaggle practice arena).
3
- *
4
- * The control plane is server-authoritative (design §5): the CLI POSTs
5
- * lease/status/release and renders what it gets back; quota, max-1 and
6
- * timeout-kill all live server-side (panda/kaggle/gpu_api.py). This module is
7
- * the pure part — response parsing, connect-field validation, ssh arg
8
- * building — so the trust boundary is unit-tested: a lease response can NEVER
9
- * smuggle shell into the ssh command (every field is format-whitelisted and
10
- * the remote command string is built by buildRemoteBridgeCommand's quoting).
11
- *
12
- * Transports: 'ssh' (real GPU box) and 'local' (dev loop — spawns the bridge
13
- * under a local shell; the command layer only honours it when the student
14
- * explicitly pointed ICOA_GPU_SERVER at a dev broker, so a hostile prod
15
- * response cannot make the CLI spawn local processes).
16
- */
17
- export interface GpuLease {
18
- state: 'ready' | 'queued' | 'none' | 'error';
19
- transport?: 'ssh' | 'local';
20
- host?: string;
21
- port?: number;
22
- user?: string;
23
- /** Remote venv python that runs the kernel bridge. */
24
- python?: string;
25
- /** Fixed dataset mount root on the box (design §4: /data/kaggle). */
26
- dataRoot?: string;
27
- /** Per-session workspace on the box (submission.csv lands here). */
28
- outDir?: string;
29
- /** SSH private key for this lease (PEM, from the broker). */
30
- keyPem?: string;
31
- timeLeftSec?: number;
32
- queuePosition?: number;
33
- estimatedWaitSec?: number;
34
- message?: string;
35
- }
36
- /** Parse a broker response ({success,data:{...}} or bare) into a GpuLease. */
37
- export declare function parseLeaseResponse(resp: unknown): GpuLease;
38
- /**
39
- * Trust boundary: a ready lease's connect fields must be plainly-shaped
40
- * before they go anywhere near a spawn. Returns the list of problems
41
- * (empty = safe to connect).
42
- */
43
- export declare function leaseConnectProblems(l: GpuLease): string[];
44
- /**
45
- * ssh argv for a validated lease (spawn-array — no local shell ever parses
46
- * any of this). `remoteCommand` is the single bridge command from
47
- * buildRemoteBridgeCommand; `keyPath` is where the caller wrote keyPem (0600).
48
- */
49
- export declare function buildSshArgs(l: GpuLease, keyPath: string, remoteCommand: string): string[];
50
- /** `⏳ GPU queue: #3 · ~6 min` — the student-facing queue line (design §5). */
51
- export declare function queueLine(l: GpuLease): string;
@@ -1,35 +0,0 @@
1
- export interface HttpOptions extends RequestInit {
2
- /** Abort after this long. Default 15s — long enough for a slow exam upload,
3
- * short enough that a student notices something is wrong. */
4
- timeoutMs?: number;
5
- /** Extra attempts after the first. Default 2 for GET/HEAD, 0 otherwise. */
6
- retries?: number;
7
- /** Declare a non-GET request safe to replay (pure reads, pings, idempotent
8
- * upserts keyed by the caller). Without this, writes are sent exactly once. */
9
- idempotent?: boolean;
10
- }
11
- interface Deps {
12
- fetch: typeof globalThis.fetch;
13
- sleep: (ms: number) => Promise<void>;
14
- }
15
- export declare function isOwnTimeout(err: unknown): boolean;
16
- /**
17
- * 429 = the server explicitly refused to process this request, so replaying is
18
- * safe by definition. 502/503/504 come from a proxy that could not reach the
19
- * origin or get an answer from it, so the request most likely never applied.
20
- *
21
- * 500 is deliberately absent: it means the origin DID receive the request and
22
- * blew up somewhere unknown — possibly after committing. Retrying a 500 is the
23
- * classic way to double-charge, double-submit, or double-score.
24
- */
25
- export declare function isRetryableStatus(status: number): boolean;
26
- /**
27
- * How long to wait before attempt N+1 (0-indexed). A `Retry-After` header wins
28
- * outright — the server knows its own recovery window better than we do.
29
- * Otherwise exponential backoff with ±30% jitter so a roomful of clients that
30
- * all failed on the same server blip does not come back in lockstep.
31
- */
32
- export declare function retryDelayMs(attempt: number, response?: Response): number;
33
- export declare function isCheapTransportFailure(err: unknown): boolean;
34
- export declare function httpFetch(url: string, opts?: HttpOptions, deps?: Deps): Promise<Response>;
35
- export {};