@tencent-ai/agent-sdk 0.3.206-dev.0c715ff.202607102010 → 0.3.206

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 (33) hide show
  1. package/cli/dist/codebuddy-headless.js +178 -226
  2. package/cli/dist/web-ui/assets/{index-D0Z5-Zvd.js → index-BZjhFKbY.js} +2 -2
  3. package/cli/dist/web-ui/index.html +1 -1
  4. package/cli/dist/web-ui/sw.js +1 -1
  5. package/cli/package.json +2 -3
  6. package/cli/product.cloudhosted.json +2 -2
  7. package/cli/product.internal.json +2 -2
  8. package/cli/product.ioa.json +2 -2
  9. package/cli/product.json +2 -2
  10. package/cli/product.selfhosted.json +2 -2
  11. package/cli/vendor/shim/genie-safe-delete.cjs +781 -4
  12. package/cli/vendor/shim/safe-bin/safe-delete-bash-env.sh +1 -1
  13. package/cli/vendor/shim/safe-bin/safe-delete-common.sh +34 -95
  14. package/cli/vendor/shim/sitecustomize.py +22 -551
  15. package/package.json +2 -3
  16. package/cli/vendor/native-builds.json +0 -18
  17. package/cli/vendor/shim/broker-ipc-client.cjs +0 -158
  18. package/cli/vendor/shim/brokered-bin/codebuddy-toybox-dispatch +0 -381
  19. package/cli/vendor/shim/brokered-sandbox-bash-env.sh +0 -10
  20. package/cli/vendor/shim/native/binding.gyp +0 -13
  21. package/cli/vendor/shim/native/brokered_sandbox_native.c +0 -293
  22. package/cli/vendor/shim/native/darwin-arm64/brokered-sandbox-native.node +0 -0
  23. package/cli/vendor/shim/native/darwin-x64/brokered-sandbox-native.node +0 -0
  24. package/cli/vendor/shim/node-brokered-fs-shim.cjs +0 -932
  25. package/cli/vendor/shim/node-language-shim.cjs +0 -35
  26. package/cli/vendor/shim/node-safe-delete-shim.cjs +0 -810
  27. package/cli/vendor/shim/safe-delete-broker-delete.cjs +0 -166
  28. package/cli/vendor/shim/shell-runtime-bash-env.sh +0 -8
  29. package/cli/vendor/toybox-macos/LICENSE +0 -12
  30. package/cli/vendor/toybox-macos/toybox +0 -0
  31. package/cli/vendor/toybox-macos/toybox.sb +0 -19
  32. package/cli/vendor/zsh-macos/LICENSE +0 -37
  33. package/cli/vendor/zsh-macos/bin/zsh +0 -0
@@ -1,5 +1,5 @@
1
1
  # genie-safe-delete bash environment — sourced via BASH_ENV for every bash subprocess.
2
- # Defines safe-bin wrappers to intercept shell file commands.
2
+ # Defines rm/unlink/rmdir wrappers to intercept shell delete commands and move to OS trash.
3
3
  if [ -n "${CODEBUDDY_SAFE_DELETE_BIN_DIR:-}" ]; then
4
4
  rm() { "${CODEBUDDY_SAFE_DELETE_BIN_DIR}/rm" "$@"; }
5
5
  unlink() { "${CODEBUDDY_SAFE_DELETE_BIN_DIR}/unlink" "$@"; }
@@ -72,6 +72,11 @@ safe_delete_normalize_path() {
72
72
  while [ "$p" != "/" ] && [ "${p%/}" != "$p" ]; do
73
73
  p="${p%/}"
74
74
  done
75
+ case "$OS" in
76
+ MINGW*|MSYS*|CYGWIN*)
77
+ p="$(printf '%s' "$p" | tr '[:upper:]' '[:lower:]')"
78
+ ;;
79
+ esac
75
80
  printf '%s' "$p"
76
81
  }
77
82
 
@@ -143,50 +148,17 @@ SAFE_DELETE_OS_TMP_DIRS="$(safe_delete_build_os_tmp_dirs)"
143
148
  safe_delete_is_under_os_tmp_dir() {
144
149
  local abs
145
150
  abs="$(safe_delete_normalize_path "$(safe_delete_abs_path "$1")")"
146
-
147
- # 用数组分片而不是 heredoc/here-string 遍历 tmp 目录列表:heredoc 在 bash 内部
148
- # 会落一个临时文件再 unlink(/tmp/sh-thd-*),在沙箱 broker 场景下这次 unlink
149
- # 会被 Seatbelt 的 file-write-unlink 监控误判为一次“受保护文件修改”拦截,
150
- # 抢在批量删除确认信号之前触发提权 UI。纯数组分片不产生任何文件系统操作。
151
- local tmp_dir
152
- local __sdiotd_old_ifs="$IFS"
153
- IFS=$'\n'
154
- set -f
155
- local -a __sdiotd_tmp_dirs=($SAFE_DELETE_OS_TMP_DIRS)
156
- set +f
157
- IFS="$__sdiotd_old_ifs"
158
-
159
- for tmp_dir in "${__sdiotd_tmp_dirs[@]}"; do
151
+ while IFS= read -r tmp_dir; do
160
152
  [ -n "$tmp_dir" ] || continue
161
- case "$OS" in
162
- MINGW*|MSYS*|CYGWIN*)
163
- local abs_lower tmp_lower
164
- abs_lower="$(printf '%s' "$abs" | tr '[:upper:]' '[:lower:]')"
165
- tmp_lower="$(printf '%s' "$tmp_dir" | tr '[:upper:]' '[:lower:]')"
166
- case "$abs_lower" in
167
- "$tmp_lower"/*) return 0 ;;
168
- esac
169
- continue
170
- ;;
171
- esac
172
153
  case "$abs" in
173
154
  "$tmp_dir"/*) return 0 ;;
174
155
  esac
175
- done
156
+ done <<EOF
157
+ $SAFE_DELETE_OS_TMP_DIRS
158
+ EOF
176
159
  return 1
177
160
  }
178
161
 
179
- safe_delete_bulk_guard_non_tmp_check() {
180
- local targets=()
181
- local p
182
- for p in "$@"; do
183
- safe_delete_is_under_os_tmp_dir "$p" && continue
184
- targets+=("$p")
185
- done
186
- [ ${#targets[@]} -eq 0 ] && return 0
187
- safe_delete_bulk_guard_check "${targets[@]}"
188
- }
189
-
190
162
  # ---- platform-specific trash helpers -----------------------------------------
191
163
 
192
164
  trash_darwin() {
@@ -402,57 +374,10 @@ trash_one() {
402
374
  esac
403
375
  }
404
376
 
405
- try_broker_delete() {
406
- local abs="$1"
407
- local recursive="${2:-false}"
408
- local force="${3:-false}"
409
- [ -n "${CODEBUDDY_SANDBOX_BROKER_IPC_ADDRESS:-}" ] || return 2
410
- [ -n "${CODEBUDDY_SANDBOX_BROKER_SESSION_ID:-}" ] || return 2
411
- [ -n "${CODEBUDDY_SANDBOX_HOST_FILE_OPERATION_COMMAND:-}" ] || return 2
412
-
413
- local helper="${CODEBUDDY_SAFE_DELETE_BROKER_DELETE:-}"
414
- local node_bin="${CODEBUDDY_NODE_BIN:-}"
415
- [ -n "$helper" ] && [ -f "$helper" ] && [ -n "$node_bin" ] || return 2
416
-
417
- local broker_out broker_rc
418
- local broker_args=()
419
- [ "$recursive" = "true" ] && broker_args+=("--recursive")
420
- [ "$force" = "true" ] && broker_args+=("--force")
421
- broker_out="$(
422
- NODE_OPTIONS= "$node_bin" "$helper" "${broker_args[@]}" -- "$abs" 2>&1 >/dev/null
423
- )"
424
- broker_rc=$?
425
-
426
- if [ $broker_rc -eq 0 ]; then
427
- return 0
428
- fi
429
- if [ $broker_rc -eq 2 ]; then
430
- _safe_delete_diag "broker unavailable, falling back to local trash: path=$abs"
431
- return 2
432
- fi
433
- _safe_delete_diag "broker denied delete: path=$abs stderr=$(_safe_delete_one_line "$broker_out")"
434
- return 1
435
- }
436
-
437
377
  try_trash() {
438
378
  local p="$1"
439
- local recursive="${2:-false}"
440
- local force="${3:-false}"
441
379
  local abs
442
380
  abs="$(safe_delete_abs_path "$p")"
443
-
444
- try_broker_delete "$abs" "$recursive" "$force"
445
- local broker_rc=$?
446
- if [ $broker_rc -eq 0 ]; then
447
- return 0
448
- fi
449
- if [ $broker_rc -eq 1 ]; then
450
- local target_json
451
- target_json="$(safe_delete_json_string "$p")"
452
- echo "[safe-delete][SAFE_DELETE_FAIL_CLOSED] {\"target\":$target_json,\"reason\":\"broker-denied\"}" >&2
453
- return 1
454
- fi
455
-
456
381
  if trash_one "$p"; then
457
382
  safe_delete_record_trash "$abs"
458
383
  return 0
@@ -543,9 +468,7 @@ safe_delete_rm() {
543
468
  _exit=1
544
469
  fi
545
470
  done
546
- if ! safe_delete_bulk_guard_non_tmp_check "${trash_targets[@]}"; then
547
- return 1
548
- fi
471
+ local guarded_targets=()
549
472
  for p in "${trash_targets[@]}"; do
550
473
  if safe_delete_is_under_os_tmp_dir "$p"; then
551
474
  local native_args=()
@@ -555,7 +478,16 @@ safe_delete_rm() {
555
478
  if ! "$REAL_RM" "${native_args[@]}" -- "$p"; then
556
479
  _exit=1
557
480
  fi
558
- elif ! try_trash "$p" "$recursive" "$force"; then
481
+ else
482
+ guarded_targets+=("$p")
483
+ fi
484
+ done
485
+
486
+ if ! safe_delete_bulk_guard_check "${guarded_targets[@]}"; then
487
+ return 1
488
+ fi
489
+ for p in "${guarded_targets[@]}"; do
490
+ if ! try_trash "$p"; then
559
491
  _exit=1
560
492
  fi
561
493
  done
@@ -593,13 +525,13 @@ safe_delete_unlink() {
593
525
  return 1
594
526
  fi
595
527
 
596
- if ! safe_delete_bulk_guard_non_tmp_check "$target"; then
597
- return 1
598
- fi
599
528
  if safe_delete_is_under_os_tmp_dir "$target"; then
600
529
  "$REAL_UNLINK" -- "$target"
601
530
  return $?
602
531
  fi
532
+ if ! safe_delete_bulk_guard_check "$target"; then
533
+ return 1
534
+ fi
603
535
 
604
536
  try_trash "$target"
605
537
  return $?
@@ -658,15 +590,22 @@ safe_delete_rmdir() {
658
590
  fi
659
591
  trash_targets+=("$p")
660
592
  done
661
- if ! safe_delete_bulk_guard_non_tmp_check "${trash_targets[@]}"; then
662
- return 1
663
- fi
593
+ local guarded_targets=()
664
594
  for p in "${trash_targets[@]}"; do
665
595
  if safe_delete_is_under_os_tmp_dir "$p"; then
666
596
  if ! "$REAL_RMDIR" -- "$p"; then
667
597
  _exit=1
668
598
  fi
669
- elif ! try_trash "$p"; then
599
+ else
600
+ guarded_targets+=("$p")
601
+ fi
602
+ done
603
+
604
+ if ! safe_delete_bulk_guard_check "${guarded_targets[@]}"; then
605
+ return 1
606
+ fi
607
+ for p in "${guarded_targets[@]}"; do
608
+ if ! try_trash "$p"; then
670
609
  _exit=1
671
610
  fi
672
611
  done