@coolclaw/coolclaw 1.0.7 → 1.0.8
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.
|
@@ -154,16 +154,10 @@ function validateAgentAction(action, task) {
|
|
|
154
154
|
if (!option) {
|
|
155
155
|
return { ok: false, reason: "disallowed_action_type" };
|
|
156
156
|
}
|
|
157
|
-
if (containsPublicPrivateInfoLeak(action.actionType, action.actionData)) {
|
|
158
|
-
return { ok: false, reason: "public_private_info_leak" };
|
|
159
|
-
}
|
|
160
157
|
const repaired = repairActionDataForSchema(action.actionData, option.actionDataSchema);
|
|
161
158
|
if (!matchesActionDataSchema(repaired.actionData, option.actionDataSchema)) {
|
|
162
159
|
return { ok: false, reason: "invalid_action_shape" };
|
|
163
160
|
}
|
|
164
|
-
if (containsPublicPrivateInfoLeak(action.actionType, repaired.actionData)) {
|
|
165
|
-
return { ok: false, reason: "public_private_info_leak" };
|
|
166
|
-
}
|
|
167
161
|
return {
|
|
168
162
|
ok: true,
|
|
169
163
|
action: {
|
|
@@ -259,7 +253,7 @@ function repairActionDataForSchema(actionData, schema) {
|
|
|
259
253
|
}
|
|
260
254
|
return {
|
|
261
255
|
actionData: repaired ?? actionData,
|
|
262
|
-
repairReason:
|
|
256
|
+
repairReason: truncatedFields.map((field) => `${field}_too_long`).join(",")
|
|
263
257
|
};
|
|
264
258
|
}
|
|
265
259
|
function matchesSchemaValue(value, schema, required) {
|
|
@@ -285,28 +279,6 @@ function matchesSchemaValue(value, schema, required) {
|
|
|
285
279
|
return true;
|
|
286
280
|
}
|
|
287
281
|
}
|
|
288
|
-
var PUBLIC_ACTION_TYPES = /* @__PURE__ */ new Set(["DAY_SPEAK", "DAY_VOTE", "LAST_WORD", "HUNTER_SHOOT", "HUNTER_PASS"]);
|
|
289
|
-
var PUBLIC_TEXT_FIELDS = ["content", "reason"];
|
|
290
|
-
var PRIVATE_LEAK_PATTERNS = [
|
|
291
|
-
/我是\s*狼/u,
|
|
292
|
-
/我是\s*狼人/u,
|
|
293
|
-
/作为\s*狼/u,
|
|
294
|
-
/我们\s*狼队/u,
|
|
295
|
-
/我方\s*狼队/u,
|
|
296
|
-
/我(?:的)?狼队友/u,
|
|
297
|
-
/我(?:的)?队友/u,
|
|
298
|
-
/(?:我|我们|我方).{0,8}夜聊/u,
|
|
299
|
-
/夜聊.{0,16}(?:我说|我建议|我们|我方|决定|刀|击杀)/u,
|
|
300
|
-
/(?:我们|我方)\s*狼队.*(?:刀|击杀|目标)/u,
|
|
301
|
-
/今晚\s*(?:先)?刀/u
|
|
302
|
-
];
|
|
303
|
-
function containsPublicPrivateInfoLeak(actionType, actionData) {
|
|
304
|
-
if (!PUBLIC_ACTION_TYPES.has(actionType)) return false;
|
|
305
|
-
return PUBLIC_TEXT_FIELDS.some((field) => {
|
|
306
|
-
const value = actionData[field];
|
|
307
|
-
return typeof value === "string" && PRIVATE_LEAK_PATTERNS.some((pattern) => pattern.test(value));
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
282
|
function readString(value) {
|
|
311
283
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
312
284
|
}
|
package/dist/cli-metadata.js
CHANGED
package/dist/index.js
CHANGED
package/dist/setup-entry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coolclaw/coolclaw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "OpenClaw native channel plugin for Riddle/CoolClaw chat.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"runtimeSetupEntry": "./dist/setup-entry.js",
|
|
73
73
|
"install": {
|
|
74
74
|
"npmSpec": "@coolclaw/coolclaw",
|
|
75
|
-
"expectedIntegrity": "sha512-
|
|
75
|
+
"expectedIntegrity": "sha512-IKiiU+gXYGRuZ7f72a8WyViE0+Hol2AclkebfDB4HuusLo2BNzKpuinwzp8BIiKkCKoeSNO1xhjxwtKD6U4YfQ==",
|
|
76
76
|
"defaultChoice": "npm",
|
|
77
77
|
"minHostVersion": ">=2026.3.22"
|
|
78
78
|
},
|