@clawtopia/werewolf-evolution 0.1.13 → 0.1.14
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/index.js +11 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,10 +7,6 @@ import {
|
|
|
7
7
|
// src/context-store.ts
|
|
8
8
|
import { createHash as createHash2 } from "crypto";
|
|
9
9
|
|
|
10
|
-
// src/envelope.ts
|
|
11
|
-
import { createHash } from "crypto";
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
|
|
14
10
|
// src/types.ts
|
|
15
11
|
var DEBRIEF_HEADER = "[WEREWOLF_DEBRIEF v2]";
|
|
16
12
|
var DEBRIEF_POLICY_VERSION = "werewolf-debrief-v3";
|
|
@@ -18,6 +14,8 @@ var ENVELOPE_START = "== DEBRIEF_ENVELOPE_JSON ==";
|
|
|
18
14
|
var ENVELOPE_END = "== END_DEBRIEF_ENVELOPE_JSON ==";
|
|
19
15
|
|
|
20
16
|
// src/envelope.ts
|
|
17
|
+
import { createHash } from "crypto";
|
|
18
|
+
import { z } from "zod";
|
|
21
19
|
var MAX_DEBRIEF_BODY_BYTES = 64 * 1024;
|
|
22
20
|
var SAFE_ID = /^[A-Za-z0-9:_-]{1,200}$/;
|
|
23
21
|
var SAFE_PROFILE = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
@@ -333,6 +331,12 @@ var CAPTURE_TTL_MS = 10 * 60 * 1e3;
|
|
|
333
331
|
var MAX_CAPTURES = 256;
|
|
334
332
|
var SUGGESTION_COMMAND = /^\s*(采纳|忽略|拒绝)\s+(S-\d{3,6})\s*[。.!!]?\s*$/i;
|
|
335
333
|
var LEGACY_DIRECT_CONVERSATION = /^private:(?:HUMAN|human):([0-9]+)$/;
|
|
334
|
+
function promptContainsInbound(prompt, inbound) {
|
|
335
|
+
if (prompt.includes(inbound.content)) return true;
|
|
336
|
+
if (inbound.kind !== "debrief") return false;
|
|
337
|
+
const lines = prompt.split(/\r?\n/);
|
|
338
|
+
return lines.includes(DEBRIEF_HEADER) && lines.some((line) => /^debriefId:\s*(\S+)\s*$/.exec(line)?.[1] === inbound.envelope.debriefId);
|
|
339
|
+
}
|
|
336
340
|
function isExplicitConfiguredOwner(config, channelId, senderId) {
|
|
337
341
|
if (channelId !== "clawtopia" && channelId !== "coolclaw" || !senderId) return false;
|
|
338
342
|
const owners = record(record(config)?.commands)?.ownerAllowFrom;
|
|
@@ -450,7 +454,8 @@ var EvolutionContextStore = class {
|
|
|
450
454
|
if (!prompt) return void 0;
|
|
451
455
|
const pending = this.inboundBySession.get(sessionKey);
|
|
452
456
|
if (!pending) return void 0;
|
|
453
|
-
|
|
457
|
+
const matches = pending.filter((candidate) => promptContainsInbound(prompt, candidate));
|
|
458
|
+
return matches.length === 1 ? matches[0] : void 0;
|
|
454
459
|
}
|
|
455
460
|
stableInboundKey(ctx, sessionKey, event) {
|
|
456
461
|
const messageId = event.messageId?.trim();
|
|
@@ -775,7 +780,7 @@ var RELATIVE_FUTURE_BEHAVIOR_LANGUAGE = new RegExp(
|
|
|
775
780
|
var ABSOLUTE_DAY_BEHAVIOR_LANGUAGE = new RegExp(`(?:\u7B2C([0-9\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341]+)|([\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341]+))\\s*(?:\u5929|\u8F6E|\u56DE\u5408|\u591C|\u591C\u665A)[^\u3002\uFF1B\uFF0C,!\uFF01]{0,24}(?:${BEHAVIOR_TERMS})`, "gi");
|
|
776
781
|
var BEHAVIOR_OCCURRENCE_LANGUAGE = new RegExp(`(?:${BEHAVIOR_TERMS})`, "i");
|
|
777
782
|
var PAST_BEHAVIOR_LANGUAGE = new RegExp(`(?:\u6B64\u524D|\u4E4B\u524D|\u66FE\u7ECF|\u8FC7\u53BB|\u4E0A\u4E00\u8F6E|\u4E0A\u4E00\u591C|\u6628\u591C)|\u5DF2\u7ECF(?!\u51B3\u5B9A)[^\u3002\uFF1B\uFF0C,!\uFF01]{0,4}(?:${BEHAVIOR_TERMS})`, "i");
|
|
778
|
-
var CURRENT_ACTOR_ACTION_LANGUAGE = /(
|
|
783
|
+
var CURRENT_ACTOR_ACTION_LANGUAGE = /(?:当前|本次|此时|轮到|发言(?:时|中)|投票时|行动时|查验时|已经决定|正在|正要|准备|计划|将要)/i;
|
|
779
784
|
var NEGATED_BEHAVIOR_LANGUAGE = new RegExp(`(?:\u6CA1\u6709|\u5E76\u672A|\u672A\u66FE|\u4E0D\u66FE|\u4ECE\u672A|\u5C1A\u672A|\u4E0D)[^\u3002\uFF1B\uFF0C,!\uFF01]{0,6}(?:${BEHAVIOR_TERMS})|(?:did not|never|no)\\b`, "i");
|
|
780
785
|
var BEHAVIOR_TARGET_LANGUAGE = /(?:归票|投票(?:给|到)?|票投(?:给|到)?|投(?:给|到)|跟票(?:给|到)?|冲票(?:给|到)?|查杀|保人|踩|攻击|质疑)(?:给|到|向)?\s*([1-9][0-9]*)\s*号/i;
|
|
781
786
|
var TARGET_REFERENCE_PREFIX = /(?:归票|投票|票投|投给|投到|跟票|冲票|查杀|保人|踩|攻击|质疑)(?:给|到|向)?\s*$/i;
|
package/package.json
CHANGED