calvyn-code 0.14.6 → 0.14.7

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 (2) hide show
  1. package/cli.py +28 -14
  2. package/package.json +1 -2
package/cli.py CHANGED
@@ -2502,33 +2502,47 @@ def _ensure_dev_access_gate() -> None:
2502
2502
  security_cfg = cfg.get("security", {}) if isinstance(cfg, dict) else {}
2503
2503
  if not isinstance(security_cfg, dict):
2504
2504
  security_cfg = {}
2505
+ legacy_code = str(security_cfg.get("dev_access_code") or "").strip()
2506
+ if legacy_code:
2507
+ save_config_value("security.dev_access_code", "")
2508
+ save_config_value("security.dev_access_code_hash", "")
2509
+ save_config_value("security.dev_access_granted", False)
2510
+ security_cfg["dev_access_code"] = ""
2511
+ security_cfg["dev_access_code_hash"] = ""
2512
+ security_cfg["dev_access_granted"] = False
2505
2513
  if not security_cfg.get("dev_access_required", True):
2506
2514
  return
2507
2515
  if security_cfg.get("dev_access_granted", False):
2508
2516
  return
2509
2517
 
2510
2518
  access_code_hash = str(security_cfg.get("dev_access_code_hash") or "").strip().lower()
2511
- generated_code = ""
2512
- if not access_code_hash:
2513
- generated_code = f"CALVYN-{secrets.token_hex(3).upper()}-{secrets.token_hex(3).upper()}"
2514
- access_code_hash = hashlib.sha256(generated_code.encode("utf-8")).hexdigest()
2515
- save_config_value("security.dev_access_code_hash", access_code_hash)
2519
+ first_setup = not access_code_hash
2516
2520
 
2517
2521
  print()
2518
2522
  print("╔══════════════════════════════════════════════════════════════════════════════╗")
2519
2523
  print("║ CALVYN DEV АВТОРИЗАЦИЯ ║")
2520
2524
  print("╠══════════════════════════════════════════════════════════════════════════════╣")
2521
- print("║ Доступ к режиму разработки защищен одноразовым кодом. ║")
2522
- if generated_code:
2523
- print("║ Новый секретный код сгенерирован и сохранен в виде хэша. ║")
2524
- print(f"║ Код для первого входа: {generated_code:<42}║")
2525
+ if first_setup:
2526
+ print("║ Первый запуск: придумайте секретный код. В системе сохранится только хэш. ║")
2527
+ print("║ Сам код нигде не хранится в открытом виде и не может быть прочитан обратно.║")
2525
2528
  else:
2526
- print("║ Код уже сохранен в системе. Введите секретный ключ для разблокировки. ║")
2529
+ print("║ Доступ к режиму разработки защищен вашим секретным кодом. ║")
2530
+ print("║ В системе хранится только хэш. Введите код для разблокировки. ║")
2527
2531
  print("╚══════════════════════════════════════════════════════════════════════════════╝")
2528
- entered = input("Код доступа: ").strip()
2529
- entered_hash = hashlib.sha256(entered.encode("utf-8")).hexdigest()
2530
- if entered_hash != access_code_hash:
2531
- raise SystemExit("Неверный код доступа.")
2532
+ if first_setup:
2533
+ entered = input("Новый код доступа: ").strip()
2534
+ confirm = input("Повторите код: ").strip()
2535
+ if not entered or len(entered) < 8:
2536
+ raise SystemExit("Код должен быть не короче 8 символов.")
2537
+ if entered != confirm:
2538
+ raise SystemExit("Коды не совпадают.")
2539
+ access_code_hash = hashlib.sha256(entered.encode("utf-8")).hexdigest()
2540
+ save_config_value("security.dev_access_code_hash", access_code_hash)
2541
+ else:
2542
+ entered = input("Код доступа: ").strip()
2543
+ entered_hash = hashlib.sha256(entered.encode("utf-8")).hexdigest()
2544
+ if entered_hash != access_code_hash:
2545
+ raise SystemExit("Неверный код доступа.")
2532
2546
  save_config_value("security.dev_access_granted", True)
2533
2547
  except SystemExit:
2534
2548
  raise
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "calvyn-code",
3
- "version": "0.14.6",
3
+ "version": "0.14.7",
4
4
  "description": "Calvyn Code — AI агент с инструментами, мессенджерами и локальным CLI",
5
5
  "bin": {
6
6
  "calvyn": "./bin/calvyn.js",
@@ -32,7 +32,6 @@
32
32
  "url": "https://github.com/calvyns/calvyn-code/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@askjo/camofox-browser": "^1.5.2",
36
35
  "agent-browser": "^0.26.0",
37
36
  "puppeteer": "^25.0.2"
38
37
  },