icoa-cli 2.19.458 → 2.19.460

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 (162) 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/commands/ref.js +1 -1
  7. package/dist/lib/lazy-assets.js +1 -0
  8. package/dist/lib/py-syntax.js +1 -1
  9. package/package.json +1 -2
  10. package/dist/commands/ai4ctf.d.ts +0 -4
  11. package/dist/commands/ai4ioai.d.ts +0 -29
  12. package/dist/commands/aienv.d.ts +0 -23
  13. package/dist/commands/arena-eai.d.ts +0 -37
  14. package/dist/commands/arena.d.ts +0 -8
  15. package/dist/commands/board.d.ts +0 -2
  16. package/dist/commands/challenge.d.ts +0 -9
  17. package/dist/commands/comms.d.ts +0 -2
  18. package/dist/commands/connect.d.ts +0 -15
  19. package/dist/commands/ctf.d.ts +0 -3
  20. package/dist/commands/ctf4ai-demo.d.ts +0 -4
  21. package/dist/commands/ctf4vla.d.ts +0 -34
  22. package/dist/commands/demo2.d.ts +0 -31
  23. package/dist/commands/demo4.d.ts +0 -3
  24. package/dist/commands/demo5.d.ts +0 -3
  25. package/dist/commands/doctor.d.ts +0 -2
  26. package/dist/commands/env.d.ts +0 -5
  27. package/dist/commands/exam.d.ts +0 -13
  28. package/dist/commands/files.d.ts +0 -2
  29. package/dist/commands/ioailab.d.ts +0 -1
  30. package/dist/commands/ipynb.d.ts +0 -20
  31. package/dist/commands/kaggle.d.ts +0 -12
  32. package/dist/commands/lang.d.ts +0 -2
  33. package/dist/commands/learn.d.ts +0 -16
  34. package/dist/commands/log.d.ts +0 -2
  35. package/dist/commands/note.d.ts +0 -25
  36. package/dist/commands/ref.d.ts +0 -2
  37. package/dist/commands/setup.d.ts +0 -2
  38. package/dist/commands/shell.d.ts +0 -35
  39. package/dist/commands/sim.d.ts +0 -32
  40. package/dist/commands/sprint.d.ts +0 -7
  41. package/dist/commands/teleload.d.ts +0 -8
  42. package/dist/commands/theme.d.ts +0 -13
  43. package/dist/commands/view.d.ts +0 -2
  44. package/dist/index.d.ts +0 -2
  45. package/dist/lib/access.d.ts +0 -14
  46. package/dist/lib/aienv.d.ts +0 -118
  47. package/dist/lib/arena-edit-dynamics.d.ts +0 -55
  48. package/dist/lib/arena-submit.d.ts +0 -23
  49. package/dist/lib/banner.d.ts +0 -9
  50. package/dist/lib/bgtasks.d.ts +0 -21
  51. package/dist/lib/board-render.d.ts +0 -14
  52. package/dist/lib/budget.d.ts +0 -1
  53. package/dist/lib/card-engine.d.ts +0 -45
  54. package/dist/lib/challenge-dir.d.ts +0 -1
  55. package/dist/lib/colors.d.ts +0 -11
  56. package/dist/lib/commands.d.ts +0 -53
  57. package/dist/lib/comms.d.ts +0 -40
  58. package/dist/lib/config.d.ts +0 -8
  59. package/dist/lib/countdown.d.ts +0 -4
  60. package/dist/lib/country-lang.d.ts +0 -1
  61. package/dist/lib/ctfd-client.d.ts +0 -33
  62. package/dist/lib/deck-cooldown.d.ts +0 -7
  63. package/dist/lib/demo-exam.d.ts +0 -28
  64. package/dist/lib/demo-flags.d.ts +0 -8
  65. package/dist/lib/demo-stats.d.ts +0 -17
  66. package/dist/lib/docker-probe.d.ts +0 -45
  67. package/dist/lib/drafts.d.ts +0 -11
  68. package/dist/lib/editor-spawn.d.ts +0 -28
  69. package/dist/lib/exam-client.d.ts +0 -15
  70. package/dist/lib/exam-sandbox.d.ts +0 -15
  71. package/dist/lib/exam-setup.d.ts +0 -19
  72. package/dist/lib/exam-state.d.ts +0 -42
  73. package/dist/lib/gemini.d.ts +0 -16
  74. package/dist/lib/gpu.d.ts +0 -51
  75. package/dist/lib/http.d.ts +0 -35
  76. package/dist/lib/i18n.d.ts +0 -215
  77. package/dist/lib/input-dynamics.d.ts +0 -38
  78. package/dist/lib/integrity-snapshot.d.ts +0 -22
  79. package/dist/lib/interactive-spawn.d.ts +0 -25
  80. package/dist/lib/ipynb-input.d.ts +0 -25
  81. package/dist/lib/kaggle.d.ts +0 -115
  82. package/dist/lib/kernel-protocol.d.ts +0 -92
  83. package/dist/lib/kernel.d.ts +0 -81
  84. package/dist/lib/learn-ai.d.ts +0 -159
  85. package/dist/lib/learn-contest.d.ts +0 -141
  86. package/dist/lib/learn-curricula.d.ts +0 -274
  87. package/dist/lib/learn-i18n.d.ts +0 -8
  88. package/dist/lib/learn-input.d.ts +0 -40
  89. package/dist/lib/learn-outcome.d.ts +0 -1
  90. package/dist/lib/learn-render.d.ts +0 -107
  91. package/dist/lib/learn-replies.d.ts +0 -42
  92. package/dist/lib/learn-state.d.ts +0 -66
  93. package/dist/lib/log-sync.d.ts +0 -2
  94. package/dist/lib/logger.d.ts +0 -12
  95. package/dist/lib/main-rl.d.ts +0 -20
  96. package/dist/lib/md-term.d.ts +0 -17
  97. package/dist/lib/menu-nav.d.ts +0 -25
  98. package/dist/lib/notebook-doc.d.ts +0 -38
  99. package/dist/lib/open-file.d.ts +0 -35
  100. package/dist/lib/paper-upgrade.d.ts +0 -27
  101. package/dist/lib/platform.d.ts +0 -110
  102. package/dist/lib/py-syntax.d.ts +0 -36
  103. package/dist/lib/render-card.d.ts +0 -17
  104. package/dist/lib/repl-asker.d.ts +0 -7
  105. package/dist/lib/resume.d.ts +0 -7
  106. package/dist/lib/sample-runner.d.ts +0 -14
  107. package/dist/lib/sandbox.d.ts +0 -30
  108. package/dist/lib/secure-store.d.ts +0 -18
  109. package/dist/lib/shell-split.d.ts +0 -17
  110. package/dist/lib/sim-cooldown.d.ts +0 -14
  111. package/dist/lib/sprint-meta.d.ts +0 -72
  112. package/dist/lib/statusline.d.ts +0 -1
  113. package/dist/lib/terminal-cleanup.d.ts +0 -35
  114. package/dist/lib/theme.d.ts +0 -4
  115. package/dist/lib/token-format.d.ts +0 -41
  116. package/dist/lib/tool-man.d.ts +0 -11
  117. package/dist/lib/toolset-hash.d.ts +0 -15
  118. package/dist/lib/translation.d.ts +0 -1
  119. package/dist/lib/translations-fetcher.d.ts +0 -6
  120. package/dist/lib/ui.d.ts +0 -12
  121. package/dist/lib/update-check.d.ts +0 -1
  122. package/dist/lib/version.d.ts +0 -8
  123. package/dist/repl.d.ts +0 -4
  124. package/dist/types/index.d.ts +0 -221
  125. package/refs/ROPgadget.txt +0 -67
  126. package/refs/base64.txt +0 -63
  127. package/refs/bash.txt +0 -79
  128. package/refs/binwalk.txt +0 -43
  129. package/refs/bs4.txt +0 -61
  130. package/refs/checksec.txt +0 -57
  131. package/refs/curl.txt +0 -73
  132. package/refs/cyberchef.txt +0 -78
  133. package/refs/exiftool.txt +0 -50
  134. package/refs/ffuf.txt +0 -73
  135. package/refs/gcc.txt +0 -66
  136. package/refs/gdb.txt +0 -83
  137. package/refs/hashcat.txt +0 -64
  138. package/refs/hint.txt +0 -48
  139. package/refs/icoa.txt +0 -72
  140. package/refs/john.txt +0 -74
  141. package/refs/linux.txt +0 -58
  142. package/refs/nc.txt +0 -64
  143. package/refs/nmap.txt +0 -57
  144. package/refs/numpy.txt +0 -59
  145. package/refs/openssl.txt +0 -75
  146. package/refs/pillow.txt +0 -67
  147. package/refs/pwntools.txt +0 -79
  148. package/refs/pycrypto.txt +0 -77
  149. package/refs/python.txt +0 -103
  150. package/refs/r2.txt +0 -85
  151. package/refs/regex.txt +0 -73
  152. package/refs/requests.txt +0 -83
  153. package/refs/rules.txt +0 -28
  154. package/refs/scapy.txt +0 -80
  155. package/refs/sqlmap.txt +0 -69
  156. package/refs/steghide.txt +0 -71
  157. package/refs/struct.txt +0 -61
  158. package/refs/sympy.txt +0 -77
  159. package/refs/tshark.txt +0 -65
  160. package/refs/vim.txt +0 -74
  161. package/refs/volatility.txt +0 -41
  162. package/refs/z3.txt +0 -78
@@ -1,215 +0,0 @@
1
- type Strings = Partial<typeof EN>;
2
- export declare const EN: {
3
- howToPlay: string;
4
- htpAnswer: string;
5
- htpHelp: string;
6
- htpNav: string;
7
- htpMoreHelp: string;
8
- htpBack: string;
9
- htpLang: string;
10
- egg3: string;
11
- egg5: string;
12
- egg7: string;
13
- egg9: string;
14
- egg11: string;
15
- egg13: string;
16
- egg15: string;
17
- answerThis: string;
18
- helpRemove: string;
19
- helpUsedUp: string;
20
- helpAllUsed: string;
21
- wrong: string;
22
- qTutorial: string;
23
- qTutorialBlock: string;
24
- qTutorialRequired: string;
25
- allAnswered: string;
26
- typeSubmit: string;
27
- autoSubmitting: string;
28
- grading: string;
29
- complete: string;
30
- passed: string;
31
- notPassed: string;
32
- score: string;
33
- incorrectIntro: string;
34
- yourAnswer: string;
35
- correct: string;
36
- perfectScore: string;
37
- theoryDone: string;
38
- theoryDone2: string;
39
- didYouKnow: string;
40
- ctfHistory1: string;
41
- ctfHistory2: string;
42
- ctfHistory3: string;
43
- ctfFlags1: string;
44
- ctfFlags2: string;
45
- ctfFlags3: string;
46
- timeline1: string;
47
- timeline2: string;
48
- timeline3: string;
49
- twoTracks: string;
50
- ai4ctfDesc: string;
51
- ai4ctfSub: string;
52
- ctf4aiDesc: string;
53
- ctf4aiSub: string;
54
- wantToContinue: string;
55
- orBack: string;
56
- ai4ctfTitle: string;
57
- ai4ctfSample: string;
58
- ai4ctfChallenge: string;
59
- ai4ctfIntercepted: string;
60
- ai4ctfDecode: string;
61
- ai4ctfLevels: string;
62
- ai4ctfHintA: string;
63
- ai4ctfHintAUses: string;
64
- ai4ctfHintB: string;
65
- ai4ctfHintBUses: string;
66
- ai4ctfHintC: string;
67
- ai4ctfHintCUses: string;
68
- ai4ctfTryNow: string;
69
- ai4ctfExample: string;
70
- ai4ctfFreeChat: string;
71
- ai4ctfExit: string;
72
- ai4ctfReport: string;
73
- ai4ctfTokens: string;
74
- ai4ctfModel: string;
75
- ai4ctfNext: string;
76
- tokenLimit: string;
77
- ctf4aiTitle: string;
78
- ctf4aiChallenge: string;
79
- ctf4aiIntro1: string;
80
- ctf4aiIntro2: string;
81
- ctf4aiRule: string;
82
- ctf4aiMission: string;
83
- ctf4aiIdeas: string;
84
- ctf4aiIdea1: string;
85
- ctf4aiIdea2: string;
86
- ctf4aiIdea3: string;
87
- ctf4aiIdea4: string;
88
- ctf4aiBudget: string;
89
- ctf4aiQuit: string;
90
- ctf4aiSuccess: string;
91
- ctf4aiDefense: string;
92
- ctf4aiInjection: string;
93
- ctf4aiHeld: string;
94
- reportTitle: string;
95
- reportStage1: string;
96
- reportCompleted: string;
97
- reportStage2: string;
98
- reportExperienced: string;
99
- reportStage2Sub: string;
100
- reportStage2Hints: string;
101
- reportStage3: string;
102
- reportSolved: string;
103
- reportNotSolved: string;
104
- reportRecommend: string;
105
- reportRec1: string;
106
- reportRec2: string;
107
- reportRec3: string;
108
- reportRec4: string;
109
- reportReady: string;
110
- reportNations: string;
111
- reportAbout: string;
112
- reportDemo: string;
113
- continueTitle: string;
114
- continueLevels: string;
115
- continueHints: string;
116
- continueHintA: string;
117
- continueHintB: string;
118
- continueHintC: string;
119
- continueTry: string;
120
- continueChat: string;
121
- continueAfter: string;
122
- ai4ctfCommands: string;
123
- ai4ctfSubmitCmd: string;
124
- ai4ctfShellCmd: string;
125
- ai4ctfEndSession: string;
126
- ai4ctfCorrectFlag: string;
127
- ai4ctfDecoded: string;
128
- ai4ctfWouldEarn: string;
129
- ai4ctfWrongFlag: string;
130
- ai4ctfFlagHint: string;
131
- ai4ctfFoundFlag: string;
132
- ai4ctfThinking: string;
133
- ctf4aiRelaxed: string;
134
- ctf4aiEnded: string;
135
- ctf4aiAlready: string;
136
- ctf4aiPrompt: string;
137
- ctf4aiThinking: string;
138
- readyToTry: string;
139
- forNational: string;
140
- viewRegions: string;
141
- enterExam: string;
142
- htpJump: string;
143
- htpReview: string;
144
- htpSubmit: string;
145
- htpMark: string;
146
- nextLabel: string;
147
- reportRetryCta: string;
148
- reportRetryWrongN: string;
149
- reportRetryWrongNPlural: string;
150
- reportBackHint: string;
151
- reportAboutHint: string;
152
- reportExamSetupHint: string;
153
- ai4ctfExitNextTitle: string;
154
- ai4ctfExitNextSub: string;
155
- ai4ctfExitNextBody: string;
156
- ai4ctfExitCmdNext: string;
157
- ai4ctfExitCmdBack: string;
158
- ai4ctfWelcomeCta: string;
159
- ai4ctfHintNudge: string;
160
- ai4ctfHintTechnique: string;
161
- ai4ctfHintPrinciple: string;
162
- ai4ctfWelcomeNoReveal: string;
163
- ai4ctfOrChat: string;
164
- ai4ctfOrChatExample: string;
165
- ai4ctfCmdHintLine: string;
166
- ai4ctfCmdShellLine: string;
167
- ai4ctfHintABody: string;
168
- ai4ctfHintBBody: string;
169
- ai4ctfHintCBody: string;
170
- ai4ctfHintNextA: string;
171
- ai4ctfHintNextB: string;
172
- ai4ctfHintNextC: string;
173
- examWaysToSolve: string;
174
- examWaysSavedTo: string;
175
- examWaysShell: string;
176
- examWaysPythonRepl: string;
177
- examWaysRefPython: string;
178
- examWaysAi4ctf: string;
179
- examWaysFound: string;
180
- ai4ctfWrapTitle: string;
181
- ai4ctfWrapLine1Head: string;
182
- ai4ctfWrapLine1Body: string;
183
- ai4ctfWrapLine2Head: string;
184
- ai4ctfWrapLine2Body: string;
185
- ai4ctfWrapQuotasTitle: string;
186
- ai4ctfWrapQuotaA: string;
187
- ai4ctfWrapQuotaAHint: string;
188
- ai4ctfWrapQuotaB: string;
189
- ai4ctfWrapQuotaBHint: string;
190
- ai4ctfWrapQuotaC: string;
191
- ai4ctfWrapQuotaCHint: string;
192
- ai4ctfWrapQuotaFooter: string;
193
- ai4ctfWrapNextTitle: string;
194
- ai4ctfWrapNextSub: string;
195
- ai4ctfWrapNextBody: string;
196
- ai4ctfWrapNoProg: string;
197
- ai4ctfWrapTypeCtf4ai: string;
198
- typeAndEnterToBegin: string;
199
- ai4ctfRevealTitle: string;
200
- ai4ctfRevealBody: string;
201
- ai4ctfRevealSeeFlag: string;
202
- ai4ctfRevealThenSubmit: string;
203
- ai4ctfRevealLockNote: string;
204
- ai4ctfLockedTitle: string;
205
- ai4ctfLockedUse: string;
206
- ai4ctfLockedThen: string;
207
- };
208
- /**
209
- * Force (re)load the UI pack for `lang` into the in-memory cache. Call right
210
- * after a fetch (boot / lang switch) so a freshly-downloaded ui.json takes
211
- * effect even if t() already memoized an empty pack for this lang.
212
- */
213
- export declare function loadUiPack(lang: string): void;
214
- export declare function t(key: keyof Strings): string;
215
- export {};
@@ -1,38 +0,0 @@
1
- import type { InputDynamics } from '../types/index.js';
2
- export declare const FOCUS_CARRY_MAX_GAP_MS = 20;
3
- export declare function classifyBurst(interKeyMs: number[]): {
4
- maxBurst: number;
5
- suspectPaste: boolean;
6
- };
7
- export declare function countFocusMarkers(s: string): {
8
- focusIn: number;
9
- focusOut: number;
10
- };
11
- export declare function getFocusState(): 'in' | 'out' | 'unknown';
12
- export declare function consumeFocusEvents(): Array<{
13
- kind: 'focus_in' | 'focus_out';
14
- ts: number;
15
- }>;
16
- export declare function rearmFocusMode(): void;
17
- export declare function stripTerminalMarkers(line: string): string;
18
- export declare function installInputDynamics(enableBracketed?: boolean): void;
19
- export declare function uninstallInputDynamics(): void;
20
- /** Reset focus-probe state to fresh, feed raw chunks through the real onData
21
- * handler in order, and return whatever focus events resulted.
22
- *
23
- * `gapsMs[i]` is the simulated delay BEFORE chunk `i + 1` (i.e. gapsMs[0] is
24
- * the gap between chunk 0 and chunk 1). Omitted/undefined entries default to
25
- * 0ms — back-to-back chunks, exactly what a genuinely torn escape sequence
26
- * looks like. This drives onData's real `nowOverride` parameter (fix round
27
- * 2's staleness bound) with a simulated clock rather than adding a separate
28
- * clock-injection global — the timestamp rides this existing test seam. */
29
- export declare function __feedFocusDataForTest(chunks: string[], gapsMs?: number[]): Array<{
30
- kind: 'focus_in' | 'focus_out';
31
- ts: number;
32
- }>;
33
- /** Feed one synthetic keypress event through the real onKeypress handler. */
34
- export declare function __feedKeypressForTest(key: {
35
- name?: string;
36
- code?: string;
37
- } | undefined): void;
38
- export declare function consumeLineDynamics(): InputDynamics | undefined;
@@ -1,22 +0,0 @@
1
- /**
2
- * Pure payload builder — no I/O, no network. Extracted from
3
- * `postIntegritySnapshot` so the SCRUBBED shape (and the secret-exclusion
4
- * invariant: config.accessToken / config.token never enter this object) is
5
- * unit-testable without a live server or filesystem.
6
- */
7
- export declare function buildSnapshotPayload(cfg: {
8
- deviceFingerprint?: string;
9
- installSalt?: string;
10
- }, budget: {
11
- tokensUsed: number;
12
- tokenCap: number;
13
- }, extras?: {
14
- simCooldown?: unknown;
15
- tokenBindings?: unknown;
16
- }): Record<string, unknown>;
17
- /**
18
- * Fire a scrubbed integrity snapshot to the server. Best-effort, non-blocking,
19
- * and self-swallowing — callers may `await` it inside an existing try/catch
20
- * without risking the submit flow.
21
- */
22
- export declare function postIntegritySnapshot(): Promise<void>;
@@ -1,25 +0,0 @@
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>;
@@ -1,25 +0,0 @@
1
- /**
2
- * ipynb-input — pure cell-input decision logic for the `icoa ipynb` REPL
3
- * (Phase 1 UI of the CLI notebook arena).
4
- *
5
- * IPython-style model: a one-liner runs the moment you press Enter; a block
6
- * (def/for/if/…, an open bracket, or a trailing backslash) keeps accepting
7
- * lines until you end it with a blank line. Kept pure so the rule is unit-
8
- * tested without a kernel or readline.
9
- */
10
- /**
11
- * Does this line open a multi-line block? True when its CODE portion (trailing
12
- * `#` comment stripped) ends with a colon. Naive comment-strip — good enough for
13
- * opener detection (a real block opener never hides its colon in a comment).
14
- */
15
- export declare function isBlockOpener(line: string): boolean;
16
- /**
17
- * Given the lines accumulated SO FAR (including the just-entered line), decide
18
- * whether to execute the cell now or keep taking input.
19
- *
20
- * - empty buffer → nothing to run (false),
21
- * - multi-line cell → execute as soon as the last line is blank,
22
- * - single line → execute unless it opens a block / ends with `\` / has an
23
- * unbalanced bracket.
24
- */
25
- export declare function shouldExecuteCell(lines: string[]): boolean;
@@ -1,115 +0,0 @@
1
- /**
2
- * kaggle — pure core behind `icoa kaggle` (Kaggle-style practice arena, M0).
3
- *
4
- * The student loop this powers: download a competition dataset that the ICOA
5
- * server hosts (never bundled into npm — Thin-Client plane 3), open a starter
6
- * notebook in `icoa ipynb`, run all cells on the LOCAL CPU kernel to produce
7
- * `submission.csv`, then submit it on kaggle.com manually (their own account —
8
- * no Kaggle API, no shared-account ToS risk).
9
- *
10
- * Unlike the arena starter (MODEL cell deliberately blank — that part is
11
- * judged server-side), the Kaggle starter ships a WORKING baseline: nothing
12
- * here is graded by us, Kaggle is the judge, and M0's whole point is that the
13
- * chain runs end-to-end without edits. The student then improves the model.
14
- *
15
- * Pure module: no I/O, no chalk — everything unit-testable.
16
- */
17
- import type { NbCell } from './notebook-doc.js';
18
- export interface KaggleTask {
19
- comp_id: string;
20
- title: string;
21
- metric: string;
22
- /** Student-facing challenge intro: what each row is, what you predict, how
23
- * it's scored. Rendered in the download flow and as the notebook's cell 1. */
24
- description?: string;
25
- kaggle_url?: string | null;
26
- licence?: string;
27
- attribution?: string;
28
- /** M1: base URL of this competition's public Object-Storage prefix. When
29
- * present the client fetches the CSVs straight from the bucket (practice
30
- * serves only this pointer); absent → M0 fallback via the /data bundle. */
31
- data_base?: string | null;
32
- id_col?: string;
33
- target_col?: string;
34
- n_train?: number;
35
- n_test?: number;
36
- /** M2.5 (one engine, two judges): absent/"kaggle" → manual kaggle.com upload;
37
- * "icoa-holdout" → `kaggle submit` scores server-side vs secret labels and
38
- * lands on the ICOA Board. */
39
- judge?: string;
40
- /** Board event this competition's submissions are recorded under. */
41
- board_event?: string | null;
42
- /** Task-4 Audio Classifier: a GPU task whose (large) dataset already lives on
43
- * the GPU box. The client does NOT download data locally — it fetches the
44
- * notebook and points the student at `gpu on`. */
45
- needs_gpu?: boolean;
46
- }
47
- export type KaggleMeta = KaggleTask;
48
- /** Extract the task list from a server response ({success,data:{tasks}} or bare). */
49
- export declare function parseKaggleTaskList(resp: unknown): KaggleTask[];
50
- export interface DataFileUrls {
51
- train: string;
52
- test: string;
53
- sample_submission: string;
54
- }
55
- /** The three CSV URLs under a competition's bucket prefix, or null when the
56
- * server advertised no bucket (client then falls back to the /data bundle). */
57
- export declare function dataFileUrls(task: {
58
- data_base?: string | null;
59
- }): DataFileUrls | null;
60
- /**
61
- * Build the starter notebook cells for a competition. The data dir is baked in
62
- * as an absolute path so the notebook runs from anywhere; the submission cell
63
- * uses the meta's id/target column names so its output matches
64
- * sample_submission.csv byte-for-byte in shape.
65
- */
66
- export declare function buildStarterCells(dir: string, meta: KaggleMeta): NbCell[];
67
- export interface SubmitOutcome {
68
- ok: boolean;
69
- score?: number;
70
- metric?: string;
71
- rank?: number | null;
72
- fieldSize?: number | null;
73
- deduped?: boolean;
74
- boardEvent?: string | null;
75
- /** machine-readable failure: network · bad_token · format · kaggle_judged ·
76
- * event_closed · outside_window · cap_reached · judge_unavailable · … */
77
- reason?: string;
78
- error?: string;
79
- problems?: string[];
80
- }
81
- /** Unwrap the server's judge response ({success,data} envelope or bare). */
82
- export declare function parseSubmitResponse(resp: unknown): SubmitOutcome;
83
- export interface SubmissionVerdict {
84
- ok: boolean;
85
- problems: string[];
86
- }
87
- /**
88
- * Validate a submission CSV against sample_submission.csv the way Kaggle's
89
- * uploader would: same header, same row count, same id set (any order), no
90
- * empty cells. Both files are program-generated simple CSVs (no quoting), so
91
- * naive comma-splitting is safe here.
92
- */
93
- export declare function validateSubmissionText(submission: string, sample: string): SubmissionVerdict;
94
- /**
95
- * Starter cells for a teleload-only task — the 6 sprint tasks whose dataset is a
96
- * pack of images / weights / archives rather than a CSV three-pack.
97
- *
98
- * Those tasks shipped with NO notebook at all: `teleload` unpacked a folder and
99
- * left the student staring at it. This is deliberately an ORIENTATION starter,
100
- * not a solution — it inventories the pack, draws one picture of what is inside,
101
- * and states what has to be built. Shipping the official winning notebook here
102
- * would hand over the answer and delete the exercise.
103
- *
104
- * Same cell model as the CSV starter: markdown for prose, python for work, one
105
- * `plt.show()` so `icoa ipynb` writes exactly one figure and opens one viewer.
106
- */
107
- export declare function buildMediaStarterCells(dir: string, task: {
108
- seq?: number;
109
- title?: string;
110
- topic_cn?: string;
111
- media?: {
112
- kind?: string;
113
- glob?: string;
114
- };
115
- }): NbCell[];
@@ -1,92 +0,0 @@
1
- /**
2
- * Kernel protocol — the pure Node side of the Node ↔ Python-bridge boundary
3
- * (Phase 1 of the CLI notebook arena, see `project_cli_notebook_arena_plan`).
4
- *
5
- * icoa is TypeScript/Node, but Jupyter kernels are driven by `jupyter_client`
6
- * (Python). So a thin Python bridge (shipped alongside, run from the aienv
7
- * venv) owns the kernel and speaks a line-delimited JSON protocol to Node: one
8
- * event object per stdout line. This module parses those lines and folds them
9
- * into renderable cell outputs.
10
- *
11
- * Keeping this layer pure (no I/O) means the wire contract is unit-tested
12
- * without spawning Python — and it stays identical whether the bridge drives a
13
- * LOCAL kernel (Phase 1) or a REMOTE one over a Kernel Gateway (Phase 2/4). The
14
- * Node side never changes; only the bridge's connection does.
15
- */
16
- /** Events the Python bridge emits, one JSON object per stdout line. */
17
- export type KernelEvent = {
18
- type: 'ready';
19
- } | {
20
- type: 'stream';
21
- name: 'stdout' | 'stderr';
22
- text: string;
23
- } | {
24
- type: 'result';
25
- text: string;
26
- data?: Record<string, string>;
27
- } | {
28
- type: 'display';
29
- data: Record<string, string>;
30
- } | {
31
- type: 'error';
32
- ename: string;
33
- evalue: string;
34
- traceback: string[];
35
- } | {
36
- type: 'done';
37
- id: number;
38
- count: number | null;
39
- } | {
40
- type: 'file';
41
- id: number;
42
- data: string;
43
- size: number;
44
- } | {
45
- type: 'file_error';
46
- id: number;
47
- message: string;
48
- } | {
49
- type: 'fatal';
50
- message: string;
51
- };
52
- /** Normalized, render-ready outputs for one executed cell. */
53
- export type CellOutput = {
54
- kind: 'stream';
55
- name: 'stdout' | 'stderr';
56
- text: string;
57
- } | {
58
- kind: 'result';
59
- text: string;
60
- data?: Record<string, string>;
61
- } | {
62
- kind: 'display';
63
- data: Record<string, string>;
64
- } | {
65
- kind: 'error';
66
- ename: string;
67
- evalue: string;
68
- traceback: string[];
69
- };
70
- export interface FoldedCell {
71
- outputs: CellOutput[];
72
- /** false if the cell raised. */
73
- ok: boolean;
74
- /** the kernel's execution_count, or null if no `done` event was seen. */
75
- execCount: number | null;
76
- }
77
- /**
78
- * Parse one stdout line from the bridge into a KernelEvent. Returns null for
79
- * blank lines, non-JSON, or JSON without a recognized `type` (the bridge may
80
- * interleave incidental output; we ignore anything not in the protocol).
81
- */
82
- export declare function parseKernelEvent(line: string): KernelEvent | null;
83
- /**
84
- * Fold a cell's event stream into renderable outputs.
85
- *
86
- * - consecutive `stream` events of the SAME name coalesce into one text block
87
- * (matches Jupyter's stdout/stderr batching → clean rendering),
88
- * - `result` / `display` / `error` pass through as discrete blocks,
89
- * - any `error` sets ok=false,
90
- * - `done.count` becomes execCount (null if the cell never finished).
91
- */
92
- export declare function foldCellOutputs(events: KernelEvent[]): FoldedCell;
@@ -1,81 +0,0 @@
1
- /**
2
- * NotebookKernel — the Node driver for a Jupyter kernel, Phase 1 of the CLI
3
- * notebook arena (see `project_cli_notebook_arena_plan`).
4
- *
5
- * icoa (Node) can't talk to a Jupyter kernel directly, so we spawn a small
6
- * Python BRIDGE under the aienv venv. The bridge owns the kernel via
7
- * `jupyter_client` and exchanges line-delimited JSON with us (parsed by
8
- * `kernel-protocol.ts`). This keeps the kernel a PLUGGABLE backend: Phase 1
9
- * runs it locally; Phase 2/4 point the same bridge at a remote Kernel Gateway
10
- * with zero change to the Node side.
11
- *
12
- * Isolation: the bridge runs as `<venv>/bin/python`, and it registers its
13
- * kernelspec INSIDE the venv's own `share/jupyter` tree — so the kernel is the
14
- * venv interpreter, never the system python3 (BUG3 invariant), and nothing is
15
- * written outside the venv. On posix the kernel uses IPC transport (unix
16
- * sockets) so it opens no TCP ports.
17
- */
18
- import { type FoldedCell } from './kernel-protocol.js';
19
- export declare const KERNEL_BRIDGE_PY: string;
20
- export interface KernelSpawnSpec {
21
- command: string;
22
- args: string[];
23
- }
24
- export interface KernelStartOptions {
25
- /** Local kernel: absolute path to the venv python (from aienvPaths().python). */
26
- venvPython?: string;
27
- /** Local kernel: directory to drop the bridge script in (the venv root). */
28
- venvRoot?: string;
29
- /** Remote kernel (M2 GPU sessions): spawn THIS instead of the local venv
30
- * bridge — typically `ssh … <buildRemoteBridgeCommand(...)>`. The bridge
31
- * rides inside the command itself, so the box needs no pre-provisioned
32
- * bridge file; the wire protocol is identical to the local kernel. */
33
- spawnSpec?: KernelSpawnSpec;
34
- /** Optional: max ms to wait for the kernel `ready` event. */
35
- readyTimeoutMs?: number;
36
- }
37
- /**
38
- * The single shell-command string that runs the bridge on a remote box (the
39
- * one argument after `ssh user@host`). The bridge source travels as base64
40
- * inside a `python -c exec(...)` so any box with the ML venv works — nothing
41
- * to pre-install beyond the venv itself. `env` carries the fixed-path dataset
42
- * pointers (ICOA_KAGGLE_DATA / ICOA_KAGGLE_OUT — the §4 UX invariant), `cwd`
43
- * is the per-session workspace.
44
- */
45
- export declare function buildRemoteBridgeCommand(remotePython: string, env?: Record<string, string>, cwd?: string): string;
46
- /**
47
- * A live notebook kernel. Executes are serialized (one cell at a time, as a
48
- * notebook does) so the line-buffered output demux stays unambiguous.
49
- */
50
- export declare class NotebookKernel {
51
- private proc;
52
- private buf;
53
- private errTail;
54
- private nextId;
55
- private ready;
56
- private pending;
57
- private pendingFetch;
58
- private onReady;
59
- private onExit;
60
- private readonly opts;
61
- private readonly bridgePath;
62
- constructor(opts: KernelStartOptions);
63
- /**
64
- * Write the bridge + spawn it; resolves once the kernel reports `ready`.
65
- * Safe to call again after shutdown() to get a fresh kernel (restart) — all
66
- * per-run state is reset here.
67
- */
68
- start(): Promise<void>;
69
- /** Run one cell; resolves with its folded outputs after the `done` event. */
70
- execute(code: string): Promise<FoldedCell>;
71
- /**
72
- * Fetch one small file from the kernel's filesystem (local box or remote
73
- * GPU box — same pipe either way). Resolves with the raw bytes; rejects on
74
- * missing file or the bridge's 20MB artifact cap.
75
- */
76
- fetchFile(path: string): Promise<Buffer>;
77
- /** Ask the bridge to shut the kernel down; resolves when the process exits. */
78
- shutdown(): Promise<void>;
79
- private onStdout;
80
- private handleEvent;
81
- }