@tencent-ai/agent-sdk 0.3.186 → 0.3.188-dev.368febf.202606232001
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/CHANGELOG.md +26 -0
- package/cli/dist/codebuddy-headless.js +339 -221
- package/cli/dist/web-ui/docs/cn/cli/cli-reference.md +8 -3
- package/cli/dist/web-ui/docs/cn/cli/env-vars.md +2 -1
- package/cli/dist/web-ui/docs/cn/cli/iam.md +9 -5
- package/cli/dist/web-ui/docs/cn/cli/interactive-mode.md +2 -2
- package/cli/dist/web-ui/docs/cn/cli/permission-modes.md +373 -101
- package/cli/dist/web-ui/docs/cn/cli/permissions.md +36 -14
- package/cli/dist/web-ui/docs/cn/cli/prewarm.md +134 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/README.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.106.0.md +48 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.106.1.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.106.2.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.106.3.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.106.4.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.106.5.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.106.6.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.106.7.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.107.0.md +30 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.108.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.108.1.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.108.2.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.109.0.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/settings.md +166 -2
- package/cli/dist/web-ui/docs/en/cli/cli-reference.md +15 -10
- package/cli/dist/web-ui/docs/en/cli/env-vars.md +6 -5
- package/cli/dist/web-ui/docs/en/cli/iam.md +9 -5
- package/cli/dist/web-ui/docs/en/cli/interactive-mode.md +3 -3
- package/cli/dist/web-ui/docs/en/cli/permission-modes.md +373 -101
- package/cli/dist/web-ui/docs/en/cli/permissions.md +46 -24
- package/cli/dist/web-ui/docs/en/cli/prewarm.md +124 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/README.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.106.0.md +48 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.106.1.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.106.2.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.106.3.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.106.4.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.106.5.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.106.6.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.106.7.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.107.0.md +30 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.108.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.108.1.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.108.2.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.109.0.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/settings.md +166 -2
- package/cli/dist/web-ui/docs/search-index-en.json +1 -1
- package/cli/dist/web-ui/docs/search-index-zh.json +1 -1
- package/cli/dist/web-ui/docs/sidebar-en.json +1 -1
- package/cli/dist/web-ui/docs/sidebar-zh.json +1 -1
- package/cli/package.json +3 -2
- package/cli/product.cloudhosted.json +2 -2
- package/cli/product.internal.json +2 -2
- package/cli/product.ioa.json +2 -2
- package/cli/product.json +2 -2
- package/cli/product.selfhosted.json +2 -2
- package/cli/vendor/shim/genie-safe-delete.cjs +82 -0
- package/cli/vendor/shim/safe-bin/safe-delete-common.sh +144 -9
- package/cli/vendor/shim/safe-delete-bulk-guard.cjs +447 -0
- package/cli/vendor/shim/sitecustomize.py +100 -0
- package/package.json +3 -2
|
@@ -17,6 +17,7 @@ import json
|
|
|
17
17
|
import os
|
|
18
18
|
import stat
|
|
19
19
|
import sys
|
|
20
|
+
import tempfile
|
|
20
21
|
import time
|
|
21
22
|
|
|
22
23
|
# ---------------------------------------------------------------------------
|
|
@@ -275,6 +276,40 @@ if _SESSION_ID:
|
|
|
275
276
|
_orig_path_rmdir = pathlib.Path.rmdir
|
|
276
277
|
_report_path = os.environ.get("CODEBUDDY_SAFE_DELETE_REPORT_PATH")
|
|
277
278
|
|
|
279
|
+
def _path_for_compare(path):
|
|
280
|
+
return os.path.normcase(os.path.abspath(path))
|
|
281
|
+
|
|
282
|
+
def _is_usable_temp_root(path):
|
|
283
|
+
try:
|
|
284
|
+
root = _path_for_compare(path)
|
|
285
|
+
if os.path.dirname(root) == root:
|
|
286
|
+
return False
|
|
287
|
+
return os.path.isdir(root)
|
|
288
|
+
except Exception:
|
|
289
|
+
return False
|
|
290
|
+
|
|
291
|
+
def _build_os_tmp_dirs():
|
|
292
|
+
candidates = [
|
|
293
|
+
tempfile.gettempdir(),
|
|
294
|
+
]
|
|
295
|
+
if sys.platform != "win32":
|
|
296
|
+
candidates.append("/tmp")
|
|
297
|
+
candidates.append("/private/tmp")
|
|
298
|
+
|
|
299
|
+
roots = []
|
|
300
|
+
seen = set()
|
|
301
|
+
for candidate in candidates:
|
|
302
|
+
if not candidate or not _is_usable_temp_root(candidate):
|
|
303
|
+
continue
|
|
304
|
+
root = _path_for_compare(candidate)
|
|
305
|
+
if root in seen:
|
|
306
|
+
continue
|
|
307
|
+
seen.add(root)
|
|
308
|
+
roots.append(root)
|
|
309
|
+
return roots
|
|
310
|
+
|
|
311
|
+
_os_tmp_dirs = _build_os_tmp_dirs()
|
|
312
|
+
|
|
278
313
|
def _record_trash(abs_path):
|
|
279
314
|
if not _report_path:
|
|
280
315
|
return
|
|
@@ -289,6 +324,43 @@ if _SESSION_ID:
|
|
|
289
324
|
except Exception:
|
|
290
325
|
pass
|
|
291
326
|
|
|
327
|
+
def _exit_bulk_guard_control(message):
|
|
328
|
+
try:
|
|
329
|
+
sys.stderr.write(message)
|
|
330
|
+
if not message.endswith("\n"):
|
|
331
|
+
sys.stderr.write("\n")
|
|
332
|
+
sys.stderr.flush()
|
|
333
|
+
finally:
|
|
334
|
+
raise SystemExit(1)
|
|
335
|
+
|
|
336
|
+
def _check_bulk_delete_guard(abs_path):
|
|
337
|
+
guard_path = os.environ.get("CODEBUDDY_SAFE_DELETE_BULK_GUARD")
|
|
338
|
+
node_bin = os.environ.get("CODEBUDDY_NODE_BIN")
|
|
339
|
+
if not os.environ.get("CODEBUDDY_SAFE_DELETE_BULK_STATE_DIR") \
|
|
340
|
+
or not os.environ.get("CODEBUDDY_TOOL_CALL_ID"):
|
|
341
|
+
return
|
|
342
|
+
if not guard_path or not node_bin or not os.path.isfile(guard_path):
|
|
343
|
+
_exit_bulk_guard_control(
|
|
344
|
+
"[safe-delete][SAFE_DELETE_BULK_GUARD_ERROR] msg=helper-unavailable guard=%s"
|
|
345
|
+
% (guard_path or "unset")
|
|
346
|
+
)
|
|
347
|
+
env = dict(os.environ)
|
|
348
|
+
env["NODE_OPTIONS"] = ""
|
|
349
|
+
try:
|
|
350
|
+
result = subprocess.run(
|
|
351
|
+
[node_bin, guard_path, "check", "--target", abs_path],
|
|
352
|
+
capture_output=True, text=True, timeout=10, env=env
|
|
353
|
+
)
|
|
354
|
+
except Exception as e:
|
|
355
|
+
_exit_bulk_guard_control(
|
|
356
|
+
"[safe-delete][SAFE_DELETE_BULK_GUARD_ERROR] %s" % e
|
|
357
|
+
)
|
|
358
|
+
if result.returncode != 0:
|
|
359
|
+
_exit_bulk_guard_control(
|
|
360
|
+
result.stderr.strip()
|
|
361
|
+
or "[safe-delete][SAFE_DELETE_BULK_GUARD_ERROR] exit %d" % result.returncode
|
|
362
|
+
)
|
|
363
|
+
|
|
292
364
|
# -----------------------------------------------------------------------
|
|
293
365
|
# genie-trash native binary 支持(优先路径,不可用自动降级)
|
|
294
366
|
# 优先使用 GENIE_TRASH_DIR 环境变量(由 buildSafeDeleteEnv() 注入),
|
|
@@ -366,6 +438,7 @@ if _SESSION_ID:
|
|
|
366
438
|
except Exception:
|
|
367
439
|
pass
|
|
368
440
|
raise OSError(message)
|
|
441
|
+
_check_bulk_delete_guard(abs_path)
|
|
369
442
|
if _try_trash_via_binary(abs_path):
|
|
370
443
|
_record_trash(abs_path)
|
|
371
444
|
return True
|
|
@@ -388,6 +461,20 @@ if _SESSION_ID:
|
|
|
388
461
|
except OSError:
|
|
389
462
|
return False
|
|
390
463
|
|
|
464
|
+
def _is_under_os_tmp_dir(abs_path):
|
|
465
|
+
try:
|
|
466
|
+
target = _path_for_compare(os.fsdecode(abs_path))
|
|
467
|
+
except (TypeError, UnicodeError):
|
|
468
|
+
return False
|
|
469
|
+
for tmp_dir in _os_tmp_dirs:
|
|
470
|
+
try:
|
|
471
|
+
rel = os.path.relpath(target, tmp_dir)
|
|
472
|
+
except ValueError:
|
|
473
|
+
continue
|
|
474
|
+
if rel not in ("", ".") and rel != ".." and not rel.startswith(".." + os.sep) and not os.path.isabs(rel):
|
|
475
|
+
return True
|
|
476
|
+
return False
|
|
477
|
+
|
|
391
478
|
# -----------------------------------------------------------------------
|
|
392
479
|
# 包装:os.remove / os.unlink (文件,不能是目录)
|
|
393
480
|
# -----------------------------------------------------------------------
|
|
@@ -397,6 +484,8 @@ if _SESSION_ID:
|
|
|
397
484
|
if dir_fd is not None:
|
|
398
485
|
return _orig_remove(path, dir_fd=dir_fd)
|
|
399
486
|
abs_path = os.path.abspath(os.fspath(path))
|
|
487
|
+
if _is_under_os_tmp_dir(abs_path):
|
|
488
|
+
return _orig_remove(path)
|
|
400
489
|
st = _safe_lstat(abs_path)
|
|
401
490
|
if not st:
|
|
402
491
|
return _orig_remove(path) # ENOENT / stat 错误 → 让原生抛
|
|
@@ -412,6 +501,8 @@ if _SESSION_ID:
|
|
|
412
501
|
if dir_fd is not None:
|
|
413
502
|
return _orig_rmdir(path, dir_fd=dir_fd)
|
|
414
503
|
abs_path = os.path.abspath(os.fspath(path))
|
|
504
|
+
if _is_under_os_tmp_dir(abs_path):
|
|
505
|
+
return _orig_rmdir(path)
|
|
415
506
|
st = _safe_lstat(abs_path)
|
|
416
507
|
if not st:
|
|
417
508
|
return _orig_rmdir(path) # ENOENT / stat 错误
|
|
@@ -434,6 +525,11 @@ if _SESSION_ID:
|
|
|
434
525
|
path, ignore_errors=ignore_errors, onerror=onerror, **kwargs
|
|
435
526
|
)
|
|
436
527
|
|
|
528
|
+
if _is_under_os_tmp_dir(abs_path):
|
|
529
|
+
return _orig_shutil_rmtree(
|
|
530
|
+
path, ignore_errors=ignore_errors, onerror=onerror, **kwargs
|
|
531
|
+
)
|
|
532
|
+
|
|
437
533
|
st = _safe_lstat(abs_path)
|
|
438
534
|
if not st:
|
|
439
535
|
return _orig_shutil_rmtree(
|
|
@@ -461,6 +557,8 @@ if _SESSION_ID:
|
|
|
461
557
|
|
|
462
558
|
def _safe_path_unlink(self, missing_ok=False):
|
|
463
559
|
abs_path = os.path.abspath(str(self))
|
|
560
|
+
if _is_under_os_tmp_dir(abs_path):
|
|
561
|
+
return _orig_path_unlink(self, missing_ok=missing_ok)
|
|
464
562
|
st = _safe_lstat(abs_path)
|
|
465
563
|
if not st:
|
|
466
564
|
if st is None and missing_ok:
|
|
@@ -472,6 +570,8 @@ if _SESSION_ID:
|
|
|
472
570
|
|
|
473
571
|
def _safe_path_rmdir(self):
|
|
474
572
|
abs_path = os.path.abspath(str(self))
|
|
573
|
+
if _is_under_os_tmp_dir(abs_path):
|
|
574
|
+
return _orig_path_rmdir(self)
|
|
475
575
|
st = _safe_lstat(abs_path)
|
|
476
576
|
if not st:
|
|
477
577
|
return _orig_path_rmdir(self) # ENOENT / stat 错误 → 让原生抛
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencent-ai/agent-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.188-dev.368febf.202606232001",
|
|
4
4
|
"description": "CodeBuddy Code SDK for JavaScript/TypeScript",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"zod": "^4.0.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
|
-
"access": "public"
|
|
34
|
+
"access": "public",
|
|
35
|
+
"tag": "dev"
|
|
35
36
|
}
|
|
36
37
|
}
|