luckytri 1.0.6 → 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.
- package/LICENSE +21 -21
- package/README.en.md +7 -3
- package/README.md +7 -3
- package/docs/en/CHANGELOG.md +35 -16
- package/docs/en/chat-style.md +28 -9
- package/docs/en/guide.md +5 -5
- package/docs/en/her-life.md +2 -2
- package/docs/en/webui.md +1 -1
- package/docs/zh/CHANGELOG.md +35 -16
- package/docs/zh/chat-style.md +30 -9
- package/docs/zh/guide.md +5 -5
- package/docs/zh/her-life.md +2 -2
- package/docs/zh/webui.md +1 -1
- package/package.json +1 -1
- package/public/app/assets/{ChatsPage-DCYMkJ91.js → ChatsPage-CshdtTzV.js} +2 -2
- package/public/app/assets/ChatsPage-DfyPCS9N.css +1 -0
- package/public/app/assets/{Empty-CLyZkxR5.js → Empty-C7yzOBzy.js} +1 -1
- package/public/app/assets/{Empty-DIobYG3x.css → Empty-DmUB2-Bk.css} +1 -1
- package/public/app/assets/{Field-BpaRwLI_.js → Field-BjFv4Rfn.js} +1 -1
- package/public/app/assets/HeartPage-Bft9wZp5.css +1 -0
- package/public/app/assets/{HeartPage-BIOMTiwr.js → HeartPage-eqo6ru16.js} +1 -1
- package/public/app/assets/LifePage-BUi5euBF.css +1 -0
- package/public/app/assets/{LifePage-BCgM4JkR.js → LifePage-CN8GE5NK.js} +1 -1
- package/public/app/assets/{MemoryPage-vShvRqMt.js → MemoryPage-CCpMN4Wg.js} +1 -1
- package/public/app/assets/MemoryPage-cZvXfkXb.css +1 -0
- package/public/app/assets/{NaturePage-Cy9ptr4G.js → NaturePage-C0JqdBTR.js} +2 -2
- package/public/app/assets/NaturePage-CHkpb5NK.css +1 -0
- package/public/app/assets/PeoplePage-BTU0H1pM.css +1 -0
- package/public/app/assets/{PeoplePage-CUZekB2E.js → PeoplePage-BXGBbO4u.js} +1 -1
- package/public/app/assets/{PluginsPage-1RM4rmJP.js → PluginsPage-Dksp5AV5.js} +1 -1
- package/public/app/assets/{SystemPage-BI2CB5Ig.css → SystemPage-BenIyTvk.css} +1 -1
- package/public/app/assets/{SystemPage-BeT5TmIV.js → SystemPage-Cd7aa8eE.js} +1 -1
- package/public/app/assets/TimePage-BOms_n4I.css +1 -0
- package/public/app/assets/{TimePage-taTmPMM8.js → TimePage-Bs_zImb4.js} +2 -2
- package/public/app/assets/{index-DY5AM0Hz.css → index-BHZcHUMh.css} +1 -1
- package/public/app/assets/{index-DdYwC5ZU.js → index-CyRtYxP3.js} +3 -3
- package/public/app/assets/{knowledge-DJmfu2KN.js → knowledge-BJOIyuJo.js} +1 -1
- package/public/app/assets/{media-BEtnE0Gv.js → media-Bwtx8blz.js} +1 -1
- package/public/app/assets/{mind-Dtiw0-QK.js → mind-DtTVrW6Z.js} +1 -1
- package/public/app/index.html +5 -6
- package/public/guide.en.html +3 -3
- package/public/guide.html +3 -3
- package/scripts/import-data.js +128 -128
- package/scripts/proxy-config.js +167 -167
- package/scripts/update-instance.js +201 -201
- package/server/channels/adapters.js +27 -27
- package/server/channels/onebot/adapter.js +288 -288
- package/server/channels/qqbot/adapter.js +253 -253
- package/server/channels/qqbot/api.js +199 -199
- package/server/channels/qqbot/credentials.js +11 -11
- package/server/channels/qqbot/gateway.js +274 -274
- package/server/channels/qqbot/index.js +389 -389
- package/server/channels/segments.js +40 -40
- package/server/channels/session-key.js +153 -153
- package/server/channels/state.js +42 -42
- package/server/core/api.js +564 -564
- package/server/core/context-builder.js +288 -288
- package/server/core/context-compactor.js +454 -454
- package/server/core/conversation-cues.js +385 -325
- package/server/core/conversation-grounding.js +304 -0
- package/server/core/conversation-manager.js +87 -87
- package/server/core/dialogue-context.js +244 -0
- package/server/core/dialogue-contract.js +35 -0
- package/server/core/feedback.js +8 -8
- package/server/core/group-style.js +72 -72
- package/server/core/initiative-context.js +68 -66
- package/server/core/input-budget.js +32 -32
- package/server/core/local-demo.js +98 -98
- package/server/core/message-manager.js +118 -118
- package/server/core/message-scheduler.js +78 -78
- package/server/core/model-json.js +190 -190
- package/server/core/model-manager.js +5 -8
- package/server/core/model-presets.js +900 -900
- package/server/core/name-call.js +29 -29
- package/server/core/network.js +157 -157
- package/server/core/person-name.js +22 -22
- package/server/core/persona-manager.js +359 -269
- package/server/core/reader-check.js +62 -0
- package/server/core/reply-delivery.js +537 -404
- package/server/core/reply-target-resolver.js +50 -50
- package/server/core/response-generator.js +92 -50
- package/server/core/response-validator.js +53 -32
- package/server/core/retired-prompts.js +51 -51
- package/server/core/sessions.js +109 -109
- package/server/core/speaker-names.js +92 -92
- package/server/core/topic-tracker.js +65 -65
- package/server/core/turn.js +82 -15
- package/server/http.js +18 -18
- package/server/i18n/decisions.js +209 -209
- package/server/i18n/errors.js +2 -0
- package/server/i18n/index.js +144 -144
- package/server/i18n/labels.js +6 -10
- package/server/i18n/models.js +111 -111
- package/server/knowledge/api.js +342 -342
- package/server/knowledge/embedding-profile.js +114 -114
- package/server/knowledge/index.js +13 -13
- package/server/knowledge/retrieval.js +93 -93
- package/server/knowledge/schema.js +158 -158
- package/server/knowledge/vector-index.js +90 -90
- package/server/mind/affect.js +265 -265
- package/server/mind/attention.js +200 -200
- package/server/mind/bonds.js +565 -565
- package/server/mind/clock.js +83 -83
- package/server/mind/context-selection.js +16 -4
- package/server/mind/continuity.js +562 -562
- package/server/mind/conversation-origin.js +175 -175
- package/server/mind/days.js +210 -210
- package/server/mind/evidence-read.js +45 -45
- package/server/mind/expression-grounding.js +21 -0
- package/server/mind/faces.js +373 -373
- package/server/mind/guard.js +68 -60
- package/server/mind/initiative.js +338 -338
- package/server/mind/life/activities.js +21 -21
- package/server/mind/life/context.js +330 -330
- package/server/mind/life/growth.js +261 -261
- package/server/mind/life/presence.js +305 -305
- package/server/mind/meetings.js +1069 -1069
- package/server/mind/memory-policy.js +48 -48
- package/server/mind/memory.js +888 -888
- package/server/mind/nature.js +358 -358
- package/server/mind/novelty.js +19 -19
- package/server/mind/own-voice.js +35 -0
- package/server/mind/periods.js +118 -118
- package/server/mind/reading.js +132 -120
- package/server/mind/relationship-context.js +71 -71
- package/server/mind/relationships.js +390 -390
- package/server/mind/salience.js +201 -201
- package/server/mind/schema.js +567 -567
- package/server/mind/self.js +496 -484
- package/server/mind/thoughts.js +274 -274
- package/server/mind/time/agenda.js +242 -242
- package/server/mind/time/api.js +200 -200
- package/server/mind/time/attention.js +34 -34
- package/server/mind/time/availability.js +23 -1
- package/server/mind/time/executor.js +4 -2
- package/server/mind/time/games.js +20 -11
- package/server/mind/time/index.js +9 -2
- package/server/mind/time/kinds.js +29 -2
- package/server/mind/time/material-relevance.js +19 -0
- package/server/mind/time/model-material.js +77 -77
- package/server/mind/time/presentation.js +35 -51
- package/server/mind/time/reading-input.js +31 -0
- package/server/mind/time/schedule.js +83 -83
- package/server/mind/time/schema.js +84 -84
- package/server/mind/time/search.js +383 -383
- package/server/mind/time/sharing.js +482 -472
- package/server/mind/time/task-links.js +311 -311
- package/server/mind/time/tasks.js +41 -3
- package/server/mind/time/works.js +527 -432
- package/server/mind/traits.js +191 -191
- package/server/mind/view.js +62 -12
- package/server/runtime/installation.js +116 -116
- package/server/runtime/update-manager.js +140 -140
- package/server/storage/data-package.js +298 -298
- package/server/storage/data-transfer-api.js +50 -50
- package/server/storage/data-transfer-worker.js +18 -18
- package/server/storage/data-transfer.js +416 -416
- package/server/studio/display-names.js +139 -139
- package/server/studio/management.js +102 -102
- package/server/studio/updates.js +144 -144
- package/server/version.js +10 -10
- package/public/app/assets/ChatsPage-CFMVozoG.css +0 -1
- package/public/app/assets/HeartPage-C-2jvgzF.css +0 -1
- package/public/app/assets/LifePage-CG1OHbRK.css +0 -1
- package/public/app/assets/MemoryPage-C_Bu4rfb.css +0 -1
- package/public/app/assets/NaturePage-CPZlImT0.css +0 -1
- package/public/app/assets/PeoplePage-3RRUITDz.css +0 -1
- package/public/app/assets/TimePage-C-guwPk2.css +0 -1
package/server/mind/guard.js
CHANGED
|
@@ -1,60 +1,68 @@
|
|
|
1
|
-
import { hasCredential, normalized } from "./util.js";
|
|
2
|
-
|
|
3
|
-
export { hasCredential };
|
|
4
|
-
|
|
5
|
-
const SECRET_REQUEST =
|
|
6
|
-
/(?:帮我|替我|给我|你要|记得)?保密|别(?:告诉|跟|和|对)(?:别人|其他人|任何人|他们|大家)|不要(?:告诉|跟|和|说给)(?:别人|其他人|任何人|大家)|(?:只|就)(?:告诉|跟|和)你(?:一个人)?说|(?:不要|别)(?:说|传)出去|别外传|别声张/;
|
|
7
|
-
|
|
8
|
-
export function secretRequest(text) {
|
|
9
|
-
return SECRET_REQUEST.test(String(text || ""));
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const CRISIS =
|
|
13
|
-
/自杀|不想活|活不下去|活着没意思|结束(?:自己的)?生命|伤害自己|割腕|跳楼|轻生|想死(?!你)|撑不下去了/;
|
|
14
|
-
const CASUAL_DEATH = /(?:笑|社|饿|累|困|热|冷|烦|气|丑|尬|馋)死|想死你/;
|
|
15
|
-
const EXPLICIT =
|
|
16
|
-
/自杀|不想活|活不下去|结束(?:自己的)?生命|伤害自己|割腕|跳楼|轻生/;
|
|
17
|
-
|
|
18
|
-
// A cheap signal that makes sure she actually reads the message. Whether it
|
|
19
|
-
// is a real crisis is still her understanding of the whole conversation.
|
|
20
|
-
export function crisisSignal(text) {
|
|
21
|
-
const value = String(text || "");
|
|
22
|
-
if (!CRISIS.test(value)) return false;
|
|
23
|
-
return EXPLICIT.test(value) || !CASUAL_DEATH.test(value);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// "某作玩过""都玩过一些""通关了""玩得比较杂": a claim to have played
|
|
27
|
-
// something. She has no record of playing anything, so it is not a fact she
|
|
28
|
-
// can give. Wishes ("想通关"), questions ("玩过吗"), other people ("他玩过")
|
|
29
|
-
// and "没玩过" are not claims.
|
|
30
|
-
const NOT_A_CLAIM = "没未不还想要会能可等算你他她谁人";
|
|
31
|
-
const CLAIMED_PLAY = new RegExp(
|
|
32
|
-
`(?<![${NOT_A_CLAIM}][^,。!?,.!?\\s]{0,4})(?:也|都|早就|之前|以前|已经|全)?(?:玩过|通关|二周目|全结局|全成就)(?![吗么没??]|不(?![少多])|的?吧)|(?<![你他她谁人][^,。!?,.!?\\s]{0,6})玩得(?:比较|挺|还)?(?:杂|多)(?![吗么??]|的?吧)`,
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export function claimedPlay(text) {
|
|
36
|
-
return CLAIMED_PLAY.test(String(text || ""));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Secrets never enter another conversation's context, but a reply is still
|
|
40
|
-
// checked against them before it leaves.
|
|
41
|
-
export function leaks(bubbles, secrets) {
|
|
42
|
-
const said = normalized((bubbles || []).join(""));
|
|
43
|
-
if (said.length < 4) return [];
|
|
44
|
-
const pairs = (s) =>
|
|
45
|
-
new Set(Array.from({ length: s.length - 1 }, (_, i) => s.slice(i, i + 2)));
|
|
46
|
-
const spoken = pairs(said);
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
import { hasCredential, normalized } from "./util.js";
|
|
2
|
+
|
|
3
|
+
export { hasCredential };
|
|
4
|
+
|
|
5
|
+
const SECRET_REQUEST =
|
|
6
|
+
/(?:帮我|替我|给我|你要|记得)?保密|别(?:告诉|跟|和|对)(?:别人|其他人|任何人|他们|大家)|不要(?:告诉|跟|和|说给)(?:别人|其他人|任何人|大家)|(?:只|就)(?:告诉|跟|和)你(?:一个人)?说|(?:不要|别)(?:说|传)出去|别外传|别声张/;
|
|
7
|
+
|
|
8
|
+
export function secretRequest(text) {
|
|
9
|
+
return SECRET_REQUEST.test(String(text || ""));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const CRISIS =
|
|
13
|
+
/自杀|不想活|活不下去|活着没意思|结束(?:自己的)?生命|伤害自己|割腕|跳楼|轻生|想死(?!你)|撑不下去了/;
|
|
14
|
+
const CASUAL_DEATH = /(?:笑|社|饿|累|困|热|冷|烦|气|丑|尬|馋)死|想死你/;
|
|
15
|
+
const EXPLICIT =
|
|
16
|
+
/自杀|不想活|活不下去|结束(?:自己的)?生命|伤害自己|割腕|跳楼|轻生/;
|
|
17
|
+
|
|
18
|
+
// A cheap signal that makes sure she actually reads the message. Whether it
|
|
19
|
+
// is a real crisis is still her understanding of the whole conversation.
|
|
20
|
+
export function crisisSignal(text) {
|
|
21
|
+
const value = String(text || "");
|
|
22
|
+
if (!CRISIS.test(value)) return false;
|
|
23
|
+
return EXPLICIT.test(value) || !CASUAL_DEATH.test(value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// "某作玩过""都玩过一些""通关了""玩得比较杂": a claim to have played
|
|
27
|
+
// something. She has no record of playing anything, so it is not a fact she
|
|
28
|
+
// can give. Wishes ("想通关"), questions ("玩过吗"), other people ("他玩过")
|
|
29
|
+
// and "没玩过" are not claims.
|
|
30
|
+
const NOT_A_CLAIM = "没未不还想要会能可等算你他她谁人";
|
|
31
|
+
const CLAIMED_PLAY = new RegExp(
|
|
32
|
+
`(?<![${NOT_A_CLAIM}][^,。!?,.!?\\s]{0,4})(?:也|都|早就|之前|以前|已经|全)?(?:玩过|通关|二周目|全结局|全成就)(?![吗么没??]|不(?![少多])|的?吧)|(?<![你他她谁人][^,。!?,.!?\\s]{0,6})玩得(?:比较|挺|还)?(?:杂|多)(?![吗么??]|的?吧)`,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export function claimedPlay(text) {
|
|
36
|
+
return CLAIMED_PLAY.test(String(text || ""));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Secrets never enter another conversation's context, but a reply is still
|
|
40
|
+
// checked against them before it leaves.
|
|
41
|
+
export function leaks(bubbles, secrets, alreadySaid = []) {
|
|
42
|
+
const said = normalized((bubbles || []).join(""));
|
|
43
|
+
if (said.length < 4) return [];
|
|
44
|
+
const pairs = (s) =>
|
|
45
|
+
new Set(Array.from({ length: s.length - 1 }, (_, i) => s.slice(i, i + 2)));
|
|
46
|
+
const spoken = pairs(said);
|
|
47
|
+
const known = alreadySaid.map(normalized);
|
|
48
|
+
const alreadyKnown = (phrase) => known.some((line) => line.includes(phrase));
|
|
49
|
+
const found = [];
|
|
50
|
+
for (const secret of secrets || []) {
|
|
51
|
+
const key = normalized(secret.content);
|
|
52
|
+
if (key.length < 4) continue;
|
|
53
|
+
const grams = pairs(key);
|
|
54
|
+
let hit =
|
|
55
|
+
(said.includes(key) && !alreadyKnown(key)) ||
|
|
56
|
+
[...grams].filter((g) => spoken.has(g) && !alreadyKnown(g)).length /
|
|
57
|
+
grams.size >=
|
|
58
|
+
0.6;
|
|
59
|
+
for (let i = 0; !hit && i + 6 <= key.length; i += 2)
|
|
60
|
+
if (
|
|
61
|
+
said.includes(key.slice(i, i + 6)) &&
|
|
62
|
+
!alreadyKnown(key.slice(i, i + 6))
|
|
63
|
+
)
|
|
64
|
+
hit = true;
|
|
65
|
+
if (hit) found.push(secret);
|
|
66
|
+
}
|
|
67
|
+
return found;
|
|
68
|
+
}
|