luckytri 1.0.8 → 1.1.0
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 +1 -1
- package/README.md +1 -1
- package/docs/en/CHANGELOG.md +44 -24
- package/docs/en/architecture.md +4 -0
- package/docs/en/cognition.md +34 -0
- package/docs/en/guide.md +8 -6
- package/docs/zh/CHANGELOG.md +44 -24
- package/docs/zh/architecture.md +4 -0
- package/docs/zh/cognition.md +34 -0
- package/docs/zh/guide.md +8 -6
- package/package.json +112 -112
- package/public/app/assets/ChatsPage-DH4ZPRXB.js +3 -0
- package/public/app/assets/{Empty-C7yzOBzy.js → Empty-DRsHeX-L.js} +1 -1
- package/public/app/assets/Field-BfIUcaNa.js +1 -0
- package/public/app/assets/HeartPage-BxgSUJJ_.js +1 -0
- package/public/app/assets/LifePage-CAKr8h_q.js +1 -0
- package/public/app/assets/MemoryPage-CFq8L_TC.js +1 -0
- package/public/app/assets/NaturePage-BU1iDno3.js +3 -0
- package/public/app/assets/PeoplePage-C6i_nAfr.js +1 -0
- package/public/app/assets/PluginsPage-DRV8lzk3.js +2 -0
- package/public/app/assets/SystemPage-21AlQBiC.js +1 -0
- package/public/app/assets/SystemPage-CMcuUdLm.css +1 -0
- package/public/app/assets/TimePage-DUzjLnZV.js +3 -0
- package/public/app/assets/index-WAvrlAcO.js +4 -0
- package/public/app/assets/{knowledge-BJOIyuJo.js → knowledge-V_blbx9R.js} +1 -1
- package/public/app/assets/media-C7j5HqxK.js +1 -0
- package/public/app/assets/{mind-DtTVrW6Z.js → mind-BBAstMqH.js} +1 -1
- package/public/app/index.html +3 -3
- package/public/guide.en.html +13 -5
- package/public/guide.html +12 -5
- package/public/tutorial.en.md +3 -1
- package/public/tutorial.md +3 -1
- package/server/core/backoff.js +123 -0
- package/server/core/context-builder.js +307 -288
- package/server/core/contribution-check.js +50 -0
- package/server/core/conversation-cues.js +377 -385
- package/server/core/conversation-grounding.js +547 -304
- package/server/core/dialogue-context.js +247 -244
- package/server/core/dialogue-contract.js +33 -9
- package/server/core/embedding.js +246 -0
- package/server/core/expression-strategy.js +90 -0
- package/server/core/initiative-context.js +88 -68
- package/server/core/model-json.js +223 -190
- package/server/core/model-manager.js +256 -56
- package/server/core/model-presets.js +1045 -900
- package/server/core/orchestrator.js +41 -3
- package/server/core/persona-manager.js +364 -359
- package/server/core/reader-check.js +166 -62
- package/server/core/reply-delivery.js +688 -537
- package/server/core/repository.js +36 -0
- package/server/core/response-generator.js +101 -92
- package/server/core/response-validator.js +18 -3
- package/server/core/retired-prompts.js +53 -51
- package/server/core/time-expressions.js +143 -0
- package/server/core/turn-processor.js +175 -5
- package/server/core/turn.js +299 -44
- package/server/core/understanding.js +85 -0
- package/server/core/working-memory.js +149 -0
- package/server/i18n/decisions.js +225 -209
- package/server/i18n/errors.js +14 -0
- package/server/i18n/models.js +120 -111
- package/server/knowledge/api.js +362 -342
- package/server/knowledge/embedding-profile.js +158 -114
- package/server/knowledge/manager.js +6 -1
- package/server/mind/api.js +68 -0
- package/server/mind/continuity.js +634 -562
- package/server/mind/day-planner.js +52 -3
- package/server/mind/episodes.js +242 -0
- package/server/mind/expression-grounding.js +24 -21
- package/server/mind/index.js +13 -2
- package/server/mind/initiative.js +356 -338
- package/server/mind/life/index.js +6 -0
- package/server/mind/meetings.js +1112 -1069
- package/server/mind/memory.js +1091 -888
- package/server/mind/recall/index.js +776 -0
- package/server/mind/recall/schema.js +132 -0
- package/server/mind/recall/sources.js +220 -0
- package/server/mind/recall/store.js +368 -0
- package/server/mind/salience.js +202 -201
- package/server/mind/schema.js +568 -567
- package/server/mind/self.js +537 -496
- package/server/mind/time/activity-recall.js +65 -0
- package/server/mind/time/index.js +6 -2
- package/server/mind/time/tasks.js +36 -10
- package/server/mind/time/works.js +528 -527
- package/server/mind/view.js +63 -17
- package/server/storage/archive.js +1 -1
- package/public/app/assets/ChatsPage-CshdtTzV.js +0 -3
- package/public/app/assets/Field-BjFv4Rfn.js +0 -1
- package/public/app/assets/HeartPage-eqo6ru16.js +0 -1
- package/public/app/assets/LifePage-CN8GE5NK.js +0 -1
- package/public/app/assets/MemoryPage-CCpMN4Wg.js +0 -1
- package/public/app/assets/NaturePage-C0JqdBTR.js +0 -3
- package/public/app/assets/PeoplePage-BXGBbO4u.js +0 -1
- package/public/app/assets/PluginsPage-Dksp5AV5.js +0 -2
- package/public/app/assets/SystemPage-BenIyTvk.css +0 -1
- package/public/app/assets/SystemPage-Cd7aa8eE.js +0 -1
- package/public/app/assets/TimePage-Bs_zImb4.js +0 -3
- package/public/app/assets/index-CyRtYxP3.js +0 -4
- package/public/app/assets/media-Bwtx8blz.js +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
conversationGrounding,
|
|
3
|
+
recentOwnMessages,
|
|
4
|
+
} from "./conversation-grounding.js";
|
|
5
|
+
|
|
6
|
+
export function botExchange(snapshot, decision = {}) {
|
|
7
|
+
if (!decision || typeof decision !== "object" || Array.isArray(decision))
|
|
8
|
+
return null;
|
|
9
|
+
if (
|
|
10
|
+
snapshot.initiative ||
|
|
11
|
+
decision.act ||
|
|
12
|
+
decision.share ||
|
|
13
|
+
["chat", "rest"].includes(decision.attention?.action)
|
|
14
|
+
)
|
|
15
|
+
return null;
|
|
16
|
+
const grounding = conversationGrounding(snapshot);
|
|
17
|
+
const current = (snapshot.messages || []).filter(
|
|
18
|
+
(m) => snapshot.batchIds?.includes(m.id) && m.role === "user",
|
|
19
|
+
);
|
|
20
|
+
if (
|
|
21
|
+
!current.length ||
|
|
22
|
+
!current.every((m) => grounding.botMessageIds.includes(m.id)) ||
|
|
23
|
+
grounding.botOnlyTail < 4
|
|
24
|
+
)
|
|
25
|
+
return null;
|
|
26
|
+
const own = recentOwnMessages(snapshot, 4);
|
|
27
|
+
if (!own.length) return null;
|
|
28
|
+
const speakers = new Set(current.map((m) => m.speaker));
|
|
29
|
+
return {
|
|
30
|
+
current: current.map(({ id, speaker, text }) => ({ id, speaker, text })),
|
|
31
|
+
previousOwn: own.map(({ id, text }) => ({ id, text })),
|
|
32
|
+
previousBots: (snapshot.messages || [])
|
|
33
|
+
.filter(
|
|
34
|
+
(m) =>
|
|
35
|
+
m.role === "user" &&
|
|
36
|
+
speakers.has(m.speaker) &&
|
|
37
|
+
!snapshot.batchIds.includes(m.id),
|
|
38
|
+
)
|
|
39
|
+
.slice(-4)
|
|
40
|
+
.map(({ id, text }) => ({ id, text })),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const CONTRIBUTION_CHECK = `判断一段机器人之间的接话是否有继续说的内容。只输出JSON,不扮演任何人。
|
|
45
|
+
botExchange是实际原话,reply是准备发出的话;plannedPoint只是草稿的自我描述,不能拿“接住、回应、强调、确认、收住”这些工作说明证明有内容。reply非空时只判断它实际说了什么。
|
|
46
|
+
对方提出新问题、分享新感受或实际段落,可以回应;具体的感受、疑问、不同看法、小联想也算内容,不要求新知识、完整故事或重大事件。尤其创作讨论,可以喜欢或不喜欢一处实际表达,不必强迫沉默。
|
|
47
|
+
但同一个边界、承诺、等待、归属或确认,换措辞、换比喻再认一遍,仍没有新意思。比如双方已经确认什么时候发由作者自己定,下一句“对,还是你决定”不用再发;只说“等稿、这笔记上、原样还你、谁也不欠、按你算”不能独自成为新内容。对方报备同一决定也不需要你再次许可。没有新内容就结束,不为了避免沉默另编一件事。
|
|
48
|
+
如果reply没有新内容,再判断current里是否有这轮刚出现、且draft没有回答的具体新段落、作品交付、问题或纠正。有则shouldRepair=true,表示需要根据这轮新内容重想一次;这不是要换词确认。若current只是旧决定的重复报备、同意或收尾,shouldRepair=false。输出 {"hasContribution":true或false,"newPoint":"reply里确有的新内容,没有则空","shouldRepair":true或false,"reason":"与先前原话相比,实际增加或重复了什么"}。`;
|
|
49
|
+
|
|
50
|
+
export const CONTRIBUTION_REPAIR = `上一稿被判为没有新内容。请重新读 context 和 exchange.current,判断这轮是否有还没答到的新问题、纠正、实际交付或具体片段。若有,就只回应那个新点:有人送来新作品或片段时,不只重复“我等全文/会按约定读”,先从本轮实际给出的文字里挑一处,给出具体而有限的反应;整部主线或人物动机未知时再说明未知。不要编造原文没有的情节,不必复盘整段历史。若眼前确实没有新点,可以继续沉默。仍输出完整的聊天判断 JSON。`;
|