@aiyiran/myclaw 1.1.69 → 1.1.71
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/gateway.js +3 -1
- package/package.json +1 -1
- package/server/sync_workspace.py +11 -9
package/gateway.js
CHANGED
|
@@ -74,10 +74,12 @@ function stop() {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
// 2b. 杀所有 openclaw 相关进程(防止僵尸进程)
|
|
77
|
+
// 注意:用精确匹配,避免误杀路径中含 "openclaw" 的无关进程(如 Antigravity 等)
|
|
77
78
|
try {
|
|
78
79
|
if (!isWin) {
|
|
79
80
|
const myPid = process.pid;
|
|
80
|
-
|
|
81
|
+
// 只匹配进程名完全等于 openclaw 的进程,避免误杀路径/命令行中含关键字的无关进程
|
|
82
|
+
const procs = execSync('pgrep -x openclaw 2>/dev/null || true', {
|
|
81
83
|
encoding: 'utf8', stdio: 'pipe', timeout: 5000
|
|
82
84
|
}).trim();
|
|
83
85
|
if (procs) {
|
package/package.json
CHANGED
package/server/sync_workspace.py
CHANGED
|
@@ -591,16 +591,21 @@ def _list_files_from_qiniu(prefix):
|
|
|
591
591
|
"""按前缀列出七牛 OSS 上的所有文件"""
|
|
592
592
|
marker = None
|
|
593
593
|
files = []
|
|
594
|
+
print(f"[Qiniu] 列举前缀: bucket={bucket_name}, prefix={prefix}")
|
|
594
595
|
while True:
|
|
595
596
|
ret, eof, info = bucket_manager.list(
|
|
596
597
|
bucket_name, prefix=prefix, marker=marker, limit=1000)
|
|
597
598
|
if ret is not None:
|
|
598
|
-
|
|
599
|
+
batch = ret.get('items', [])
|
|
600
|
+
files.extend(batch)
|
|
599
601
|
marker = ret.get('marker')
|
|
602
|
+
print(f"[Qiniu] 本批 {len(batch)} 个文件, eof={eof}")
|
|
600
603
|
if eof:
|
|
601
604
|
break
|
|
602
605
|
else:
|
|
606
|
+
print(f"[Qiniu] ❌ list 失败: status={info.status_code}, error={info.text_body}")
|
|
603
607
|
break
|
|
608
|
+
print(f"[Qiniu] 共找到 {len(files)} 个文件")
|
|
604
609
|
return files
|
|
605
610
|
|
|
606
611
|
|
|
@@ -624,15 +629,14 @@ def _download_from_cdn(key, local_path):
|
|
|
624
629
|
return False
|
|
625
630
|
|
|
626
631
|
|
|
627
|
-
def _do_fork(job_id, src_clawname, src_workspace, src_version, entry_rel_path=None, target_agent=None
|
|
632
|
+
def _do_fork(job_id, src_clawname, src_workspace, src_version, entry_rel_path=None, target_agent=None):
|
|
628
633
|
"""在后台线程中执行 fork
|
|
629
634
|
- target_agent 为 None 或对应目录不存在:新建 workspace
|
|
630
635
|
- target_agent 存在:将文件下载到该 workspace 下的子文件夹
|
|
631
|
-
- claw_name 指定目标 claw,由调用方负责路由;未传则使用本机默认路径
|
|
632
636
|
"""
|
|
633
637
|
try:
|
|
634
638
|
now = datetime.now()
|
|
635
|
-
time_id = now.strftime('%d') + '
|
|
639
|
+
time_id = now.strftime('%d') + 'd' + now.strftime('%M') + 'm'
|
|
636
640
|
|
|
637
641
|
base_name = src_workspace
|
|
638
642
|
if base_name.startswith("workspace-"):
|
|
@@ -741,12 +745,11 @@ def _do_fork(job_id, src_clawname, src_workspace, src_version, entry_rel_path=No
|
|
|
741
745
|
_fork_jobs[job_id] = {"status": "failed", "error": str(e)}
|
|
742
746
|
|
|
743
747
|
|
|
744
|
-
def start_fork(remote_url, target_agent=None
|
|
748
|
+
def start_fork(remote_url, target_agent=None):
|
|
745
749
|
"""
|
|
746
750
|
解析 remote_url,生成 job_id,在后台线程执行 fork。
|
|
747
751
|
URL 格式: https://cdn.yiranlaoshi.com/myclaw/show/{clawname}/{workspace}/{version}/...
|
|
748
752
|
target_agent: 可选,指定已有 workspace 的 agent 名(不含 workspace- 前缀亦可)
|
|
749
|
-
claw_name: 可选,指定目标 claw,由调用方负责路由到对应机器/目录
|
|
750
753
|
"""
|
|
751
754
|
parsed = urlparse(remote_url)
|
|
752
755
|
# path: /myclaw/show/{clawname}/{workspace}/{version}/...
|
|
@@ -769,7 +772,7 @@ def start_fork(remote_url, target_agent=None, claw_name=None):
|
|
|
769
772
|
|
|
770
773
|
t = threading.Thread(
|
|
771
774
|
target=_do_fork,
|
|
772
|
-
args=(job_id, src_clawname, src_workspace, src_version, entry_rel_path, target_agent
|
|
775
|
+
args=(job_id, src_clawname, src_workspace, src_version, entry_rel_path, target_agent),
|
|
773
776
|
daemon=True
|
|
774
777
|
)
|
|
775
778
|
t.start()
|
|
@@ -1058,7 +1061,6 @@ class MyclawAPIHandler(BaseHTTPRequestHandler):
|
|
|
1058
1061
|
body = json.loads(self.rfile.read(length).decode('utf-8')) if length else {}
|
|
1059
1062
|
remote_url = body.get('url', '')
|
|
1060
1063
|
target_agent = body.get('targetAgent', None) or None
|
|
1061
|
-
claw_name = body.get('clawName', None) or None
|
|
1062
1064
|
except Exception:
|
|
1063
1065
|
self._send_json({"error": "请求体解析失败"}, 400)
|
|
1064
1066
|
return
|
|
@@ -1067,7 +1069,7 @@ class MyclawAPIHandler(BaseHTTPRequestHandler):
|
|
|
1067
1069
|
self._send_json({"error": "缺少 url 参数"}, 400)
|
|
1068
1070
|
return
|
|
1069
1071
|
|
|
1070
|
-
job_id, err = start_fork(remote_url, target_agent
|
|
1072
|
+
job_id, err = start_fork(remote_url, target_agent)
|
|
1071
1073
|
if err:
|
|
1072
1074
|
self._send_json({"error": err}, 400)
|
|
1073
1075
|
return
|