@musnows/scriverse 0.2.0 → 0.3.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 +13 -4
- package/README.md +13 -4
- package/dist/ai.js +3374 -0
- package/dist/ai.js.map +1 -0
- package/dist/app.js +1046 -0
- package/dist/app.js.map +1 -0
- package/dist/cli-core.js +147 -20
- package/dist/cli-core.js.map +1 -1
- package/dist/credential-vault.js +40 -0
- package/dist/credential-vault.js.map +1 -0
- package/dist/database.js +1122 -0
- package/dist/database.js.map +1 -0
- package/dist/docx-security.js +184 -0
- package/dist/docx-security.js.map +1 -0
- package/dist/domain.js +21 -0
- package/dist/domain.js.map +1 -0
- package/dist/errors.js +16 -0
- package/dist/errors.js.map +1 -0
- package/dist/image-captcha.js +173 -0
- package/dist/image-captcha.js.map +1 -0
- package/dist/image-metadata.js +128 -0
- package/dist/image-metadata.js.map +1 -0
- package/dist/import-security.js +46 -0
- package/dist/import-security.js.map +1 -0
- package/dist/parser.js +223 -0
- package/dist/parser.js.map +1 -0
- package/dist/public/ai-context-meter.js +10 -0
- package/dist/public/ai-conversation.js +3 -0
- package/dist/public/ai-mentions.js +55 -0
- package/dist/public/ai-message-actions.js +27 -0
- package/dist/public/ai-message-meta.js +15 -0
- package/dist/public/ai-message-time.js +23 -0
- package/dist/public/ai-prompt-keyboard.js +3 -0
- package/dist/public/app.js +4255 -0
- package/dist/public/character-profile.d.ts +9 -0
- package/dist/public/character-profile.js +65 -0
- package/dist/public/character-version.d.ts +2 -0
- package/dist/public/character-version.js +31 -0
- package/dist/public/entity-version.js +34 -0
- package/dist/public/icon.svg +10 -0
- package/dist/public/index.html +547 -0
- package/dist/public/line-number-layout.js +15 -0
- package/dist/public/markdown.js +199 -0
- package/dist/public/model-config.d.ts +17 -0
- package/dist/public/model-config.js +57 -0
- package/dist/public/page-route.d.ts +11 -0
- package/dist/public/page-route.js +81 -0
- package/dist/public/relationship-graph.js +2017 -0
- package/dist/public/site.webmanifest +17 -0
- package/dist/public/styles.css +1399 -0
- package/dist/public/text-formatting.d.ts +2 -0
- package/dist/public/text-formatting.js +20 -0
- package/dist/public/theme-init.js +8 -0
- package/dist/public/theme.js +13 -0
- package/dist/public/whitespace-visualization.js +20 -0
- package/dist/request-context.js +9 -0
- package/dist/request-context.js.map +1 -0
- package/dist/security.js +235 -0
- package/dist/security.js.map +1 -0
- package/dist/server-runtime.js +77 -0
- package/dist/server-runtime.js.map +1 -0
- package/dist/server.js +15 -0
- package/dist/server.js.map +1 -0
- package/dist/store.js +2492 -0
- package/dist/store.js.map +1 -0
- package/dist/user-auth.js +489 -0
- package/dist/user-auth.js.map +1 -0
- package/dist/utils.js +50 -0
- package/dist/utils.js.map +1 -0
- package/package.json +4 -9
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type CharacterDetail = { label: string; value: string };
|
|
2
|
+
export type CharacterSection = { title: string; content: string };
|
|
3
|
+
|
|
4
|
+
export function normalizeCharacterDetails(value: unknown): CharacterDetail[];
|
|
5
|
+
export function normalizeCharacterSections(value: unknown): CharacterSection[];
|
|
6
|
+
export function buildCharacterDetails(labels: unknown[], values: unknown[]): CharacterDetail[];
|
|
7
|
+
export function buildCharacterSections(titles: unknown[], contents: unknown[]): CharacterSection[];
|
|
8
|
+
export function characterStateEntries(value: unknown): CharacterDetail[];
|
|
9
|
+
export function buildCharacterState(labels: unknown[], values: unknown[], previous?: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
function text(value) {
|
|
2
|
+
return typeof value === "string" ? value.trim() : "";
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function normalizeCharacterDetails(value) {
|
|
6
|
+
if (!Array.isArray(value)) return [];
|
|
7
|
+
return value.map((item) => ({
|
|
8
|
+
label: text(item?.label),
|
|
9
|
+
value: text(item?.value)
|
|
10
|
+
})).filter((item) => item.label && item.value);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function normalizeCharacterSections(value) {
|
|
14
|
+
if (!Array.isArray(value)) return [];
|
|
15
|
+
return value.map((item) => ({
|
|
16
|
+
title: text(item?.title),
|
|
17
|
+
content: text(item?.content)
|
|
18
|
+
})).filter((item) => item.title && item.content);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function buildCharacterDetails(labels, values) {
|
|
22
|
+
const size = Math.max(labels.length, values.length);
|
|
23
|
+
return normalizeCharacterDetails(Array.from({ length: size }, (_, index) => ({
|
|
24
|
+
label: labels[index],
|
|
25
|
+
value: values[index]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function buildCharacterSections(titles, contents) {
|
|
30
|
+
const size = Math.max(titles.length, contents.length);
|
|
31
|
+
return normalizeCharacterSections(Array.from({ length: size }, (_, index) => ({
|
|
32
|
+
title: titles[index],
|
|
33
|
+
content: contents[index]
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function stateDisplayValue(value) {
|
|
38
|
+
if (typeof value === "string") return value;
|
|
39
|
+
if (value === undefined || value === null) return "";
|
|
40
|
+
try {
|
|
41
|
+
return JSON.stringify(value);
|
|
42
|
+
} catch {
|
|
43
|
+
return String(value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function characterStateEntries(value) {
|
|
48
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return [];
|
|
49
|
+
return Object.entries(value).map(([label, item]) => ({ label, value: stateDisplayValue(item) }));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function buildCharacterState(labels, values, previous = {}) {
|
|
53
|
+
const forbidden = new Set(["__proto__", "constructor", "prototype"]);
|
|
54
|
+
const state = Object.create(null);
|
|
55
|
+
const size = Math.max(labels.length, values.length);
|
|
56
|
+
for (let index = 0; index < size; index += 1) {
|
|
57
|
+
const label = text(labels[index]);
|
|
58
|
+
const value = text(values[index]);
|
|
59
|
+
if (!label || !value || forbidden.has(label)) continue;
|
|
60
|
+
state[label] = Object.prototype.hasOwnProperty.call(previous, label) && stateDisplayValue(previous[label]) === value
|
|
61
|
+
? previous[label]
|
|
62
|
+
: value;
|
|
63
|
+
}
|
|
64
|
+
return state;
|
|
65
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const fieldLabels = Object.freeze({
|
|
2
|
+
name: "标准名",
|
|
3
|
+
aliases: "别名",
|
|
4
|
+
raceId: "种族",
|
|
5
|
+
species: "种族",
|
|
6
|
+
organizationIds: "所属组织",
|
|
7
|
+
attributes: "身份与扩展属性",
|
|
8
|
+
profile: "人物档案与设定章节",
|
|
9
|
+
currentState: "当前状态",
|
|
10
|
+
lockedFields: "锁定字段",
|
|
11
|
+
visibility: "可见范围",
|
|
12
|
+
firstChapterId: "首次登场章节"
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export function describeCharacterVersionChanges(snapshot, previousSnapshot) {
|
|
16
|
+
if (!previousSnapshot) return ["建立人物档案"];
|
|
17
|
+
return [...new Set(Object.entries(fieldLabels).filter(([key]) => (
|
|
18
|
+
JSON.stringify(snapshot?.[key] ?? null) !== JSON.stringify(previousSnapshot?.[key] ?? null)
|
|
19
|
+
)).map(([, label]) => label))];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function characterVersionSourceLabel(source) {
|
|
23
|
+
return ({
|
|
24
|
+
create: "创建",
|
|
25
|
+
manual: "手动保存",
|
|
26
|
+
restore: "历史回滚",
|
|
27
|
+
race: "种族变更",
|
|
28
|
+
organization: "组织变更",
|
|
29
|
+
migration: "历史基线"
|
|
30
|
+
})[String(source)] ?? String(source || "未知来源");
|
|
31
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const VERSIONED_ENTITY_LABELS = Object.freeze({
|
|
2
|
+
setting: "世界观设定",
|
|
3
|
+
race: "种族档案",
|
|
4
|
+
organization: "组织档案",
|
|
5
|
+
"timeline-track": "独立时间轴",
|
|
6
|
+
"timeline-event": "时间事件",
|
|
7
|
+
relationship: "人物关系",
|
|
8
|
+
"chapter-outline": "章节大纲",
|
|
9
|
+
foreshadow: "伏笔"
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export function entityVersionSourceLabel(source) {
|
|
13
|
+
return ({
|
|
14
|
+
create: "初始版本",
|
|
15
|
+
manual: "人工编辑",
|
|
16
|
+
migration: "迁移基线",
|
|
17
|
+
restore: "历史回滚",
|
|
18
|
+
analysis: "AI 分析",
|
|
19
|
+
merge: "事件合并",
|
|
20
|
+
split: "事件拆分"
|
|
21
|
+
})[source] ?? source;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function entityVersionSnapshotSummary(type, snapshot = {}) {
|
|
25
|
+
if (type === "setting") return `${snapshot.category || "未分类"} · ${snapshot.title || "未命名设定"}`;
|
|
26
|
+
if (type === "race") return `${snapshot.name || "未命名种族"} · ${(snapshot.memberIds ?? []).length} 位角色`;
|
|
27
|
+
if (type === "organization") return `${snapshot.name || "未命名组织"} · ${(snapshot.memberIds ?? []).length} 位成员`;
|
|
28
|
+
if (type === "timeline-track") return `${snapshot.name || "未命名时间轴"} · 排序 ${snapshot.sortOrder ?? 0}`;
|
|
29
|
+
if (type === "timeline-event") return `${snapshot.timeLabel || "时间待定"} · ${snapshot.name || "未命名事件"}`;
|
|
30
|
+
if (type === "relationship") return `${snapshot.category || "未分类"} / ${snapshot.subtype || "未细分"} · ${Math.round(Number(snapshot.confidence ?? 0) * 100)}%`;
|
|
31
|
+
if (type === "chapter-outline") return `目标:${snapshot.goal || "未填写"}`;
|
|
32
|
+
if (type === "foreshadow") return `${snapshot.importance || "medium"} · ${snapshot.title || "未命名伏笔"}`;
|
|
33
|
+
return "历史快照";
|
|
34
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-labelledby="title description">
|
|
2
|
+
<title id="title">叙界</title>
|
|
3
|
+
<desc id="description">一本展开的书与一颗星,代表小说创作与灵感</desc>
|
|
4
|
+
<rect width="64" height="64" rx="14" fill="#8b3d2c"/>
|
|
5
|
+
<path d="M10 16.5c8.7-1.6 15.7.4 21 6v29c-5.4-4.8-12.4-6.5-21-5.1V16.5Z" fill="#fffaf0"/>
|
|
6
|
+
<path d="M54 16.5c-8.7-1.6-15.7.4-21 6v29c5.4-4.8 12.4-6.5 21-5.1V16.5Z" fill="#fffaf0"/>
|
|
7
|
+
<path d="M31 22.5h2V52h-2z" fill="#d9b070"/>
|
|
8
|
+
<path d="m48 9.5 1.7 4.1 4.3 1.7-4.3 1.7-1.7 4.1-1.7-4.1-4.3-1.7 4.3-1.7L48 9.5Z" fill="#f2cb7b"/>
|
|
9
|
+
<path d="M15.5 25.5c4.2-.3 7.8.6 10.8 2.7M15.5 32c4.2-.3 7.8.6 10.8 2.7M48.5 25.5c-4.2-.3-7.8.6-10.8 2.7M48.5 32c-4.2-.3-7.8.6-10.8 2.7" fill="none" stroke="#c78a78" stroke-linecap="round" stroke-width="2"/>
|
|
10
|
+
</svg>
|