@tencent-ai/codebuddy-code 2.132.0-dev.d295d4e.202608132252 → 2.132.0-dev.d864ad3.202608192332
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/dist/codebuddy-headless.js +96 -96
- package/dist/codebuddy.js +126 -126
- package/package.json +1 -1
- package/product.cloudhosted.json +2 -2
- package/product.internal.json +2 -2
- package/product.ioa.json +2 -2
- package/product.json +2 -2
- package/product.selfhosted.json +2 -2
- package/vendor/shim/broker-program-policy-check.cjs +68 -0
- package/vendor/shim/brokered-bin/codebuddy-toybox-dispatch +5 -19
- package/vendor/shim/safe-bin/safe-delete-common.sh +21 -0
- package/vendor/shim/sitecustomize.py +25 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencent-ai/codebuddy-code",
|
|
3
|
-
"version": "2.132.0-dev.
|
|
3
|
+
"version": "2.132.0-dev.d864ad3.202608192332",
|
|
4
4
|
"description": "Use CodeBuddy, Tencent's AI assistant, right from your terminal. CodeBuddy can understand your codebase, edit files, run terminal commands, and handle entire workflows for you.",
|
|
5
5
|
"main": "lib/node/index.js",
|
|
6
6
|
"typings": "lib/node/index.d.ts",
|
package/product.cloudhosted.json
CHANGED
|
@@ -836,6 +836,6 @@
|
|
|
836
836
|
"SelectImage": true,
|
|
837
837
|
"SkipToolCallSupportCheck": true
|
|
838
838
|
},
|
|
839
|
-
"commit": "
|
|
840
|
-
"date": "2026-08-
|
|
839
|
+
"commit": "d864ad34ec647b14242ed249c5c845448be0843a",
|
|
840
|
+
"date": "2026-08-19T15:31:49.737Z"
|
|
841
841
|
}
|
package/product.internal.json
CHANGED
package/product.ioa.json
CHANGED
package/product.json
CHANGED
|
@@ -1811,6 +1811,6 @@
|
|
|
1811
1811
|
"description": "tool-repl-description"
|
|
1812
1812
|
}
|
|
1813
1813
|
],
|
|
1814
|
-
"commit": "
|
|
1815
|
-
"date": "2026-08-
|
|
1814
|
+
"commit": "d864ad34ec647b14242ed249c5c845448be0843a",
|
|
1815
|
+
"date": "2026-08-19T15:31:49.753Z"
|
|
1816
1816
|
}
|
package/product.selfhosted.json
CHANGED
|
@@ -349,6 +349,6 @@
|
|
|
349
349
|
"ScheduledTasks": true,
|
|
350
350
|
"SkipToolCallSupportCheck": true
|
|
351
351
|
},
|
|
352
|
-
"commit": "
|
|
353
|
-
"date": "2026-08-
|
|
352
|
+
"commit": "d864ad34ec647b14242ed249c5c845448be0843a",
|
|
353
|
+
"date": "2026-08-19T15:31:49.736Z"
|
|
354
354
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared brokered Program Blacklist check for command shims.
|
|
3
|
+
*
|
|
4
|
+
* CLI contract: `node broker-program-policy-check.cjs <program> [runtime] [brokerClientPath]`
|
|
5
|
+
* Exit codes: 0 = allowed/not configured, 126 = forbidden program,
|
|
6
|
+
* 13 = policy check unavailable or otherwise denied.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
|
|
14
|
+
function checkProgramPolicy(program, runtime = 'brokered-program-policy', options = {}) {
|
|
15
|
+
const command = options.command || process.env.CODEBUDDY_SANDBOX_PROGRAM_POLICY_COMMAND;
|
|
16
|
+
if (!command) {
|
|
17
|
+
return { code: 0 };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const socketPath = options.socketPath || process.env.CODEBUDDY_SANDBOX_BROKER_IPC_ADDRESS;
|
|
21
|
+
const sessionId = options.sessionId || process.env.CODEBUDDY_SANDBOX_BROKER_SESSION_ID;
|
|
22
|
+
const brokerClientPath = options.brokerClientPath || path.join(__dirname, 'broker-ipc-client.cjs');
|
|
23
|
+
if (!program || !socketPath || !sessionId || !fs.existsSync(brokerClientPath)) {
|
|
24
|
+
return { code: 13, error: 'Brokered program policy check unavailable' };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const { sendBrokerRequestSync } = require(brokerClientPath);
|
|
29
|
+
const response = sendBrokerRequestSync({
|
|
30
|
+
command,
|
|
31
|
+
program,
|
|
32
|
+
sessionId,
|
|
33
|
+
toolCallId: options.toolCallId || process.env.CODEBUDDY_SANDBOX_BROKER_TOOL_CALL_ID,
|
|
34
|
+
brokerTraceId: options.brokerTraceId || process.env.CODEBUDDY_SANDBOX_BROKER_TRACE_ID,
|
|
35
|
+
runtime,
|
|
36
|
+
});
|
|
37
|
+
if (response && response.ok === true && response.decision === 'allow') {
|
|
38
|
+
return { code: 0, response };
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
code: response && response.reason === 'forbidden_program' ? 126 : 13,
|
|
42
|
+
error: response && response.error
|
|
43
|
+
? response.error
|
|
44
|
+
: `Brokered program policy denied "${program}"`,
|
|
45
|
+
response,
|
|
46
|
+
};
|
|
47
|
+
} catch (_) {
|
|
48
|
+
return { code: 13, error: 'Brokered program policy check unavailable' };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function runCli(argv = process.argv.slice(2)) {
|
|
53
|
+
const [program, runtime, brokerClientPath] = argv;
|
|
54
|
+
const result = checkProgramPolicy(program, runtime || 'brokered-program-policy', { brokerClientPath });
|
|
55
|
+
if (result.error) {
|
|
56
|
+
process.stderr.write(result.error);
|
|
57
|
+
}
|
|
58
|
+
return result.code;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
checkProgramPolicy,
|
|
63
|
+
runCli,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
if (require.main === module) {
|
|
67
|
+
process.exit(runCli());
|
|
68
|
+
}
|
|
@@ -4,6 +4,7 @@ __cb_app="${0##*/}"
|
|
|
4
4
|
__cb_toybox="${CODEBUDDY_TOYBOX_BIN:-}"
|
|
5
5
|
__cb_brokered_dir="${CODEBUDDY_BROKERED_BIN_DIR:-${0%/*}}"
|
|
6
6
|
__cb_broker_client="${CODEBUDDY_BROKER_IPC_CLIENT:-${__cb_brokered_dir%/brokered-bin}/broker-ipc-client.cjs}"
|
|
7
|
+
__cb_program_policy_helper="${__cb_brokered_dir%/brokered-bin}/broker-program-policy-check.cjs"
|
|
7
8
|
|
|
8
9
|
__cb_cleanup() { /bin/rm -f "$__cb_err" 2>/dev/null || true; }
|
|
9
10
|
|
|
@@ -13,28 +14,13 @@ __cb_check_program_policy() {
|
|
|
13
14
|
[ -n "${CODEBUDDY_SANDBOX_PROGRAM_POLICY_COMMAND:-}" ] || return 0
|
|
14
15
|
if [ -z "${CODEBUDDY_SANDBOX_BROKER_IPC_ADDRESS:-}" ] \
|
|
15
16
|
|| [ -z "${CODEBUDDY_SANDBOX_BROKER_SESSION_ID:-}" ] \
|
|
16
|
-
|| [ ! -f "$__cb_broker_client" ]
|
|
17
|
+
|| [ ! -f "$__cb_broker_client" ] \
|
|
18
|
+
|| [ ! -f "$__cb_program_policy_helper" ]; then
|
|
17
19
|
printf '%s' 'Brokered program policy check unavailable' >&2
|
|
18
20
|
return 13
|
|
19
21
|
fi
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const { sendBrokerRequestSync } = require(process.argv[2]);
|
|
23
|
-
const program = process.argv[3];
|
|
24
|
-
const response = sendBrokerRequestSync({
|
|
25
|
-
command: process.env.CODEBUDDY_SANDBOX_PROGRAM_POLICY_COMMAND,
|
|
26
|
-
program,
|
|
27
|
-
sessionId: process.env.CODEBUDDY_SANDBOX_BROKER_SESSION_ID,
|
|
28
|
-
toolCallId: process.env.CODEBUDDY_SANDBOX_BROKER_TOOL_CALL_ID,
|
|
29
|
-
brokerTraceId: process.env.CODEBUDDY_SANDBOX_BROKER_TRACE_ID,
|
|
30
|
-
runtime: 'toybox-dispatch',
|
|
31
|
-
});
|
|
32
|
-
if (response && response.ok === true && response.decision === 'allow') {
|
|
33
|
-
process.exit(0);
|
|
34
|
-
}
|
|
35
|
-
process.stderr.write(response && response.error ? response.error : `Brokered program policy denied "${program}"`);
|
|
36
|
-
process.exit(response && response.reason === 'forbidden_program' ? 126 : 13);
|
|
37
|
-
NODE
|
|
22
|
+
NODE_OPTIONS= "${CODEBUDDY_NODE_BIN:-node}" \
|
|
23
|
+
"$__cb_program_policy_helper" "$1" toybox-dispatch "$__cb_broker_client"
|
|
38
24
|
}
|
|
39
25
|
|
|
40
26
|
__cb_check_program_policy "$__cb_app"
|
|
@@ -459,6 +459,24 @@ trash_one() {
|
|
|
459
459
|
esac
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
+
safe_delete_check_program_policy() {
|
|
463
|
+
local program="$1"
|
|
464
|
+
[ -n "${CODEBUDDY_SANDBOX_PROGRAM_POLICY_COMMAND:-}" ] || return 0
|
|
465
|
+
|
|
466
|
+
local helper="${SAFE_DELETE_BIN_DIR%/safe-bin}/broker-program-policy-check.cjs"
|
|
467
|
+
local broker_client="${SAFE_DELETE_BIN_DIR%/safe-bin}/broker-ipc-client.cjs"
|
|
468
|
+
local node_bin="${CODEBUDDY_NODE_BIN:-node}"
|
|
469
|
+
if [ -z "${CODEBUDDY_SANDBOX_BROKER_IPC_ADDRESS:-}" ] \
|
|
470
|
+
|| [ -z "${CODEBUDDY_SANDBOX_BROKER_SESSION_ID:-}" ] \
|
|
471
|
+
|| [ ! -f "$broker_client" ] \
|
|
472
|
+
|| [ ! -f "$helper" ]; then
|
|
473
|
+
printf '%s' 'Brokered program policy check unavailable' >&2
|
|
474
|
+
return 13
|
|
475
|
+
fi
|
|
476
|
+
|
|
477
|
+
NODE_OPTIONS= "$node_bin" "$helper" "$program" safe-delete "$broker_client"
|
|
478
|
+
}
|
|
479
|
+
|
|
462
480
|
try_broker_delete() {
|
|
463
481
|
local abs="$1"
|
|
464
482
|
local recursive="${2:-false}"
|
|
@@ -733,6 +751,9 @@ safe_delete_rmdir() {
|
|
|
733
751
|
safe_delete_main() {
|
|
734
752
|
local mode="$1"
|
|
735
753
|
shift
|
|
754
|
+
safe_delete_check_program_policy "$mode"
|
|
755
|
+
local program_policy_rc=$?
|
|
756
|
+
[ $program_policy_rc -eq 0 ] || return $program_policy_rc
|
|
736
757
|
case "$mode" in
|
|
737
758
|
rm) safe_delete_rm "$@"; return $? ;;
|
|
738
759
|
unlink) safe_delete_unlink "$@"; return $? ;;
|
|
@@ -932,21 +932,24 @@ if _SESSION_ID:
|
|
|
932
932
|
except Exception:
|
|
933
933
|
return "unavailable"
|
|
934
934
|
|
|
935
|
+
def _emit_safe_delete_fail_closed(abs_path, reason, detail=None):
|
|
936
|
+
payload = {
|
|
937
|
+
"target": abs_path,
|
|
938
|
+
"reason": reason,
|
|
939
|
+
}
|
|
940
|
+
if detail:
|
|
941
|
+
payload["detail"] = detail
|
|
942
|
+
message = (
|
|
943
|
+
"[safe-delete][SAFE_DELETE_FAIL_CLOSED] "
|
|
944
|
+
+ json.dumps(payload, ensure_ascii=False)
|
|
945
|
+
)
|
|
946
|
+
try:
|
|
947
|
+
sys.stderr.write(message + "\n")
|
|
948
|
+
sys.stderr.flush()
|
|
949
|
+
except Exception:
|
|
950
|
+
pass
|
|
951
|
+
|
|
935
952
|
def _try_trash(abs_path, recursive=False, force=False):
|
|
936
|
-
if sys.platform == "win32" and _IN_SANDBOX:
|
|
937
|
-
message = (
|
|
938
|
-
"[safe-delete][SAFE_DELETE_FAIL_CLOSED] "
|
|
939
|
-
+ json.dumps({
|
|
940
|
-
"target": abs_path,
|
|
941
|
-
"reason": "windows-sandbox-recycle-bin-unavailable",
|
|
942
|
-
}, ensure_ascii=False)
|
|
943
|
-
)
|
|
944
|
-
try:
|
|
945
|
-
sys.stderr.write(message + "\n")
|
|
946
|
-
sys.stderr.flush()
|
|
947
|
-
except Exception:
|
|
948
|
-
pass
|
|
949
|
-
raise OSError(message)
|
|
950
953
|
_check_bulk_delete_guard(abs_path)
|
|
951
954
|
|
|
952
955
|
broker_result = _try_broker_delete(abs_path, recursive=recursive, force=force)
|
|
@@ -957,10 +960,14 @@ if _SESSION_ID:
|
|
|
957
960
|
"[safe-delete] broker denied delete: path=%s" % abs_path
|
|
958
961
|
)
|
|
959
962
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
963
|
+
try:
|
|
964
|
+
if _try_trash_via_binary(abs_path):
|
|
965
|
+
_record_trash(abs_path)
|
|
966
|
+
return True
|
|
967
|
+
_platform_trash(abs_path)
|
|
968
|
+
except Exception as e:
|
|
969
|
+
_emit_safe_delete_fail_closed(abs_path, "trash-failed", str(e))
|
|
970
|
+
raise
|
|
964
971
|
_record_trash(abs_path)
|
|
965
972
|
return True
|
|
966
973
|
|