icoa-cli 2.19.357 → 2.19.359
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/ctf.js +1 -787
- package/dist/commands/ctf4ai-demo.js +1 -1
- package/dist/commands/ctf4vla.js +1 -1
- package/dist/commands/demo2.js +1 -1502
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +1 -0
- package/dist/commands/exam.js +1 -1
- package/dist/commands/files.js +1 -59
- package/dist/commands/lang.js +1 -202
- package/dist/commands/log.js +1 -171
- package/dist/commands/shell.js +1 -151
- package/dist/commands/sim.js +1 -389
- package/dist/index.js +1 -355
- package/dist/lib/access.js +1 -184
- package/dist/lib/aienv.js +1 -205
- package/dist/lib/arena-submit.js +1 -21
- package/dist/lib/banner.js +1 -31
- package/dist/lib/budget.js +1 -6
- package/dist/lib/challenge-dir.js +1 -16
- package/dist/lib/colors.js +1 -17
- package/dist/lib/comms.js +1 -212
- package/dist/lib/config.js +1 -93
- package/dist/lib/countdown.js +1 -43
- package/dist/lib/country-lang.js +1 -39
- package/dist/lib/ctfd-client.js +1 -417
- package/dist/lib/demo-exam.js +1 -478
- package/dist/lib/demo-flags.js +1 -27
- package/dist/lib/demo-stats.js +1 -62
- package/dist/lib/demo2-progress.js +1 -102
- package/dist/lib/docker-probe.js +1 -118
- package/dist/lib/editor-spawn.js +1 -53
- package/dist/lib/exam-client.js +1 -54
- package/dist/lib/exam-sandbox.js +1 -201
- package/dist/lib/exam-setup.js +1 -36
- package/dist/lib/exam-state.js +1 -273
- package/dist/lib/gemini.js +1 -247
- package/dist/lib/i18n.js +1 -302
- package/dist/lib/integrity-snapshot.js +1 -88
- package/dist/lib/interactive-spawn.js +1 -55
- package/dist/lib/ipynb-input.js +1 -65
- package/dist/lib/kernel-protocol.js +1 -88
- package/dist/lib/kernel.js +2 -146
- package/dist/lib/learn-curricula.js +1 -309
- package/dist/lib/learn-i18n.js +1 -184
- package/dist/lib/learn-input.js +1 -101
- package/dist/lib/learn-render.js +1 -863
- package/dist/lib/learn-state.js +1 -103
- package/dist/lib/log-sync.js +1 -155
- package/dist/lib/logger.js +1 -49
- package/dist/lib/main-rl.js +1 -7
- package/dist/lib/menu-nav.js +1 -105
- package/dist/lib/notebook-doc.js +1 -137
- package/dist/lib/open-file.js +1 -55
- package/dist/lib/paper-upgrade.js +1 -119
- package/dist/lib/platform.js +1 -99
- package/dist/lib/render-card.js +1 -112
- package/dist/lib/repl-asker.js +1 -67
- package/dist/lib/sample-runner.js +1 -227
- package/dist/lib/sandbox.js +1 -144
- package/dist/lib/shell-split.js +1 -69
- package/dist/lib/sim-cooldown.js +1 -75
- package/dist/lib/theme.js +1 -119
- package/dist/lib/token-format.js +1 -74
- package/dist/lib/tool-man.js +1 -418
- package/dist/lib/toolset-hash.js +1 -48
- package/dist/lib/translation.js +1 -80
- package/dist/lib/translations-fetcher.js +1 -95
- package/dist/lib/ui.js +1 -99
- package/dist/lib/update-check.js +1 -114
- package/dist/lib/version.js +1 -24
- package/dist/postinstall.js +1 -48
- package/dist/repl.js +1 -2391
- package/dist/types/index.js +1 -63
- package/package.json +1 -1
package/dist/lib/learn-input.js
CHANGED
|
@@ -1,101 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Fuzzy resolver for the 🧠 Learn token-input picker.
|
|
3
|
-
*
|
|
4
|
-
* Problem: a first-time newbie at the prompt:
|
|
5
|
-
*
|
|
6
|
-
* Learn token (or blank to go back): _
|
|
7
|
-
*
|
|
8
|
-
* naturally tries any of the following (none of which used to work):
|
|
9
|
-
*
|
|
10
|
-
* learn LEARNDEMO01 (echoes the command they expect to type)
|
|
11
|
-
* ctf4eai (the track-name they saw in the list)
|
|
12
|
-
* 3 (the third listed option)
|
|
13
|
-
* learndemo01 (lower-case the token they saw)
|
|
14
|
-
* demo (it said "Free 12-card demos:")
|
|
15
|
-
*
|
|
16
|
-
* Only the correct input — bare upper-case LEARNDEMO01 — used to work.
|
|
17
|
-
* That's a >20% bounce point on the new-user funnel. This resolver maps
|
|
18
|
-
* all the above to the correct token (or returns a friendly hint).
|
|
19
|
-
*
|
|
20
|
-
* See [[reference-newbie-path-invariant]] + CLAUDE.md "Newbie Path
|
|
21
|
-
* Invariant" rule. Gold standard for inline guidance + accept-many-
|
|
22
|
-
* variants is the pre-v2.19.180 national-selection demo flow.
|
|
23
|
-
*/
|
|
24
|
-
const DEMO_BY_TRACK = {
|
|
25
|
-
ai4ctf: 'AI4CTFDEMO01',
|
|
26
|
-
ctf4ai: 'CTF4AIDEMO01',
|
|
27
|
-
ctf4eai: 'LEARNDEMO01',
|
|
28
|
-
// ".-12" variants (curriculum-id form)
|
|
29
|
-
'ai4ctf-12': 'AI4CTFDEMO01',
|
|
30
|
-
'ctf4ai-12': 'CTF4AIDEMO01',
|
|
31
|
-
'ctf4eai-12': 'LEARNDEMO01',
|
|
32
|
-
// Common aliases / typos
|
|
33
|
-
ctf4vla: 'LEARNDEMO01',
|
|
34
|
-
vla: 'LEARNDEMO01',
|
|
35
|
-
embodied: 'LEARNDEMO01',
|
|
36
|
-
ai4ctfdemo: 'AI4CTFDEMO01',
|
|
37
|
-
ctf4aidemo: 'CTF4AIDEMO01',
|
|
38
|
-
learndemo: 'LEARNDEMO01',
|
|
39
|
-
};
|
|
40
|
-
// Numeric shortcuts mirror the order shown in the picker UI.
|
|
41
|
-
const DEMO_BY_NUMBER = {
|
|
42
|
-
'1': 'AI4CTFDEMO01',
|
|
43
|
-
'2': 'CTF4AIDEMO01',
|
|
44
|
-
'3': 'LEARNDEMO01',
|
|
45
|
-
};
|
|
46
|
-
// Any 2-letter cohort prefix + 6+ chars. Generic on purpose: the prefix list
|
|
47
|
-
// (AC/CA/EA/EI/IO/IA/PH/MP/…) lives in panda/bootstrap-learn-tokens.py and the
|
|
48
|
-
// server is authoritative — never hard-code it here (new tracks would bounce).
|
|
49
|
-
const COHORT_TOKEN_RE = /^[A-Z]{2}[A-Z0-9]{6,}$/;
|
|
50
|
-
const DEMO_TOKEN_RE = /^(AI4CTFDEMO\d+|CTF4AIDEMO\d+|LEARNDEMO\d+)$/;
|
|
51
|
-
export function resolveLearnInput(raw) {
|
|
52
|
-
const trimmed = raw.trim();
|
|
53
|
-
if (!trimmed)
|
|
54
|
-
return { kind: 'back' };
|
|
55
|
-
// Strip common command-echo prefixes the user types out of muscle memory.
|
|
56
|
-
// Case-insensitive: "learn ", "icoa learn ", "/learn ", "> learn ".
|
|
57
|
-
const core = trimmed.replace(/^\s*(?:[/>])?\s*(?:icoa\s+)?learn\s+/i, '').trim();
|
|
58
|
-
if (!core) {
|
|
59
|
-
return {
|
|
60
|
-
kind: 'ambiguous',
|
|
61
|
-
hint: 'Type just the token (e.g. LEARNDEMO01) or one of: ai4ctf / ctf4ai / ctf4eai',
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
// Numeric shortcut (1/2/3 → demo by list order).
|
|
65
|
-
if (DEMO_BY_NUMBER[core])
|
|
66
|
-
return { kind: 'token', token: DEMO_BY_NUMBER[core] };
|
|
67
|
-
// Track-name / alias lookup (case-insensitive).
|
|
68
|
-
const lowered = core.toLowerCase();
|
|
69
|
-
if (DEMO_BY_TRACK[lowered])
|
|
70
|
-
return { kind: 'token', token: DEMO_BY_TRACK[lowered] };
|
|
71
|
-
// "demo" alone is ambiguous — there are three. Ask which.
|
|
72
|
-
if (lowered === 'demo' || lowered === 'demos') {
|
|
73
|
-
return {
|
|
74
|
-
kind: 'ambiguous',
|
|
75
|
-
hint: 'Which demo? Type: 1 (ai4ctf) / 2 (ctf4ai) / 3 (ctf4eai)',
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
// Looks like a literal token — uppercase + validate format. Reject if
|
|
79
|
-
// it contains internal whitespace (multi-word input like "something
|
|
80
|
-
// random" is clearly NOT a token).
|
|
81
|
-
if (/\s/.test(core)) {
|
|
82
|
-
return {
|
|
83
|
-
kind: 'unknown',
|
|
84
|
-
hint: `Don't recognize "${trimmed}". Try one of: ai4ctf / ctf4ai / ctf4eai (for the free demos), 1/2/3, or paste your AC/CA/EA/EI/IO/IA + 8 chars cohort token. Blank to go back.`,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
const upper = core.toUpperCase();
|
|
88
|
-
if (DEMO_TOKEN_RE.test(upper))
|
|
89
|
-
return { kind: 'token', token: upper };
|
|
90
|
-
if (COHORT_TOKEN_RE.test(upper))
|
|
91
|
-
return { kind: 'token', token: upper };
|
|
92
|
-
// Last-ditch: alphanumeric + 8+ chars (no spaces by definition since we
|
|
93
|
-
// returned above) → optimistic try (server will reject cleanly if invalid).
|
|
94
|
-
// Better than refusing a typo'd cohort token at the client.
|
|
95
|
-
if (/^[A-Z0-9]{8,}$/.test(upper))
|
|
96
|
-
return { kind: 'token', token: upper };
|
|
97
|
-
return {
|
|
98
|
-
kind: 'unknown',
|
|
99
|
-
hint: `Don't recognize "${trimmed}". Try one of: ai4ctf / ctf4ai / ctf4eai (for the free demos), 1/2/3, or paste your AC/CA/EA/EI/IO/IA + 8 chars cohort token. Blank to go back.`,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
1
|
+
const t={ai4ctf:"AI4CTFDEMO01",ctf4ai:"CTF4AIDEMO01",ctf4eai:"LEARNDEMO01","ai4ctf-12":"AI4CTFDEMO01","ctf4ai-12":"CTF4AIDEMO01","ctf4eai-12":"LEARNDEMO01",ctf4vla:"LEARNDEMO01",vla:"LEARNDEMO01",embodied:"LEARNDEMO01",ai4ctfdemo:"AI4CTFDEMO01",ctf4aidemo:"CTF4AIDEMO01",learndemo:"LEARNDEMO01"},e={1:"AI4CTFDEMO01",2:"CTF4AIDEMO01",3:"LEARNDEMO01"},o=/^[A-Z]{2}[A-Z0-9]{6,}$/,n=/^(AI4CTFDEMO\d+|CTF4AIDEMO\d+|LEARNDEMO\d+)$/;export function resolveLearnInput(i){const r=i.trim();if(!r)return{kind:"back"};const a=r.replace(/^\s*(?:[/>])?\s*(?:icoa\s+)?learn\s+/i,"").trim();if(!a)return{kind:"ambiguous",hint:"Type just the token (e.g. LEARNDEMO01) or one of: ai4ctf / ctf4ai / ctf4eai"};if(e[a])return{kind:"token",token:e[a]};const c=a.toLowerCase();if(t[c])return{kind:"token",token:t[c]};if("demo"===c||"demos"===c)return{kind:"ambiguous",hint:"Which demo? Type: 1 (ai4ctf) / 2 (ctf4ai) / 3 (ctf4eai)"};if(/\s/.test(a))return{kind:"unknown",hint:`Don't recognize "${r}". Try one of: ai4ctf / ctf4ai / ctf4eai (for the free demos), 1/2/3, or paste your AC/CA/EA/EI/IO/IA + 8 chars cohort token. Blank to go back.`};const f=a.toUpperCase();return n.test(f)||o.test(f)||/^[A-Z0-9]{8,}$/.test(f)?{kind:"token",token:f}:{kind:"unknown",hint:`Don't recognize "${r}". Try one of: ai4ctf / ctf4ai / ctf4eai (for the free demos), 1/2/3, or paste your AC/CA/EA/EI/IO/IA + 8 chars cohort token. Blank to go back.`}}
|