aios-core 4.2.1 → 4.2.2

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.
@@ -7,8 +7,8 @@
7
7
  # - SHA256 hashes for change detection
8
8
  # - File types for categorization
9
9
  #
10
- version: 4.2.1
11
- generated_at: "2026-02-16T00:12:14.502Z"
10
+ version: 4.2.2
11
+ generated_at: "2026-02-16T00:23:14.678Z"
12
12
  generator: scripts/generate-install-manifest.js
13
13
  file_count: 992
14
14
  files:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aios-core",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "Synkra AIOS: AI-Orchestrated System for Full Stack Development - Core Framework",
5
5
  "bin": {
6
6
  "aios": "bin/aios.js",
@@ -421,57 +421,122 @@ async function authenticateWithEmail(email, password) {
421
421
  };
422
422
  }
423
423
 
424
- // Try login first
425
- const spinner = createSpinner('Authenticating...');
426
- spinner.start();
427
-
428
424
  let sessionToken;
429
425
  let emailVerified;
426
+ let currentPassword = password;
430
427
 
431
- try {
432
- const loginResult = await client.login(email, password);
433
- sessionToken = loginResult.sessionToken;
434
- emailVerified = loginResult.emailVerified;
435
- spinner.succeed('Authenticated successfully.');
436
- } catch (loginError) {
437
- // If invalid credentials, offer to create account
438
- if (loginError.code === 'INVALID_CREDENTIALS') {
439
- spinner.info('No account found for this email.');
440
-
441
- // In CI mode, auto-create without prompting
442
- if (isCIEnvironment()) {
428
+ // Login with retry loop (max 3 attempts for wrong password)
429
+ for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
430
+ const spinner = createSpinner('Authenticating...');
431
+ spinner.start();
432
+
433
+ try {
434
+ const loginResult = await client.login(email, currentPassword);
435
+ sessionToken = loginResult.sessionToken;
436
+ emailVerified = loginResult.emailVerified;
437
+ spinner.succeed('Authenticated successfully.');
438
+ break; // Success, exit retry loop
439
+ } catch (loginError) {
440
+ if (loginError.code === 'INVALID_CREDENTIALS') {
441
+ spinner.stop();
442
+
443
+ // Try to determine if account exists by attempting signup
444
+ // If signup fails with EMAIL_ALREADY_REGISTERED, account exists (wrong password)
445
+ // If signup succeeds or would succeed, account doesn't exist (new user)
446
+ if (isCIEnvironment()) {
447
+ // CI mode: try auto-signup
448
+ try {
449
+ await client.signup(email, currentPassword);
450
+ showSuccess('Account created. Verification email sent!');
451
+ emailVerified = false;
452
+ const loginAfterSignup = await client.login(email, currentPassword);
453
+ sessionToken = loginAfterSignup.sessionToken;
454
+ break;
455
+ } catch (signupError) {
456
+ if (signupError.code === 'EMAIL_ALREADY_REGISTERED') {
457
+ showError('Account exists but the password is incorrect.');
458
+ showInfo('Forgot your password? Visit https://pro.synkra.ai/reset-password or contact support@synkra.ai');
459
+ return { success: false, error: signupError.message };
460
+ }
461
+ return { success: false, error: signupError.message };
462
+ }
463
+ }
464
+
465
+ // Interactive mode: check if account exists
466
+ const accountCheckSpinner = createSpinner('Checking account...');
467
+ accountCheckSpinner.start();
468
+
469
+ let accountExists = false;
443
470
  try {
444
- await client.signup(email, password);
445
- showSuccess('Account created. Verification email sent!');
446
- emailVerified = false;
447
- const loginAfterSignup = await client.login(email, password);
471
+ // Try a lightweight signup to probe. If EMAIL_ALREADY_REGISTERED, account exists.
472
+ await client.signup(email, currentPassword);
473
+ // Signup succeeded — account was just created
474
+ accountCheckSpinner.succeed('Account created! Verification email sent.');
475
+ const loginAfterSignup = await client.login(email, currentPassword);
448
476
  sessionToken = loginAfterSignup.sessionToken;
449
- } catch (signupError) {
450
- if (signupError.code === 'EMAIL_ALREADY_REGISTERED') {
451
- showError('An account exists with this email but the password is incorrect.');
477
+ emailVerified = false;
478
+ break;
479
+ } catch (probeError) {
480
+ if (probeError.code === 'EMAIL_ALREADY_REGISTERED') {
481
+ accountExists = true;
482
+ accountCheckSpinner.stop();
483
+ } else {
484
+ accountCheckSpinner.stop();
485
+ // Unknown error during probe — offer create account flow
486
+ const signupResult = await promptCreateAccount(client, email);
487
+ if (!signupResult.success) {
488
+ return signupResult;
489
+ }
490
+ sessionToken = signupResult.sessionToken;
491
+ emailVerified = false;
492
+ break;
493
+ }
494
+ }
495
+
496
+ if (accountExists) {
497
+ // Account exists but password is wrong — retry
498
+ const remaining = MAX_RETRIES - attempt;
499
+ if (remaining > 0) {
500
+ showError(`Incorrect password. ${remaining} attempt${remaining > 1 ? 's' : ''} remaining.`);
501
+ showInfo('Forgot your password? Visit https://pro.synkra.ai/reset-password');
502
+
503
+ const inquirer = require('inquirer');
504
+ const { retryPassword } = await inquirer.prompt([
505
+ {
506
+ type: 'password',
507
+ name: 'retryPassword',
508
+ message: colors.primary('Password:'),
509
+ mask: '*',
510
+ validate: (input) => {
511
+ if (!input || input.length < MIN_PASSWORD_LENGTH) {
512
+ return `Password must be at least ${MIN_PASSWORD_LENGTH} characters`;
513
+ }
514
+ return true;
515
+ },
516
+ },
517
+ ]);
518
+ currentPassword = retryPassword;
519
+ continue; // Retry login
520
+ } else {
521
+ showError('Maximum login attempts reached.');
452
522
  showInfo('Forgot your password? Visit https://pro.synkra.ai/reset-password or contact support@synkra.ai');
453
- return { success: false, error: signupError.message };
523
+ return { success: false, error: 'Maximum login attempts reached.' };
454
524
  }
455
- return { success: false, error: signupError.message };
456
525
  }
526
+ } else if (loginError.code === 'AUTH_RATE_LIMITED') {
527
+ spinner.fail(loginError.message);
528
+ return { success: false, error: loginError.message };
457
529
  } else {
458
- // Interactive: ask user if they want to create account
459
- const signupResult = await promptCreateAccount(client, email);
460
- if (!signupResult.success) {
461
- return signupResult;
462
- }
463
- sessionToken = signupResult.sessionToken;
464
- emailVerified = false;
530
+ spinner.fail(`Authentication failed: ${loginError.message}`);
531
+ return { success: false, error: loginError.message };
465
532
  }
466
- } else if (loginError.code === 'AUTH_RATE_LIMITED') {
467
- spinner.fail(loginError.message);
468
- return { success: false, error: loginError.message };
469
- } else {
470
- spinner.fail(`Authentication failed: ${loginError.message}`);
471
- return { success: false, error: loginError.message };
472
533
  }
473
534
  }
474
535
 
536
+ if (!sessionToken) {
537
+ return { success: false, error: 'Authentication failed after all attempts.' };
538
+ }
539
+
475
540
  // Wait for email verification if needed
476
541
  if (!emailVerified) {
477
542
  const verifyResult = await waitForEmailVerification(client, sessionToken);