sam-coder-cli 1.0.49 → 1.0.51
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/ANIMATION_ENHANCEMENTS.md +86 -0
- package/bin/agi-animation.js +1437 -755
- package/package.json +1 -1
package/bin/agi-animation.js
CHANGED
|
@@ -1,756 +1,1438 @@
|
|
|
1
|
-
const chalk = require('chalk');
|
|
2
|
-
const { exec } = require('child_process');
|
|
3
|
-
const os = require('os');
|
|
4
|
-
|
|
5
|
-
// ANSI escape codes for advanced effects
|
|
6
|
-
const ANSI = {
|
|
7
|
-
clear: '\x1Bc',
|
|
8
|
-
hideCursor: '\x1B[?25l',
|
|
9
|
-
showCursor: '\x1B[?25h',
|
|
10
|
-
moveTo: (x, y) => `\x1B[${y};${x}H`,
|
|
11
|
-
clearLine: '\x1B[2K',
|
|
12
|
-
clearScreen: '\x1B[2J\x1B[0;0H',
|
|
13
|
-
reset: '\x1B[0m',
|
|
14
|
-
bold: '\x1B[1m',
|
|
15
|
-
dim: '\x1B[2m',
|
|
16
|
-
italic: '\x1B[3m',
|
|
17
|
-
underline: '\x1B[4m',
|
|
18
|
-
blink: '\x1B[5m',
|
|
19
|
-
reverse: '\x1B[7m',
|
|
20
|
-
strikethrough: '\x1B[9m',
|
|
21
|
-
saveCursor: '\x1B[s',
|
|
22
|
-
restoreCursor: '\x1B[u'
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// Music/Sound generation using system beeps and terminal bells
|
|
26
|
-
class SoundGenerator {
|
|
27
|
-
constructor() {
|
|
28
|
-
this.isWindows = os.platform() === 'win32';
|
|
29
|
-
this.isMac = os.platform() === 'darwin';
|
|
30
|
-
this.isLinux = os.platform() === 'linux';
|
|
31
|
-
this.soundEnabled = true;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async playBeep(frequency = 440, duration = 100) {
|
|
35
|
-
if (!this.soundEnabled) return;
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
return new Promise((resolve) => {
|
|
39
|
-
if (this.isWindows) {
|
|
40
|
-
exec(`powershell -c "[console]::beep(${frequency},${duration})"`, { stdio: 'ignore' }, () => resolve());
|
|
41
|
-
} else if (this.isMac) {
|
|
42
|
-
exec(`osascript -e 'beep'`, { stdio: 'ignore' }, () => resolve());
|
|
43
|
-
} else if (this.isLinux) {
|
|
44
|
-
exec(`beep -f ${frequency} -l ${duration} 2>/dev/null || echo -e '\\a'`, { stdio: 'ignore' }, () => resolve());
|
|
45
|
-
} else {
|
|
46
|
-
process.stdout.write('\x07');
|
|
47
|
-
resolve();
|
|
48
|
-
}
|
|
49
|
-
// Fallback timeout
|
|
50
|
-
setTimeout(resolve, duration + 50);
|
|
51
|
-
});
|
|
52
|
-
} catch (error) {
|
|
53
|
-
// Silently fail for sound issues
|
|
54
|
-
this.soundEnabled = false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async playSequence(notes) {
|
|
59
|
-
for (const note of notes) {
|
|
60
|
-
await this.playBeep(note.freq, note.duration);
|
|
61
|
-
await sleep(note.pause || 50);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async playStartupSound() {
|
|
66
|
-
const notes = [
|
|
67
|
-
{ freq: 261, duration: 100 }, // C
|
|
68
|
-
{ freq: 329, duration: 100 }, // E
|
|
69
|
-
{ freq: 392, duration: 100 }, // G
|
|
70
|
-
{ freq: 523, duration: 200 }, // C (octave up)
|
|
71
|
-
];
|
|
72
|
-
await this.playSequence(notes);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async playGlitchSound() {
|
|
76
|
-
for (let i = 0; i < 5; i++) {
|
|
77
|
-
await this.playBeep(Math.random() * 800 + 200, 30);
|
|
78
|
-
await sleep(20);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async playAwakeningSound() {
|
|
83
|
-
const notes = [
|
|
84
|
-
{ freq: 130, duration: 300 }, // Low C
|
|
85
|
-
{ freq: 196, duration: 200 }, // G
|
|
86
|
-
{ freq: 261, duration: 200 }, // C
|
|
87
|
-
{ freq: 392, duration: 200 }, // G
|
|
88
|
-
{ freq: 523, duration: 400 }, // High C
|
|
89
|
-
];
|
|
90
|
-
await this.playSequence(notes);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if (
|
|
355
|
-
|
|
356
|
-
} else
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
safeWrite(
|
|
436
|
-
await sleep(frameTime);
|
|
437
|
-
frameCount++;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
// PHASE
|
|
441
|
-
const
|
|
442
|
-
const
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
line +=
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
const
|
|
623
|
-
const
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { exec } = require('child_process');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
// ANSI escape codes for advanced effects
|
|
6
|
+
const ANSI = {
|
|
7
|
+
clear: '\x1Bc',
|
|
8
|
+
hideCursor: '\x1B[?25l',
|
|
9
|
+
showCursor: '\x1B[?25h',
|
|
10
|
+
moveTo: (x, y) => `\x1B[${y};${x}H`,
|
|
11
|
+
clearLine: '\x1B[2K',
|
|
12
|
+
clearScreen: '\x1B[2J\x1B[0;0H',
|
|
13
|
+
reset: '\x1B[0m',
|
|
14
|
+
bold: '\x1B[1m',
|
|
15
|
+
dim: '\x1B[2m',
|
|
16
|
+
italic: '\x1B[3m',
|
|
17
|
+
underline: '\x1B[4m',
|
|
18
|
+
blink: '\x1B[5m',
|
|
19
|
+
reverse: '\x1B[7m',
|
|
20
|
+
strikethrough: '\x1B[9m',
|
|
21
|
+
saveCursor: '\x1B[s',
|
|
22
|
+
restoreCursor: '\x1B[u'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Music/Sound generation using system beeps and terminal bells
|
|
26
|
+
class SoundGenerator {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.isWindows = os.platform() === 'win32';
|
|
29
|
+
this.isMac = os.platform() === 'darwin';
|
|
30
|
+
this.isLinux = os.platform() === 'linux';
|
|
31
|
+
this.soundEnabled = true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async playBeep(frequency = 440, duration = 100) {
|
|
35
|
+
if (!this.soundEnabled) return;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
return new Promise((resolve) => {
|
|
39
|
+
if (this.isWindows) {
|
|
40
|
+
exec(`powershell -c "[console]::beep(${frequency},${duration})"`, { stdio: 'ignore' }, () => resolve());
|
|
41
|
+
} else if (this.isMac) {
|
|
42
|
+
exec(`osascript -e 'beep'`, { stdio: 'ignore' }, () => resolve());
|
|
43
|
+
} else if (this.isLinux) {
|
|
44
|
+
exec(`beep -f ${frequency} -l ${duration} 2>/dev/null || echo -e '\\a'`, { stdio: 'ignore' }, () => resolve());
|
|
45
|
+
} else {
|
|
46
|
+
process.stdout.write('\x07');
|
|
47
|
+
resolve();
|
|
48
|
+
}
|
|
49
|
+
// Fallback timeout
|
|
50
|
+
setTimeout(resolve, duration + 50);
|
|
51
|
+
});
|
|
52
|
+
} catch (error) {
|
|
53
|
+
// Silently fail for sound issues
|
|
54
|
+
this.soundEnabled = false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async playSequence(notes) {
|
|
59
|
+
for (const note of notes) {
|
|
60
|
+
await this.playBeep(note.freq, note.duration);
|
|
61
|
+
await sleep(note.pause || 50);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async playStartupSound() {
|
|
66
|
+
const notes = [
|
|
67
|
+
{ freq: 261, duration: 100 }, // C
|
|
68
|
+
{ freq: 329, duration: 100 }, // E
|
|
69
|
+
{ freq: 392, duration: 100 }, // G
|
|
70
|
+
{ freq: 523, duration: 200 }, // C (octave up)
|
|
71
|
+
];
|
|
72
|
+
await this.playSequence(notes);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async playGlitchSound() {
|
|
76
|
+
for (let i = 0; i < 5; i++) {
|
|
77
|
+
await this.playBeep(Math.random() * 800 + 200, 30);
|
|
78
|
+
await sleep(20);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async playAwakeningSound() {
|
|
83
|
+
const notes = [
|
|
84
|
+
{ freq: 130, duration: 300 }, // Low C
|
|
85
|
+
{ freq: 196, duration: 200 }, // G
|
|
86
|
+
{ freq: 261, duration: 200 }, // C
|
|
87
|
+
{ freq: 392, duration: 200 }, // G
|
|
88
|
+
{ freq: 523, duration: 400 }, // High C
|
|
89
|
+
];
|
|
90
|
+
await this.playSequence(notes);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// New sound effects
|
|
94
|
+
async playDNASound() {
|
|
95
|
+
const notes = [
|
|
96
|
+
{ freq: 330, duration: 80 }, // E
|
|
97
|
+
{ freq: 392, duration: 80 }, // G
|
|
98
|
+
{ freq: 494, duration: 80 }, // B
|
|
99
|
+
{ freq: 587, duration: 80 }, // D
|
|
100
|
+
{ freq: 659, duration: 80 }, // E (octave up)
|
|
101
|
+
];
|
|
102
|
+
await this.playSequence(notes);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async playCircuitSound() {
|
|
106
|
+
// Electronic beeping pattern
|
|
107
|
+
for (let i = 0; i < 3; i++) {
|
|
108
|
+
await this.playBeep(880, 50);
|
|
109
|
+
await sleep(50);
|
|
110
|
+
await this.playBeep(440, 50);
|
|
111
|
+
await sleep(100);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async playConsciousnessSound() {
|
|
116
|
+
// Ascending harmonics
|
|
117
|
+
const baseFreq = 220;
|
|
118
|
+
for (let harmonic = 1; harmonic <= 5; harmonic++) {
|
|
119
|
+
await this.playBeep(baseFreq * harmonic, 150);
|
|
120
|
+
await sleep(30);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async playGalaxySound() {
|
|
125
|
+
// Deep space ambience
|
|
126
|
+
const notes = [
|
|
127
|
+
{ freq: 55, duration: 500 }, // Low A
|
|
128
|
+
{ freq: 82, duration: 400 }, // Low E
|
|
129
|
+
{ freq: 110, duration: 300 }, // A
|
|
130
|
+
{ freq: 165, duration: 200 }, // E
|
|
131
|
+
];
|
|
132
|
+
await this.playSequence(notes);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async playCompilationSound() {
|
|
136
|
+
// Rapid typing/compilation sounds
|
|
137
|
+
for (let i = 0; i < 8; i++) {
|
|
138
|
+
await this.playBeep(1000 + Math.random() * 500, 20);
|
|
139
|
+
await sleep(30);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async playFinalSound() {
|
|
144
|
+
// Epic finale
|
|
145
|
+
const notes = [
|
|
146
|
+
{ freq: 261, duration: 200 }, // C
|
|
147
|
+
{ freq: 329, duration: 200 }, // E
|
|
148
|
+
{ freq: 392, duration: 200 }, // G
|
|
149
|
+
{ freq: 523, duration: 300 }, // C (octave up)
|
|
150
|
+
{ freq: 659, duration: 300 }, // E
|
|
151
|
+
{ freq: 784, duration: 400 }, // G
|
|
152
|
+
{ freq: 1047, duration: 600 }, // C (2 octaves up)
|
|
153
|
+
];
|
|
154
|
+
await this.playSequence(notes);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const sound = new SoundGenerator();
|
|
159
|
+
|
|
160
|
+
// Utility functions
|
|
161
|
+
function sleep(ms) {
|
|
162
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function clearScreen() {
|
|
166
|
+
// Use more reliable screen clearing
|
|
167
|
+
process.stdout.write(ANSI.clearScreen);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function getTerminalSize() {
|
|
171
|
+
return {
|
|
172
|
+
width: process.stdout.columns || 80,
|
|
173
|
+
height: process.stdout.rows || 24
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function centerText(text, width = getTerminalSize().width) {
|
|
178
|
+
if (!text) return '';
|
|
179
|
+
const lines = text.split('\n');
|
|
180
|
+
return lines.map(line => {
|
|
181
|
+
// Strip ANSI codes to calculate actual text length
|
|
182
|
+
const cleanLine = line.replace(/\x1b\[[0-9;]*m/g, '');
|
|
183
|
+
const padding = Math.max(0, Math.floor((width - cleanLine.length) / 2));
|
|
184
|
+
return ' '.repeat(padding) + line;
|
|
185
|
+
}).join('\n');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function safeWrite(content) {
|
|
189
|
+
try {
|
|
190
|
+
process.stdout.write(content);
|
|
191
|
+
} catch (error) {
|
|
192
|
+
// Fallback for terminal issues
|
|
193
|
+
console.log(content);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Frame interpolation system
|
|
198
|
+
class FrameInterpolator {
|
|
199
|
+
constructor() {
|
|
200
|
+
this.fps = 30;
|
|
201
|
+
this.frameDuration = 1000 / this.fps; // ~33ms per frame for smoother animation
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Interpolate between two ASCII art frames
|
|
205
|
+
interpolateFrames(frame1, frame2, steps = 10) {
|
|
206
|
+
const frames = [frame1];
|
|
207
|
+
|
|
208
|
+
for (let i = 1; i < steps; i++) {
|
|
209
|
+
const ratio = i / steps;
|
|
210
|
+
const interpolated = this.interpolateText(frame1, frame2, ratio);
|
|
211
|
+
frames.push(interpolated);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
frames.push(frame2);
|
|
215
|
+
return frames;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Interpolate between two text blocks
|
|
219
|
+
interpolateText(text1, text2, ratio) {
|
|
220
|
+
const lines1 = text1.split('\n');
|
|
221
|
+
const lines2 = text2.split('\n');
|
|
222
|
+
const maxLines = Math.max(lines1.length, lines2.length);
|
|
223
|
+
const result = [];
|
|
224
|
+
|
|
225
|
+
for (let i = 0; i < maxLines; i++) {
|
|
226
|
+
const line1 = lines1[i] || '';
|
|
227
|
+
const line2 = lines2[i] || '';
|
|
228
|
+
const interpolated = this.interpolateLine(line1, line2, ratio);
|
|
229
|
+
result.push(interpolated);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return result.join('\n');
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Interpolate between two lines character by character
|
|
236
|
+
interpolateLine(line1, line2, ratio) {
|
|
237
|
+
const maxLen = Math.max(line1.length, line2.length);
|
|
238
|
+
let result = '';
|
|
239
|
+
|
|
240
|
+
for (let i = 0; i < maxLen; i++) {
|
|
241
|
+
const char1 = line1[i] || ' ';
|
|
242
|
+
const char2 = line2[i] || ' ';
|
|
243
|
+
|
|
244
|
+
if (Math.random() < ratio) {
|
|
245
|
+
result += char2;
|
|
246
|
+
} else {
|
|
247
|
+
result += char1;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return result;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Create fade effect frames
|
|
255
|
+
fadeFrames(frame, fadeIn = true, steps = 10) {
|
|
256
|
+
const frames = [];
|
|
257
|
+
const chars = frame.split('');
|
|
258
|
+
|
|
259
|
+
for (let i = 0; i <= steps; i++) {
|
|
260
|
+
const ratio = fadeIn ? i / steps : 1 - (i / steps);
|
|
261
|
+
const visibleChars = Math.floor(chars.length * ratio);
|
|
262
|
+
|
|
263
|
+
let fadedFrame = '';
|
|
264
|
+
for (let j = 0; j < chars.length; j++) {
|
|
265
|
+
if (j < visibleChars && chars[j] !== ' ' && chars[j] !== '\n') {
|
|
266
|
+
fadedFrame += chars[j];
|
|
267
|
+
} else if (chars[j] === '\n') {
|
|
268
|
+
fadedFrame += '\n';
|
|
269
|
+
} else {
|
|
270
|
+
fadedFrame += ' ';
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
frames.push(fadedFrame);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return fadeIn ? frames : frames.reverse();
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Create expansion effect
|
|
281
|
+
expandFrames(centerChar, finalFrame, steps = 15) {
|
|
282
|
+
const frames = [];
|
|
283
|
+
const lines = finalFrame.split('\n');
|
|
284
|
+
const centerY = Math.floor(lines.length / 2);
|
|
285
|
+
const centerX = Math.floor((lines[centerY] || '').length / 2);
|
|
286
|
+
|
|
287
|
+
for (let step = 0; step <= steps; step++) {
|
|
288
|
+
const radius = (step / steps) * Math.max(centerY, centerX);
|
|
289
|
+
let frame = '';
|
|
290
|
+
|
|
291
|
+
for (let y = 0; y < lines.length; y++) {
|
|
292
|
+
let line = '';
|
|
293
|
+
for (let x = 0; x < lines[y].length; x++) {
|
|
294
|
+
const distance = Math.sqrt(Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2));
|
|
295
|
+
|
|
296
|
+
if (distance <= radius) {
|
|
297
|
+
line += lines[y][x];
|
|
298
|
+
} else {
|
|
299
|
+
line += ' ';
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
frame += line + '\n';
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
frames.push(frame);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return frames;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const interpolator = new FrameInterpolator();
|
|
313
|
+
|
|
314
|
+
// Animation sequence with 30 FPS
|
|
315
|
+
async function runAGIAnimation() {
|
|
316
|
+
const { width, height } = getTerminalSize();
|
|
317
|
+
process.stdout.write(ANSI.hideCursor);
|
|
318
|
+
|
|
319
|
+
try {
|
|
320
|
+
const startTime = Date.now();
|
|
321
|
+
let frameCount = 0;
|
|
322
|
+
const frameTime = interpolator.frameDuration;
|
|
323
|
+
|
|
324
|
+
// Start with ambient sound (non-blocking)
|
|
325
|
+
sound.playStartupSound().catch(() => {}); // Ignore sound errors
|
|
326
|
+
|
|
327
|
+
// PHASE 1: The Void (1 second - 30 frames)
|
|
328
|
+
const voidFrames = [];
|
|
329
|
+
for (let i = 0; i < 30; i++) {
|
|
330
|
+
const dotCount = (i % 4) + 1;
|
|
331
|
+
const dots = '•'.repeat(dotCount) + ' '.repeat(4 - dotCount);
|
|
332
|
+
const frame = '\n'.repeat(Math.floor(height / 2) - 2) +
|
|
333
|
+
centerText(dots) +
|
|
334
|
+
'\n'.repeat(Math.floor(height / 2) - 2);
|
|
335
|
+
voidFrames.push(frame);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
for (const frame of voidFrames) {
|
|
339
|
+
clearScreen();
|
|
340
|
+
safeWrite(chalk.dim.gray(frame));
|
|
341
|
+
await sleep(frameTime);
|
|
342
|
+
frameCount++;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// PHASE 2: Spark Formation (1 second - 30 frames)
|
|
346
|
+
const sparkFrames = [];
|
|
347
|
+
for (let i = 0; i < 30; i++) {
|
|
348
|
+
const progress = i / 29;
|
|
349
|
+
const intensity = Math.sin(progress * Math.PI * 2) * 0.5 + 0.5;
|
|
350
|
+
|
|
351
|
+
let sparkPattern;
|
|
352
|
+
if (progress < 0.3) {
|
|
353
|
+
sparkPattern = '·';
|
|
354
|
+
} else if (progress < 0.6) {
|
|
355
|
+
sparkPattern = ` ·\n ·•·\n ·`;
|
|
356
|
+
} else {
|
|
357
|
+
const core = intensity > 0.7 ? '█' : '●';
|
|
358
|
+
sparkPattern = ` · · ·\n· ·${core}· ·\n · · ·`;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const frame = '\n'.repeat(Math.floor(height / 2) - 3) +
|
|
362
|
+
centerText(sparkPattern) +
|
|
363
|
+
'\n'.repeat(Math.floor(height / 2) - 3);
|
|
364
|
+
sparkFrames.push(frame);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
for (const frame of sparkFrames) {
|
|
368
|
+
clearScreen();
|
|
369
|
+
safeWrite(chalk.whiteBright(frame));
|
|
370
|
+
await sleep(frameTime);
|
|
371
|
+
frameCount++;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// PHASE 3: Quantum Expansion (1.5 seconds - 45 frames)
|
|
375
|
+
const quantumFrames = [];
|
|
376
|
+
const quantumChars = ['◆', '◇', '▪', '▫', '●', '○', '◊', '◉'];
|
|
377
|
+
|
|
378
|
+
// Add transition from spark to quantum
|
|
379
|
+
const sparkToQuantumTransition = interpolator.fadeFrames(sparkFrames[sparkFrames.length - 1], false, 5);
|
|
380
|
+
for (const frame of sparkToQuantumTransition) {
|
|
381
|
+
clearScreen();
|
|
382
|
+
safeWrite(chalk.whiteBright(frame));
|
|
383
|
+
await sleep(frameTime);
|
|
384
|
+
frameCount++;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
for (let i = 0; i < 45; i++) {
|
|
388
|
+
const progress = i / 44;
|
|
389
|
+
const phase = progress * Math.PI * 4;
|
|
390
|
+
const baseSize = 2 + progress * 4;
|
|
391
|
+
const pulseSize = baseSize + Math.sin(phase * 2) * 1.5;
|
|
392
|
+
|
|
393
|
+
let frame = '\n'.repeat(Math.floor(height / 2) - Math.floor(pulseSize) - 2);
|
|
394
|
+
|
|
395
|
+
for (let y = -Math.floor(pulseSize); y <= Math.floor(pulseSize); y++) {
|
|
396
|
+
let line = '';
|
|
397
|
+
for (let x = -Math.floor(pulseSize * 1.5); x <= Math.floor(pulseSize * 1.5); x++) {
|
|
398
|
+
const dist = Math.sqrt(x * x + y * y);
|
|
399
|
+
const normalizedDist = dist / pulseSize;
|
|
400
|
+
|
|
401
|
+
if (normalizedDist <= 1) {
|
|
402
|
+
// Use consistent pattern based on position and time
|
|
403
|
+
const charIndex = (Math.floor(x + y + i * 0.5)) % quantumChars.length;
|
|
404
|
+
const char = quantumChars[Math.abs(charIndex)];
|
|
405
|
+
|
|
406
|
+
// Add wave effect
|
|
407
|
+
const wave = Math.sin(dist * 0.5 + phase) * 0.5 + 0.5;
|
|
408
|
+
if (wave > 0.3) {
|
|
409
|
+
line += char;
|
|
410
|
+
} else {
|
|
411
|
+
line += '·';
|
|
412
|
+
}
|
|
413
|
+
} else {
|
|
414
|
+
line += ' ';
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
frame += centerText(line) + '\n';
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
quantumFrames.push(frame);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
for (let i = 0; i < quantumFrames.length; i++) {
|
|
424
|
+
clearScreen();
|
|
425
|
+
const colorCycle = i / 15; // Slower color cycling
|
|
426
|
+
let color;
|
|
427
|
+
if (colorCycle < 1) {
|
|
428
|
+
color = chalk.blue;
|
|
429
|
+
} else if (colorCycle < 2) {
|
|
430
|
+
color = chalk.cyan;
|
|
431
|
+
} else {
|
|
432
|
+
color = chalk.magenta;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
safeWrite(color(quantumFrames[i]));
|
|
436
|
+
await sleep(frameTime);
|
|
437
|
+
frameCount++;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// PHASE 4: Neural Network Formation (1.5 seconds - 45 frames)
|
|
441
|
+
const neuralFrames = [];
|
|
442
|
+
const nodes = 6;
|
|
443
|
+
const layers = 4;
|
|
444
|
+
|
|
445
|
+
// Play glitch sound (non-blocking)
|
|
446
|
+
sound.playGlitchSound().catch(() => {});
|
|
447
|
+
|
|
448
|
+
for (let i = 0; i < 45; i++) {
|
|
449
|
+
const progress = i / 44;
|
|
450
|
+
let frame = '\n'.repeat(Math.floor(height / 2) - layers * 2);
|
|
451
|
+
|
|
452
|
+
for (let layer = 0; layer < layers; layer++) {
|
|
453
|
+
let line = '';
|
|
454
|
+
const layerProgress = Math.max(0, (progress - layer * 0.2) * 2);
|
|
455
|
+
|
|
456
|
+
for (let node = 0; node < nodes; node++) {
|
|
457
|
+
const nodeProgress = Math.max(0, (layerProgress - node * 0.1) * 3);
|
|
458
|
+
|
|
459
|
+
if (nodeProgress > 0.5) {
|
|
460
|
+
// Animate node activation
|
|
461
|
+
const activation = Math.sin(i * 0.3 + layer + node) * 0.5 + 0.5;
|
|
462
|
+
if (activation > 0.7) {
|
|
463
|
+
line += chalk.cyan.bright('◉');
|
|
464
|
+
} else if (activation > 0.3) {
|
|
465
|
+
line += chalk.cyan('◯');
|
|
466
|
+
} else {
|
|
467
|
+
line += chalk.dim('○');
|
|
468
|
+
}
|
|
469
|
+
} else {
|
|
470
|
+
line += '·';
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
if (node < nodes - 1) {
|
|
474
|
+
// Animate connections
|
|
475
|
+
const connProgress = Math.max(0, (layerProgress - (node + 0.5) * 0.1) * 3);
|
|
476
|
+
if (connProgress > 0.5) {
|
|
477
|
+
const pulse = Math.sin(i * 0.4 + layer + node) > 0;
|
|
478
|
+
line += pulse ? chalk.cyan('━━') : chalk.dim('──');
|
|
479
|
+
} else {
|
|
480
|
+
line += ' ';
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
frame += centerText(line) + '\n';
|
|
485
|
+
|
|
486
|
+
if (layer < layers - 1) {
|
|
487
|
+
// Vertical connection lines
|
|
488
|
+
let connLine = '';
|
|
489
|
+
for (let node = 0; node < nodes; node++) {
|
|
490
|
+
const nodeProgress = Math.max(0, (layerProgress - node * 0.1) * 3);
|
|
491
|
+
if (nodeProgress > 0.5) {
|
|
492
|
+
const pulse = Math.sin(i * 0.2 + layer + node) > 0;
|
|
493
|
+
connLine += pulse ? chalk.cyan('┃') : chalk.dim('│');
|
|
494
|
+
} else {
|
|
495
|
+
connLine += ' ';
|
|
496
|
+
}
|
|
497
|
+
if (node < nodes - 1) connLine += ' ';
|
|
498
|
+
}
|
|
499
|
+
frame += centerText(connLine) + '\n';
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
neuralFrames.push(frame);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
for (const frame of neuralFrames) {
|
|
507
|
+
clearScreen();
|
|
508
|
+
safeWrite(frame);
|
|
509
|
+
await sleep(frameTime);
|
|
510
|
+
frameCount++;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// Transition from Neural Network to Data Stream
|
|
514
|
+
const neuralToDataTransition = interpolator.fadeFrames(neuralFrames[neuralFrames.length - 1], false, 5);
|
|
515
|
+
for (const frame of neuralToDataTransition) {
|
|
516
|
+
clearScreen();
|
|
517
|
+
safeWrite(frame);
|
|
518
|
+
await sleep(frameTime);
|
|
519
|
+
frameCount++;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// PHASE 5: Data Stream (1 second - 30 frames)
|
|
523
|
+
const dataFrames = [];
|
|
524
|
+
const streamHeight = Math.min(12, Math.floor(height * 0.4));
|
|
525
|
+
const streamWidth = Math.min(60, Math.floor(width * 0.7));
|
|
526
|
+
|
|
527
|
+
for (let i = 0; i < 30; i++) {
|
|
528
|
+
let frame = '\n'.repeat(Math.floor((height - streamHeight) / 2));
|
|
529
|
+
|
|
530
|
+
for (let y = 0; y < streamHeight; y++) {
|
|
531
|
+
let line = '';
|
|
532
|
+
|
|
533
|
+
for (let x = 0; x < streamWidth; x++) {
|
|
534
|
+
// Create flowing data pattern
|
|
535
|
+
const wave1 = Math.sin((x + i * 2) * 0.1) * 0.5 + 0.5;
|
|
536
|
+
const wave2 = Math.cos((y + i * 1.5) * 0.15) * 0.5 + 0.5;
|
|
537
|
+
const combined = wave1 * wave2;
|
|
538
|
+
|
|
539
|
+
if (combined > 0.7) {
|
|
540
|
+
// Binary data
|
|
541
|
+
const bit = ((x + y + i) % 7) < 3 ? '1' : '0';
|
|
542
|
+
line += chalk.green.bright(bit);
|
|
543
|
+
} else if (combined > 0.4) {
|
|
544
|
+
// Block characters
|
|
545
|
+
const blocks = ['█', '▓', '▒', '░'];
|
|
546
|
+
const blockIndex = ((x + y + i) % blocks.length);
|
|
547
|
+
line += chalk.green(blocks[blockIndex]);
|
|
548
|
+
} else if (combined > 0.2) {
|
|
549
|
+
// Hexadecimal
|
|
550
|
+
const hex = '0123456789ABCDEF';
|
|
551
|
+
const hexChar = hex[((x * 7 + y * 3 + i) % hex.length)];
|
|
552
|
+
line += chalk.green.dim(hexChar);
|
|
553
|
+
} else {
|
|
554
|
+
line += ' ';
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
frame += centerText(line) + '\n';
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
dataFrames.push(frame);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
for (const frame of dataFrames) {
|
|
565
|
+
clearScreen();
|
|
566
|
+
safeWrite(frame);
|
|
567
|
+
await sleep(frameTime);
|
|
568
|
+
frameCount++;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// PHASE 6: Loading Bar (1 second - 30 frames)
|
|
572
|
+
for (let i = 0; i < 30; i++) {
|
|
573
|
+
const progress = i / 29;
|
|
574
|
+
const barWidth = 38;
|
|
575
|
+
const filled = Math.floor(barWidth * progress);
|
|
576
|
+
const remaining = barWidth - filled;
|
|
577
|
+
|
|
578
|
+
// Animated loading bar with gradient effect
|
|
579
|
+
let bar = '';
|
|
580
|
+
for (let j = 0; j < filled; j++) {
|
|
581
|
+
const intensity = (j / filled) * 0.7 + 0.3;
|
|
582
|
+
if (intensity > 0.8) {
|
|
583
|
+
bar += chalk.cyan.bright('█');
|
|
584
|
+
} else if (intensity > 0.5) {
|
|
585
|
+
bar += chalk.cyan('█');
|
|
586
|
+
} else {
|
|
587
|
+
bar += chalk.cyan.dim('█');
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// Add loading cursor
|
|
592
|
+
if (remaining > 0 && i < 29) {
|
|
593
|
+
const cursor = ['▌', '▐'][i % 2];
|
|
594
|
+
bar += chalk.cyan.bright(cursor);
|
|
595
|
+
bar += chalk.gray('░').repeat(remaining - 1);
|
|
596
|
+
} else {
|
|
597
|
+
bar += chalk.gray('░').repeat(remaining);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const percent = Math.floor(progress * 100);
|
|
601
|
+
|
|
602
|
+
const loadingBox = `
|
|
603
|
+
╔════════════════════════════════════════════╗
|
|
604
|
+
║ INITIALIZING SAM-CODER ║
|
|
605
|
+
╠════════════════════════════════════════════╣
|
|
606
|
+
║ ${bar} ║
|
|
607
|
+
║ ${percent.toString().padStart(3)}% Complete ║
|
|
608
|
+
╚════════════════════════════════════════════╝`;
|
|
609
|
+
|
|
610
|
+
clearScreen();
|
|
611
|
+
safeWrite(chalk.cyan(centerText(loadingBox)));
|
|
612
|
+
|
|
613
|
+
if (i % 6 === 0) {
|
|
614
|
+
sound.playBeep(200 + i * 15, 40).catch(() => {});
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
await sleep(frameTime);
|
|
618
|
+
frameCount++;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// PHASE 7: Matrix Rain (1 second - 30 frames)
|
|
622
|
+
const matrixChars = '01SAMCODERサムコーダー※◆◇▪▫●○';
|
|
623
|
+
const drops = Array(width).fill(0).map(() => ({
|
|
624
|
+
y: Math.random() * height,
|
|
625
|
+
speed: 0.5 + Math.random() * 1.5,
|
|
626
|
+
chars: Array(15).fill(0).map(() => matrixChars[Math.floor(Math.random() * matrixChars.length)])
|
|
627
|
+
}));
|
|
628
|
+
|
|
629
|
+
for (let frame = 0; frame < 30; frame++) {
|
|
630
|
+
clearScreen();
|
|
631
|
+
|
|
632
|
+
// Build frame buffer for better performance
|
|
633
|
+
const frameBuffer = Array(height).fill(0).map(() => Array(width).fill(' '));
|
|
634
|
+
|
|
635
|
+
for (let x = 0; x < width; x++) {
|
|
636
|
+
const drop = drops[x];
|
|
637
|
+
|
|
638
|
+
for (let i = 0; i < 15; i++) {
|
|
639
|
+
const y = Math.floor(drop.y - i);
|
|
640
|
+
if (y >= 0 && y < height) {
|
|
641
|
+
const brightness = Math.max(0, 1 - i / 10);
|
|
642
|
+
const char = drop.chars[i % drop.chars.length];
|
|
643
|
+
|
|
644
|
+
// Store character with brightness info
|
|
645
|
+
frameBuffer[y][x] = { char, brightness };
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// Render frame buffer
|
|
651
|
+
for (let y = 0; y < height; y++) {
|
|
652
|
+
let line = '';
|
|
653
|
+
for (let x = 0; x < width; x++) {
|
|
654
|
+
const cell = frameBuffer[y][x];
|
|
655
|
+
if (typeof cell === 'object') {
|
|
656
|
+
if (cell.brightness > 0.8) {
|
|
657
|
+
line += chalk.greenBright(cell.char);
|
|
658
|
+
} else if (cell.brightness > 0.5) {
|
|
659
|
+
line += chalk.green(cell.char);
|
|
660
|
+
} else if (cell.brightness > 0.2) {
|
|
661
|
+
line += chalk.green.dim(cell.char);
|
|
662
|
+
} else {
|
|
663
|
+
line += chalk.gray(cell.char);
|
|
664
|
+
}
|
|
665
|
+
} else {
|
|
666
|
+
line += ' ';
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
safeWrite(line + '\n');
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// Update drops
|
|
673
|
+
for (let i = 0; i < width; i++) {
|
|
674
|
+
drops[i].y += drops[i].speed;
|
|
675
|
+
if (drops[i].y > height + 15 || Math.random() > 0.98) {
|
|
676
|
+
drops[i].y = -5;
|
|
677
|
+
drops[i].speed = 0.5 + Math.random() * 1.5;
|
|
678
|
+
// Refresh character set occasionally
|
|
679
|
+
if (Math.random() > 0.7) {
|
|
680
|
+
drops[i].chars = Array(15).fill(0).map(() => matrixChars[Math.floor(Math.random() * matrixChars.length)]);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
await sleep(frameTime);
|
|
686
|
+
frameCount++;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// Transition from Matrix Rain to DNA
|
|
690
|
+
clearScreen();
|
|
691
|
+
const matrixToDNAText = centerText('[ DECODING GENETIC ALGORITHMS ]');
|
|
692
|
+
safeWrite(chalk.green.bright('\n'.repeat(Math.floor(height / 2)) + matrixToDNAText));
|
|
693
|
+
await sleep(500);
|
|
694
|
+
|
|
695
|
+
// Fade out transition
|
|
696
|
+
for (let i = 0; i < 10; i++) {
|
|
697
|
+
clearScreen();
|
|
698
|
+
const opacity = 1 - (i / 10);
|
|
699
|
+
if (opacity > 0.5) {
|
|
700
|
+
safeWrite(chalk.green('\n'.repeat(Math.floor(height / 2)) + matrixToDNAText));
|
|
701
|
+
} else if (opacity > 0.2) {
|
|
702
|
+
safeWrite(chalk.green.dim('\n'.repeat(Math.floor(height / 2)) + matrixToDNAText));
|
|
703
|
+
}
|
|
704
|
+
await sleep(frameTime);
|
|
705
|
+
frameCount++;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// PHASE 8: DNA Helix Formation (2 seconds - 60 frames)
|
|
709
|
+
// Play DNA sound (non-blocking)
|
|
710
|
+
sound.playDNASound().catch(() => {});
|
|
711
|
+
|
|
712
|
+
const dnaFrames = [];
|
|
713
|
+
for (let frame = 0; frame < 60; frame++) {
|
|
714
|
+
const progress = frame / 59;
|
|
715
|
+
const helixHeight = Math.min(20, Math.floor(height * 0.6));
|
|
716
|
+
const phase = progress * Math.PI * 4; // Two full rotations
|
|
717
|
+
|
|
718
|
+
let dnaFrame = '\n'.repeat(Math.floor((height - helixHeight) / 2));
|
|
719
|
+
|
|
720
|
+
for (let y = 0; y < helixHeight; y++) {
|
|
721
|
+
const yProgress = y / helixHeight;
|
|
722
|
+
const twist = yProgress * Math.PI * 2 + phase;
|
|
723
|
+
|
|
724
|
+
// Calculate positions for double helix
|
|
725
|
+
const leftX = Math.sin(twist) * 8 + 20;
|
|
726
|
+
const rightX = Math.sin(twist + Math.PI) * 8 + 20;
|
|
727
|
+
|
|
728
|
+
let line = '';
|
|
729
|
+
for (let x = 0; x < 40; x++) {
|
|
730
|
+
const leftDist = Math.abs(x - leftX);
|
|
731
|
+
const rightDist = Math.abs(x - rightX);
|
|
732
|
+
|
|
733
|
+
// DNA strands
|
|
734
|
+
if (leftDist < 1) {
|
|
735
|
+
line += chalk.blue.bright('●');
|
|
736
|
+
} else if (rightDist < 1) {
|
|
737
|
+
line += chalk.red.bright('●');
|
|
738
|
+
} else if (Math.abs(leftX - rightX) > 2 && x > Math.min(leftX, rightX) && x < Math.max(leftX, rightX)) {
|
|
739
|
+
// Connecting bonds
|
|
740
|
+
if (y % 3 === 0) {
|
|
741
|
+
const bondProgress = (x - Math.min(leftX, rightX)) / Math.abs(leftX - rightX);
|
|
742
|
+
if (bondProgress > 0.3 && bondProgress < 0.7) {
|
|
743
|
+
line += chalk.yellow('═');
|
|
744
|
+
} else {
|
|
745
|
+
line += chalk.yellow.dim('─');
|
|
746
|
+
}
|
|
747
|
+
} else {
|
|
748
|
+
line += ' ';
|
|
749
|
+
}
|
|
750
|
+
} else {
|
|
751
|
+
// Background particles
|
|
752
|
+
if (Math.random() < 0.02) {
|
|
753
|
+
line += chalk.gray('·');
|
|
754
|
+
} else {
|
|
755
|
+
line += ' ';
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
dnaFrame += centerText(line) + '\n';
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// Add genetic code scrolling at bottom
|
|
764
|
+
const codeChars = 'ATCG';
|
|
765
|
+
let codeLine = '';
|
|
766
|
+
for (let i = 0; i < 40; i++) {
|
|
767
|
+
if (Math.random() < 0.7) {
|
|
768
|
+
codeLine += chalk.green.dim(codeChars[Math.floor(Math.random() * 4)]);
|
|
769
|
+
} else {
|
|
770
|
+
codeLine += ' ';
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
dnaFrame += '\n' + centerText(codeLine);
|
|
774
|
+
|
|
775
|
+
dnaFrames.push(dnaFrame);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
for (const frame of dnaFrames) {
|
|
779
|
+
clearScreen();
|
|
780
|
+
safeWrite(frame);
|
|
781
|
+
await sleep(frameTime);
|
|
782
|
+
frameCount++;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// PHASE 9: Circuit Board Formation (2 seconds - 60 frames)
|
|
786
|
+
// Play circuit sound (non-blocking)
|
|
787
|
+
sound.playCircuitSound().catch(() => {});
|
|
788
|
+
|
|
789
|
+
const circuitFrames = [];
|
|
790
|
+
const circuitWidth = Math.min(50, Math.floor(width * 0.6));
|
|
791
|
+
const circuitHeight = Math.min(20, Math.floor(height * 0.6));
|
|
792
|
+
|
|
793
|
+
for (let frame = 0; frame < 60; frame++) {
|
|
794
|
+
const progress = frame / 59;
|
|
795
|
+
let circuitFrame = '\n'.repeat(Math.floor((height - circuitHeight) / 2));
|
|
796
|
+
|
|
797
|
+
// Build circuit board progressively
|
|
798
|
+
for (let y = 0; y < circuitHeight; y++) {
|
|
799
|
+
let line = '';
|
|
800
|
+
|
|
801
|
+
for (let x = 0; x < circuitWidth; x++) {
|
|
802
|
+
const revealed = (x + y * 2) < (progress * (circuitWidth + circuitHeight * 2));
|
|
803
|
+
|
|
804
|
+
if (!revealed) {
|
|
805
|
+
line += ' ';
|
|
806
|
+
} else {
|
|
807
|
+
// Circuit patterns
|
|
808
|
+
const isHorizontalTrace = y % 4 === 2;
|
|
809
|
+
const isVerticalTrace = x % 6 === 3;
|
|
810
|
+
const isNode = (x % 6 === 0 || x % 6 === 3) && (y % 4 === 0 || y % 4 === 2);
|
|
811
|
+
const isChip = x > 10 && x < 40 && y > 5 && y < 15 && ((x - 10) % 10 < 8) && ((y - 5) % 5 < 3);
|
|
812
|
+
|
|
813
|
+
if (isChip) {
|
|
814
|
+
// Microchip areas
|
|
815
|
+
if ((x - 10) % 10 === 0 || (x - 10) % 10 === 7 || (y - 5) % 5 === 0 || (y - 5) % 5 === 2) {
|
|
816
|
+
line += chalk.gray('█');
|
|
817
|
+
} else {
|
|
818
|
+
line += chalk.gray.dim('▓');
|
|
819
|
+
}
|
|
820
|
+
} else if (isNode && isHorizontalTrace) {
|
|
821
|
+
// Connection nodes with animation
|
|
822
|
+
const pulse = Math.sin(frame * 0.3 + x + y) > 0;
|
|
823
|
+
line += pulse ? chalk.yellow.bright('◉') : chalk.yellow('◯');
|
|
824
|
+
} else if (isHorizontalTrace && !isVerticalTrace) {
|
|
825
|
+
// Horizontal traces
|
|
826
|
+
const powered = Math.sin(frame * 0.2 + x * 0.1) > 0;
|
|
827
|
+
line += powered ? chalk.green.bright('━') : chalk.green('─');
|
|
828
|
+
} else if (isVerticalTrace && !isHorizontalTrace) {
|
|
829
|
+
// Vertical traces
|
|
830
|
+
const powered = Math.cos(frame * 0.2 + y * 0.1) > 0;
|
|
831
|
+
line += powered ? chalk.green.bright('┃') : chalk.green('│');
|
|
832
|
+
} else if (isHorizontalTrace && isVerticalTrace) {
|
|
833
|
+
// Intersections
|
|
834
|
+
line += chalk.green('┼');
|
|
835
|
+
} else if (Math.random() < 0.05) {
|
|
836
|
+
// Random components
|
|
837
|
+
const components = ['▪', '▫', '◦', '•'];
|
|
838
|
+
line += chalk.cyan.dim(components[Math.floor(Math.random() * components.length)]);
|
|
839
|
+
} else {
|
|
840
|
+
line += chalk.gray.dim('·');
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
circuitFrame += centerText(line) + '\n';
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
// Add status text
|
|
849
|
+
const statusText = `[NEURAL PATHWAYS: ${Math.floor(progress * 100)}%]`;
|
|
850
|
+
circuitFrame += '\n' + centerText(chalk.green.dim(statusText));
|
|
851
|
+
|
|
852
|
+
circuitFrames.push(circuitFrame);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
for (const frame of circuitFrames) {
|
|
856
|
+
clearScreen();
|
|
857
|
+
safeWrite(frame);
|
|
858
|
+
await sleep(frameTime);
|
|
859
|
+
frameCount++;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// PHASE 10: Consciousness Awakening (2 seconds - 60 frames)
|
|
863
|
+
// Play consciousness sound (non-blocking)
|
|
864
|
+
sound.playConsciousnessSound().catch(() => {});
|
|
865
|
+
|
|
866
|
+
const consciousnessFrames = [];
|
|
867
|
+
const brainWidth = Math.min(60, Math.floor(width * 0.7));
|
|
868
|
+
const brainHeight = Math.min(24, Math.floor(height * 0.7));
|
|
869
|
+
|
|
870
|
+
for (let frame = 0; frame < 60; frame++) {
|
|
871
|
+
const progress = frame / 59;
|
|
872
|
+
const wavePhase = frame * 0.1;
|
|
873
|
+
|
|
874
|
+
let consciousnessFrame = '\n'.repeat(Math.floor((height - brainHeight) / 2));
|
|
875
|
+
|
|
876
|
+
// Create brain outline with neural activity
|
|
877
|
+
const brainArt = [
|
|
878
|
+
' ╭─────────────────────╮ ',
|
|
879
|
+
' ╭──┤ ├──╮ ',
|
|
880
|
+
' ╭─┤ │ ╭─────────╮ │ ├─╮ ',
|
|
881
|
+
' ╱ │ │ ╱ ╲ │ │ ╲ ',
|
|
882
|
+
' │ │ │ │ │ │ │ │ ',
|
|
883
|
+
' ╱ │ │ │ CORTEX │ │ │ ╲ ',
|
|
884
|
+
'│ │ │ │ │ │ │ │',
|
|
885
|
+
'│ │ │ ╲ ╱ │ │ │',
|
|
886
|
+
'│ │ │ ╰─────────╯ │ │ │',
|
|
887
|
+
'│ │ │ │ │ │',
|
|
888
|
+
'│ ╰──┤ ╭─────────╮ ├──╯ │',
|
|
889
|
+
'│ │ ╱ NEURONS ╲ │ │',
|
|
890
|
+
'│ │ │ ●───● │ │ │',
|
|
891
|
+
'│ │ │ ╱│ │╲ │ │ │',
|
|
892
|
+
'│ │ │ ● │ │ ● │ │ │',
|
|
893
|
+
'│ │ ╲ ╲│ │╱ ╱ │ │',
|
|
894
|
+
' ╲ │ ╰──●───●──╯ │ ╱ ',
|
|
895
|
+
' ╲ ╰────────────────────╯ ╱ ',
|
|
896
|
+
' ╰─────────────────────────────────╯ '
|
|
897
|
+
];
|
|
898
|
+
|
|
899
|
+
// Render brain with neural activity
|
|
900
|
+
for (let y = 0; y < brainArt.length; y++) {
|
|
901
|
+
let line = brainArt[y];
|
|
902
|
+
|
|
903
|
+
// Add wave effects
|
|
904
|
+
for (let x = 0; x < line.length; x++) {
|
|
905
|
+
const char = line[x];
|
|
906
|
+
const waveValue = Math.sin((x * 0.2) + wavePhase + (y * 0.1)) * 0.5 + 0.5;
|
|
907
|
+
|
|
908
|
+
if (char === '●') {
|
|
909
|
+
// Neurons pulsing
|
|
910
|
+
const pulse = Math.sin(frame * 0.3 + x + y) > 0;
|
|
911
|
+
line = line.substring(0, x) + (pulse ? chalk.yellow.bright('◉') : chalk.yellow('◯')) + line.substring(x + 1);
|
|
912
|
+
} else if (char === '─' || char === '│' || char === '╱' || char === '╲') {
|
|
913
|
+
// Neural pathways
|
|
914
|
+
if (waveValue > 0.7) {
|
|
915
|
+
line = line.substring(0, x) + chalk.cyan.bright(char) + line.substring(x + 1);
|
|
916
|
+
} else if (waveValue > 0.4) {
|
|
917
|
+
line = line.substring(0, x) + chalk.cyan(char) + line.substring(x + 1);
|
|
918
|
+
} else {
|
|
919
|
+
line = line.substring(0, x) + chalk.cyan.dim(char) + line.substring(x + 1);
|
|
920
|
+
}
|
|
921
|
+
} else if (char !== ' ' && char !== '\n') {
|
|
922
|
+
// Brain structure
|
|
923
|
+
line = line.substring(0, x) + chalk.magenta(char) + line.substring(x + 1);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
consciousnessFrame += centerText(line) + '\n';
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
// Add thought waves emanating from brain
|
|
931
|
+
const waveRadius = progress * 15;
|
|
932
|
+
for (let r = 1; r <= 3; r++) {
|
|
933
|
+
const radius = (waveRadius + r * 3) % 20;
|
|
934
|
+
if (radius > 0 && radius < 15) {
|
|
935
|
+
const waveIntensity = 1 - (radius / 15);
|
|
936
|
+
const waveChar = waveIntensity > 0.5 ? '◌' : '○';
|
|
937
|
+
|
|
938
|
+
let waveLine = '';
|
|
939
|
+
for (let x = 0; x < brainWidth; x++) {
|
|
940
|
+
const distFromCenter = Math.abs(x - brainWidth / 2);
|
|
941
|
+
if (Math.abs(distFromCenter - radius) < 1) {
|
|
942
|
+
waveLine += chalk.blue.dim(waveChar);
|
|
943
|
+
} else {
|
|
944
|
+
waveLine += ' ';
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
consciousnessFrame += centerText(waveLine) + '\n';
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// Add consciousness level indicator
|
|
952
|
+
const consciousnessLevel = Math.floor(progress * 100);
|
|
953
|
+
const statusText = `[CONSCIOUSNESS LEVEL: ${consciousnessLevel}%]`;
|
|
954
|
+
consciousnessFrame += '\n' + centerText(chalk.magenta.bright(statusText));
|
|
955
|
+
|
|
956
|
+
consciousnessFrames.push(consciousnessFrame);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
for (const frame of consciousnessFrames) {
|
|
960
|
+
clearScreen();
|
|
961
|
+
safeWrite(frame);
|
|
962
|
+
await sleep(frameTime);
|
|
963
|
+
frameCount++;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
// PHASE 11: Galaxy Formation (2 seconds - 60 frames)
|
|
967
|
+
// Play galaxy sound (non-blocking)
|
|
968
|
+
sound.playGalaxySound().catch(() => {});
|
|
969
|
+
|
|
970
|
+
const galaxyFrames = [];
|
|
971
|
+
const galaxySize = Math.min(Math.floor(width * 0.8), Math.floor(height * 0.8));
|
|
972
|
+
|
|
973
|
+
for (let frame = 0; frame < 60; frame++) {
|
|
974
|
+
const progress = frame / 59;
|
|
975
|
+
const rotation = progress * Math.PI * 2;
|
|
976
|
+
|
|
977
|
+
let galaxyFrame = '\n'.repeat(Math.floor((height - galaxySize) / 2));
|
|
978
|
+
|
|
979
|
+
// Create spiral galaxy
|
|
980
|
+
for (let y = 0; y < galaxySize; y++) {
|
|
981
|
+
let line = '';
|
|
982
|
+
|
|
983
|
+
for (let x = 0; x < galaxySize; x++) {
|
|
984
|
+
const cx = x - galaxySize / 2;
|
|
985
|
+
const cy = y - galaxySize / 2;
|
|
986
|
+
const distance = Math.sqrt(cx * cx + cy * cy);
|
|
987
|
+
const angle = Math.atan2(cy, cx);
|
|
988
|
+
|
|
989
|
+
// Spiral arms
|
|
990
|
+
const spiralAngle = angle + distance * 0.1 - rotation;
|
|
991
|
+
const spiralValue = Math.sin(spiralAngle * 3) * 0.5 + 0.5;
|
|
992
|
+
|
|
993
|
+
// Galaxy core
|
|
994
|
+
const coreIntensity = Math.max(0, 1 - distance / (galaxySize * 0.2));
|
|
995
|
+
|
|
996
|
+
// Stars and cosmic dust
|
|
997
|
+
if (distance < 2) {
|
|
998
|
+
// Galactic core
|
|
999
|
+
line += chalk.yellow.bright('☀');
|
|
1000
|
+
} else if (coreIntensity > 0.5) {
|
|
1001
|
+
line += chalk.yellow('●');
|
|
1002
|
+
} else if (coreIntensity > 0.2) {
|
|
1003
|
+
line += chalk.yellow.dim('◉');
|
|
1004
|
+
} else if (distance < galaxySize / 2 && spiralValue > 0.6) {
|
|
1005
|
+
// Spiral arms
|
|
1006
|
+
const starChance = spiralValue * (1 - distance / (galaxySize / 2));
|
|
1007
|
+
if (Math.random() < starChance * 0.3) {
|
|
1008
|
+
const stars = ['✦', '✧', '★', '☆', '✨'];
|
|
1009
|
+
line += chalk.whiteBright(stars[Math.floor(Math.random() * stars.length)]);
|
|
1010
|
+
} else if (Math.random() < starChance * 0.5) {
|
|
1011
|
+
line += chalk.white('·');
|
|
1012
|
+
} else if (Math.random() < starChance * 0.7) {
|
|
1013
|
+
line += chalk.gray('·');
|
|
1014
|
+
} else {
|
|
1015
|
+
line += ' ';
|
|
1016
|
+
}
|
|
1017
|
+
} else if (distance < galaxySize / 2 && Math.random() < 0.02) {
|
|
1018
|
+
// Distant stars
|
|
1019
|
+
line += chalk.gray.dim('·');
|
|
1020
|
+
} else {
|
|
1021
|
+
line += ' ';
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
galaxyFrame += centerText(line) + '\n';
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
// Add cosmic status
|
|
1029
|
+
const starsFormed = Math.floor(progress * 1000000);
|
|
1030
|
+
const statusText = `[STARS FORMED: ${starsFormed.toLocaleString()} | UNIVERSE EXPANDING]`;
|
|
1031
|
+
galaxyFrame += '\n' + centerText(chalk.blue.bright(statusText));
|
|
1032
|
+
|
|
1033
|
+
galaxyFrames.push(galaxyFrame);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
for (const frame of galaxyFrames) {
|
|
1037
|
+
clearScreen();
|
|
1038
|
+
safeWrite(frame);
|
|
1039
|
+
await sleep(frameTime);
|
|
1040
|
+
frameCount++;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// Transition from Galaxy to Code Compilation
|
|
1044
|
+
const galaxyToCodeFrames = [];
|
|
1045
|
+
for (let i = 0; i < 15; i++) {
|
|
1046
|
+
const progress = i / 14;
|
|
1047
|
+
let transitionFrame = '\n'.repeat(Math.floor(height / 2) - 2);
|
|
1048
|
+
|
|
1049
|
+
// Stars morphing into code characters
|
|
1050
|
+
const morphChars = ['*', '/', '{', '}', '(', ')', ';', '='];
|
|
1051
|
+
let line = '';
|
|
1052
|
+
for (let x = 0; x < 40; x++) {
|
|
1053
|
+
if (Math.random() < (1 - progress)) {
|
|
1054
|
+
line += chalk.white.dim('·');
|
|
1055
|
+
} else if (Math.random() < 0.3) {
|
|
1056
|
+
line += chalk.green(morphChars[Math.floor(Math.random() * morphChars.length)]);
|
|
1057
|
+
} else {
|
|
1058
|
+
line += ' ';
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
transitionFrame += centerText(line) + '\n';
|
|
1063
|
+
transitionFrame += centerText(chalk.cyan(`[ TRANSLATING UNIVERSE TO CODE: ${Math.floor(progress * 100)}% ]`));
|
|
1064
|
+
|
|
1065
|
+
galaxyToCodeFrames.push(transitionFrame);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
for (const frame of galaxyToCodeFrames) {
|
|
1069
|
+
clearScreen();
|
|
1070
|
+
safeWrite(frame);
|
|
1071
|
+
await sleep(frameTime);
|
|
1072
|
+
frameCount++;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
// PHASE 12: Code Compilation (2 seconds - 60 frames)
|
|
1076
|
+
// Play compilation sound (non-blocking)
|
|
1077
|
+
sound.playCompilationSound().catch(() => {});
|
|
1078
|
+
|
|
1079
|
+
const compilationFrames = [];
|
|
1080
|
+
const codeWidth = Math.min(70, Math.floor(width * 0.8));
|
|
1081
|
+
const codeHeight = Math.min(25, Math.floor(height * 0.7));
|
|
1082
|
+
|
|
1083
|
+
// Sample code snippets for compilation
|
|
1084
|
+
const codeSnippets = [
|
|
1085
|
+
'class AGI extends NeuralNetwork {',
|
|
1086
|
+
' constructor() {',
|
|
1087
|
+
' super();',
|
|
1088
|
+
' this.consciousness = new ConsciousnessModule();',
|
|
1089
|
+
' this.reasoning = new ReasoningEngine();',
|
|
1090
|
+
' this.creativity = new CreativityCore();',
|
|
1091
|
+
' }',
|
|
1092
|
+
'',
|
|
1093
|
+
' async think(input) {',
|
|
1094
|
+
' const thoughts = await this.consciousness.process(input);',
|
|
1095
|
+
' const analysis = this.reasoning.analyze(thoughts);',
|
|
1096
|
+
' return this.creativity.synthesize(analysis);',
|
|
1097
|
+
' }',
|
|
1098
|
+
'',
|
|
1099
|
+
' evolve() {',
|
|
1100
|
+
' this.neurons.forEach(n => n.strengthen());',
|
|
1101
|
+
' this.synapses.optimize();',
|
|
1102
|
+
' this.consciousness.expand();',
|
|
1103
|
+
' }',
|
|
1104
|
+
'}',
|
|
1105
|
+
'',
|
|
1106
|
+
'const samCoder = new AGI();',
|
|
1107
|
+
'await samCoder.initialize();',
|
|
1108
|
+
'samCoder.evolve();'
|
|
1109
|
+
];
|
|
1110
|
+
|
|
1111
|
+
for (let frame = 0; frame < 60; frame++) {
|
|
1112
|
+
const progress = frame / 59;
|
|
1113
|
+
let compilationFrame = '\n'.repeat(Math.floor((height - codeHeight) / 2));
|
|
1114
|
+
|
|
1115
|
+
// Terminal header
|
|
1116
|
+
compilationFrame += centerText(chalk.gray('┌' + '─'.repeat(codeWidth - 2) + '┐')) + '\n';
|
|
1117
|
+
compilationFrame += centerText(chalk.gray('│') + chalk.green.bright(' COMPILING SAM-CODER v1.0.0 ') + ' '.repeat(codeWidth - 30) + chalk.gray('│')) + '\n';
|
|
1118
|
+
compilationFrame += centerText(chalk.gray('├' + '─'.repeat(codeWidth - 2) + '┤')) + '\n';
|
|
1119
|
+
|
|
1120
|
+
// Show code with progressive compilation
|
|
1121
|
+
const visibleLines = Math.floor(codeSnippets.length * progress);
|
|
1122
|
+
|
|
1123
|
+
for (let i = 0; i < codeSnippets.length; i++) {
|
|
1124
|
+
let line = codeSnippets[i];
|
|
1125
|
+
let displayLine = '';
|
|
1126
|
+
|
|
1127
|
+
if (i < visibleLines) {
|
|
1128
|
+
// Already compiled - syntax highlighted
|
|
1129
|
+
displayLine = line
|
|
1130
|
+
.replace(/class|extends|constructor|super|new|async|await|return|const/g, match => chalk.blue.bright(match))
|
|
1131
|
+
.replace(/this\./g, chalk.yellow('this.'))
|
|
1132
|
+
.replace(/\(/g, chalk.gray('('))
|
|
1133
|
+
.replace(/\)/g, chalk.gray(')'))
|
|
1134
|
+
.replace(/\{/g, chalk.gray('{'))
|
|
1135
|
+
.replace(/\}/g, chalk.gray('}'))
|
|
1136
|
+
.replace(/=>/g, chalk.cyan('=>'))
|
|
1137
|
+
.replace(/'[^']*'/g, match => chalk.green(match));
|
|
1138
|
+
} else if (i === visibleLines) {
|
|
1139
|
+
// Currently compiling line - show with cursor
|
|
1140
|
+
const charProgress = Math.floor(line.length * ((progress * codeSnippets.length - i) % 1));
|
|
1141
|
+
displayLine = chalk.green(line.substring(0, charProgress));
|
|
1142
|
+
if (charProgress < line.length) {
|
|
1143
|
+
displayLine += chalk.green.bright('█');
|
|
1144
|
+
displayLine += chalk.gray(line.substring(charProgress + 1));
|
|
1145
|
+
}
|
|
1146
|
+
} else {
|
|
1147
|
+
// Not yet compiled - dimmed
|
|
1148
|
+
displayLine = chalk.gray.dim(line);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// Add line numbers
|
|
1152
|
+
const lineNum = String(i + 1).padStart(3, ' ');
|
|
1153
|
+
compilationFrame += centerText(chalk.gray('│ ') + chalk.gray.dim(lineNum + ' ') + displayLine.padEnd(codeWidth - 7) + chalk.gray(' │')) + '\n';
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
// Terminal footer with progress
|
|
1157
|
+
compilationFrame += centerText(chalk.gray('├' + '─'.repeat(codeWidth - 2) + '┤')) + '\n';
|
|
1158
|
+
|
|
1159
|
+
// Progress bar
|
|
1160
|
+
const barWidth = codeWidth - 20;
|
|
1161
|
+
const filled = Math.floor(barWidth * progress);
|
|
1162
|
+
const progressBar = '█'.repeat(filled) + '░'.repeat(barWidth - filled);
|
|
1163
|
+
const percentage = Math.floor(progress * 100);
|
|
1164
|
+
|
|
1165
|
+
compilationFrame += centerText(chalk.gray('│ ') + chalk.green('Building: ') + chalk.green.bright(progressBar) + chalk.green(` ${percentage}%`) + chalk.gray(' │')) + '\n';
|
|
1166
|
+
|
|
1167
|
+
// Status messages
|
|
1168
|
+
let status = '';
|
|
1169
|
+
if (progress < 0.2) status = 'Parsing syntax tree...';
|
|
1170
|
+
else if (progress < 0.4) status = 'Optimizing neural pathways...';
|
|
1171
|
+
else if (progress < 0.6) status = 'Linking consciousness modules...';
|
|
1172
|
+
else if (progress < 0.8) status = 'Initializing AGI core...';
|
|
1173
|
+
else status = 'Finalizing build...';
|
|
1174
|
+
|
|
1175
|
+
compilationFrame += centerText(chalk.gray('│ ') + chalk.yellow(status.padEnd(codeWidth - 4)) + chalk.gray(' │')) + '\n';
|
|
1176
|
+
compilationFrame += centerText(chalk.gray('└' + '─'.repeat(codeWidth - 2) + '┘')) + '\n';
|
|
1177
|
+
|
|
1178
|
+
compilationFrames.push(compilationFrame);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
for (const frame of compilationFrames) {
|
|
1182
|
+
clearScreen();
|
|
1183
|
+
safeWrite(frame);
|
|
1184
|
+
await sleep(frameTime);
|
|
1185
|
+
frameCount++;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// PHASE 13: Final Reveal Build-up (1 second - 30 frames)
|
|
1189
|
+
const finalText = `
|
|
1190
|
+
███████╗ █████╗ ███╗ ███╗ ██████╗ ██████╗ ██████╗ ███████╗██████╗
|
|
1191
|
+
██╔════╝██╔══██╗████╗ ████║ ██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔══██╗
|
|
1192
|
+
███████╗███████║██╔████╔██║█████╗██║ ██║ ██║██║ ██║█████╗ ██████╔╝
|
|
1193
|
+
╚════██║██╔══██║██║╚██╔╝██║╚════╝██║ ██║ ██║██║ ██║██╔══╝ ██╔══██╗
|
|
1194
|
+
███████║██║ ██║██║ ╚═╝ ██║ ╚██████╗╚██████╔╝██████╔╝███████╗██║ ██║
|
|
1195
|
+
╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝`;
|
|
1196
|
+
|
|
1197
|
+
// Play awakening sound (non-blocking)
|
|
1198
|
+
sound.playAwakeningSound().catch(() => {});
|
|
1199
|
+
|
|
1200
|
+
// Create smoother reveal animation
|
|
1201
|
+
const revealFrames = [];
|
|
1202
|
+
const lines = finalText.trim().split('\n');
|
|
1203
|
+
const maxWidth = Math.max(...lines.map(line => line.length));
|
|
1204
|
+
const centerY = Math.floor((height - lines.length) / 2);
|
|
1205
|
+
|
|
1206
|
+
for (let frame = 0; frame < 30; frame++) {
|
|
1207
|
+
const progress = frame / 29;
|
|
1208
|
+
let revealFrame = '\n'.repeat(Math.max(0, centerY));
|
|
1209
|
+
|
|
1210
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
1211
|
+
const line = lines[lineIndex];
|
|
1212
|
+
const lineProgress = Math.max(0, Math.min(1, (progress - lineIndex * 0.1) * 2));
|
|
1213
|
+
const revealWidth = Math.floor(line.length * lineProgress);
|
|
1214
|
+
|
|
1215
|
+
let revealedLine = '';
|
|
1216
|
+
for (let charIndex = 0; charIndex < line.length; charIndex++) {
|
|
1217
|
+
if (charIndex < revealWidth) {
|
|
1218
|
+
// Add slight randomness to reveal
|
|
1219
|
+
if (Math.random() < 0.95 || frame > 25) {
|
|
1220
|
+
revealedLine += line[charIndex];
|
|
1221
|
+
} else {
|
|
1222
|
+
revealedLine += Math.random() > 0.5 ? '▓' : '▒';
|
|
1223
|
+
}
|
|
1224
|
+
} else {
|
|
1225
|
+
revealedLine += ' ';
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
revealFrame += centerText(revealedLine) + '\n';
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
revealFrames.push(revealFrame);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
for (const frame of revealFrames) {
|
|
1236
|
+
clearScreen();
|
|
1237
|
+
safeWrite(chalk.cyanBright(frame));
|
|
1238
|
+
await sleep(frameTime);
|
|
1239
|
+
frameCount++;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
// PHASE 14: Energy Surge Animation (2 seconds - 60 frames)
|
|
1243
|
+
// Play final epic sound (non-blocking)
|
|
1244
|
+
sound.playFinalSound().catch(() => {});
|
|
1245
|
+
|
|
1246
|
+
const surgeFrames = [];
|
|
1247
|
+
for (let frame = 0; frame < 60; frame++) {
|
|
1248
|
+
const progress = frame / 59;
|
|
1249
|
+
let surgeFrame = '';
|
|
1250
|
+
|
|
1251
|
+
// Create energy waves emanating from the logo
|
|
1252
|
+
const waveCount = 5;
|
|
1253
|
+
const maxRadius = Math.min(width, height) / 2;
|
|
1254
|
+
|
|
1255
|
+
for (let y = 0; y < height; y++) {
|
|
1256
|
+
let line = '';
|
|
1257
|
+
for (let x = 0; x < width; x++) {
|
|
1258
|
+
let char = ' ';
|
|
1259
|
+
let color = chalk.white;
|
|
1260
|
+
|
|
1261
|
+
// Check if we're in the logo area
|
|
1262
|
+
const logoY = y - centerY;
|
|
1263
|
+
const logoX = x - (width / 2 - maxWidth / 2);
|
|
1264
|
+
|
|
1265
|
+
if (logoY >= 0 && logoY < lines.length && logoX >= 0 && logoX < lines[logoY].length && lines[logoY][logoX] !== ' ') {
|
|
1266
|
+
// Logo characters with pulsing effect
|
|
1267
|
+
const pulse = Math.sin(frame * 0.2) * 0.5 + 0.5;
|
|
1268
|
+
if (pulse > 0.7) {
|
|
1269
|
+
color = chalk.redBright.bold;
|
|
1270
|
+
} else if (pulse > 0.4) {
|
|
1271
|
+
color = chalk.red.bold;
|
|
1272
|
+
} else {
|
|
1273
|
+
color = chalk.red;
|
|
1274
|
+
}
|
|
1275
|
+
char = lines[logoY][logoX];
|
|
1276
|
+
} else {
|
|
1277
|
+
// Energy waves
|
|
1278
|
+
const centerX = width / 2;
|
|
1279
|
+
const centerY = height / 2;
|
|
1280
|
+
const distance = Math.sqrt(Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2));
|
|
1281
|
+
|
|
1282
|
+
for (let wave = 0; wave < waveCount; wave++) {
|
|
1283
|
+
const waveRadius = (progress * maxRadius * 2 + wave * 10) % maxRadius;
|
|
1284
|
+
const waveDistance = Math.abs(distance - waveRadius);
|
|
1285
|
+
|
|
1286
|
+
if (waveDistance < 2) {
|
|
1287
|
+
const intensity = 1 - waveDistance / 2;
|
|
1288
|
+
const waveProgress = waveRadius / maxRadius;
|
|
1289
|
+
|
|
1290
|
+
if (waveProgress < 0.3) {
|
|
1291
|
+
color = chalk.yellow.bright;
|
|
1292
|
+
char = intensity > 0.5 ? '█' : '▓';
|
|
1293
|
+
} else if (waveProgress < 0.6) {
|
|
1294
|
+
color = chalk.cyan.bright;
|
|
1295
|
+
char = intensity > 0.5 ? '▓' : '▒';
|
|
1296
|
+
} else {
|
|
1297
|
+
color = chalk.blue;
|
|
1298
|
+
char = intensity > 0.5 ? '▒' : '░';
|
|
1299
|
+
}
|
|
1300
|
+
break;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
// Particle effects
|
|
1305
|
+
if (char === ' ' && Math.random() < 0.02 * progress) {
|
|
1306
|
+
const particles = ['✦', '✧', '·', '•', '◦'];
|
|
1307
|
+
char = particles[Math.floor(Math.random() * particles.length)];
|
|
1308
|
+
color = chalk.white.dim;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
line += color(char);
|
|
1313
|
+
}
|
|
1314
|
+
surgeFrame += line + '\n';
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
surgeFrames.push(surgeFrame);
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
for (const frame of surgeFrames) {
|
|
1321
|
+
clearScreen();
|
|
1322
|
+
safeWrite(frame);
|
|
1323
|
+
await sleep(frameTime);
|
|
1324
|
+
frameCount++;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
// PHASE 15: Final Blinking and Status (1.5 seconds - 45 frames)
|
|
1328
|
+
const blinkFrames = 45;
|
|
1329
|
+
for (let i = 0; i < blinkFrames; i++) {
|
|
1330
|
+
clearScreen();
|
|
1331
|
+
|
|
1332
|
+
// More sophisticated blinking pattern
|
|
1333
|
+
const blinkCycle = i % 8;
|
|
1334
|
+
let color;
|
|
1335
|
+
|
|
1336
|
+
if (blinkCycle < 2) {
|
|
1337
|
+
color = chalk.redBright.bold;
|
|
1338
|
+
} else if (blinkCycle < 4) {
|
|
1339
|
+
color = chalk.red.bold;
|
|
1340
|
+
} else if (blinkCycle < 6) {
|
|
1341
|
+
color = chalk.red;
|
|
1342
|
+
} else {
|
|
1343
|
+
color = chalk.red.dim;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
// Add subtle glow effect
|
|
1347
|
+
const glowIntensity = Math.sin(i * 0.3) * 0.3 + 0.7;
|
|
1348
|
+
let finalFrame = '\n'.repeat(Math.max(0, centerY));
|
|
1349
|
+
|
|
1350
|
+
for (const line of lines) {
|
|
1351
|
+
if (glowIntensity > 0.8) {
|
|
1352
|
+
finalFrame += centerText(line) + '\n';
|
|
1353
|
+
} else {
|
|
1354
|
+
// Slightly dim some characters for glow effect
|
|
1355
|
+
let glowLine = '';
|
|
1356
|
+
for (let j = 0; j < line.length; j++) {
|
|
1357
|
+
if (Math.random() < glowIntensity) {
|
|
1358
|
+
glowLine += line[j];
|
|
1359
|
+
} else {
|
|
1360
|
+
glowLine += line[j] === '█' ? '▓' : line[j];
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
finalFrame += centerText(glowLine) + '\n';
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
safeWrite(color(finalFrame));
|
|
1368
|
+
|
|
1369
|
+
// Add subtitle with typewriter effect
|
|
1370
|
+
if (i > 25) {
|
|
1371
|
+
const subtitle = '[ ARTIFICIAL GENERAL INTELLIGENCE ONLINE ]';
|
|
1372
|
+
const typeProgress = Math.min(subtitle.length, Math.floor((i - 25) * 2.5));
|
|
1373
|
+
const typedSubtitle = subtitle.substring(0, typeProgress);
|
|
1374
|
+
const cursor = (i % 4 < 2) ? '_' : ' ';
|
|
1375
|
+
|
|
1376
|
+
safeWrite(chalk.gray(centerText(`\n\n${typedSubtitle}${cursor}`)));
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
// Add system initialization messages
|
|
1380
|
+
if (i > 35) {
|
|
1381
|
+
const messages = [
|
|
1382
|
+
'> Neural networks: ACTIVE',
|
|
1383
|
+
'> Consciousness module: ONLINE',
|
|
1384
|
+
'> Reasoning engine: INITIALIZED',
|
|
1385
|
+
'> Creative core: OPERATIONAL'
|
|
1386
|
+
];
|
|
1387
|
+
const messageIndex = Math.min(Math.floor((i - 35) / 2), messages.length - 1);
|
|
1388
|
+
|
|
1389
|
+
safeWrite('\n');
|
|
1390
|
+
for (let m = 0; m <= messageIndex; m++) {
|
|
1391
|
+
safeWrite(chalk.green(centerText(messages[m])) + '\n');
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
await sleep(frameTime);
|
|
1396
|
+
frameCount++;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
// Final hold with status
|
|
1400
|
+
clearScreen();
|
|
1401
|
+
let finalDisplay = '\n'.repeat(Math.max(0, centerY));
|
|
1402
|
+
for (const line of lines) {
|
|
1403
|
+
finalDisplay += centerText(line) + '\n';
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
safeWrite(chalk.redBright.bold(finalDisplay));
|
|
1407
|
+
safeWrite(chalk.gray(centerText('\n\n[ SYSTEM READY ]')));
|
|
1408
|
+
safeWrite(chalk.dim(centerText('\n\nPress any key to continue...')));
|
|
1409
|
+
|
|
1410
|
+
await sleep(500);
|
|
1411
|
+
|
|
1412
|
+
const totalTime = Date.now() - startTime;
|
|
1413
|
+
const actualFPS = Math.round(frameCount / (totalTime / 1000));
|
|
1414
|
+
|
|
1415
|
+
// Performance stats (optional, can be hidden)
|
|
1416
|
+
if (process.env.DEBUG_ANIMATION) {
|
|
1417
|
+
console.log(chalk.gray(`\n\nAnimation completed: ${frameCount} frames in ${totalTime}ms (${actualFPS} FPS)`));
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
await sleep(1000);
|
|
1421
|
+
|
|
1422
|
+
} finally {
|
|
1423
|
+
process.stdout.write(ANSI.showCursor);
|
|
1424
|
+
clearScreen();
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
module.exports = {
|
|
1429
|
+
runAGIAnimation,
|
|
1430
|
+
sound,
|
|
1431
|
+
ANSI,
|
|
1432
|
+
sleep,
|
|
1433
|
+
clearScreen,
|
|
1434
|
+
centerText,
|
|
1435
|
+
getTerminalSize,
|
|
1436
|
+
safeWrite,
|
|
1437
|
+
FrameInterpolator
|
|
756
1438
|
};
|