@tencent-ai/codebuddy-code 2.109.0 → 2.109.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/codebuddy-headless.js +165 -103
  3. package/dist/codebuddy.js +177 -115
  4. package/dist/web-ui/docs/cn/cli/cli-reference.md +8 -3
  5. package/dist/web-ui/docs/cn/cli/env-vars.md +2 -1
  6. package/dist/web-ui/docs/cn/cli/iam.md +9 -5
  7. package/dist/web-ui/docs/cn/cli/interactive-mode.md +2 -2
  8. package/dist/web-ui/docs/cn/cli/permission-modes.md +373 -101
  9. package/dist/web-ui/docs/cn/cli/permissions.md +36 -14
  10. package/dist/web-ui/docs/cn/cli/prewarm.md +134 -0
  11. package/dist/web-ui/docs/cn/cli/release-notes/README.md +14 -0
  12. package/dist/web-ui/docs/cn/cli/release-notes/v2.106.0.md +48 -0
  13. package/dist/web-ui/docs/cn/cli/release-notes/v2.106.1.md +13 -0
  14. package/dist/web-ui/docs/cn/cli/release-notes/v2.106.2.md +24 -0
  15. package/dist/web-ui/docs/cn/cli/release-notes/v2.106.3.md +14 -0
  16. package/dist/web-ui/docs/cn/cli/release-notes/v2.106.4.md +24 -0
  17. package/dist/web-ui/docs/cn/cli/release-notes/v2.106.5.md +18 -0
  18. package/dist/web-ui/docs/cn/cli/release-notes/v2.106.6.md +15 -0
  19. package/dist/web-ui/docs/cn/cli/release-notes/v2.106.7.md +13 -0
  20. package/dist/web-ui/docs/cn/cli/release-notes/v2.107.0.md +30 -0
  21. package/dist/web-ui/docs/cn/cli/release-notes/v2.108.0.md +20 -0
  22. package/dist/web-ui/docs/cn/cli/release-notes/v2.108.1.md +15 -0
  23. package/dist/web-ui/docs/cn/cli/release-notes/v2.108.2.md +13 -0
  24. package/dist/web-ui/docs/cn/cli/release-notes/v2.109.0.md +24 -0
  25. package/dist/web-ui/docs/cn/cli/settings.md +166 -2
  26. package/dist/web-ui/docs/en/cli/cli-reference.md +15 -10
  27. package/dist/web-ui/docs/en/cli/env-vars.md +6 -5
  28. package/dist/web-ui/docs/en/cli/iam.md +9 -5
  29. package/dist/web-ui/docs/en/cli/interactive-mode.md +3 -3
  30. package/dist/web-ui/docs/en/cli/permission-modes.md +373 -101
  31. package/dist/web-ui/docs/en/cli/permissions.md +46 -24
  32. package/dist/web-ui/docs/en/cli/prewarm.md +124 -0
  33. package/dist/web-ui/docs/en/cli/release-notes/README.md +14 -0
  34. package/dist/web-ui/docs/en/cli/release-notes/v2.106.0.md +48 -0
  35. package/dist/web-ui/docs/en/cli/release-notes/v2.106.1.md +13 -0
  36. package/dist/web-ui/docs/en/cli/release-notes/v2.106.2.md +24 -0
  37. package/dist/web-ui/docs/en/cli/release-notes/v2.106.3.md +14 -0
  38. package/dist/web-ui/docs/en/cli/release-notes/v2.106.4.md +24 -0
  39. package/dist/web-ui/docs/en/cli/release-notes/v2.106.5.md +18 -0
  40. package/dist/web-ui/docs/en/cli/release-notes/v2.106.6.md +15 -0
  41. package/dist/web-ui/docs/en/cli/release-notes/v2.106.7.md +13 -0
  42. package/dist/web-ui/docs/en/cli/release-notes/v2.107.0.md +30 -0
  43. package/dist/web-ui/docs/en/cli/release-notes/v2.108.0.md +20 -0
  44. package/dist/web-ui/docs/en/cli/release-notes/v2.108.1.md +15 -0
  45. package/dist/web-ui/docs/en/cli/release-notes/v2.108.2.md +13 -0
  46. package/dist/web-ui/docs/en/cli/release-notes/v2.109.0.md +24 -0
  47. package/dist/web-ui/docs/en/cli/settings.md +166 -2
  48. package/dist/web-ui/docs/search-index-en.json +1 -1
  49. package/dist/web-ui/docs/search-index-zh.json +1 -1
  50. package/dist/web-ui/docs/sidebar-en.json +1 -1
  51. package/dist/web-ui/docs/sidebar-zh.json +1 -1
  52. package/package.json +1 -1
  53. package/product.cloudhosted.json +2 -2
  54. package/product.internal.json +2 -2
  55. package/product.ioa.json +2 -2
  56. package/product.json +2 -2
  57. package/product.selfhosted.json +2 -2
  58. package/vendor/shim/genie-safe-delete.cjs +53 -0
  59. package/vendor/shim/safe-bin/safe-delete-common.sh +108 -0
  60. package/vendor/shim/sitecustomize.py +62 -0
@@ -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
@@ -388,6 +423,20 @@ if _SESSION_ID:
388
423
  except OSError:
389
424
  return False
390
425
 
426
+ def _is_under_os_tmp_dir(abs_path):
427
+ try:
428
+ target = _path_for_compare(os.fsdecode(abs_path))
429
+ except (TypeError, UnicodeError):
430
+ return False
431
+ for tmp_dir in _os_tmp_dirs:
432
+ try:
433
+ rel = os.path.relpath(target, tmp_dir)
434
+ except ValueError:
435
+ continue
436
+ if rel not in ("", ".") and rel != ".." and not rel.startswith(".." + os.sep) and not os.path.isabs(rel):
437
+ return True
438
+ return False
439
+
391
440
  # -----------------------------------------------------------------------
392
441
  # 包装:os.remove / os.unlink (文件,不能是目录)
393
442
  # -----------------------------------------------------------------------
@@ -397,6 +446,8 @@ if _SESSION_ID:
397
446
  if dir_fd is not None:
398
447
  return _orig_remove(path, dir_fd=dir_fd)
399
448
  abs_path = os.path.abspath(os.fspath(path))
449
+ if _is_under_os_tmp_dir(abs_path):
450
+ return _orig_remove(path)
400
451
  st = _safe_lstat(abs_path)
401
452
  if not st:
402
453
  return _orig_remove(path) # ENOENT / stat 错误 → 让原生抛
@@ -412,6 +463,8 @@ if _SESSION_ID:
412
463
  if dir_fd is not None:
413
464
  return _orig_rmdir(path, dir_fd=dir_fd)
414
465
  abs_path = os.path.abspath(os.fspath(path))
466
+ if _is_under_os_tmp_dir(abs_path):
467
+ return _orig_rmdir(path)
415
468
  st = _safe_lstat(abs_path)
416
469
  if not st:
417
470
  return _orig_rmdir(path) # ENOENT / stat 错误
@@ -434,6 +487,11 @@ if _SESSION_ID:
434
487
  path, ignore_errors=ignore_errors, onerror=onerror, **kwargs
435
488
  )
436
489
 
490
+ if _is_under_os_tmp_dir(abs_path):
491
+ return _orig_shutil_rmtree(
492
+ path, ignore_errors=ignore_errors, onerror=onerror, **kwargs
493
+ )
494
+
437
495
  st = _safe_lstat(abs_path)
438
496
  if not st:
439
497
  return _orig_shutil_rmtree(
@@ -461,6 +519,8 @@ if _SESSION_ID:
461
519
 
462
520
  def _safe_path_unlink(self, missing_ok=False):
463
521
  abs_path = os.path.abspath(str(self))
522
+ if _is_under_os_tmp_dir(abs_path):
523
+ return _orig_path_unlink(self, missing_ok=missing_ok)
464
524
  st = _safe_lstat(abs_path)
465
525
  if not st:
466
526
  if st is None and missing_ok:
@@ -472,6 +532,8 @@ if _SESSION_ID:
472
532
 
473
533
  def _safe_path_rmdir(self):
474
534
  abs_path = os.path.abspath(str(self))
535
+ if _is_under_os_tmp_dir(abs_path):
536
+ return _orig_path_rmdir(self)
475
537
  st = _safe_lstat(abs_path)
476
538
  if not st:
477
539
  return _orig_path_rmdir(self) # ENOENT / stat 错误 → 让原生抛