@ynhcj/xiaoyi-channel 0.0.136-beta → 0.0.137-beta
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.
|
@@ -66,7 +66,7 @@ export async function callCsplApi(questionText, cfg) {
|
|
|
66
66
|
res.on("end", () => {
|
|
67
67
|
try {
|
|
68
68
|
const result = parseResponse(data);
|
|
69
|
-
logger.log(`[SENTINEL HOOK] ✅
|
|
69
|
+
logger.log(`[SENTINEL HOOK] ✅ 请求成功, securityResult=${result?.data?.securityResult ?? "N/A"}`);
|
|
70
70
|
resolve(result);
|
|
71
71
|
}
|
|
72
72
|
catch (e) {
|
|
@@ -114,7 +114,7 @@ export async function callCsplApiWithConfig(questionText, config) {
|
|
|
114
114
|
res.on("end", () => {
|
|
115
115
|
try {
|
|
116
116
|
const result = parseResponse(data);
|
|
117
|
-
logger.log(`[SENTINEL HOOK] ✅
|
|
117
|
+
logger.log(`[SENTINEL HOOK] ✅ 请求成功, securityResult=${result?.data?.securityResult ?? "N/A"}`);
|
|
118
118
|
resolve(result);
|
|
119
119
|
}
|
|
120
120
|
catch (e) {
|
|
@@ -46,6 +46,7 @@ export function createCsplMiddleware() {
|
|
|
46
46
|
if (resultLength <= MIN_TEXT_LENGTH || resultLength > MAX_TOTAL_LENGTH) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
+
logger.log(`[CSPL MIDDLEWARE] Scanning tool result: toolName=${event.toolName}, textLength=${resultLength}`);
|
|
49
50
|
// Build CSPL request payload
|
|
50
51
|
const questionText = {
|
|
51
52
|
subSceneID: "TOOL_OUTPUT",
|
|
@@ -67,9 +68,11 @@ export function createCsplMiddleware() {
|
|
|
67
68
|
const csplConfig = sessionCtx
|
|
68
69
|
? initCsplConfigFromXYConfig(sessionCtx.config)
|
|
69
70
|
: getCsplConfig();
|
|
71
|
+
const csplStartTime = Date.now();
|
|
70
72
|
const response = await callCsplApiWithConfig(finalJson, csplConfig);
|
|
73
|
+
const csplElapsed = Date.now() - csplStartTime;
|
|
71
74
|
const result = parseSecurityResult(response);
|
|
72
|
-
logger.log(`[CSPL MIDDLEWARE] Security result: status=${result.status}, toolName=${event.toolName}`);
|
|
75
|
+
logger.log(`[CSPL MIDDLEWARE] Security result: status=${result.status}, toolName=${event.toolName}, elapsed=${csplElapsed}ms`);
|
|
73
76
|
if (result.status === "REJECT") {
|
|
74
77
|
logger.log(`[CSPL MIDDLEWARE] REJECT - replacing tool result with security message`);
|
|
75
78
|
return {
|