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/server/mind/view.js
CHANGED
|
@@ -6,6 +6,7 @@ import { describeFace } from "./faces.js";
|
|
|
6
6
|
import { SELF_KINDS } from "./self.js";
|
|
7
7
|
import { DAY, text } from "./util.js";
|
|
8
8
|
import { relationshipHistory } from "./relationship-context.js";
|
|
9
|
+
import { fixedReplyHabit } from "../core/conversation-grounding.js";
|
|
9
10
|
|
|
10
11
|
const FORGOTTEN = "(很久没想起了)";
|
|
11
12
|
|
|
@@ -46,6 +47,12 @@ function groupStyle(mind, session, now) {
|
|
|
46
47
|
)
|
|
47
48
|
.all(session, now + 60000);
|
|
48
49
|
const ids = rows.map((row) => row.event_id).filter(Boolean);
|
|
50
|
+
const bots = new Set(
|
|
51
|
+
mind.relationships
|
|
52
|
+
.context({ room: session, now, limit: 100 })
|
|
53
|
+
.known.filter((p) => p.kind === "bot")
|
|
54
|
+
.map((p) => String(p.subjectId)),
|
|
55
|
+
);
|
|
49
56
|
const away = ids.length
|
|
50
57
|
? new Set(
|
|
51
58
|
mind.db
|
|
@@ -57,7 +64,9 @@ function groupStyle(mind, session, now) {
|
|
|
57
64
|
)
|
|
58
65
|
: new Set();
|
|
59
66
|
const profile = summarizeGroupStyle(
|
|
60
|
-
|
|
67
|
+
rows.filter(
|
|
68
|
+
(row) => !away.has(row.event_id) && !bots.has(String(row.user_id)),
|
|
69
|
+
),
|
|
61
70
|
now,
|
|
62
71
|
);
|
|
63
72
|
return profile.ready ? profile.summary : "";
|
|
@@ -97,11 +106,31 @@ export function innerView(
|
|
|
97
106
|
now,
|
|
98
107
|
});
|
|
99
108
|
const carries = (thread) => mind.meetings.stays(thread, session, now);
|
|
109
|
+
const availableThreads = mind.self
|
|
110
|
+
.annotated({ before: now, now })
|
|
111
|
+
.filter(
|
|
112
|
+
(t) =>
|
|
113
|
+
!t.faded &&
|
|
114
|
+
carries(t) &&
|
|
115
|
+
!fixedReplyHabit(t.content) &&
|
|
116
|
+
!(
|
|
117
|
+
t.kind === "habit" &&
|
|
118
|
+
t.origin === "memory" &&
|
|
119
|
+
new Set(t.days).size < 3
|
|
120
|
+
),
|
|
121
|
+
);
|
|
122
|
+
// Her cached self stays the same across cues. Topic-specific recollections
|
|
123
|
+
// belong in inner, so a new question does not swap her personality.
|
|
100
124
|
const visibleThreads = relevantContext(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
125
|
+
availableThreads.filter((t) => t.core || t.thread === living?.thread),
|
|
126
|
+
{
|
|
127
|
+
limit: 6,
|
|
128
|
+
pinned: (t) => t.core || t.thread === living?.thread,
|
|
129
|
+
},
|
|
130
|
+
);
|
|
131
|
+
const relatedSelf = relevantContext(
|
|
132
|
+
availableThreads.filter((t) => !visibleThreads.includes(t)),
|
|
133
|
+
{ cues, limit: 2, requireOverlap: true },
|
|
105
134
|
);
|
|
106
135
|
const shownLiving = living && carries(living) ? living : null;
|
|
107
136
|
const reminded = [
|
|
@@ -212,7 +241,7 @@ export function innerView(
|
|
|
212
241
|
mind.thoughts
|
|
213
242
|
.open({ now, limit: 400, session })
|
|
214
243
|
.filter((t) => mind.meetings.sayable(t.content, session)),
|
|
215
|
-
{ cues, limit: 3 },
|
|
244
|
+
{ cues, limit: 3, requireOverlap: cue.length > 0 },
|
|
216
245
|
);
|
|
217
246
|
const heard = feedback(mind, session, now);
|
|
218
247
|
const continuity = mind.continuity.recall({ session, people, cue, now });
|
|
@@ -272,6 +301,14 @@ export function innerView(
|
|
|
272
301
|
),
|
|
273
302
|
}
|
|
274
303
|
: {}),
|
|
304
|
+
...(relatedSelf.length
|
|
305
|
+
? {
|
|
306
|
+
relatedSelf: relatedSelf.map(
|
|
307
|
+
(t) =>
|
|
308
|
+
`${SELF_KINDS[t.kind]}:${relationshipHistory(text(t.content, 80), t.created, relationships)}`,
|
|
309
|
+
),
|
|
310
|
+
}
|
|
311
|
+
: {}),
|
|
275
312
|
...(expectingLines.length ? { expecting: expectingLines } : {}),
|
|
276
313
|
...(withLines.length ? { with: withLines } : {}),
|
|
277
314
|
...(will ? { will } : {}),
|
|
@@ -62,7 +62,7 @@ export async function performUpdate(
|
|
|
62
62
|
writeActive(paths.home, { id, version: job.version });
|
|
63
63
|
changed = true;
|
|
64
64
|
child = await start(candidate);
|
|
65
|
-
save("verifying");
|
|
65
|
+
save("verifying", { childPid: child });
|
|
66
66
|
await health(child, job.version);
|
|
67
67
|
save("done", { finished: Date.now() });
|
|
68
68
|
try {
|
|
@@ -115,6 +115,7 @@ export async function performUpdate(
|
|
|
115
115
|
save("error", {
|
|
116
116
|
error: UPDATE_FAILED,
|
|
117
117
|
restored: true,
|
|
118
|
+
childPid: restored,
|
|
118
119
|
finished: Date.now(),
|
|
119
120
|
});
|
|
120
121
|
} catch {
|