@agentunion/kite 1.6.1 → 1.6.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.
- package/cli.js +1 -1
- package/launcher/entry.py +25 -1
- package/main.py +55 -3
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -69,7 +69,7 @@ for (let i = 0; i < args.length; i++) {
|
|
|
69
69
|
const versionDir = path.join(kiteHome, 'versions', useVersion);
|
|
70
70
|
|
|
71
71
|
// Check if first arg is a CLI command or help/version flag
|
|
72
|
-
const cliCommands = ['install', 'uninstall', 'update', 'list', 'search', 'info', 'log', 'rollback', 'clean', 'doctor', 'history'];
|
|
72
|
+
const cliCommands = ['install', 'uninstall', 'update', 'list', 'search', 'info', 'log', 'rollback', 'clean', 'doctor', 'history', 'install-skill'];
|
|
73
73
|
const helpFlags = ['-h', '-H', '--help', 'help'];
|
|
74
74
|
const versionFlags = ['-v', '-V', '--version', 'version'];
|
|
75
75
|
|
package/launcher/entry.py
CHANGED
|
@@ -907,7 +907,24 @@ class Launcher:
|
|
|
907
907
|
print(f"\033[33m[launcher] 提示: 已连续 {attempt} 次无法连接 Kernel (端口 {self.kernel_port})")
|
|
908
908
|
if self.kernel_port < 1024:
|
|
909
909
|
print(f"[launcher] ⚠ 端口 {self.kernel_port} 异常偏低,可能是 Kernel 端口绑定失败或配置错误")
|
|
910
|
-
print(f"[launcher] 请检查: 1) Kernel 进程是否存活 2) kernel/module.md 中 preferred_port
|
|
910
|
+
print(f"[launcher] 请检查: 1) Kernel 进程是否存活 2) kernel/module.md 中 preferred_port 配置是否正确")
|
|
911
|
+
# Check if Kernel crashed due to missing dependencies
|
|
912
|
+
crash_log = os.path.join(os.environ.get("KITE_INSTANCE_DIR", ""), "kernel", "log", "crashes.jsonl")
|
|
913
|
+
if os.path.exists(crash_log):
|
|
914
|
+
try:
|
|
915
|
+
with open(crash_log, "r", encoding="utf-8") as f:
|
|
916
|
+
last_line = None
|
|
917
|
+
for line in f:
|
|
918
|
+
last_line = line
|
|
919
|
+
if last_line:
|
|
920
|
+
crash = json.loads(last_line)
|
|
921
|
+
if "ModuleNotFoundError" in crash.get("error_type", ""):
|
|
922
|
+
print(f"[launcher] ⚠ 检测到依赖缺失: {crash.get('error_type', '')}")
|
|
923
|
+
print(f"[launcher] 提示: 直接运行 'python3 main.py' 会跳过依赖检查")
|
|
924
|
+
print(f"[launcher] 请使用 'kite start' 或手动安装依赖: pip3 install uvicorn fastapi httpx json5")
|
|
925
|
+
except Exception:
|
|
926
|
+
pass
|
|
927
|
+
print("\033[0m")
|
|
911
928
|
self._ws = None
|
|
912
929
|
if self._thread_shutdown.is_set():
|
|
913
930
|
return
|
|
@@ -4486,6 +4503,13 @@ def start_launcher():
|
|
|
4486
4503
|
|
|
4487
4504
|
print("[launcher] Kite 启动中...")
|
|
4488
4505
|
|
|
4506
|
+
# Print OS info
|
|
4507
|
+
import platform
|
|
4508
|
+
os_name = platform.system()
|
|
4509
|
+
os_version = platform.release()
|
|
4510
|
+
os_arch = platform.machine()
|
|
4511
|
+
print(f"[launcher] 操作系统: {os_name} {os_version} ({os_arch})")
|
|
4512
|
+
|
|
4489
4513
|
# Create and run launcher
|
|
4490
4514
|
token = secrets.token_hex(32)
|
|
4491
4515
|
launcher = Launcher(kite_token=token)
|
package/main.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Kite development entry point.
|
|
3
|
-
1.
|
|
4
|
-
2.
|
|
3
|
+
1. Check dependencies (if bypassing cli.js)
|
|
4
|
+
2. Run code stats
|
|
5
|
+
3. Start launcher
|
|
5
6
|
|
|
6
|
-
注意:环境检查已在 Node.js 层(cli.js
|
|
7
|
+
注意:环境检查已在 Node.js 层(cli.js)完成,但直接运行 python3 main.py 会绕过检查
|
|
7
8
|
"""
|
|
8
9
|
import sys
|
|
9
10
|
from pathlib import Path
|
|
@@ -18,6 +19,57 @@ if "--stop" in sys.argv:
|
|
|
18
19
|
stop_instances()
|
|
19
20
|
sys.exit(0)
|
|
20
21
|
|
|
22
|
+
# --no-tls: 禁用 TLS 要求(本地开发用)
|
|
23
|
+
if "--no-tls" in sys.argv:
|
|
24
|
+
import os
|
|
25
|
+
os.environ["KITE_REQUIRE_TLS"] = "false"
|
|
26
|
+
sys.argv.remove("--no-tls")
|
|
27
|
+
|
|
28
|
+
# 0. Check critical dependencies (only if bypassing cli.js)
|
|
29
|
+
def check_critical_deps():
|
|
30
|
+
"""检查关键依赖,如果缺失则自动安装"""
|
|
31
|
+
missing = []
|
|
32
|
+
try:
|
|
33
|
+
import uvicorn
|
|
34
|
+
except ImportError:
|
|
35
|
+
missing.append("uvicorn")
|
|
36
|
+
try:
|
|
37
|
+
import fastapi
|
|
38
|
+
except ImportError:
|
|
39
|
+
missing.append("fastapi")
|
|
40
|
+
try:
|
|
41
|
+
import httpx
|
|
42
|
+
except ImportError:
|
|
43
|
+
missing.append("httpx")
|
|
44
|
+
try:
|
|
45
|
+
import json5
|
|
46
|
+
except ImportError:
|
|
47
|
+
missing.append("json5")
|
|
48
|
+
|
|
49
|
+
if missing:
|
|
50
|
+
print("\033[93m[Kite] 检测到缺少关键依赖库:\033[0m")
|
|
51
|
+
for pkg in missing:
|
|
52
|
+
print(f" - {pkg}")
|
|
53
|
+
print()
|
|
54
|
+
print("\033[96m[Kite] 正在自动安装依赖...\033[0m")
|
|
55
|
+
|
|
56
|
+
import subprocess
|
|
57
|
+
try:
|
|
58
|
+
subprocess.check_call(
|
|
59
|
+
[sys.executable, "-m", "pip", "install"] + missing,
|
|
60
|
+
stdout=subprocess.DEVNULL,
|
|
61
|
+
stderr=subprocess.PIPE
|
|
62
|
+
)
|
|
63
|
+
print("\033[92m[Kite] 依赖安装成功\033[0m")
|
|
64
|
+
print()
|
|
65
|
+
except subprocess.CalledProcessError as e:
|
|
66
|
+
print("\033[91m[Kite] 依赖安装失败\033[0m")
|
|
67
|
+
print(f"\033[93m请手动安装: pip3 install {' '.join(missing)}\033[0m")
|
|
68
|
+
print()
|
|
69
|
+
sys.exit(1)
|
|
70
|
+
|
|
71
|
+
check_critical_deps()
|
|
72
|
+
|
|
21
73
|
# 1. Run code stats
|
|
22
74
|
from launcher.count_lines import run_stats
|
|
23
75
|
run_stats()
|