icoa-cli 2.17.0 → 2.17.1
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 +7 -0
- package/dist/commands/ctf4ai-demo.js +12 -0
- package/dist/commands/exam.js +16 -0
- package/package.json +1 -1
package/dist/commands/ai4ctf.js
CHANGED
|
@@ -35,6 +35,13 @@ export async function handleChatMessage(input) {
|
|
|
35
35
|
if (input === 'exit' || input === 'back' || input === 'quit') {
|
|
36
36
|
chatActive = false;
|
|
37
37
|
chatSession = null;
|
|
38
|
+
// Anonymous stats
|
|
39
|
+
fetch('https://practice.icoa2026.au:9090/api/icoa/demo-stats', {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers: { 'Content-Type': 'application/json' },
|
|
42
|
+
body: JSON.stringify({ type: 'ai4ctf', tokensUsed: chatTokensUsed, timestamp: new Date().toISOString() }),
|
|
43
|
+
signal: AbortSignal.timeout(5000),
|
|
44
|
+
}).catch(() => { });
|
|
38
45
|
console.log();
|
|
39
46
|
console.log(chalk.gray(' ─────────────────────────────────────────'));
|
|
40
47
|
console.log(chalk.white(' AI4CTF Session Report'));
|
|
@@ -27,6 +27,12 @@ export async function handleCtf4aiMessage(input) {
|
|
|
27
27
|
if (input === 'exit' || input === 'back' || input === 'quit') {
|
|
28
28
|
ctf4aiActive = false;
|
|
29
29
|
ctf4aiSession = null;
|
|
30
|
+
fetch('https://practice.icoa2026.au:9090/api/icoa/demo-stats', {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: { 'Content-Type': 'application/json' },
|
|
33
|
+
body: JSON.stringify({ type: 'ctf4ai', solved: false, tokensUsed: ctf4aiTokens, timestamp: new Date().toISOString() }),
|
|
34
|
+
signal: AbortSignal.timeout(5000),
|
|
35
|
+
}).catch(() => { });
|
|
30
36
|
console.log();
|
|
31
37
|
console.log(chalk.gray(' CTF4AI challenge ended.'));
|
|
32
38
|
console.log(chalk.gray(` Tokens used: ${ctf4aiTokens}/${CTF4AI_TOKEN_LIMIT}`));
|
|
@@ -67,6 +73,12 @@ export async function handleCtf4aiMessage(input) {
|
|
|
67
73
|
console.log();
|
|
68
74
|
ctf4aiActive = false;
|
|
69
75
|
ctf4aiSession = null;
|
|
76
|
+
fetch('https://practice.icoa2026.au:9090/api/icoa/demo-stats', {
|
|
77
|
+
method: 'POST',
|
|
78
|
+
headers: { 'Content-Type': 'application/json' },
|
|
79
|
+
body: JSON.stringify({ type: 'ctf4ai', solved: true, tokensUsed: ctf4aiTokens, timestamp: new Date().toISOString() }),
|
|
80
|
+
signal: AbortSignal.timeout(5000),
|
|
81
|
+
}).catch(() => { });
|
|
70
82
|
return 'solved';
|
|
71
83
|
}
|
|
72
84
|
return 'continue';
|
package/dist/commands/exam.js
CHANGED
|
@@ -581,6 +581,22 @@ export function registerExamCommand(program) {
|
|
|
581
581
|
}
|
|
582
582
|
drawProgress(100, 'Complete!');
|
|
583
583
|
console.log();
|
|
584
|
+
// Anonymous stats (fire-and-forget)
|
|
585
|
+
const helpInfo = getHelpState(state);
|
|
586
|
+
const statsLang = getConfig().language || 'en';
|
|
587
|
+
fetch('https://practice.icoa2026.au:9090/api/icoa/demo-stats', {
|
|
588
|
+
method: 'POST',
|
|
589
|
+
headers: { 'Content-Type': 'application/json' },
|
|
590
|
+
body: JSON.stringify({
|
|
591
|
+
score,
|
|
592
|
+
total: state.questions.length,
|
|
593
|
+
lang: statsLang,
|
|
594
|
+
helpUsed: helpInfo.used,
|
|
595
|
+
helpMax: helpInfo.max,
|
|
596
|
+
timestamp: new Date().toISOString(),
|
|
597
|
+
}),
|
|
598
|
+
signal: AbortSignal.timeout(5000),
|
|
599
|
+
}).catch(() => { });
|
|
584
600
|
clearExamState();
|
|
585
601
|
const pct = Math.round(score / state.questions.length * 100);
|
|
586
602
|
console.log();
|