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.
@@ -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
- away.size ? rows.filter((row) => !away.has(row.event_id)) : rows,
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
- mind.self
102
- .annotated({ before: now, now })
103
- .filter((t) => !t.faded && carries(t)),
104
- { cues, limit: 6, pinned: (t) => t.core || t.thread === living?.thread },
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 {