luckytri 1.3.2 → 1.3.3
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/docs/en/CHANGELOG.md +6 -0
- package/docs/zh/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/public/guide.en.html +3 -3
- package/public/guide.html +3 -3
- package/server/core/conversation-grounding.js +216 -1
- package/server/core/conversation-needs.js +10 -3
- package/server/core/dialogue-context.js +139 -1
- package/server/core/dialogue-contract.js +2 -2
- package/server/core/response-validator.js +1 -1
- package/server/core/turn-processor.js +2 -0
- package/server/core/turn.js +20 -1
- package/server/core/understanding.js +60 -4
- package/server/core/vision-manager.js +76 -7
- package/server/i18n/errors.js +2 -0
- package/server/mind/time/sharing.js +582 -482
- package/server/mind/time/works.js +51 -48
|
@@ -406,57 +406,60 @@ export class Works {
|
|
|
406
406
|
const terms = interestTerms([words]);
|
|
407
407
|
// Search the work catalogue, not just the two newest activities. Select
|
|
408
408
|
// the version that existed at the requested time, including in replays.
|
|
409
|
-
return
|
|
410
|
-
.
|
|
411
|
-
|
|
409
|
+
return (
|
|
410
|
+
this.db
|
|
411
|
+
.prepare(
|
|
412
|
+
`SELECT w.*,COALESCE(p.kind,(SELECT kind FROM mind_creations WHERE id=w.legacy_creation)) kind,p.title project_title,p.bible,v.version,v.title,v.created version_created,v.summary,v.sources,v.provenance,length(v.content) characters
|
|
412
413
|
FROM mind_time_works w LEFT JOIN mind_time_projects p ON p.id=w.project_id
|
|
413
414
|
JOIN mind_time_versions v ON v.work_id=w.id AND v.version=(SELECT max(h.version) FROM mind_time_versions h WHERE h.work_id=w.id AND h.created<=?)
|
|
414
415
|
WHERE w.created<=? ORDER BY v.created DESC`,
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
(
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
416
|
+
)
|
|
417
|
+
.all(now, now)
|
|
418
|
+
.filter(
|
|
419
|
+
(w) =>
|
|
420
|
+
w.created <= now &&
|
|
421
|
+
this.time.visible(
|
|
422
|
+
{ ...w, sources: parse(w.sources, []) },
|
|
423
|
+
session,
|
|
424
|
+
now,
|
|
425
|
+
),
|
|
426
|
+
)
|
|
427
|
+
.map((w) => ({
|
|
428
|
+
...w,
|
|
429
|
+
score: [...interestTerms([w.title, w.project_title, w.summary])]
|
|
430
|
+
.filter((term) => terms.has(term))
|
|
431
|
+
.reduce(
|
|
432
|
+
(total, term) =>
|
|
433
|
+
total + (/^[a-z][a-z0-9]{2,}$/.test(term) ? 8 : 1),
|
|
434
|
+
0,
|
|
435
|
+
),
|
|
436
|
+
}))
|
|
437
|
+
.sort(
|
|
438
|
+
(a, b) => b.score - a.score || b.version_created - a.version_created,
|
|
439
|
+
)
|
|
440
|
+
// No topic hit → empty. Do not fall back to "latest two" and pollute
|
|
441
|
+
// ordinary chatter with manuscript fragments.
|
|
442
|
+
.filter((w) => w.score >= 2)
|
|
443
|
+
.filter((w) => this.materialSupported(w))
|
|
444
|
+
.slice(0, 3)
|
|
445
|
+
.map((w) => ({
|
|
446
|
+
id: w.id,
|
|
447
|
+
title: w.title,
|
|
448
|
+
state: this.get(w.id, w.version, { before: now }).state,
|
|
449
|
+
kind: w.kind,
|
|
450
|
+
version: w.version,
|
|
451
|
+
ordinal: w.ordinal,
|
|
452
|
+
summary: text(w.summary, 180),
|
|
453
|
+
fragment: text(this.get(w.id, w.version).content, 300),
|
|
454
|
+
...(w.kind === "game"
|
|
455
|
+
? {
|
|
456
|
+
experienceMode: "reference",
|
|
457
|
+
provenance: this.get(w.id, w.version).provenance,
|
|
458
|
+
}
|
|
459
|
+
: {}),
|
|
460
|
+
characters: w.characters,
|
|
461
|
+
}))
|
|
462
|
+
);
|
|
460
463
|
}
|
|
461
464
|
|
|
462
465
|
activityEvidence({ session, now = this.time.now(), cue = [] } = {}) {
|