luckytri 1.0.0 → 1.0.2
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/.github/SECURITY.md +4 -4
- package/README.en.md +252 -250
- package/README.md +252 -250
- package/bin/luckytri.js +5 -1
- package/docs/en/CHANGELOG.md +8 -0
- package/docs/en/connect.md +18 -18
- package/docs/en/guide.md +202 -216
- package/docs/en/npm-release.md +25 -25
- package/docs/zh/CHANGELOG.md +8 -0
- package/docs/zh/connect.md +17 -17
- package/docs/zh/guide.md +202 -216
- package/docs/zh/npm-release.md +33 -33
- package/package.json +110 -108
- package/plugins/sdk/index.d.ts +155 -155
- package/plugins/sdk/testing.js +58 -58
- package/plugins/weather/index.js +82 -82
- package/plugins/weather/luckytri-plugin.json +29 -29
- package/public/app/assets/ChatsPage-BhlJHseG.js +3 -0
- package/public/app/assets/Empty-DP6WMGHi.js +2 -0
- package/public/app/assets/Field-CtbdqaiB.js +1 -0
- package/public/app/assets/HeartPage-32BeTPn2.js +1 -0
- package/public/app/assets/LifePage-CxSm0XKI.js +1 -0
- package/public/app/assets/MemoryPage-BeKBcPCY.js +1 -0
- package/public/app/assets/NaturePage-NEPYl2HS.js +3 -0
- package/public/app/assets/PeoplePage-DxtpekwM.js +1 -0
- package/public/app/assets/PluginsPage-CVVQwEBI.css +1 -0
- package/public/app/assets/PluginsPage-DksEZbUU.js +2 -0
- package/public/app/assets/{SystemPage-CAMPoYqM.css → SystemPage-BkRu0Rvx.css} +1 -1
- package/public/app/assets/SystemPage-BvzJlHuY.js +1 -0
- package/public/app/assets/TimePage-7-awH5XL.js +3 -0
- package/public/app/assets/index-4rItIkD-.js +4 -0
- package/public/app/assets/{index-YDz1ree1.css → index-DY4e15Kh.css} +1 -1
- package/public/app/assets/{knowledge-DG0e0uKw.js → knowledge-C6_HvoyB.js} +1 -1
- package/public/app/assets/media-SMfTT-yc.js +1 -0
- package/public/app/index.html +3 -3
- package/public/guide.en.html +72 -99
- package/public/guide.html +44 -86
- package/public/tutorial.en.md +25 -39
- package/public/tutorial.md +25 -39
- package/scripts/backup.js +311 -311
- package/scripts/browser.js +41 -41
- package/scripts/import-data.js +128 -0
- package/scripts/launch.js +101 -94
- package/scripts/plugin.js +150 -150
- package/scripts/reset-password.js +22 -0
- package/scripts/runtime.js +25 -25
- package/scripts/service.js +56 -47
- package/scripts/setup.js +50 -50
- package/scripts/start-server.js +41 -41
- package/scripts/stop.js +36 -36
- package/server/app.js +112 -96
- package/server/auth.js +217 -0
- package/server/channels/contract.js +57 -57
- package/server/channels/hub.js +165 -165
- package/server/channels/index.js +28 -25
- package/server/channels/onebot/index.js +335 -336
- package/server/channels/onebot/token.js +22 -3
- package/server/core/capabilities.js +208 -208
- package/server/core/events.js +64 -60
- package/server/core/image-preprocessor.js +208 -208
- package/server/core/model-manager.js +1213 -1213
- package/server/core/net-guard.js +49 -49
- package/server/core/orchestrator.js +569 -569
- package/server/core/perceivers.js +91 -91
- package/server/core/persona-manager.js +243 -243
- package/server/core/repository.js +293 -293
- package/server/core/response-validator.js +508 -508
- package/server/core/turn-processor.js +630 -630
- package/server/core/turn.js +236 -236
- package/server/core/vision-manager.js +633 -633
- package/server/i18n/errors.js +548 -497
- package/server/i18n/labels.js +649 -653
- package/server/index.js +151 -102
- package/server/knowledge/manager.js +386 -386
- package/server/knowledge/schema.js +12 -8
- package/server/local-access.js +32 -0
- package/server/mind/anticipations.js +507 -507
- package/server/mind/api.js +703 -703
- package/server/mind/budget.js +152 -152
- package/server/mind/context-selection.js +61 -61
- package/server/mind/day-planner.js +324 -324
- package/server/mind/evidence.js +148 -148
- package/server/mind/index.js +445 -445
- package/server/mind/life/diary.js +786 -786
- package/server/mind/life/index.js +1049 -1049
- package/server/mind/observations.js +84 -84
- package/server/mind/own-day.js +324 -324
- package/server/mind/own-voice.js +318 -318
- package/server/mind/senses.js +53 -53
- package/server/mind/time/activity-clock.js +196 -196
- package/server/mind/time/availability.js +69 -69
- package/server/mind/time/commitment-review.js +198 -198
- package/server/mind/time/executor.js +512 -512
- package/server/mind/time/experiences.js +128 -128
- package/server/mind/time/games.js +562 -562
- package/server/mind/time/index.js +739 -739
- package/server/mind/time/intent.js +166 -166
- package/server/mind/time/kinds.js +171 -171
- package/server/mind/time/plugin-activity.js +207 -207
- package/server/mind/time/tasks.js +587 -587
- package/server/mind/util.js +110 -110
- package/server/mind/view.js +273 -273
- package/server/paths.js +102 -102
- package/server/plugins/api.js +204 -204
- package/server/plugins/host.js +967 -967
- package/server/plugins/install.js +295 -295
- package/server/plugins/manifest.js +201 -201
- package/server/plugins/permissions.js +42 -42
- package/server/plugins/runner/guard.mjs +36 -36
- package/server/plugins/runner/worker.mjs +250 -250
- package/server/plugins/schema.js +91 -91
- package/server/plugins/zip.js +112 -112
- package/server/startup-lock.js +118 -118
- package/server/storage/archive.js +242 -241
- package/server/storage/backup-cleanup-worker.js +8 -8
- package/server/storage/backup-cleanup.js +415 -414
- package/server/storage/backup-lock.js +76 -76
- package/server/storage/backup-scheduler.js +131 -131
- package/server/storage/data-package.js +298 -0
- package/server/storage/data-transfer-api.js +50 -0
- package/server/storage/data-transfer-worker.js +18 -0
- package/server/storage/data-transfer.js +415 -0
- package/server/storage/store.js +202 -199
- package/server/studio/readiness.js +181 -190
- package/server/studio/settings.js +236 -236
- package/public/app/assets/ChatsPage-C-FcRapR.js +0 -3
- package/public/app/assets/Empty-CpP5kQHH.js +0 -2
- package/public/app/assets/Field-D4gY-INU.js +0 -1
- package/public/app/assets/HeartPage-CPy_thQd.js +0 -1
- package/public/app/assets/LifePage-CxWvwmSf.js +0 -1
- package/public/app/assets/MemoryPage-DC4rhQ68.js +0 -1
- package/public/app/assets/NaturePage-IvYw04Zq.js +0 -3
- package/public/app/assets/PeoplePage-Cqefm9-q.js +0 -1
- package/public/app/assets/PluginsPage-DKSaKvXb.js +0 -2
- package/public/app/assets/PluginsPage-HyBe5D8w.css +0 -1
- package/public/app/assets/SystemPage-CJmtJkrK.js +0 -1
- package/public/app/assets/TimePage-Cw44inM4.js +0 -3
- package/public/app/assets/index-BheRW-1t.js +0 -4
- package/public/app/assets/media-BzPDBm7e.js +0 -1
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
import { parse, text } from "../util.js";
|
|
2
|
-
import { gameText } from "./presentation.js";
|
|
3
|
-
import { activityLabel } from "./kinds.js";
|
|
4
|
-
|
|
5
|
-
const labels = {
|
|
6
|
-
game: "游玩",
|
|
7
|
-
write: "创作",
|
|
8
|
-
read: "阅读",
|
|
9
|
-
think: "独处思考",
|
|
10
|
-
research: "探索",
|
|
11
|
-
};
|
|
12
|
-
const generic =
|
|
13
|
-
/^(?:留下了实际成果|玩过这一段,留下自己的感受|保存位置,下次接着做)$/;
|
|
14
|
-
|
|
15
|
-
// Events remain the audit trail. The library shows each saved outcome once,
|
|
16
|
-
// using its historical version rather than today's task or latest manuscript.
|
|
17
|
-
export function experiences(db, { limit = 40, offset = 0, q = "" } = {}) {
|
|
18
|
-
const rows = db
|
|
19
|
-
.prepare(
|
|
20
|
-
`
|
|
21
|
-
WITH drafts AS MATERIALIZED (
|
|
22
|
-
SELECT id,created,reason,json_extract(data,'$.workId') work_id,
|
|
23
|
-
json_extract(data,'$.version') version FROM mind_time_events WHERE kind='draft'
|
|
24
|
-
), linked AS (
|
|
25
|
-
SELECT e.*,t.activity,t.title task_title,w.id work_id,w.project_id,
|
|
26
|
-
p.title project_title,p.kind project_kind,v.version,v.title work_title,
|
|
27
|
-
v.summary,substr(v.content,1,300) excerpt,length(v.content) characters,
|
|
28
|
-
v.provenance,
|
|
29
|
-
(SELECT reason FROM drafts d WHERE d.work_id=w.id AND d.version=v.version
|
|
30
|
-
AND d.created<=e.created AND d.id<e.id
|
|
31
|
-
ORDER BY d.created DESC,d.id DESC LIMIT 1) saved_reason
|
|
32
|
-
FROM mind_time_events e
|
|
33
|
-
LEFT JOIN mind_time_tasks t ON t.id=e.task_id
|
|
34
|
-
LEFT JOIN mind_time_works w ON w.id=COALESCE(json_extract(e.data,'$.workId'),
|
|
35
|
-
(SELECT id FROM mind_time_works WHERE legacy_creation=json_extract(e.data,'$.creation')))
|
|
36
|
-
LEFT JOIN mind_time_projects p ON p.id=w.project_id
|
|
37
|
-
LEFT JOIN mind_time_versions v ON v.work_id=w.id AND v.created<=e.created
|
|
38
|
-
AND v.version=COALESCE(json_extract(e.data,'$.version'),
|
|
39
|
-
(SELECT version FROM drafts d WHERE d.work_id=w.id AND d.created<=e.created AND d.id<e.id
|
|
40
|
-
ORDER BY d.created DESC,d.id DESC LIMIT 1),
|
|
41
|
-
CASE WHEN w.legacy_creation IS NOT NULL THEN
|
|
42
|
-
(SELECT MAX(version) FROM mind_time_versions WHERE work_id=w.id AND created<=e.created) END)
|
|
43
|
-
WHERE e.kind IN ('reference-experience','done','checkpoint')
|
|
44
|
-
), grouped AS (
|
|
45
|
-
SELECT *,ROW_NUMBER() OVER (PARTITION BY
|
|
46
|
-
CASE WHEN version IS NOT NULL THEN work_id||':'||version ELSE 'event:'||id END
|
|
47
|
-
ORDER BY CASE kind WHEN 'reference-experience' THEN 3 WHEN 'done' THEN 2 ELSE 1 END DESC,
|
|
48
|
-
created DESC,id DESC) position,
|
|
49
|
-
MAX(kind='done') OVER (PARTITION BY
|
|
50
|
-
CASE WHEN version IS NOT NULL THEN work_id||':'||version ELSE 'event:'||id END) completed
|
|
51
|
-
FROM linked
|
|
52
|
-
)
|
|
53
|
-
SELECT * FROM grouped WHERE position=1
|
|
54
|
-
AND (COALESCE(work_title,'') LIKE ? OR COALESCE(task_title,'') LIKE ?
|
|
55
|
-
OR COALESCE(project_title,'') LIKE ? OR COALESCE(summary,'') LIKE ?)
|
|
56
|
-
ORDER BY created DESC,id DESC LIMIT ? OFFSET ?
|
|
57
|
-
`,
|
|
58
|
-
)
|
|
59
|
-
.all(
|
|
60
|
-
...Array(4).fill("%" + text(q, 80) + "%"),
|
|
61
|
-
Math.max(1, Math.min(100, Number(limit) || 40)),
|
|
62
|
-
Math.max(0, Number(offset) || 0),
|
|
63
|
-
);
|
|
64
|
-
const sources = db.prepare(
|
|
65
|
-
"SELECT id,title,kind,url FROM mind_time_sources WHERE id=?",
|
|
66
|
-
);
|
|
67
|
-
return rows.map((row) => {
|
|
68
|
-
const data = parse(row.data, {}),
|
|
69
|
-
provenance = parse(row.provenance, {});
|
|
70
|
-
const activity =
|
|
71
|
-
row.activity ||
|
|
72
|
-
row.project_kind ||
|
|
73
|
-
(row.kind === "reference-experience" ? "game" : "other");
|
|
74
|
-
const clean = (value) =>
|
|
75
|
-
activity === "game" ? gameText(value) : String(value || "").trim();
|
|
76
|
-
const title =
|
|
77
|
-
clean(row.work_title || row.task_title || row.project_title) ||
|
|
78
|
-
"这次活动的记录";
|
|
79
|
-
const summary = text(
|
|
80
|
-
clean(
|
|
81
|
-
row.summary ||
|
|
82
|
-
row.excerpt ||
|
|
83
|
-
(!generic.test(row.reason) ? row.reason : ""),
|
|
84
|
-
),
|
|
85
|
-
260,
|
|
86
|
-
);
|
|
87
|
-
const sourceIds = [
|
|
88
|
-
...new Set([
|
|
89
|
-
...(Array.isArray(data.sourceIds) ? data.sourceIds : []),
|
|
90
|
-
...(Array.isArray(provenance.sourceIds) ? provenance.sourceIds : []),
|
|
91
|
-
]),
|
|
92
|
-
];
|
|
93
|
-
return {
|
|
94
|
-
id: row.id,
|
|
95
|
-
created: row.created,
|
|
96
|
-
task_id: row.task_id,
|
|
97
|
-
kind: row.kind,
|
|
98
|
-
title,
|
|
99
|
-
summary,
|
|
100
|
-
activity,
|
|
101
|
-
label: labels[activity] || activityLabel(activity),
|
|
102
|
-
project: row.project_id
|
|
103
|
-
? { id: row.project_id, title: clean(row.project_title) }
|
|
104
|
-
: null,
|
|
105
|
-
work: row.version
|
|
106
|
-
? {
|
|
107
|
-
id: row.work_id,
|
|
108
|
-
version: row.version,
|
|
109
|
-
characters: row.characters,
|
|
110
|
-
state:
|
|
111
|
-
row.completed ||
|
|
112
|
-
row.kind === "reference-experience" ||
|
|
113
|
-
row.saved_reason === "保存完成稿"
|
|
114
|
-
? "complete"
|
|
115
|
-
: "draft",
|
|
116
|
-
}
|
|
117
|
-
: null,
|
|
118
|
-
materials: sourceIds.map((id) => sources.get(id)).filter(Boolean),
|
|
119
|
-
// Compatibility for older clients; never substitute a future manuscript.
|
|
120
|
-
reason: row.reason,
|
|
121
|
-
data: {
|
|
122
|
-
...data,
|
|
123
|
-
workId: row.version ? row.work_id : null,
|
|
124
|
-
version: row.version,
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
});
|
|
128
|
-
}
|
|
1
|
+
import { parse, text } from "../util.js";
|
|
2
|
+
import { gameText } from "./presentation.js";
|
|
3
|
+
import { activityLabel } from "./kinds.js";
|
|
4
|
+
|
|
5
|
+
const labels = {
|
|
6
|
+
game: "游玩",
|
|
7
|
+
write: "创作",
|
|
8
|
+
read: "阅读",
|
|
9
|
+
think: "独处思考",
|
|
10
|
+
research: "探索",
|
|
11
|
+
};
|
|
12
|
+
const generic =
|
|
13
|
+
/^(?:留下了实际成果|玩过这一段,留下自己的感受|保存位置,下次接着做)$/;
|
|
14
|
+
|
|
15
|
+
// Events remain the audit trail. The library shows each saved outcome once,
|
|
16
|
+
// using its historical version rather than today's task or latest manuscript.
|
|
17
|
+
export function experiences(db, { limit = 40, offset = 0, q = "" } = {}) {
|
|
18
|
+
const rows = db
|
|
19
|
+
.prepare(
|
|
20
|
+
`
|
|
21
|
+
WITH drafts AS MATERIALIZED (
|
|
22
|
+
SELECT id,created,reason,json_extract(data,'$.workId') work_id,
|
|
23
|
+
json_extract(data,'$.version') version FROM mind_time_events WHERE kind='draft'
|
|
24
|
+
), linked AS (
|
|
25
|
+
SELECT e.*,t.activity,t.title task_title,w.id work_id,w.project_id,
|
|
26
|
+
p.title project_title,p.kind project_kind,v.version,v.title work_title,
|
|
27
|
+
v.summary,substr(v.content,1,300) excerpt,length(v.content) characters,
|
|
28
|
+
v.provenance,
|
|
29
|
+
(SELECT reason FROM drafts d WHERE d.work_id=w.id AND d.version=v.version
|
|
30
|
+
AND d.created<=e.created AND d.id<e.id
|
|
31
|
+
ORDER BY d.created DESC,d.id DESC LIMIT 1) saved_reason
|
|
32
|
+
FROM mind_time_events e
|
|
33
|
+
LEFT JOIN mind_time_tasks t ON t.id=e.task_id
|
|
34
|
+
LEFT JOIN mind_time_works w ON w.id=COALESCE(json_extract(e.data,'$.workId'),
|
|
35
|
+
(SELECT id FROM mind_time_works WHERE legacy_creation=json_extract(e.data,'$.creation')))
|
|
36
|
+
LEFT JOIN mind_time_projects p ON p.id=w.project_id
|
|
37
|
+
LEFT JOIN mind_time_versions v ON v.work_id=w.id AND v.created<=e.created
|
|
38
|
+
AND v.version=COALESCE(json_extract(e.data,'$.version'),
|
|
39
|
+
(SELECT version FROM drafts d WHERE d.work_id=w.id AND d.created<=e.created AND d.id<e.id
|
|
40
|
+
ORDER BY d.created DESC,d.id DESC LIMIT 1),
|
|
41
|
+
CASE WHEN w.legacy_creation IS NOT NULL THEN
|
|
42
|
+
(SELECT MAX(version) FROM mind_time_versions WHERE work_id=w.id AND created<=e.created) END)
|
|
43
|
+
WHERE e.kind IN ('reference-experience','done','checkpoint')
|
|
44
|
+
), grouped AS (
|
|
45
|
+
SELECT *,ROW_NUMBER() OVER (PARTITION BY
|
|
46
|
+
CASE WHEN version IS NOT NULL THEN work_id||':'||version ELSE 'event:'||id END
|
|
47
|
+
ORDER BY CASE kind WHEN 'reference-experience' THEN 3 WHEN 'done' THEN 2 ELSE 1 END DESC,
|
|
48
|
+
created DESC,id DESC) position,
|
|
49
|
+
MAX(kind='done') OVER (PARTITION BY
|
|
50
|
+
CASE WHEN version IS NOT NULL THEN work_id||':'||version ELSE 'event:'||id END) completed
|
|
51
|
+
FROM linked
|
|
52
|
+
)
|
|
53
|
+
SELECT * FROM grouped WHERE position=1
|
|
54
|
+
AND (COALESCE(work_title,'') LIKE ? OR COALESCE(task_title,'') LIKE ?
|
|
55
|
+
OR COALESCE(project_title,'') LIKE ? OR COALESCE(summary,'') LIKE ?)
|
|
56
|
+
ORDER BY created DESC,id DESC LIMIT ? OFFSET ?
|
|
57
|
+
`,
|
|
58
|
+
)
|
|
59
|
+
.all(
|
|
60
|
+
...Array(4).fill("%" + text(q, 80) + "%"),
|
|
61
|
+
Math.max(1, Math.min(100, Number(limit) || 40)),
|
|
62
|
+
Math.max(0, Number(offset) || 0),
|
|
63
|
+
);
|
|
64
|
+
const sources = db.prepare(
|
|
65
|
+
"SELECT id,title,kind,url FROM mind_time_sources WHERE id=?",
|
|
66
|
+
);
|
|
67
|
+
return rows.map((row) => {
|
|
68
|
+
const data = parse(row.data, {}),
|
|
69
|
+
provenance = parse(row.provenance, {});
|
|
70
|
+
const activity =
|
|
71
|
+
row.activity ||
|
|
72
|
+
row.project_kind ||
|
|
73
|
+
(row.kind === "reference-experience" ? "game" : "other");
|
|
74
|
+
const clean = (value) =>
|
|
75
|
+
activity === "game" ? gameText(value) : String(value || "").trim();
|
|
76
|
+
const title =
|
|
77
|
+
clean(row.work_title || row.task_title || row.project_title) ||
|
|
78
|
+
"这次活动的记录";
|
|
79
|
+
const summary = text(
|
|
80
|
+
clean(
|
|
81
|
+
row.summary ||
|
|
82
|
+
row.excerpt ||
|
|
83
|
+
(!generic.test(row.reason) ? row.reason : ""),
|
|
84
|
+
),
|
|
85
|
+
260,
|
|
86
|
+
);
|
|
87
|
+
const sourceIds = [
|
|
88
|
+
...new Set([
|
|
89
|
+
...(Array.isArray(data.sourceIds) ? data.sourceIds : []),
|
|
90
|
+
...(Array.isArray(provenance.sourceIds) ? provenance.sourceIds : []),
|
|
91
|
+
]),
|
|
92
|
+
];
|
|
93
|
+
return {
|
|
94
|
+
id: row.id,
|
|
95
|
+
created: row.created,
|
|
96
|
+
task_id: row.task_id,
|
|
97
|
+
kind: row.kind,
|
|
98
|
+
title,
|
|
99
|
+
summary,
|
|
100
|
+
activity,
|
|
101
|
+
label: labels[activity] || activityLabel(activity),
|
|
102
|
+
project: row.project_id
|
|
103
|
+
? { id: row.project_id, title: clean(row.project_title) }
|
|
104
|
+
: null,
|
|
105
|
+
work: row.version
|
|
106
|
+
? {
|
|
107
|
+
id: row.work_id,
|
|
108
|
+
version: row.version,
|
|
109
|
+
characters: row.characters,
|
|
110
|
+
state:
|
|
111
|
+
row.completed ||
|
|
112
|
+
row.kind === "reference-experience" ||
|
|
113
|
+
row.saved_reason === "保存完成稿"
|
|
114
|
+
? "complete"
|
|
115
|
+
: "draft",
|
|
116
|
+
}
|
|
117
|
+
: null,
|
|
118
|
+
materials: sourceIds.map((id) => sources.get(id)).filter(Boolean),
|
|
119
|
+
// Compatibility for older clients; never substitute a future manuscript.
|
|
120
|
+
reason: row.reason,
|
|
121
|
+
data: {
|
|
122
|
+
...data,
|
|
123
|
+
workId: row.version ? row.work_id : null,
|
|
124
|
+
version: row.version,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
}
|