cortico-world-fun 0.3.0 → 0.7.5
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/CHANGELOG.md +571 -404
- package/PUBLISHING.md +37 -85
- package/README.md +199 -47
- package/assets/home/chibi-cards.webp +0 -0
- package/assets/home/chibi-chatting.webp +0 -0
- package/assets/home/chibi-cooking.webp +0 -0
- package/assets/home/chibi-gaming.webp +0 -0
- package/assets/home/chibi-idle.webp +0 -0
- package/assets/home/chibi-looking_outside.webp +0 -0
- package/assets/home/chibi-painting.webp +0 -0
- package/assets/home/chibi-reading.webp +0 -0
- package/assets/home/chibi-sleeping.webp +0 -0
- package/assets/home/chibi-watching.webp +0 -0
- package/assets/icon.png +0 -0
- package/describe.json +365 -48
- package/dist/webui.js +7515 -848
- package/package.json +16 -10
- package/src/ENV_PROMPT.md +11 -10
- package/src/bridge-echo-solo.json +137 -0
- package/src/config.js +356 -176
- package/src/creek-letter.js +3 -0
- package/src/definition.js +121 -106
- package/src/exploration.js +2 -2
- package/src/home-room.js +895 -0
- package/src/journeys.js +1 -1
- package/src/phases.js +5 -10
- package/src/place-cover.js +176 -0
- package/src/place-library.js +794 -0
- package/src/place-transfer.js +162 -0
- package/src/state.js +717 -596
- package/src/story-canon.js +21 -0
- package/src/story-dm.js +140 -0
- package/src/story-examples.js +597 -78
- package/src/story-free.js +298 -0
- package/src/story-images.js +474 -0
- package/src/story-library.js +187 -20
- package/src/story-node-limit.js +55 -0
- package/src/story-packs.js +333 -16
- package/src/story-panel.js +314 -0
- package/src/story-read.js +113 -0
- package/src/story-reliability.js +95 -0
- package/src/story-secrets.js +485 -0
- package/src/story-venue-migration.js +113 -0
- package/src/swapped-plaque-riddle.json +167 -0
- package/src/time.js +16 -0
- package/src/user-venues.js +44 -15
- package/src/venues.js +93 -9
- package/src/world.js +3690 -1847
- package/dist/artwork.js +0 -64
- package/dist/stories.js +0 -395
package/src/definition.js
CHANGED
|
@@ -1,106 +1,121 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WorldDefinition:默认配置、实例工厂和自描述。
|
|
3
|
-
* create() 必须保持纯:不读状态文件、不建目录、不启动定时器。
|
|
4
|
-
*/
|
|
5
|
-
import { DEFAULTS, ID, LABEL } from './config.js';
|
|
6
|
-
import { FUN_TOOL_DECLS, FunWorld } from './world.js';
|
|
7
|
-
|
|
8
|
-
/** 自描述里每个工具配一句给人看的话,按工具名。 */
|
|
9
|
-
const TOOL_SUMMARIES = {
|
|
10
|
-
fun_places: {
|
|
11
|
-
zh: '查询当前地点,按营业状态和拥挤度排序;可筛选或列出全部。',
|
|
12
|
-
en: 'Query available places ranked by opening hours and crowd; filter by kind or list all.',
|
|
13
|
-
},
|
|
14
|
-
fun_go: {
|
|
15
|
-
zh: '进门开始行程,返回当前时段描写和可逛项目。',
|
|
16
|
-
en: 'Start a trip and return the current-time description and available areas.',
|
|
17
|
-
},
|
|
18
|
-
fun_choice: {
|
|
19
|
-
zh: '处理待选择事件,可按回执选择或略过。',
|
|
20
|
-
en: 'Resolve or skip a pending event choice.',
|
|
21
|
-
},
|
|
22
|
-
fun_resume: {
|
|
23
|
-
zh: '继续一趟未逛完的行程。',
|
|
24
|
-
en: 'Resume an unfinished outing.',
|
|
25
|
-
},
|
|
26
|
-
fun_wander: {
|
|
27
|
-
zh: '逛一个项目,可记录本次购买、拍照或吃喝;待选择事件按回执处理。',
|
|
28
|
-
en: 'Wander one spot and optionally record a purchase, photo or food; resolve pending choices from the receipt.',
|
|
29
|
-
},
|
|
30
|
-
fun_home: {
|
|
31
|
-
zh: '结束行程并返回本次摘要与记录提示。',
|
|
32
|
-
en: 'End the trip and return its summary and logging prompt.',
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
zh: '
|
|
36
|
-
en: '
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
zh: '
|
|
40
|
-
en: '
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
zh: '
|
|
44
|
-
en: '
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
zh: '
|
|
48
|
-
en: '
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
zh: '
|
|
52
|
-
en: '
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
zh: '
|
|
56
|
-
en: '
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
zh: '
|
|
60
|
-
en: '
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
zh: '
|
|
64
|
-
en: '
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
1
|
+
/**
|
|
2
|
+
* WorldDefinition:默认配置、实例工厂和自描述。
|
|
3
|
+
* create() 必须保持纯:不读状态文件、不建目录、不启动定时器。
|
|
4
|
+
*/
|
|
5
|
+
import { DEFAULTS, ID, LABEL } from './config.js';
|
|
6
|
+
import { FUN_TOOL_DECLS, FunWorld } from './world.js';
|
|
7
|
+
|
|
8
|
+
/** 自描述里每个工具配一句给人看的话,按工具名。 */
|
|
9
|
+
const TOOL_SUMMARIES = {
|
|
10
|
+
fun_places: {
|
|
11
|
+
zh: '查询当前地点,按营业状态和拥挤度排序;可筛选或列出全部。',
|
|
12
|
+
en: 'Query available places ranked by opening hours and crowd; filter by kind or list all.',
|
|
13
|
+
},
|
|
14
|
+
fun_go: {
|
|
15
|
+
zh: '进门开始行程,返回当前时段描写和可逛项目。',
|
|
16
|
+
en: 'Start a trip and return the current-time description and available areas.',
|
|
17
|
+
},
|
|
18
|
+
fun_choice: {
|
|
19
|
+
zh: '处理待选择事件,可按回执选择或略过。',
|
|
20
|
+
en: 'Resolve or skip a pending event choice.',
|
|
21
|
+
},
|
|
22
|
+
fun_resume: {
|
|
23
|
+
zh: '继续一趟未逛完的行程。',
|
|
24
|
+
en: 'Resume an unfinished outing.',
|
|
25
|
+
},
|
|
26
|
+
fun_wander: {
|
|
27
|
+
zh: '逛一个项目,可记录本次购买、拍照或吃喝;待选择事件按回执处理。',
|
|
28
|
+
en: 'Wander one spot and optionally record a purchase, photo or food; resolve pending choices from the receipt.',
|
|
29
|
+
},
|
|
30
|
+
fun_home: {
|
|
31
|
+
zh: '结束行程并返回本次摘要与记录提示。',
|
|
32
|
+
en: 'End the trip and return its summary and logging prompt.',
|
|
33
|
+
},
|
|
34
|
+
fun_home_state: {
|
|
35
|
+
zh: '只读查看房间状态与可复制的「待记一条」;不含图片,不写盘。',
|
|
36
|
+
en: 'Read the room state and a copyable "one line to log"; no images, no writes.',
|
|
37
|
+
},
|
|
38
|
+
fun_home_activity: {
|
|
39
|
+
zh: '切换她在家的十个固定活动之一,可附备注;revision 冲突不自动重试。',
|
|
40
|
+
en: 'Switch one of her ten fixed home activities, optionally with a note; no retry on revision conflicts.',
|
|
41
|
+
},
|
|
42
|
+
fun_start: {
|
|
43
|
+
zh: '查看当前推荐地点;详细筛选用 fun_places。',
|
|
44
|
+
en: 'Show current place recommendations; use fun_places for filters.',
|
|
45
|
+
},
|
|
46
|
+
fun_route: {
|
|
47
|
+
zh: '规划和管理最多两站的出门路线,明确前往下一站或提前结束。',
|
|
48
|
+
en: 'Plan and manage a two-stop outing, explicitly move on or end early.',
|
|
49
|
+
},
|
|
50
|
+
fun_view: {
|
|
51
|
+
zh: '查看正在逛、未逛完或已回家的行程。',
|
|
52
|
+
en: 'View active, unfinished, or finished outings.',
|
|
53
|
+
},
|
|
54
|
+
fun_wishes: {
|
|
55
|
+
zh: '查看明确记下的出游心愿和状态,不催促。',
|
|
56
|
+
en: 'View outing wishes and their status without reminders.',
|
|
57
|
+
},
|
|
58
|
+
fun_wish: {
|
|
59
|
+
zh: '记录、暂缓、恢复或取消一个出游心愿。',
|
|
60
|
+
en: 'Add, pause, resume or cancel an outing wish.',
|
|
61
|
+
},
|
|
62
|
+
fun_keepsake: {
|
|
63
|
+
zh: '珍藏或取消珍藏一趟行程,不影响纪念册近期列表和长期收藏。',
|
|
64
|
+
en: 'Keep or unkeep a trip without changing the recent trip book or permanent collection.',
|
|
65
|
+
},
|
|
66
|
+
fun_story: {
|
|
67
|
+
zh: '管理、校验与预览本地故事工坊,支持自填地点。',
|
|
68
|
+
en: 'Manage, validate, and preview local story packs, including custom places.',
|
|
69
|
+
},
|
|
70
|
+
fun_shelf: {
|
|
71
|
+
zh: '按地点查询长期纪念品收藏和收集进度。',
|
|
72
|
+
en: 'Query long-term souvenirs and collection progress by place.',
|
|
73
|
+
},
|
|
74
|
+
fun_story_places: { zh: '查询地点索引或单个地点详情,只读,不开始出游;JSON 回执经标准 text 返回。', en: 'Read the place index or one place detail; does not start an outing. JSON is returned in standard text.' },
|
|
75
|
+
fun_story_candidates: { zh: '查询故事候选和公开简介,不返回未来分支;JSON 回执经标准 text 返回。', en: 'Read story candidates and public synopses without future branches. JSON is returned in standard text.' },
|
|
76
|
+
fun_story_detail: { zh: '查询单个故事的公开资料与可用原因,不返回节点内容;JSON 回执经标准 text 返回。', en: 'Read one story’s public metadata and availability without node contents. JSON is returned in standard text.' },
|
|
77
|
+
fun_story_current: { zh: '查询当前故事的状态和已发生内容,不推进故事;JSON 回执经标准 text 返回。', en: 'Read current story state and actual events without advancing it. JSON is returned in standard text.' },
|
|
78
|
+
fun_story_recap: { zh: '查询已保存故事的事实回顾,不写入日程或长期记忆;JSON 回执经标准 text 返回。', en: 'Read an actual story recap without writing a schedule or long-term memory. JSON is returned in standard text.' },
|
|
79
|
+
fun_story_schedule: { zh: '生成可复制的故事候选短文本;复制不写日程;JSON 回执经标准 text 返回。', en: 'Create copyable story-candidate text; copying does not write a schedule. JSON is returned in standard text.' },
|
|
80
|
+
fun_story_start: { zh: '在文字通道里开始一段故事(需开启文字通道开关),开始前重新校验条件;JSON 回执经标准 text 返回。', en: 'Start a story from a text channel (requires the text switch), rechecking conditions. JSON is returned in standard text.' },
|
|
81
|
+
fun_story_act: { zh: '在文字通道里推进当前故事:选项式先给待确认提议,自由模式每句推进一回合;JSON 回执经标准 text 返回。', en: 'Advance the current story from a text channel: option packs return a proposal, free packs advance one turn per line. JSON is returned in standard text.' },
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
function describeTools(decls) {
|
|
85
|
+
return decls.map(({ name, description, parameters, tags }) => ({
|
|
86
|
+
name,
|
|
87
|
+
description,
|
|
88
|
+
parameters,
|
|
89
|
+
tags,
|
|
90
|
+
summary: TOOL_SUMMARIES[name],
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const funDefinition = {
|
|
95
|
+
id: ID,
|
|
96
|
+
label: LABEL,
|
|
97
|
+
/** `worlds.fun` 段的默认值;启用与否由部署决定,定义里恒为 false。 */
|
|
98
|
+
defaults: () => structuredClone(DEFAULTS),
|
|
99
|
+
preflight: () => {
|
|
100
|
+
if (typeof structuredClone !== 'function') throw new Error('从0开始的肥鱼大冒险需要 Node 22+ 的 structuredClone。');
|
|
101
|
+
},
|
|
102
|
+
create: (ctx) => new FunWorld({
|
|
103
|
+
cfg: ctx.cfg,
|
|
104
|
+
dataDir: ctx.dataDir,
|
|
105
|
+
timezone: ctx.timezone,
|
|
106
|
+
// 补齐配置段用:宿主的 /api/config 读的是落盘的 worlds.fun(不做默认值合并)。
|
|
107
|
+
persist: typeof ctx.persist === 'function' ? (patch) => ctx.persist(patch) : null,
|
|
108
|
+
}),
|
|
109
|
+
/**
|
|
110
|
+
* 自描述:可能出现的全部工具与事件,不进提示词。
|
|
111
|
+
*
|
|
112
|
+
* 不再声明 `fun.home.free`:自己出门的许可跟着「鱼的每一天」的「她自己的时间」走,
|
|
113
|
+
* 本 World 不注册自己的叫醒、也不推这条 internal 事件。许可本身只在提示词里。
|
|
114
|
+
*/
|
|
115
|
+
describe: {
|
|
116
|
+
tools: describeTools(FUN_TOOL_DECLS),
|
|
117
|
+
events: [],
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default funDefinition;
|
package/src/exploration.js
CHANGED
|
@@ -188,7 +188,7 @@ function retainedTrips(input) {
|
|
|
188
188
|
const seen = new Set();
|
|
189
189
|
const out = [];
|
|
190
190
|
for (const trip of rows) {
|
|
191
|
-
if (!trip || typeof trip !== 'object' || Array.isArray(trip)) continue;
|
|
191
|
+
if (!trip || typeof trip !== 'object' || Array.isArray(trip) || trip.storyRun?.canonical === false) continue;
|
|
192
192
|
const placeId = text(trip.placeId, 40);
|
|
193
193
|
const id = tripId(trip);
|
|
194
194
|
if (!placeId || !id || seen.has(id)) continue;
|
|
@@ -234,7 +234,7 @@ export function normalizeExploration(raw, trips = [], timezone = 'Asia/Shanghai'
|
|
|
234
234
|
/** Add one completed trip to a ledger without mutating either input. */
|
|
235
235
|
export function recordExploration(ledger, trip, timezone = 'Asia/Shanghai') {
|
|
236
236
|
const map = normalizedRawLedger(ledger);
|
|
237
|
-
if (!trip || typeof trip !== 'object' || Array.isArray(trip)) return serialize(map);
|
|
237
|
+
if (!trip || typeof trip !== 'object' || Array.isArray(trip) || trip.storyRun?.canonical === false) return serialize(map);
|
|
238
238
|
const placeId = text(trip.placeId, 40);
|
|
239
239
|
const id = tripId(trip);
|
|
240
240
|
if (!placeId || !id) return serialize(map);
|