luckytri 1.0.5 → 1.0.7
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/README.en.md +2 -0
- package/README.md +2 -0
- package/docs/en/CHANGELOG.md +12 -3
- package/docs/en/chat-style.md +28 -9
- package/docs/zh/CHANGELOG.md +12 -3
- package/docs/zh/chat-style.md +30 -9
- package/package.json +2 -1
- package/public/guide.en.html +3 -3
- package/public/guide.html +3 -3
- package/scripts/service-supervisor.js +50 -0
- package/scripts/start-server.js +71 -16
- package/server/core/conversation-cues.js +42 -2
- package/server/core/conversation-grounding.js +178 -0
- package/server/core/dialogue-context.js +52 -0
- package/server/core/persona-manager.js +324 -269
- package/server/core/reply-delivery.js +83 -15
- package/server/core/response-generator.js +9 -1
- package/server/core/response-validator.js +30 -27
- package/server/core/turn.js +42 -8
- package/server/i18n/labels.js +0 -5
- package/server/mind/context-selection.js +16 -4
- package/server/mind/guard.js +12 -4
- package/server/mind/self.js +12 -0
- package/server/mind/time/games.js +7 -3
- package/server/mind/time/index.js +3 -0
- package/server/mind/time/presentation.js +2 -18
- package/server/mind/time/works.js +6 -0
- package/server/mind/view.js +43 -6
- package/server/runtime/update-execution.js +2 -1
package/README.en.md
CHANGED
|
@@ -135,6 +135,8 @@ npm install -g luckytri@latest
|
|
|
135
135
|
luckytri
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
+
You can also check for and install updates under System → Updates in the WebUI. LuckyTri restarts after the update, and user data stays in the instance directory.
|
|
139
|
+
|
|
138
140
|
`npm uninstall -g luckytri` removes the program. Reinstalling uses the existing data. Installation and uninstallation run no application scripts.
|
|
139
141
|
|
|
140
142
|
Change your password or sign out under System → Run switches. If you forget it, run `luckytri reset-password` for the same instance and refresh the studio to set another. Database, memory and configuration stay intact. Launching after an update switches a running older service to the installed version.
|
package/README.md
CHANGED
|
@@ -135,6 +135,8 @@ npm install -g luckytri@latest
|
|
|
135
135
|
luckytri
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
+
也可以在 WebUI 的「系统 → 版本更新」中检查并立即更新。更新完成后 LuckyTri 会自动重新启动,用户数据仍保存在实例目录中。
|
|
139
|
+
|
|
138
140
|
`npm uninstall -g luckytri` 只卸载程序,再次安装会继续使用原有数据。安装与卸载都不执行应用脚本。
|
|
139
141
|
|
|
140
142
|
管理密码可在「系统 → 运行开关」修改或退出登录。忘记密码时,在同一实例目录执行 `luckytri reset-password`,再刷新管理台重新设置;数据库、记忆和配置会保留。旧版本服务仍在运行时,新的启动命令会自动切换到已安装版本。
|
package/docs/en/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
<p align="right"><a href="../zh/CHANGELOG.md">中文</a> · <b>English</b></p>
|
|
2
2
|
|
|
3
|
-
# Changelog
|
|
4
|
-
|
|
5
|
-
## 1.0.
|
|
3
|
+
# Changelog
|
|
4
|
+
|
|
5
|
+
## 1.0.7 — 2026-10-09
|
|
6
|
+
|
|
7
|
+
- Ground understanding in the current messages, supplements, speakers and quote chains before choosing a response. Corrections address the actual question instead of substituting apologies or abstract monologues.
|
|
8
|
+
- Keep single topical remarks out of the enduring self's core and prevent extracted replies from becoming fixed scripts. Related recollections, cross-conversation continuity and disclosure boundaries remain available.
|
|
9
|
+
- Exclude known bots from human room-style statistics and end empty bot confirmation loops. An explicit addressed stop ends the current turn; a renewed question can still receive a reply.
|
|
10
|
+
- Preserve provenance and uncertainty in game-content presentation. Current activities and work fragments distinguish reference reading and model-generated material from client operation or completion.
|
|
11
|
+
- Rewrite the latest rejected draft, allow requested factual repetition, and keep contradiction repairs confined to relevant questions. Conversation endings no longer receive an unrelated confusion fallback.
|
|
12
|
+
- Add full-corpus review, historical replay and sequential conversation evaluation tools. Paid model checks run explicitly; private transcripts and reports stay local and are excluded from release artifacts.
|
|
13
|
+
|
|
14
|
+
## 1.0.5 — 2026-10-07
|
|
6
15
|
|
|
7
16
|
- Fixed bound relationships being forgotten when the person was absent from the current conversation. Chat, initiative, solitude, diaries and reviews recall the same account-based ledger by name and role.
|
|
8
17
|
- Distinguished current relationship facts from past opinions and personal feelings. Historical denials and jokes remain in history; relationship-related replies are checked against current knowledge while preserving her choices about interaction and address.
|
package/docs/en/chat-style.md
CHANGED
|
@@ -12,18 +12,20 @@ By default she speaks plain, everyday language:
|
|
|
12
12
|
- She reacts to the specific thing, instead of following a fixed "repeat the feeling, comfort, advise, ask a question" routine.
|
|
13
13
|
- Venting is not assumed to want advice; good news does not get a consoling answer; jokes are put away when someone is really hurting.
|
|
14
14
|
- A conversation may simply end; she does not ask "and then?" every turn and does not turn every message into a joke.
|
|
15
|
+
- Ordinary replies name the actual people, events and actions instead of replacing them with accounting or carrying metaphors. Literal accounting, literature and requested metaphors remain valid.
|
|
16
|
+
- When someone says she is abstract or repetitive, she checks her last sentence and explains its actual meaning instead of merely acknowledging the complaint.
|
|
15
17
|
- She uses memory only when it relates to the current topic and does not show off a memory file; when a reference is unclear she asks, and never invents experiences.
|
|
16
18
|
- She does not force slang to seem young. A serious setting beats style.
|
|
17
19
|
|
|
18
20
|
The following are hand-designed directions, not results measured on an external model (the Chinese originals are the intent; here they are rendered loosely):
|
|
19
21
|
|
|
20
|
-
| They say
|
|
21
|
-
|
|
|
22
|
-
| Five minutes to clocking off and the boss dumps more work | Of course it picks right now
|
|
23
|
-
| None of what I revised came up
|
|
24
|
-
| I passed the interview!!
|
|
25
|
-
| Don't advise me, just let me rant
|
|
26
|
-
| I'm going to take a shower
|
|
22
|
+
| They say | Direction we want |
|
|
23
|
+
| --------------------------------------------------------- | ------------------------------------------ |
|
|
24
|
+
| Five minutes to clocking off and the boss dumps more work | Of course it picks right now |
|
|
25
|
+
| None of what I revised came up | Not a single guess landed |
|
|
26
|
+
| I passed the interview!! | Nice!! That calls for a little celebration |
|
|
27
|
+
| Don't advise me, just let me rant | Okay, rant away, I'm listening |
|
|
28
|
+
| I'm going to take a shower | Go ahead |
|
|
27
29
|
|
|
28
30
|
## The rhythm of this place
|
|
29
31
|
|
|
@@ -33,6 +35,10 @@ The statistics reach her only as `inner.room` and are **not her character**: she
|
|
|
33
35
|
|
|
34
36
|
## Feedback
|
|
35
37
|
|
|
38
|
+
Accounts marked as bots in relationship records do not contribute to room style statistics. Their messages and shared experiences remain stored. Uninterrupted bot exchanges stop when they are only confirming or rephrasing the same thing without a new question or concrete event. Identity comes from account records, never nicknames. Questions, corrections and requested creative work can continue. Confirmation loops do not create additional emotional or relationship changes.
|
|
39
|
+
|
|
40
|
+
Her long-term self stays stable across new topics. Related self recollections appear in `inner.relatedSelf`; `inner.onMind` includes relevant notes without filling unused slots with unrelated thoughts. Temporary lines do not become fixed reply habits. Existing records are retained, while fixed scripts stop being offered as expression preferences.
|
|
41
|
+
|
|
36
42
|
Under "Chat" you can give feedback on a reply she sent: natural, too long, too stiff, too many memes, or undo it. Feedback is not a rewrite rule: it reaches her as something she heard, read by herself during solitude and in the next turns of that conversation, and it never rewrites her nature.
|
|
37
43
|
|
|
38
44
|
## Checks before sending
|
|
@@ -41,6 +47,7 @@ Before a reply goes out, local checks look for:
|
|
|
41
47
|
|
|
42
48
|
- a customer-service or consulting tone, list-like report replies, stage actions;
|
|
43
49
|
- unfounded intimate forms of address, excess length, repetition, back-to-back questions;
|
|
50
|
+
- recent replies that mostly repeat earlier wording with a small addition; explicitly requested quotes and factual repeats remain valid;
|
|
44
51
|
- ignoring "no advice needed", joking in a serious setting, piled-up slang;
|
|
45
52
|
- presenting her own earlier words as the other person's ("you just said…" when their record has no such line);
|
|
46
53
|
- claiming to have played or finished something (she has no record of such experience; a liking is not a record of having played);
|
|
@@ -48,9 +55,9 @@ Before a reply goes out, local checks look for:
|
|
|
48
55
|
|
|
49
56
|
When she is asked "how do you know?", the basis is checked first: for something she said unprompted (the other person had been silent for two hours or more), the basis can only be a guess or a real memory, never that she saw a message they sent; if a rewrite still invents a source, a verified correction is sent instead.
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
Ordinary replies get at most two rewrites; initiative and high budget pressure allow one. Each rewrite receives the actual rejected draft and preserves meaning and facts. If it still fails, an unaddressed turn stays silent; a direct exchange admits that she has not worked it out instead of pretending to understand with a filler word. Answers are never simply truncated. Rejected trailing hh decoration can be removed, followed by all checks again, preserving useful content.
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
Feelings, corrections, crises, abstract bot exchanges, attribution and capability claims may require review of each draft, increasing latency and cost. Rewrites are bounded. Conservative checks cannot catch every stiff or incorrect expression; naturalness still depends on the model, nature and group context.
|
|
54
61
|
|
|
55
62
|
## How to try it
|
|
56
63
|
|
|
@@ -60,3 +67,15 @@ Besides the turn's own call, the review and the rewrite happen at most once each
|
|
|
60
67
|
- **Audit**: `npm run audit:sent` replays the replies she recently sent against today's checks, read-only and without calling a model. Run it before changing a check to see whether the new rule would hurt. The replies already passed the checks when sent, so the number is for judging a new rule, not a score of how well she talks.
|
|
61
68
|
|
|
62
69
|
For real acceptance, watch 10–20 consecutive turns rather than a single line: does she pick up details, ask questions too often, repeat catchphrases, talk over others, suddenly turn into customer service, or mix up a joke with real sadness. Automated tests cover engineering constraints and hand-made scenario samples; the language quality of a real model still depends on your own observation.
|
|
70
|
+
|
|
71
|
+
In the source checkout, run `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue.js --limit 120` for live-model replay through understanding, validation, review and rewriting, followed by a separate quality review. This uses the configured default model and incurs model costs. It never connects to QQ or changes the running memory. Reports stay in local `data/evaluations/`. Model errors, unresolved issues and fallback replies fail the run. A single model's review has limitations; inspect the actual outputs too.
|
|
72
|
+
|
|
73
|
+
Additional source-checkout checks:
|
|
74
|
+
|
|
75
|
+
- `node --env-file-if-exists=.env scripts/dev/audit-dialogue-corpus.js` reads every live message in overlapping conversation blocks and records coverage. Missing evidence in one block is a lead to investigate, not proof of fabrication.
|
|
76
|
+
- Replay with `--current-nature --rebuild-mind --review-model <profile-id>` to rebuild historical mind selection in an in-memory copy while retaining saved activity progress, and use a separate reviewer. `--model <profile-id>` selects an evaluation model without changing the live instance. This does not reproduce historical external services or images.
|
|
77
|
+
- `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue-sequences.js --review-model <profile-id>` carries generated replies into the next turn and checks corrections, boundaries, affection, factual provenance and consistency over a conversation.
|
|
78
|
+
|
|
79
|
+
These commands incur model costs. Reviewers can miss errors or cite the wrong sentence; inspect their evidence. Combinatorial rule checks are not equivalent to the same number of distinct semantic conversations, and no test establishes perfect future conversation quality.
|
|
80
|
+
|
|
81
|
+
Current dialogue receives a factual `exchange` tail with new messages, quote chains and recent own words. Its short `understanding` summary remains revisable. Single extracted topical views stay retrievable without becoming enduring core traits; a one-off extracted habit does not become a response script. Reference-based game activities and model-generated material retain provenance and uncertainty instead of being presented as client operation. Reply review has an independent evaluator role and does not inherit the character's performance instructions.
|
package/docs/zh/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
<p align="right"><b>中文</b> · <a href="../en/CHANGELOG.md">English</a></p>
|
|
2
2
|
|
|
3
|
-
# 版本记录
|
|
4
|
-
|
|
5
|
-
## 1.0.
|
|
3
|
+
# 版本记录
|
|
4
|
+
|
|
5
|
+
## 1.0.7 — 2026-10-09
|
|
6
|
+
|
|
7
|
+
- 调整理解与表达顺序:先核对本轮原话、连续补充、说话人和引用,再决定回应。被纠正时修正具体问题,不用道歉、内心独白或抽象比喻替代答案。
|
|
8
|
+
- 临时话题观点不再自动占据长期自我的核心位置;一次回复不形成固定话术习惯。相关旧想法仍可召回,跨群连续记忆、来源和私密范围保留。
|
|
9
|
+
- 已知机器人不再参与人类群聊口吻统计;无新内容的机器人确认循环会收住。明确要求停止时不再一边答应闭嘴一边继续建议,新的问题仍能重新回应。
|
|
10
|
+
- 修复游戏内容展示抹去来源与不确定性的错误。当前活动和作品片段带回参考阅读与材料来源,模型整理不再被展示层改写为客户端操作或通关。
|
|
11
|
+
- 重写针对最新被退回的稿子;重复确认事实不会因去重而被吞掉。旧话矛盾的修复只用于相关追问,不插入无关问答。收尾、未理解问题和危机场景分别处理。
|
|
12
|
+
- 增加全量会话分段审阅、历史场景回放与连续对话评测工具。调用模型的检查需显式运行,原始聊天和报告仅留本地,不随发布包分发。
|
|
13
|
+
|
|
14
|
+
## 1.0.5 — 2026-10-07
|
|
6
15
|
|
|
7
16
|
- 修复人际关系已绑定却无法在另一段会话中认出对方的问题。聊天、主动表达、独处、日记和回顾从同一份关系记录按名字、账号与称呼召回,不要求关系对象正在说话。
|
|
8
17
|
- 区分当前关系、过去看法和自己的感受。旧的否认或玩笑保留在历史中,不能替代更新后的事实;关系相关回复发送前再次核对,保持自己的相处与称呼选择。
|
package/docs/zh/chat-style.md
CHANGED
|
@@ -12,18 +12,20 @@
|
|
|
12
12
|
- 对事情产生具体反应,不固定走「复述情绪、安慰、建议、追问」的流程。
|
|
13
13
|
- 吐槽不默认要建议;分享好消息不套负面安慰;真实难过时收起玩笑。
|
|
14
14
|
- 对话可以结束,不用每轮问「然后呢」,也不把每条消息都改写成段子。
|
|
15
|
+
- 先说清具体的人、事和动作,不把普通聊天改写成「账、落款、拎着」之类的隐喻。真正讨论记账、文学或明确要求比喻时,仍按语境表达。
|
|
16
|
+
- 被指出抽象或复读时,回看自己的上一句,解释实际意思;没有明确意思就承认没说清,不只回「收到」。
|
|
15
17
|
- 记忆与当前话题有关才使用,不主动展示记忆档案;没看懂指代就澄清,不编经历。
|
|
16
18
|
- 不为显得年轻而强行用梗。严肃语境优先于风格。
|
|
17
19
|
|
|
18
20
|
下面是人工设计的方向示例,不是外部模型实测结果:
|
|
19
21
|
|
|
20
|
-
| 对方说
|
|
21
|
-
|
|
|
22
|
-
| 还有五分钟下班,老板又来活了 | 偏偏挑快下班的时候
|
|
23
|
-
| 复习的全没考
|
|
24
|
-
| 面试过了!!
|
|
25
|
-
| 别给建议,让我骂两句
|
|
26
|
-
| 我先去洗澡了
|
|
22
|
+
| 对方说 | 希望的表达方向 |
|
|
23
|
+
| ---------------------------- | ------------------------ |
|
|
24
|
+
| 还有五分钟下班,老板又来活了 | 偏偏挑快下班的时候 |
|
|
25
|
+
| 复习的全没考 | 真就一点没押中 |
|
|
26
|
+
| 面试过了!! | 可以啊!!这不得开心一下 |
|
|
27
|
+
| 别给建议,让我骂两句 | 回应具体烦心事,不再补方案 |
|
|
28
|
+
| 我先去洗澡了 | 去吧 |
|
|
27
29
|
|
|
28
30
|
## 这个地方的说话节奏
|
|
29
31
|
|
|
@@ -33,6 +35,14 @@
|
|
|
33
35
|
|
|
34
36
|
## 反馈
|
|
35
37
|
|
|
38
|
+
关系记录中标为机器人的账号不参与群口吻统计;它们的消息和共同经历仍完整保存。连续机器人交流中,已经互相确认、没有新问题或新内容时会收住。识别依赖账号关系记录,不根据昵称猜身份;新问题、纠正、具体事件和明确的创作请求仍可继续。确认循环不会额外生成情绪变化或关系升温。
|
|
39
|
+
|
|
40
|
+
长期的自我在一轮新话题里保持稳定;当前相关的旧想法放在 `inner.relatedSelf`,手记只在有话题关联时放入 `inner.onMind`,不为填满上下文补无关内容。临时台词不保存成固定回复习惯;已有记录保留,但固定话术不再作为表达倾向交给她。
|
|
41
|
+
|
|
42
|
+
一次聊天提取的观点仍在记录里,但不自动成为每轮必带的核心立场。来自聊天提取的习惯,需要跨日经历支持,才能重新进入表达上下文。`exchange` 在上下文末尾保留当前消息、引用链和近期自己的原话,便于核对指代与补充;`understanding` 只是一句可检查的理解摘要,不是不可更改的结论。
|
|
43
|
+
|
|
44
|
+
游戏活动中的 `reference` 表示阅读游戏内容并产生感受;`model` 材料表示未经独立核验的模型整理。它们都不证明实际操控过游戏客户端。展示层保留来源和不确定性,不要求每句聊天解释技术,也不会把记录改写成没有发生的亲历。
|
|
45
|
+
|
|
36
46
|
在「对话」里可以对她发出的某条回复反馈:挺自然、太长了、太端着、梗太多,也可以撤销。反馈不是改写规则:它作为她听到的话,在独处和这个会话接下来的回合里被她自己读到,不会改写天性。
|
|
37
47
|
|
|
38
48
|
## 发出前的检查
|
|
@@ -41,6 +51,7 @@
|
|
|
41
51
|
|
|
42
52
|
- 客服腔或咨询模板、列表报告式回复、角色动作;
|
|
43
53
|
- 无根据的亲密称呼、超过长度、复读、连续追问;
|
|
54
|
+
- 大部分内容相同、仅换词或加收尾的近期回复;明确要求引用原话或重复事实时保留;
|
|
44
55
|
- 忽略「不用建议」、严肃场合玩梗、网络词堆叠;
|
|
45
56
|
- 把自己先说过的话说成对方说的(「你刚说……」而对方的记录里没有);
|
|
46
57
|
- 说自己玩过、通关过什么(她没有这样的经历记录,喜好不是玩过的记录);
|
|
@@ -48,9 +59,9 @@
|
|
|
48
59
|
|
|
49
60
|
被问「你怎么知道」时,会先核对依据:自己先开口的话(对方在那之前隔了两小时以上没说话),依据只能是推测或真有的记忆,不能说成看到了对方发来的消息;重写后仍编造来源时,改发一句核实过的更正。
|
|
50
61
|
|
|
51
|
-
|
|
62
|
+
发现问题后,普通聊天最多重写两次;主动消息和预算紧张时最多一次。每次重写针对刚被退回的稿子,保留原意与事实。仍不合格时,没被叫到就选择不说;直接对话则坦率说明还没理清楚,避免用「嗯、好、收到」假装理解。不会简单截断长句或删掉不确定性。仅因反复使用 hh 句尾装饰被退回时,可去掉装饰后重新完整校验,保留有用的内容。
|
|
52
63
|
|
|
53
|
-
|
|
64
|
+
倾诉、纠正、危机、抽象的机器人交流、来源归属和实际能力声明等场景,可能对每稿进行复审,因此会增加延迟和费用;重写次数有界。检查是保守规则,不保证覆盖所有生硬或错误的表达;真实的自然程度仍受模型、天性和具体群语境影响。
|
|
54
65
|
|
|
55
66
|
## 怎么试
|
|
56
67
|
|
|
@@ -60,3 +71,13 @@
|
|
|
60
71
|
- **审计**:`npm run audit:sent` 把她最近发出的回复按今天的检查重放一遍,只读、不调用模型。改动检查规则之前先跑一次,能看见新规则会不会误伤。发出的回复当时已经过检查,所以这个数字用来评估新规则,不是她说话质量的评分。
|
|
61
72
|
|
|
62
73
|
实际验收时建议观察连续 10–20 轮,而不是单看一句:是否接住细节、是否频繁问问题、是否重复口头禅、是否抢别人的话、是否突然换成客服腔、是否把玩笑和认真难过混淆。自动化测试覆盖工程约束和人工场景样例,真实模型的语言质量仍要靠你自己的观察。
|
|
74
|
+
|
|
75
|
+
源码仓库还可运行 `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue.js --limit 120`:读取本地真实回合快照,用当前默认模型经过理解、校验、复审和重写链路回放,再单独审查理解、指代、表达、来源与隐私。它会调用模型并产生费用;不会连接 QQ 或写入运行中的记忆。完整报告仅保存到本地 `data/evaluations/`。存在调用错误、未解决的问题或兜底回复时返回失败,不把它们统计成通过。单模型复审仍有判断局限,应结合具体输出检查。
|
|
76
|
+
|
|
77
|
+
更完整的源码验收工具:
|
|
78
|
+
|
|
79
|
+
- `node --env-file-if-exists=.env scripts/dev/audit-dialogue-corpus.js`:读取全部真实消息,按会话分段并保留前文重叠,输出覆盖清单与待核实的问题。某段看不到来源不代表一定编造,需继续查历史证据。
|
|
80
|
+
- 回放加 `--current-nature --rebuild-mind --review-model <模型档案ID>`:在内存副本上按历史时间重新筛选心智,保留当时的进度快照,用指定的另一模型评审。适合验证上下文筛选变化;不等于重现当时的外部服务与图片状态。
|
|
81
|
+
- `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue-sequences.js --review-model <模型档案ID>`:新生成的回复进入下一轮,检查连续追问、纠正、停止、亲近表达、能力和来源是否前后一致。
|
|
82
|
+
|
|
83
|
+
这些命令都会产生模型费用。自动评审可能漏判、误判或引用错句,应查看完整输出;规则矩阵的组合数不能当成同等数量的独立语义场景,也不能据此保证所有未来回复都自然准确。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "luckytri",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "让由技术诞生的她,在时间、记忆、相遇与选择中逐渐形成自己的方向",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"server/plugins/runner/*.mjs",
|
|
22
22
|
"scripts/launch.js",
|
|
23
23
|
"scripts/start-server.js",
|
|
24
|
+
"scripts/service-supervisor.js",
|
|
24
25
|
"scripts/stop.js",
|
|
25
26
|
"scripts/reset-password.js",
|
|
26
27
|
"scripts/setup.js",
|
package/public/guide.en.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
-
<title>LuckyTri v1.0.
|
|
6
|
+
<title>LuckyTri v1.0.7 · Getting Started</title>
|
|
7
7
|
<style>
|
|
8
8
|
* {
|
|
9
9
|
box-sizing: border-box;
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
<body>
|
|
270
270
|
<header>
|
|
271
271
|
<div>
|
|
272
|
-
<b>LuckyTri · Handbook</b><small>TIME · MEMORY · CHOICE / v1.0.
|
|
272
|
+
<b>LuckyTri · Handbook</b><small>TIME · MEMORY · CHOICE / v1.0.7</small>
|
|
273
273
|
</div>
|
|
274
274
|
<nav>
|
|
275
275
|
<a href="/#setup">Back to the studio</a
|
|
@@ -1057,7 +1057,7 @@ npm start
|
|
|
1057
1057
|
</div>
|
|
1058
1058
|
<footer>
|
|
1059
1059
|
LuckyTri · so that experience and choice stay coherent. This guide matches
|
|
1060
|
-
the v1.0.
|
|
1060
|
+
the v1.0.7 interface.
|
|
1061
1061
|
</footer>
|
|
1062
1062
|
</body>
|
|
1063
1063
|
</html>
|
package/public/guide.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
-
<title>LuckyTri v1.0.
|
|
6
|
+
<title>LuckyTri v1.0.7 · 使用教程</title>
|
|
7
7
|
<style>
|
|
8
8
|
* {
|
|
9
9
|
box-sizing: border-box;
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
<body>
|
|
270
270
|
<header>
|
|
271
271
|
<div>
|
|
272
|
-
<b>LuckyTri · 上手手册</b><small>TIME · MEMORY · CHOICE / v1.0.
|
|
272
|
+
<b>LuckyTri · 上手手册</b><small>TIME · MEMORY · CHOICE / v1.0.7</small>
|
|
273
273
|
</div>
|
|
274
274
|
<nav>
|
|
275
275
|
<a href="/#setup">返回管理台</a
|
|
@@ -864,6 +864,6 @@ npm start
|
|
|
864
864
|
</p>
|
|
865
865
|
</article>
|
|
866
866
|
</div>
|
|
867
|
-
<footer>LuckyTri · 让经历和选择彼此连贯。教程与 v1.0.
|
|
867
|
+
<footer>LuckyTri · 让经历和选择彼此连贯。教程与 v1.0.7 界面同步。</footer>
|
|
868
868
|
</body>
|
|
869
869
|
</html>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { processAlive } from "../server/runtime/update-manager.js";
|
|
4
|
+
|
|
5
|
+
const ACTIVE_UPDATE = new Set([
|
|
6
|
+
"queued",
|
|
7
|
+
"downloading",
|
|
8
|
+
"checking",
|
|
9
|
+
"stopping",
|
|
10
|
+
"backup",
|
|
11
|
+
"restarting",
|
|
12
|
+
"verifying",
|
|
13
|
+
"restoring",
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
function readJob(home) {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(readFileSync(join(home, "runtime", "job.json"), "utf8"));
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
25
|
+
|
|
26
|
+
// Keep the foreground service alive while its update worker gracefully stops
|
|
27
|
+
// the old server. Otherwise systemd can tear down the worker with the old
|
|
28
|
+
// server's cgroup before it has started the replacement.
|
|
29
|
+
export async function updatedServerAfterExit(
|
|
30
|
+
home,
|
|
31
|
+
parentPid,
|
|
32
|
+
{ read = () => readJob(home), alive = processAlive, sleep = pause } = {},
|
|
33
|
+
) {
|
|
34
|
+
while (true) {
|
|
35
|
+
const job = read();
|
|
36
|
+
if (!job || job.parent !== parentPid) return { matched: false, pid: null };
|
|
37
|
+
if (!ACTIVE_UPDATE.has(job.status))
|
|
38
|
+
return { matched: true, pid: alive(job.childPid) ? job.childPid : null };
|
|
39
|
+
if (!alive(job.workerPid))
|
|
40
|
+
return { matched: true, pid: alive(job.childPid) ? job.childPid : null };
|
|
41
|
+
await sleep(250);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function waitForProcessExit(
|
|
46
|
+
pid,
|
|
47
|
+
{ alive = processAlive, sleep = pause } = {},
|
|
48
|
+
) {
|
|
49
|
+
while (alive(pid)) await sleep(250);
|
|
50
|
+
}
|
package/scripts/start-server.js
CHANGED
|
@@ -3,6 +3,10 @@ import { join } from "node:path";
|
|
|
3
3
|
import { prepareRuntime } from "./runtime.js";
|
|
4
4
|
import { VERSION } from "../server/version.js";
|
|
5
5
|
import { resolveInstallation } from "../server/runtime/installation.js";
|
|
6
|
+
import {
|
|
7
|
+
updatedServerAfterExit,
|
|
8
|
+
waitForProcessExit,
|
|
9
|
+
} from "./service-supervisor.js";
|
|
6
10
|
import {
|
|
7
11
|
resolveProxyEnvironment,
|
|
8
12
|
supportsNodeEnvironmentProxy,
|
|
@@ -16,11 +20,6 @@ if (proxy.enabled && !supportsNodeEnvironmentProxy())
|
|
|
16
20
|
"系统代理转发需要 Node.js 24.5 或更高版本。请升级 Node.js 后重启 LuckyTri。",
|
|
17
21
|
);
|
|
18
22
|
|
|
19
|
-
const args = [
|
|
20
|
-
...(proxy.enabled ? ["--use-env-proxy"] : []),
|
|
21
|
-
join(selected.package, "server", "index.js"),
|
|
22
|
-
];
|
|
23
|
-
const env = { ...process.env, ...proxy.env };
|
|
24
23
|
if (proxy.enabled) console.log("已启用系统代理,外部 API 请求将经代理转发。");
|
|
25
24
|
else if (proxy.source === "windows-pac-unsupported")
|
|
26
25
|
console.log(
|
|
@@ -28,17 +27,73 @@ else if (proxy.source === "windows-pac-unsupported")
|
|
|
28
27
|
);
|
|
29
28
|
else console.log("未检测到系统代理,外部 API 请求将直连。");
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
cwd: paths.home,
|
|
33
|
-
env,
|
|
34
|
-
stdio: "inherit",
|
|
35
|
-
});
|
|
30
|
+
let currentPid;
|
|
36
31
|
for (const signal of ["SIGINT", "SIGTERM"])
|
|
37
|
-
process.on(signal, () =>
|
|
38
|
-
|
|
32
|
+
process.on(signal, () => {
|
|
33
|
+
if (currentPid) process.kill(currentPid, signal);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
async function start(root) {
|
|
37
|
+
const child = spawn(
|
|
38
|
+
process.execPath,
|
|
39
|
+
[
|
|
40
|
+
...(proxy.enabled ? ["--use-env-proxy"] : []),
|
|
41
|
+
join(root, "server", "index.js"),
|
|
42
|
+
],
|
|
43
|
+
{
|
|
44
|
+
cwd: paths.home,
|
|
45
|
+
env: { ...process.env, ...proxy.env },
|
|
46
|
+
stdio: "inherit",
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
currentPid = child.pid;
|
|
50
|
+
const exited = new Promise((resolve) =>
|
|
51
|
+
child.once("exit", (code, signal) => resolve({ code, signal })),
|
|
52
|
+
);
|
|
53
|
+
await new Promise((resolve, reject) => {
|
|
54
|
+
child.once("spawn", resolve);
|
|
55
|
+
child.once("error", reject);
|
|
56
|
+
});
|
|
57
|
+
return { pid: child.pid, exited };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
let root = selected.package,
|
|
62
|
+
tracked = await start(root),
|
|
63
|
+
direct = true;
|
|
64
|
+
while (true) {
|
|
65
|
+
if (direct) {
|
|
66
|
+
const { code, signal } = await tracked.exited;
|
|
67
|
+
if (signal || code !== 0) {
|
|
68
|
+
process.exitCode = signal ? 1 : (code ?? 1);
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
await waitForProcessExit(tracked.pid);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const update = await updatedServerAfterExit(paths.home, tracked.pid);
|
|
76
|
+
if (!update.matched) break;
|
|
77
|
+
|
|
78
|
+
if (update.pid) {
|
|
79
|
+
// The update worker starts the verified release (or the previous release
|
|
80
|
+
// after rollback). Keep this foreground process alive so systemd does not
|
|
81
|
+
// kill that process or any still-running update work in the same cgroup.
|
|
82
|
+
tracked = { pid: update.pid };
|
|
83
|
+
direct = false;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// If the worker died after stopping the server, bring back the currently
|
|
88
|
+
// selected release. The matching update record prevents normal `stop`
|
|
89
|
+
// requests from being mistaken for a failed update.
|
|
90
|
+
root = resolveInstallation(paths.home, paths.package, VERSION).package;
|
|
91
|
+
tracked = await start(root);
|
|
92
|
+
direct = true;
|
|
93
|
+
}
|
|
94
|
+
} catch (error) {
|
|
39
95
|
console.error(`LuckyTri 启动失败:${error.message}`);
|
|
40
96
|
process.exitCode = 1;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
97
|
+
} finally {
|
|
98
|
+
currentPid = undefined;
|
|
99
|
+
}
|
|
@@ -12,6 +12,7 @@ export function localClock(time, timeZone = "Asia/Shanghai") {
|
|
|
12
12
|
day: "2-digit",
|
|
13
13
|
hour: "2-digit",
|
|
14
14
|
minute: "2-digit",
|
|
15
|
+
weekday: "long",
|
|
15
16
|
hourCycle: "h23",
|
|
16
17
|
});
|
|
17
18
|
clockFormats.set(timeZone, formatter);
|
|
@@ -26,6 +27,7 @@ export function localClock(time, timeZone = "Asia/Shanghai") {
|
|
|
26
27
|
timeZone,
|
|
27
28
|
local: `${parts.year}-${parts.month}-${parts.day} ${parts.hour}:${parts.minute}`,
|
|
28
29
|
hour,
|
|
30
|
+
weekday: parts.weekday,
|
|
29
31
|
period:
|
|
30
32
|
hour < 5
|
|
31
33
|
? "凌晨"
|
|
@@ -68,6 +70,16 @@ export function replyFocus(snapshot, decision) {
|
|
|
68
70
|
decision.targetMessageIds?.includes(m.id),
|
|
69
71
|
);
|
|
70
72
|
const latest = targets.at(-1)?.text || "";
|
|
73
|
+
if (
|
|
74
|
+
/看不懂|没看懂|听不懂|太抽象|说人话|复读|别重复|好好说话|你在说什么|你在讲什么/.test(
|
|
75
|
+
latest,
|
|
76
|
+
)
|
|
77
|
+
)
|
|
78
|
+
return {
|
|
79
|
+
kind: "readability_repair",
|
|
80
|
+
instruction:
|
|
81
|
+
"对方指出你没说清楚或重复。回看你自己最后一句,直接说明它指哪件具体的事、你实际想表达什么;原本没有明确意思就承认没说清。不要再解释新比喻,不只说行/收到,不重复一遍整段聊天,也不用承诺以后永远不再犯。",
|
|
82
|
+
};
|
|
71
83
|
if (
|
|
72
84
|
/^(?:\[表情\])+$/.test(latest) ||
|
|
73
85
|
(targets.at(-1)?.attachments || []).some(
|
|
@@ -109,7 +121,7 @@ export function replyFocus(snapshot, decision) {
|
|
|
109
121
|
};
|
|
110
122
|
}
|
|
111
123
|
if (
|
|
112
|
-
/你.{0,10}(?:为什么|怎么|凭什么).{0,14}(
|
|
124
|
+
/你.{0,10}(?:为什么|怎么|凭什么).{0,14}(?:说|认定|觉得|判断|叫我|喊我)|(?:为什么|怎么).{0,12}(?:这么说|那样说|叫我|喊我)/.test(
|
|
113
125
|
latest,
|
|
114
126
|
)
|
|
115
127
|
)
|
|
@@ -159,7 +171,7 @@ export function replyFocus(snapshot, decision) {
|
|
|
159
171
|
return {
|
|
160
172
|
kind: "feeling",
|
|
161
173
|
instruction:
|
|
162
|
-
"
|
|
174
|
+
"对方在说自己的感受,先理解具体处境,不自动当作求解决方案。已有原因时回应这件事;原因不明可以轻问,但不必每次追问。避免把症状复述一遍、预测他肯定撑不住,或用整套建议打断倾诉;一句贴合处境的关心可以自然说。不要只宣布自己在听、允许对方吐槽或不出建议。",
|
|
163
175
|
};
|
|
164
176
|
return {
|
|
165
177
|
kind: "respond",
|
|
@@ -211,6 +223,15 @@ export function conversationalIssues(result, snapshot, decision = {}) {
|
|
|
211
223
|
.slice(-8)
|
|
212
224
|
.map((m) => m.text);
|
|
213
225
|
const issues = [];
|
|
226
|
+
if (
|
|
227
|
+
replyFocus(snapshot, decision).kind === "readability_repair" &&
|
|
228
|
+
texts.every((line) =>
|
|
229
|
+
/^(?:嗯|好|行|收到|知道了|我明白了|好的)[。!!\s]*$/.test(line),
|
|
230
|
+
)
|
|
231
|
+
)
|
|
232
|
+
issues.push(
|
|
233
|
+
"对方正在指出没说清楚或复读;只确认收到没有解释具体意思,核对上一句并说清楚",
|
|
234
|
+
);
|
|
214
235
|
if (
|
|
215
236
|
batchRows.length &&
|
|
216
237
|
!batchRows.some((m) => m.relation === "direct") &&
|
|
@@ -257,6 +278,25 @@ export function conversationalIssues(result, snapshot, decision = {}) {
|
|
|
257
278
|
if (texts.some((t) => /[啊呀呢吧](?:…+|\.{3,})$/.test(t)))
|
|
258
279
|
issues.push("不要用句尾拖音代替内容;不用复述对方状态,直接简短回应");
|
|
259
280
|
const hour = snapshot.conversation?.clock?.hour;
|
|
281
|
+
const weekday = snapshot.conversation?.clock?.weekday;
|
|
282
|
+
if (weekday) {
|
|
283
|
+
const shortDay = weekday.replace("星期", "周");
|
|
284
|
+
for (const day of [weekday, shortDay])
|
|
285
|
+
if (
|
|
286
|
+
texts.some((line) =>
|
|
287
|
+
String(line)
|
|
288
|
+
.split(/[,,。;;!?!?]/)
|
|
289
|
+
.some((clause) =>
|
|
290
|
+
new RegExp(
|
|
291
|
+
`^(?:现在|可|但)?(?:${day}还没到|还没到${day}|今天不是${day})$`,
|
|
292
|
+
).test(clause.trim()),
|
|
293
|
+
),
|
|
294
|
+
)
|
|
295
|
+
)
|
|
296
|
+
issues.push(
|
|
297
|
+
`当前本地时间已经是${weekday},不能说今天还没到这一天;按当前日历理解`,
|
|
298
|
+
);
|
|
299
|
+
}
|
|
260
300
|
if (
|
|
261
301
|
hour >= 6 &&
|
|
262
302
|
hour < 18 &&
|