@agentunion/kite 1.0.1 → 1.0.3
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/core/__pycache__/data_dir.cpython-313.pyc +0 -0
- package/core/data_dir.py +62 -0
- package/core/launcher/data/log/lifecycle.jsonl +43 -0
- package/core/launcher/entry.py +9 -3
- package/core/launcher/process_manager.py +12 -1
- package/core/registry/entry.py +2 -1
- package/package.json +11 -3
- package/core/launcher/data/processes_14752.json +0 -32
- package/core/registry/data/port_14752.txt +0 -1
|
Binary file
|
package/core/data_dir.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Data directory management for Kite.
|
|
3
|
+
When installed globally via npm, use ~/.kite/ for runtime data.
|
|
4
|
+
When running locally, use project_root/core/*/data/.
|
|
5
|
+
"""
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_data_root() -> str:
|
|
11
|
+
"""Get the root directory for runtime data.
|
|
12
|
+
|
|
13
|
+
Returns:
|
|
14
|
+
- ~/.kite/ if installed globally (no write permission to install dir)
|
|
15
|
+
- project_root if running locally (development mode)
|
|
16
|
+
"""
|
|
17
|
+
# Check if we're in a global npm install (no write permission)
|
|
18
|
+
project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
19
|
+
test_file = os.path.join(project_root, "core", "launcher", "data", ".write_test")
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
os.makedirs(os.path.dirname(test_file), exist_ok=True)
|
|
23
|
+
with open(test_file, "w") as f:
|
|
24
|
+
f.write("test")
|
|
25
|
+
os.remove(test_file)
|
|
26
|
+
# Write permission OK, use project_root
|
|
27
|
+
return project_root
|
|
28
|
+
except (OSError, PermissionError):
|
|
29
|
+
# No write permission, use user home
|
|
30
|
+
home = os.path.expanduser("~")
|
|
31
|
+
kite_home = os.path.join(home, ".kite")
|
|
32
|
+
os.makedirs(kite_home, exist_ok=True)
|
|
33
|
+
return kite_home
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def get_launcher_data_dir() -> str:
|
|
37
|
+
"""Get launcher data directory."""
|
|
38
|
+
root = get_data_root()
|
|
39
|
+
if root.endswith(".kite"):
|
|
40
|
+
# User home mode: ~/.kite/launcher/
|
|
41
|
+
return os.path.join(root, "launcher")
|
|
42
|
+
else:
|
|
43
|
+
# Project mode: project_root/core/launcher/data/
|
|
44
|
+
return os.path.join(root, "core", "launcher", "data")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def get_registry_data_dir() -> str:
|
|
48
|
+
"""Get registry data directory."""
|
|
49
|
+
root = get_data_root()
|
|
50
|
+
if root.endswith(".kite"):
|
|
51
|
+
return os.path.join(root, "registry")
|
|
52
|
+
else:
|
|
53
|
+
return os.path.join(root, "core", "registry", "data")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def get_event_hub_data_dir() -> str:
|
|
57
|
+
"""Get event hub data directory."""
|
|
58
|
+
root = get_data_root()
|
|
59
|
+
if root.endswith(".kite"):
|
|
60
|
+
return os.path.join(root, "event_hub")
|
|
61
|
+
else:
|
|
62
|
+
return os.path.join(root, "core", "event_hub", "data")
|
|
@@ -1113,3 +1113,46 @@
|
|
|
1113
1113
|
{"ts": "2026-02-28T07:57:48.632978+00:00", "event": "scanned", "module": "hello_test", "state": "manual", "module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\test_modules\\hello"}
|
|
1114
1114
|
{"ts": "2026-02-28T07:57:48.633432+00:00", "event": "scanned", "module": "hello_node", "state": "manual", "module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\test_modules\\hello_node"}
|
|
1115
1115
|
{"ts": "2026-02-28T07:57:48.852301+00:00", "event": "starting", "module": "event_hub"}
|
|
1116
|
+
{"ts": "2026-02-28T07:58:18.884176+00:00", "event": "started", "module": "event_hub", "pid": 16856}
|
|
1117
|
+
{"ts": "2026-02-28T07:58:18.885116+00:00", "event": "starting", "module": "event_hub_bench"}
|
|
1118
|
+
{"ts": "2026-02-28T07:58:48.914951+00:00", "event": "started", "module": "event_hub_bench", "pid": 7428}
|
|
1119
|
+
{"ts": "2026-02-28T07:58:48.915845+00:00", "event": "starting", "module": "registry"}
|
|
1120
|
+
{"ts": "2026-02-28T07:59:18.918721+00:00", "event": "started", "module": "registry", "pid": 1784}
|
|
1121
|
+
{"ts": "2026-02-28T07:59:18.919864+00:00", "event": "starting", "module": "watchdog"}
|
|
1122
|
+
{"ts": "2026-02-28T07:59:48.945594+00:00", "event": "started", "module": "watchdog", "pid": 7328}
|
|
1123
|
+
{"ts": "2026-02-28T07:59:49.189163+00:00", "event": "exited", "module": "event_hub_bench", "exit_code": 1}
|
|
1124
|
+
{"ts": "2026-02-28T07:59:49.190243+00:00", "event": "core_crash", "module": "event_hub_bench", "exit_code": 1}
|
|
1125
|
+
{"ts": "2026-02-28T07:59:49.191319+00:00", "event": "stopping", "module": "event_hub", "reason": "system_shutdown"}
|
|
1126
|
+
{"ts": "2026-02-28T07:59:49.192040+00:00", "event": "stopping", "module": "registry", "reason": "system_shutdown"}
|
|
1127
|
+
{"ts": "2026-02-28T07:59:49.192534+00:00", "event": "stopping", "module": "watchdog", "reason": "system_shutdown"}
|
|
1128
|
+
{"ts": "2026-02-28T07:59:53.841466+00:00", "event": "stopping", "module": "registry", "reason": "restart"}
|
|
1129
|
+
{"ts": "2026-02-28T07:59:59.121162+00:00", "event": "started", "module": "registry", "pid": 5100, "via": "restart_api"}
|
|
1130
|
+
{"ts": "2026-02-28T07:59:59.299185+00:00", "event": "stopped", "module": "event_hub", "reason": "system_shutdown"}
|
|
1131
|
+
{"ts": "2026-02-28T07:59:59.299948+00:00", "event": "stopped", "module": "registry", "reason": "system_shutdown"}
|
|
1132
|
+
{"ts": "2026-02-28T07:59:59.300517+00:00", "event": "stopped", "module": "watchdog", "reason": "system_shutdown"}
|
|
1133
|
+
{"ts": "2026-02-28T08:00:00.422625+00:00", "event": "scanned", "module": "event_hub", "state": "enabled", "module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\core\\event_hub"}
|
|
1134
|
+
{"ts": "2026-02-28T08:00:00.423287+00:00", "event": "scanned", "module": "event_hub_bench", "state": "enabled", "module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\core\\event_hub_bench"}
|
|
1135
|
+
{"ts": "2026-02-28T08:00:00.423795+00:00", "event": "scanned", "module": "registry", "state": "enabled", "module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\core\\registry"}
|
|
1136
|
+
{"ts": "2026-02-28T08:00:00.424305+00:00", "event": "scanned", "module": "watchdog", "state": "enabled", "module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\extensions\\services\\watchdog"}
|
|
1137
|
+
{"ts": "2026-02-28T08:00:00.425001+00:00", "event": "scanned", "module": "hello_test", "state": "manual", "module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\test_modules\\hello"}
|
|
1138
|
+
{"ts": "2026-02-28T08:00:00.425888+00:00", "event": "scanned", "module": "hello_node", "state": "manual", "module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\test_modules\\hello_node"}
|
|
1139
|
+
{"ts": "2026-02-28T08:00:00.658390+00:00", "event": "starting", "module": "event_hub"}
|
|
1140
|
+
{"ts": "2026-02-28T08:00:30.678544+00:00", "event": "started", "module": "event_hub", "pid": 16788}
|
|
1141
|
+
{"ts": "2026-02-28T08:00:30.679539+00:00", "event": "starting", "module": "event_hub_bench"}
|
|
1142
|
+
{"ts": "2026-02-28T08:01:00.699105+00:00", "event": "started", "module": "event_hub_bench", "pid": 14584}
|
|
1143
|
+
{"ts": "2026-02-28T08:01:00.700248+00:00", "event": "starting", "module": "registry"}
|
|
1144
|
+
{"ts": "2026-02-28T08:01:30.704355+00:00", "event": "started", "module": "registry", "pid": 7948}
|
|
1145
|
+
{"ts": "2026-02-28T08:01:30.705422+00:00", "event": "starting", "module": "watchdog"}
|
|
1146
|
+
{"ts": "2026-02-28T08:02:00.733196+00:00", "event": "started", "module": "watchdog", "pid": 11596}
|
|
1147
|
+
{"ts": "2026-02-28T08:02:00.952786+00:00", "event": "exited", "module": "event_hub_bench", "exit_code": 1}
|
|
1148
|
+
{"ts": "2026-02-28T08:02:00.953605+00:00", "event": "core_crash", "module": "event_hub_bench", "exit_code": 1}
|
|
1149
|
+
{"ts": "2026-02-28T08:02:00.954466+00:00", "event": "stopping", "module": "event_hub", "reason": "system_shutdown"}
|
|
1150
|
+
{"ts": "2026-02-28T08:02:00.955040+00:00", "event": "stopping", "module": "registry", "reason": "system_shutdown"}
|
|
1151
|
+
{"ts": "2026-02-28T08:02:00.955518+00:00", "event": "stopping", "module": "watchdog", "reason": "system_shutdown"}
|
|
1152
|
+
{"ts": "2026-02-28T08:02:05.223936+00:00", "event": "stopping", "module": "registry", "reason": "restart"}
|
|
1153
|
+
{"ts": "2026-02-28T08:02:10.527416+00:00", "event": "started", "module": "registry", "pid": 16200, "via": "restart_api"}
|
|
1154
|
+
{"ts": "2026-02-28T08:02:11.075072+00:00", "event": "stopped", "module": "event_hub", "reason": "system_shutdown"}
|
|
1155
|
+
{"ts": "2026-02-28T08:02:11.075831+00:00", "event": "stopped", "module": "registry", "reason": "system_shutdown"}
|
|
1156
|
+
{"ts": "2026-02-28T08:02:11.076307+00:00", "event": "stopped", "module": "watchdog", "reason": "system_shutdown"}
|
|
1157
|
+
{"ts": "2026-02-28T08:02:21.121280+00:00", "event": "stopping", "module": "registry", "reason": "system_shutdown"}
|
|
1158
|
+
{"ts": "2026-02-28T08:02:31.218728+00:00", "event": "stopped", "module": "registry", "reason": "system_shutdown"}
|
package/core/launcher/entry.py
CHANGED
|
@@ -26,6 +26,7 @@ from fastapi.responses import JSONResponse
|
|
|
26
26
|
|
|
27
27
|
from .module_scanner import ModuleScanner, ModuleInfo, _parse_frontmatter
|
|
28
28
|
from .process_manager import ProcessManager
|
|
29
|
+
from core.data_dir import get_launcher_data_dir
|
|
29
30
|
|
|
30
31
|
IS_WINDOWS = sys.platform == "win32"
|
|
31
32
|
|
|
@@ -68,7 +69,7 @@ class Launcher:
|
|
|
68
69
|
self._event_waiters: dict[str, tuple[asyncio.Event, dict]] = {}
|
|
69
70
|
|
|
70
71
|
self._lifecycle_log = os.path.join(
|
|
71
|
-
|
|
72
|
+
get_launcher_data_dir(), "lifecycle.jsonl",
|
|
72
73
|
)
|
|
73
74
|
self._app = self._create_api_app()
|
|
74
75
|
|
|
@@ -376,8 +377,12 @@ class Launcher:
|
|
|
376
377
|
if not os.path.isdir(registry_dir):
|
|
377
378
|
raise RuntimeError(f"Registry module not found at {registry_dir}")
|
|
378
379
|
|
|
380
|
+
# Use centralized data directory
|
|
381
|
+
from core.data_dir import get_registry_data_dir
|
|
382
|
+
registry_data_dir = get_registry_data_dir()
|
|
383
|
+
|
|
379
384
|
# Clean our instance's port file before starting
|
|
380
|
-
port_file = os.path.join(
|
|
385
|
+
port_file = os.path.join(registry_data_dir, f"port_{self.instance_id}.txt")
|
|
381
386
|
if os.path.isfile(port_file):
|
|
382
387
|
os.remove(port_file)
|
|
383
388
|
|
|
@@ -701,7 +706,8 @@ class Launcher:
|
|
|
701
706
|
os.remove(self.process_manager.records_path)
|
|
702
707
|
except OSError:
|
|
703
708
|
pass
|
|
704
|
-
|
|
709
|
+
from core.data_dir import get_registry_data_dir
|
|
710
|
+
port_file = os.path.join(get_registry_data_dir(), f"port_{self.instance_id}.txt")
|
|
705
711
|
try:
|
|
706
712
|
os.remove(port_file)
|
|
707
713
|
except OSError:
|
|
@@ -32,7 +32,10 @@ class ProcessManager:
|
|
|
32
32
|
self.project_root = project_root
|
|
33
33
|
self.kite_token = kite_token
|
|
34
34
|
self.instance_id = instance_id or str(os.getpid())
|
|
35
|
-
|
|
35
|
+
# Use centralized data directory management
|
|
36
|
+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
37
|
+
from data_dir import get_launcher_data_dir
|
|
38
|
+
self.data_dir = get_launcher_data_dir()
|
|
36
39
|
self.records_path = os.path.join(self.data_dir, f"processes_{self.instance_id}.json")
|
|
37
40
|
self._processes: dict[str, subprocess.Popen] = {} # name -> Popen
|
|
38
41
|
self._records: dict[str, ProcessRecord] = {} # name -> record
|
|
@@ -56,6 +59,10 @@ class ProcessManager:
|
|
|
56
59
|
files.append(legacy)
|
|
57
60
|
|
|
58
61
|
registry_data_dir = os.path.join(self.project_root, "core", "registry", "data")
|
|
62
|
+
# Also check user home registry data dir
|
|
63
|
+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
64
|
+
from data_dir import get_registry_data_dir
|
|
65
|
+
registry_data_dir_alt = get_registry_data_dir()
|
|
59
66
|
|
|
60
67
|
for path in files:
|
|
61
68
|
if path == self.records_path:
|
|
@@ -99,6 +106,10 @@ class ProcessManager:
|
|
|
99
106
|
port_file = os.path.join(registry_data_dir, f"port_{inst_id}.txt")
|
|
100
107
|
if os.path.isfile(port_file):
|
|
101
108
|
os.remove(port_file)
|
|
109
|
+
# Also check alt location
|
|
110
|
+
port_file_alt = os.path.join(registry_data_dir_alt, f"port_{inst_id}.txt")
|
|
111
|
+
if os.path.isfile(port_file_alt):
|
|
112
|
+
os.remove(port_file_alt)
|
|
102
113
|
|
|
103
114
|
# Also clean legacy port.txt
|
|
104
115
|
legacy_port = os.path.join(registry_data_dir, "port.txt")
|
package/core/registry/entry.py
CHANGED
|
@@ -26,7 +26,8 @@ def _get_free_port() -> int:
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def _write_port_file(port: int, instance_id: str = ""):
|
|
29
|
-
data_dir
|
|
29
|
+
from core.data_dir import get_registry_data_dir
|
|
30
|
+
data_dir = get_registry_data_dir()
|
|
30
31
|
os.makedirs(data_dir, exist_ok=True)
|
|
31
32
|
filename = f"port_{instance_id}.txt" if instance_id else "port.txt"
|
|
32
33
|
port_file = os.path.join(data_dir, filename)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentunion/kite",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Kite framework launcher — start Kite from anywhere",
|
|
5
5
|
"bin": {
|
|
6
6
|
"kite": "./cli.js"
|
|
@@ -16,8 +16,16 @@
|
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">=16"
|
|
18
18
|
},
|
|
19
|
-
"os": [
|
|
20
|
-
|
|
19
|
+
"os": [
|
|
20
|
+
"win32",
|
|
21
|
+
"linux",
|
|
22
|
+
"darwin"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"kite",
|
|
26
|
+
"framework",
|
|
27
|
+
"launcher"
|
|
28
|
+
],
|
|
21
29
|
"license": "MIT",
|
|
22
30
|
"author": "agentcp",
|
|
23
31
|
"repository": {
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"name": "event_hub",
|
|
4
|
-
"pid": 7768,
|
|
5
|
-
"cmd": [
|
|
6
|
-
"C:\\Users\\agentcp\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\\python.exe",
|
|
7
|
-
"C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\core\\event_hub\\entry.py"
|
|
8
|
-
],
|
|
9
|
-
"module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\core\\event_hub",
|
|
10
|
-
"started_at": 1772265337.0893958
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"name": "watchdog",
|
|
14
|
-
"pid": 15496,
|
|
15
|
-
"cmd": [
|
|
16
|
-
"C:\\Users\\agentcp\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\\python.exe",
|
|
17
|
-
"C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\extensions\\services\\watchdog\\entry.py"
|
|
18
|
-
],
|
|
19
|
-
"module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\extensions\\services\\watchdog",
|
|
20
|
-
"started_at": 1772265427.1668043
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"name": "registry",
|
|
24
|
-
"pid": 11156,
|
|
25
|
-
"cmd": [
|
|
26
|
-
"C:\\Users\\agentcp\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\\python.exe",
|
|
27
|
-
"C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\core\\registry\\entry.py"
|
|
28
|
-
],
|
|
29
|
-
"module_dir": "C:\\Users\\agentcp\\AppData\\Roaming\\Evol\\default\\workspace\\openclaw-acp-channel\\ai-phone-agent\\Kite\\core\\registry",
|
|
30
|
-
"started_at": 1772265467.0388315
|
|
31
|
-
}
|
|
32
|
-
]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
63212
|