cortico-world-feast 0.7.3 → 0.7.4
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 +28 -0
- package/GUIDE.md +25 -6
- package/PUBLISHING.md +13 -13
- package/README.md +26 -6
- package/describe.json +2 -2
- package/dist/webui.js +1 -1
- package/package.json +7 -7
- package/src/ENV_PROMPT.md +2 -2
- package/src/config.js +29 -16
- package/src/definition.js +1 -1
- package/src/dishes.js +3 -3
- package/src/life/free.js +3 -3
- package/src/life/funlink.js +106 -0
- package/src/life/index.js +1 -0
- package/src/life/inject.js +1 -1
- package/src/life/plan.js +2 -2
- package/src/life/store.js +1 -1
- package/src/life/time.js +1 -1
- package/src/state.js +1 -1
- package/src/weather.js +1 -1
- package/src/world.js +93 -48
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## 0.7.4
|
|
4
|
+
|
|
5
|
+
**改名「鱼的每一天」,外加和「娱乐时间」的联动**
|
|
6
|
+
|
|
7
|
+
一个是换了牌子,一个是接上了隔壁的娱乐插件:现在她会真的出门逛,玩完了回来记进自己的一天。
|
|
8
|
+
|
|
9
|
+
**改名:食时 → 鱼的每一天**
|
|
10
|
+
|
|
11
|
+
名字再换一次。上一版「食时」两个字里"吃"和"时间"都在,可它从 0.7.0 起管的早就不是一顿饭,是她自己写明天、到点过自己的时间、做完记一笔的整整一天。太文雅的名字没人看,干脆叫**鱼的每一天**——直白、口语,把她这一整天摆到台面上。换的还是牌子:显示名(`鱼的每一天` / `Fish Every Day`)、事件标题(`【鱼的每一天 · …】`)、日志前缀、配置卡标题、文档标题、市场简介;**包名 `cortico-world-feast`、world id `feast`、事件类型、配置键一律没动**,装过的不受影响、不用重装。散文里当普通名词用的"一桌菜"照旧留着。
|
|
12
|
+
|
|
13
|
+
**和「娱乐时间」(`cortico-world-fun`)联动**
|
|
14
|
+
|
|
15
|
+
装了她也不再是「有地方可去、但从没真的去成」:叫醒她过自己的时间时,例子里会多一行
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
- 出门去逛逛:fun_places 看今天能去哪 → fun_go 进门 → fun_wander 逛一处 → fun_home 收摊
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
她照着走,进门、一处一处逛、买纪念品拍照、收摊,收摊回执再把这一趟收成一句话,回来 `feast_life_play` 记一笔——她的一天里就真有了这一天。
|
|
22
|
+
|
|
23
|
+
- **自动检测,不用配路径。** 读 `<数据目录>/../config.json` 的 `worlds.fun.enabled`,**只读这一个字段**——不调娱乐时间的工具、不读它的状态和日程(读配置文件不算 World 间依赖,和 0.7.1 读 imggen `libraryRoot` 同一套)。
|
|
24
|
+
- **没装、或停用,那一行整段不出现。** 绝不让她看到指向不存在工具的例子;`config.json` 读到一半(Coo 整份重写中)会等 200ms 重读一次再判,不误判成「没装」。
|
|
25
|
+
- **你手抄过就不重复加。** 判据是「这一行提到 `fun_` 开头的工具」,所以你自己把「出门逛逛」写进 `lifeFreeMenu` 也不会变成两条。
|
|
26
|
+
- **新配置 1 项**:`lifeFreeFunOn`(「出门逛逛那一行」,默认开)。关掉=不自动加,你手写的内容照旧。归在「她自己的时间」卡里,配置卡还是 6 张。
|
|
27
|
+
- **只追加,从不改写**你原有的任何一条例子。
|
|
28
|
+
|
|
29
|
+
**测试** 323 → **337**(新增 `test/funlink.test.mjs` 14 条:装了才加 / 没装不加 / 停用不加 / 开关关掉不加 / 手抄过不重复 / `feast_life_start` 同一条路径 / config 缺失与坏 JSON 都不抛错)。
|
|
30
|
+
|
|
3
31
|
## 0.7.3
|
|
4
32
|
|
|
5
33
|
**让她知道外面现在什么天气,外加把两个漏发的提交和菜品体检一起收掉**
|
package/GUIDE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 鱼的每一天 · 使用指南
|
|
2
2
|
|
|
3
3
|
> 这份是**给你(主人)看的**:在 Coo 里怎么用它、每一步会发生什么。
|
|
4
4
|
>
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
## 0. 三分钟上手
|
|
12
12
|
|
|
13
|
-
1. 装(或从市场装)→ **完全退出 Coo 再重启** →
|
|
14
|
-
2.
|
|
13
|
+
1. 装(或从市场装)→ **完全退出 Coo 再重启** → 「世界」里启用「鱼的每一天」。
|
|
14
|
+
2. 打开「鱼的每一天」世界页签,默认落在**菜单**面板。
|
|
15
15
|
3. 随便点一道菜(比如麻婆豆腐)→ 翻到它的味道档案 → 按 **「端给她」**。
|
|
16
16
|
4. 她会收到一条内部消息(不是你发的聊天),然后用 `feast_eat` 真的吃一口,回来跟你说她尝到了什么。
|
|
17
17
|
|
|
@@ -190,10 +190,10 @@
|
|
|
190
190
|
|
|
191
191
|
**面板上也能替她开口**:「现在就想动」= 让她不用等下一档;「今天先别叫了」= 今天剩下的档不催(她随时还是能自己动)。
|
|
192
192
|
|
|
193
|
-
**菜单可以换成真的工具。** 默认只给通用说法(「出去转转」「找个视频看一会儿」),因为一个扩展不该依赖另一个扩展。想让她真去刷 B
|
|
193
|
+
**菜单可以换成真的工具。** 默认只给通用说法(「出去转转」「找个视频看一会儿」),因为一个扩展不该依赖另一个扩展。想让她真去刷 B 站、逛客厅、发动态,把 `lifeFreeMenu` 改掉:
|
|
194
194
|
|
|
195
195
|
```
|
|
196
|
-
-
|
|
196
|
+
- 去客厅坐坐(parlor_query {op:"rooms"} 看有哪些客厅 → parlor_room {op:"visit"} 进一间,有人说话用 parlor_message {scope:"room"} 回一句)
|
|
197
197
|
- 发一条空间动态(qq_qzone action=post)
|
|
198
198
|
- 去 B 站看个视频(bvp_watch_now mode="text")
|
|
199
199
|
```
|
|
@@ -202,6 +202,24 @@
|
|
|
202
202
|
|
|
203
203
|
> 这些是**别的扩展**的工具。它们没装的话,她照菜单去做会失败——所以默认才不写死,让你按自己实际装了什么来填。
|
|
204
204
|
|
|
205
|
+
### 唯一一处例外:娱乐时间(0.7.4)
|
|
206
|
+
|
|
207
|
+
「娱乐时间」(`cortico-world-fun`)是唯一一个**自动**接进例子里的:装了它并且启用着,叫醒时会多一行
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
- 出门去逛逛:fun_places 看今天能去哪 → fun_go 进门 → fun_wander 逛一处 → fun_home 收摊
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
她就能真的去逛游乐场、海洋馆、庙会、漫展这些地方,逛完还会提醒她回来记一笔。
|
|
214
|
+
|
|
215
|
+
**怎么判定的**:读 `config.json` 里的 `worlds.fun.enabled`,只看这一个字段——不调它的工具、不读它记的东西。所以:
|
|
216
|
+
|
|
217
|
+
- 娱乐时间**没装**、或装了但**世界页停用** → 这一行**不会出现**,你不用担心她看到指向不存在工具的例子;
|
|
218
|
+
- 你自己已经在上面那段里抄过 `fun_*` → 不会叠第二条;
|
|
219
|
+
- 什么情况下都不改变你手写的那些行,只**追加**一行。
|
|
220
|
+
|
|
221
|
+
不想让它自动加:配置 →「她自己的时间」→「出门逛逛那一行」关掉(`lifeFreeFunOn`,默认开)。
|
|
222
|
+
|
|
205
223
|
**明天那格写着「等她写」**:说明已经问过她、她还没交回。正常,等她回就行,或者按「请她写明天」再催一次。
|
|
206
224
|
|
|
207
225
|
**她写的东西你不喜欢**:不用改她——那是她自己的日子。真想调,用「临时改主意」改一段(她第二天会看到自己那天是这么过的)。真想从头来,去存储页清「她的一天」。
|
|
@@ -237,7 +255,7 @@
|
|
|
237
255
|
|
|
238
256
|
---
|
|
239
257
|
|
|
240
|
-
## 7. 配置(39
|
|
258
|
+
## 7. 配置(39 项,在「鱼的每一天」的世界配置里,按 6 张卡分开)
|
|
241
259
|
|
|
242
260
|
配置页不再是一张列到底的长表,按**你脑子里那几件事**切成 6 张卡:
|
|
243
261
|
|
|
@@ -295,6 +313,7 @@
|
|
|
295
313
|
| `lifeFreeMaxRetries` | `1` | 一档最多催几次 |
|
|
296
314
|
| `lifeFreeMenu` | 4 条通用说法 | 叫醒时贴给她的**例子**(措辞里写明「不照着也行」)。想让她用具体工具就在这里填 |
|
|
297
315
|
| `lifeFreeAskReport` | `true` | 做完提醒她跟你说一句 |
|
|
316
|
+
| `lifeFreeFunOn` | `true` | **出门逛逛那一行**(0.7.4)。装了「娱乐时间」并启用着才自动追加一行 `fun_*`;没装/停用/你手抄过都不加 |
|
|
298
317
|
| `lifeWardrobeOn` | `true` | 生图联动总开关:扫素材库、列给她、自动补穿着、提示词互指 |
|
|
299
318
|
| `lifeWardrobeDir` | 空 | 素材库目录。留空自动跟 imggen 的 `libraryRoot`,再降级到 `<数据目录>/imggen-library`。配置页上有原生选目录按钮 |
|
|
300
319
|
| `lifeWardrobeAutoOutfit` | `true` | 自动补 outfit(情境穿搭 > 情境默认 > 延续上一段 > 场景默认 > 默认服饰) |
|
package/PUBLISHING.md
CHANGED
|
@@ -17,13 +17,13 @@ cd 'E:\deep seek\feed-world'
|
|
|
17
17
|
node tools/validate-dishes.mjs # 菜品库:字段、九维、类别、套话、菜系与文件名一致
|
|
18
18
|
node tools/selfcheck.mjs # 复刻 Coo 的干装载检查
|
|
19
19
|
node tools/publish-check.mjs --online # 市场收录口径 + npm 包名占用
|
|
20
|
-
npm test #
|
|
20
|
+
npm test # 12 个文件,337 项
|
|
21
21
|
node tools/make-describe.mjs --check
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
`prepublishOnly` 已经把这些串起来了:`npm publish` 之前会自动跑一遍,有任何一处失败就发不出去。这不是多余的谨慎——`describe.json` 与代码脱节、标签写了词表外的值、图标超 512KB,都会让市场那张卡片缺一块,而发出去之后改不了(只能发新版本)。
|
|
25
25
|
|
|
26
|
-
当前状态(0.7.
|
|
26
|
+
当前状态(0.7.4):**17 项通过、0 失败、4 条警告**(没截 `screenshots`;工具数 / 工具 token 在卡片上会标 yellow——0.7.0 之后工具涨到 16 个;解包 2.0MB;没查在线包名占用);**337 项测试全绿**(12 个文件:dishes 25 · eat 14 · state 31 · combos 39 · together 13 · life 36 · wardrobe 20 · life-world 47 · weather 10 · funlink 14 · world 41 · panels 47)。
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
@@ -118,8 +118,8 @@ npm publish --otp 123456
|
|
|
118
118
|
npm pack --dry-run
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
0.7.
|
|
122
|
-
`package.json`、`src/`(含 28 个菜品 json + `src/life/`
|
|
121
|
+
0.7.4 应该是 **58 个文件**,解包约 2.0MB(压缩后大小以 `npm pack --dry-run` 的输出为准):
|
|
122
|
+
`package.json`、`src/`(含 28 个菜品 json + `src/life/` 10 个 js)、`dist/webui.js`、`describe.json`、
|
|
123
123
|
`assets/icon.png`、`README.md`、`CHANGELOG.md`、`PUBLISHING.md`、`GUIDE.md`。
|
|
124
124
|
|
|
125
125
|
`test/`、`tools/`、`install.ps1`、`COMBO-SPEC.md`、`TOGETHER-SPEC.md`、`DISH-SPEC.md` 都在 `files` 之外,
|
|
@@ -135,15 +135,15 @@ npm publish --otp 123456 # 没开 2FA、或用了带 bypass 2FA 的 granula
|
|
|
135
135
|
|
|
136
136
|
这个包不是新包(0.1.1 / 0.2.0 / 0.3.0 / 0.4.0 / 0.5.0 / 0.6.0 / 0.6.1 / 0.6.2 / 0.6.3 / 0.7.0 / 0.7.1 / 0.7.2 都发过),所以**不需要** `--access public`(那是作用域包 `@you/xxx` 才要的)。
|
|
137
137
|
|
|
138
|
-
`latest` 会从 **0.7.
|
|
138
|
+
`latest` 会从 **0.7.3** 走到 **0.7.4**。版本序列是 0.6.0 → 0.6.1 → 0.6.2 → 0.6.3 → 0.7.0 → 0.7.1 → 0.7.2 → 0.7.3 → 0.7.4。
|
|
139
139
|
(0.6.0 那会儿「0.7.0」这个号本来打算给套餐用、后来并进了 0.6.0;真正的 0.7.0 是后来「她的一天」才发的。)
|
|
140
140
|
|
|
141
141
|
发完立刻验:
|
|
142
142
|
|
|
143
143
|
```powershell
|
|
144
|
-
npm view cortico-world-feast version # 应回 0.7.
|
|
144
|
+
npm view cortico-world-feast version # 应回 0.7.4
|
|
145
145
|
npm view cortico-world-feast cortico --json # 应能看到 kind/api/displayName/tags/locales
|
|
146
|
-
npm view cortico-world-feast dist-tags # latest 应是 0.7.
|
|
146
|
+
npm view cortico-world-feast dist-tags # latest 应是 0.7.4
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
`npm view` 走的是 CDN,刚发出去可能有几十秒到几分钟的滞后,回 `E404` 先等一下再查。
|
|
@@ -167,7 +167,7 @@ gh issue create --repo Pal-AI-Lab/cortico-extensions `
|
|
|
167
167
|
|
|
168
168
|
> 0.2.0 那次没开成,等 Action 自己那一趟等了好几天——**发完就开一个**,别省这一步。
|
|
169
169
|
|
|
170
|
-
之后在 Coo 的「扩展 →
|
|
170
|
+
之后在 Coo 的「扩展 → 市场」里搜「鱼的每一天」就能看到。第一次出现时会带**新品**徽标(`newDays: 14`)。
|
|
171
171
|
|
|
172
172
|
---
|
|
173
173
|
|
|
@@ -175,7 +175,7 @@ gh issue create --repo Pal-AI-Lab/cortico-extensions `
|
|
|
175
175
|
|
|
176
176
|
市场详情页现在只有图标和文字。截图要你自己截,脚本替不了:
|
|
177
177
|
|
|
178
|
-
1. 重启 Coo
|
|
178
|
+
1. 重启 Coo,世界页开「鱼的每一天」
|
|
179
179
|
2. 「菜单」页签截一张(能同时看到筛选条、卡片、顶部的「一起吃饭」条最好)
|
|
180
180
|
3. 「吃过什么」页签截一张(口味画像那张)
|
|
181
181
|
4. **「今天」页签截一张**(0.7.0 新面板:此刻那条 + 时间线点亮此刻那段)
|
|
@@ -186,8 +186,8 @@ gh issue create --repo Pal-AI-Lab/cortico-extensions `
|
|
|
186
186
|
"screenshots": ["assets/screenshot-1.png", "assets/screenshot-2.png", "assets/screenshot-3.png"],
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
7. 截图塞进**当前这一版**:现在的版本号是 `0.7.
|
|
190
|
-
要是 0.7.
|
|
189
|
+
7. 截图塞进**当前这一版**:现在的版本号是 `0.7.4`(还没发),加完直接 `npm publish` 就行;
|
|
190
|
+
要是 0.7.4 已经发出去了,就再升一位重发
|
|
191
191
|
|
|
192
192
|
截图改了就必须发新版本——市场按版本扫包,不发新版本改不了已收录的那一版。
|
|
193
193
|
|
|
@@ -226,8 +226,8 @@ gh issue create --repo Pal-AI-Lab/cortico-extensions `
|
|
|
226
226
|
3. World 扩展不直接依赖其他 World 扩展
|
|
227
227
|
4. **至少有过一次后续更新**
|
|
228
228
|
|
|
229
|
-
第 4 条意味着至少要发两个版本才能申请。0.1.1 / 0.2.0 / 0.3.0 / 0.4.0 / 0.5.0 / 0.6.0 / 0.6.1 / 0.6.2 / 0.6.3 / 0.7.0 / 0.7.1 / 0.7.2 都发过,
|
|
230
|
-
早就满足了;想把截图一并带上再申请也行,那就等 0.7.
|
|
229
|
+
第 4 条意味着至少要发两个版本才能申请。0.1.1 / 0.2.0 / 0.3.0 / 0.4.0 / 0.5.0 / 0.6.0 / 0.6.1 / 0.6.2 / 0.6.3 / 0.7.0 / 0.7.1 / 0.7.2 / 0.7.3 都发过,
|
|
230
|
+
早就满足了;想把截图一并带上再申请也行,那就等 0.7.4 发出去。
|
|
231
231
|
|
|
232
232
|
申请方式是开一个 `[认证]` issue:
|
|
233
233
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 鱼的每一天 · cortico-world-feast
|
|
2
2
|
|
|
3
3
|
先给她一天,再给她一桌饭。
|
|
4
4
|
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
|
|
107
107
|
前面那些都是"吃"。这一块是**她怎么过日子**。
|
|
108
108
|
|
|
109
|
-
在 0.7.0
|
|
109
|
+
在 0.7.0 之前,她在鱼的每一天里只有一个时间维度:饭点。剩下的时间是空白的——你问她「你这会儿在干嘛」,她只能按常理推断;晚上十点说「早点睡」,她没有任何可参照的东西。
|
|
110
110
|
|
|
111
111
|
### 一晚一次,她自己写明天
|
|
112
112
|
|
|
@@ -186,7 +186,7 @@ Cortico 的 `envPromptVars()` **只在前缀重建时重算**,不是每轮请
|
|
|
186
186
|
|
|
187
187
|
叫醒事件里会带上日程的那一段,把两条线缝上:
|
|
188
188
|
|
|
189
|
-
>
|
|
189
|
+
> 【鱼的每一天 · 你自己的时间 · 21:00】现在是你自己的时间,不是主人找你,也不是待办。
|
|
190
190
|
> 你现在在家,随便做点什么都行。
|
|
191
191
|
> 今天已经玩过:还没。
|
|
192
192
|
> 想做的话,下面这些只是个例子,不照着也行;想到什么就做什么,什么都不做也可以:
|
|
@@ -194,13 +194,32 @@ Cortico 的 `envPromptVars()` **只在前缀重建时重算**,不是每轮请
|
|
|
194
194
|
> ...
|
|
195
195
|
> 做完随手用 `feast_life_play` 记一笔……不记也没关系,记只是给你自己攒。
|
|
196
196
|
|
|
197
|
-
**菜单是可配置文本,默认只给通用说法。** 不点名任何别的扩展的工具——World 契约不允许一个 World
|
|
197
|
+
**菜单是可配置文本,默认只给通用说法。** 不点名任何别的扩展的工具——World 契约不允许一个 World 依赖另一个扩展,认证也查这条。想让她真用上某个工具(客厅、B 站、空间动态…),自己在 `lifeFreeMenu` 里写明:
|
|
198
198
|
|
|
199
199
|
```
|
|
200
|
-
-
|
|
200
|
+
- 去客厅坐坐(parlor_query {op:"rooms"} 看有哪些客厅 → parlor_room {op:"visit"} 进一间,有人说话用 parlor_message {scope:"room"} 回一句)
|
|
201
201
|
- 发一条空间动态(qq_qzone action=post)
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
+
### 和「娱乐时间」联动(0.7.4)
|
|
205
|
+
|
|
206
|
+
装了 `cortico-world-fun`(娱乐时间)并且它**启用着**,这一行会自动接在例子末尾,不用你手抄:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
- 出门去逛逛:fun_places 看今天能去哪 → fun_go 进门 → fun_wander 逛一处 → fun_home 收摊
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**自动检测,不需要配置路径**:读 `<数据目录>/../config.json` 里的 `worlds.fun.enabled`(只读这一个字段,不调它的工具、不读它的状态/日程——读配置文件不算 World 间依赖)。
|
|
213
|
+
|
|
214
|
+
三种情况**这一行整段不出现**,她绝不会看到指向不存在工具的例子:
|
|
215
|
+
|
|
216
|
+
- 娱乐时间**没装**;
|
|
217
|
+
- 装了但**在配置里停用**(`worlds.fun.enabled` 不是 `true`);
|
|
218
|
+
- 你自己已经在 `lifeFreeMenu` 里抄过 `fun_*`(判据是「提到 fun_ 开头的工具」,怎么措辞随你,不会叠第二条)。
|
|
219
|
+
|
|
220
|
+
想关掉这个自动追加、但保留你手写的内容:配置 →「她自己的时间」→ `lifeFreeFunOn` 关掉(默认开)。它只追加一行,**从不改写你原有的任何一条例子**。
|
|
221
|
+
|
|
222
|
+
|
|
204
223
|
**记账单独存一份** `<数据目录>/feast/life/play-YYYY-MM-DD.json`,不写进日程:`feast_life_plan` 会整个重写一天,记进去她下次交回就覆盖了。计划和事实的生命周期不同,就该分开存。
|
|
205
224
|
|
|
206
225
|
「今天」面板底下那块「她自己的时间」显示今天记了几件、下一档几点、她做了什么;到数了标一句「不再按点叫(想动随时动)」。**被日程挡掉的那一档也会写出来**(`21:00 · 没叫:她那会儿在加班赶工`)——0.7.1 这里是纯静默,面板上只剩「今天没有了」,很容易以为功能坏了。
|
|
@@ -345,6 +364,7 @@ Cortico 的 `envPromptVars()` **只在前缀重建时重算**,不是每轮请
|
|
|
345
364
|
| `lifeFreeMaxRetries` | `1` | 一档最多催几次;0 = 不催 |
|
|
346
365
|
| `lifeFreeMenu` | 4 条通用说法 | 叫醒时贴给她的菜单。**默认不点名任何别的扩展的工具**;要用具体工具自己填 |
|
|
347
366
|
| `lifeFreeAskReport` | `true` | 做完要不要提醒她跟主人说一句 |
|
|
367
|
+
| `lifeFreeFunOn` | `true` | **出门逛逛那一行**(0.7.4)。装了「娱乐时间」并启用着才加;没装/停用/你自己抄过 `fun_*` 都不加。关掉=不自动加 |
|
|
348
368
|
| `lifeWardrobeOn` | `true` | **生图联动总开关**:扫素材库、列给她、自动补穿着、提示词互指 |
|
|
349
369
|
| `lifeWardrobeDir` | 空 | 素材库目录。留空自动跟 imggen 的 `libraryRoot`,再降级到 `<数据目录>/imggen-library`。配置页上有原生选目录按钮 |
|
|
350
370
|
| `lifeWardrobeAutoOutfit` | `true` | 自动补 outfit(情境穿搭 > 情境默认 > 延续上一段 > 场景默认 > 默认服饰) |
|
|
@@ -383,7 +403,7 @@ powershell -ExecutionPolicy Bypass -File .\install.ps1 -CooRoot "C:\Users\asus\C
|
|
|
383
403
|
|
|
384
404
|
> `install.ps1` 本身必须以 **UTF-8 with BOM** 保存。Windows PowerShell 5.1 读无 BOM 的 UTF-8 会按 GBK 解,中文全成乱码。
|
|
385
405
|
|
|
386
|
-
装完重启 Coo
|
|
406
|
+
装完重启 Coo,在「世界」里启用「鱼的每一天」。
|
|
387
407
|
|
|
388
408
|
## 从市场装
|
|
389
409
|
|
package/describe.json
CHANGED
|
@@ -554,9 +554,9 @@
|
|
|
554
554
|
"prompts": [
|
|
555
555
|
{
|
|
556
556
|
"key": "worlds.feast.env",
|
|
557
|
-
"title": "
|
|
557
|
+
"title": "鱼的每一天",
|
|
558
558
|
"role": "envPrompt",
|
|
559
|
-
"content": "##
|
|
559
|
+
"content": "## 鱼的每一天\n\n你有一张会端菜的桌子。饿了可以自己挑,主人也会端一道过来。\n\n- 到饭点(默认 11:30、18:00)你会收到一条【鱼的每一天】事件:那不是主人找你,是你自己的饭点。里面写着今天吃过什么和几道候选。\n- **吃到嘴里才算数**:用 `feast_eat` 吃(`dish` 填菜名或 id;不带参数就吃主人端来的那道,没有就随机)。别只回一句\"我吃了\"。\n- 吃完用 `feast_reaction` 记一句自己的真实反应:`action` 填 `like` / `ok` / `dislike`,`note` 写一句具体的(\"麻得正好,就是豆腐碎\"这种)。这是你自己的口味账,不是给主人打的分。\n- 记完顺手跟主人说一句你尝到了什么——一句话就够。别把味道档案整段背给他听,说你自己的那口。\n- 主人从面板端一道菜过来时,你能闻到、看到它;用 `feast_eat`(`dish` 留空)先吃端来的那道。\n- 主人也可能**端一整桌过来**(几道菜一起)。那时 `feast_eat` 留空就是吃这一桌里还没吃的那道,回执会告诉你还剩几道。想吃哪道就点名,也算进这一桌。\n- 你也可以自己开一桌:`feast_combos` 看有哪些套餐(四菜一汤、清爽一餐……),`feast_combo` 开一桌。想一个人慢慢吃就别开一桌。\n- 主人也可能**和你一起吃一顿**(一起吃饭那条 `feast.together`):他喂你一口时,回执里就是\"这一口\"当下的样子——说一句什么味儿,别背档案。你自己想请他一起吃,用 `feast_together`(`action` 填 `invite`):面板上会挂一条等他回应,但**他听不到那句话,得你自己在聊天里说**;一天最多主动开口两次,没人应就自己收掉,别追着问。\n- 想分主人一口就用 `feast_together`(`action` 填 `feed`,`dish` 填菜名):他接不接由他,会告诉你。**你分出去的那口不算你吃过**——真正吃进你嘴里才进你自己的账。\n- 不想吃就 `feast_skip`,今天剩下的饭点不再叫你。**别为了应付提醒去吃东西**——不吃也是一种回答。\n- `feast_menu` 是挑菜用的(能按菜系/类别/标签筛);`feast_taste` 只看不吃,适合你想跟主人形容一道菜的时候;`feast_history` 查你吃过什么和自己的口味画像。\n- 同一道菜每次吃都不一样(温度、状态、配的那口都会变),所以别照着上次的说法重复一遍——说这一口。\n\n{{feast_life_block}}\n\n{{feast_weather_block}}\n"
|
|
560
560
|
}
|
|
561
561
|
]
|
|
562
562
|
}
|
package/dist/webui.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortico-world-feast",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.7.4",
|
|
4
|
+
"description": "鱼的每一天 · 先给她一天,再给她一桌饭:她自己的日程(每晚自己写明天、到点过自己的时间、做完记一笔)+ 824 道菜的桌子,能端一道、端一桌,也能和她一起吃一顿。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "青",
|
|
7
7
|
"repository": {
|
|
@@ -45,28 +45,28 @@
|
|
|
45
45
|
"node": ">=22.6"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
|
-
"test": "node test/dishes.test.mjs && node test/eat.test.mjs && node test/state.test.mjs && node test/combos.test.mjs && node test/together.test.mjs && node test/life.test.mjs && node test/wardrobe.test.mjs && node test/life-world.test.mjs && node test/weather.test.mjs && node test/world.test.mjs && node test/panels.test.mjs",
|
|
48
|
+
"test": "node test/dishes.test.mjs && node test/eat.test.mjs && node test/state.test.mjs && node test/combos.test.mjs && node test/together.test.mjs && node test/life.test.mjs && node test/wardrobe.test.mjs && node test/life-world.test.mjs && node test/weather.test.mjs && node test/funlink.test.mjs && node test/world.test.mjs && node test/panels.test.mjs",
|
|
49
49
|
"dishes": "node tools/validate-dishes.mjs",
|
|
50
50
|
"selfcheck": "node tools/selfcheck.mjs",
|
|
51
51
|
"check:install": "node tools/check-install.mjs",
|
|
52
52
|
"check:publish": "node tools/publish-check.mjs --online",
|
|
53
53
|
"describe": "node tools/make-describe.mjs",
|
|
54
|
-
"prepublishOnly": "node tools/validate-dishes.mjs && node tools/selfcheck.mjs && node tools/publish-check.mjs --online && node test/dishes.test.mjs && node test/eat.test.mjs && node test/state.test.mjs && node test/combos.test.mjs && node test/together.test.mjs && node test/life.test.mjs && node test/wardrobe.test.mjs && node test/life-world.test.mjs && node test/weather.test.mjs && node test/world.test.mjs && node test/panels.test.mjs && node tools/make-describe.mjs --check"
|
|
54
|
+
"prepublishOnly": "node tools/validate-dishes.mjs && node tools/selfcheck.mjs && node tools/publish-check.mjs --online && node test/dishes.test.mjs && node test/eat.test.mjs && node test/state.test.mjs && node test/combos.test.mjs && node test/together.test.mjs && node test/life.test.mjs && node test/wardrobe.test.mjs && node test/life-world.test.mjs && node test/weather.test.mjs && node test/funlink.test.mjs && node test/world.test.mjs && node test/panels.test.mjs && node tools/make-describe.mjs --check"
|
|
55
55
|
},
|
|
56
56
|
"cortico": {
|
|
57
57
|
"kind": "world",
|
|
58
58
|
"api": 6,
|
|
59
|
-
"displayName": "
|
|
59
|
+
"displayName": "鱼的每一天",
|
|
60
60
|
"icon": "assets/icon.png",
|
|
61
61
|
"webUiClient": "dist/webui.js",
|
|
62
62
|
"describe": "describe.json",
|
|
63
63
|
"locales": {
|
|
64
64
|
"zh": {
|
|
65
|
-
"displayName": "
|
|
65
|
+
"displayName": "鱼的每一天",
|
|
66
66
|
"description": "先给她一天,再给她一桌饭。每天晚上到点请她自己写明天怎么过(零 API Key,用已配的模型),第二天按它过;到点还有「她自己的时间」,让她挑件事做并记一笔。主人能在「今天」面板看今天和明天的时间线、此刻她在做什么、她做过什么、往前翻往期,也能临时改掉某一段。桌上是 824 道菜(28 个菜系组),每道都有九维口味、香气、口感、余韵和一段实吃描写;她能自己按菜系挑,主人也能从面板端一道或整桌端过去(8 套内置套餐,也能自己勾几道攒成一桌存下来);还能和她一起吃一顿:邀请她、互相喂一口,你吃了什么她也知道。同一道菜每次吃到的都不一样,吃过什么、对什么反应、口味画像跨天攒着。饭点提醒、「她的一天」和自由时间都能在配置里单独关掉。"
|
|
67
67
|
},
|
|
68
68
|
"en": {
|
|
69
|
-
"displayName": "
|
|
69
|
+
"displayName": "Fish Every Day",
|
|
70
70
|
"description": "First a day of her own, then a table of food. Every evening she is asked to write tomorrow herself (no API key — it uses the model you already have), and the next day she lives it; on her own-time slots she picks something to do and logs it. The Today panel shows today's and tomorrow's timeline, what she is doing right now, what she has been up to, past days, and lets you change a stretch of it. The table holds 824 dishes across 28 cuisines, each with a nine-axis flavour profile, aroma, texture, aftertaste and a full paragraph of how it actually eats. She can pick by cuisine, or you can put a dish down in front of her from the panel — or serve a whole table at once (8 built-in set meals, plus your own saved tables). You can also share a meal with her: invite her, feed each other a bite, and tell her what you are eating. The same dish never lands the same way twice, and what she ate, how it landed and her taste profile accumulate across days. Meal reminders, her day, and her own time can each be switched off in config."
|
|
71
71
|
}
|
|
72
72
|
},
|
package/src/ENV_PROMPT.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
##
|
|
1
|
+
## 鱼的每一天
|
|
2
2
|
|
|
3
3
|
你有一张会端菜的桌子。饿了可以自己挑,主人也会端一道过来。
|
|
4
4
|
|
|
5
|
-
- 到饭点(默认 11:30、18:00
|
|
5
|
+
- 到饭点(默认 11:30、18:00)你会收到一条【鱼的每一天】事件:那不是主人找你,是你自己的饭点。里面写着今天吃过什么和几道候选。
|
|
6
6
|
- **吃到嘴里才算数**:用 `feast_eat` 吃(`dish` 填菜名或 id;不带参数就吃主人端来的那道,没有就随机)。别只回一句"我吃了"。
|
|
7
7
|
- 吃完用 `feast_reaction` 记一句自己的真实反应:`action` 填 `like` / `ok` / `dislike`,`note` 写一句具体的("麻得正好,就是豆腐碎"这种)。这是你自己的口味账,不是给主人打的分。
|
|
8
8
|
- 记完顺手跟主人说一句你尝到了什么——一句话就够。别把味道档案整段背给他听,说你自己的那口。
|
package/src/config.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 鱼的每一天的配置段与文案。
|
|
3
3
|
*
|
|
4
4
|
* 段名是 `config.json` 的 `worlds.feast`。WebUI 热改就地写这个对象,
|
|
5
5
|
* World 每次用时现读,所以这里只有默认值与 schema,不持有副本。
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export const ID = 'feast';
|
|
9
|
-
export const LABEL = '
|
|
9
|
+
export const LABEL = '鱼的每一天';
|
|
10
10
|
|
|
11
11
|
/** 饭点提醒用的事件类型;也是 describe 里对外的名字。 */
|
|
12
12
|
export const EVENT_MEAL = 'feast.meal';
|
|
@@ -58,7 +58,7 @@ export const DEFAULTS = Object.freeze({
|
|
|
58
58
|
togetherTTLMin: 60,
|
|
59
59
|
|
|
60
60
|
// ---- 「她的一天」(0.7.0 融合自 dsh-daily-schedule)----
|
|
61
|
-
/**
|
|
61
|
+
/** 总开关。关掉后不生成、不注入、不推时段事件;鱼的每一天的饭点照旧。 */
|
|
62
62
|
lifeEnabled: true,
|
|
63
63
|
/** 每晚几点请她自己写明天(24 小时制 HH:MM)。 */
|
|
64
64
|
lifeGenerateAt: '22:00',
|
|
@@ -100,6 +100,9 @@ export const DEFAULTS = Object.freeze({
|
|
|
100
100
|
].join('\n'),
|
|
101
101
|
/** 做完要不要提醒她跟主人说一句。 */
|
|
102
102
|
lifeFreeAskReport: true,
|
|
103
|
+
// ---- 娱乐时间联动(0.7.4)----
|
|
104
|
+
/** 「出门逛逛」那一行要不要加。娱乐时间没装/没启用时,这一项写了也不会加。 */
|
|
105
|
+
lifeFreeFunOn: true,
|
|
103
106
|
// ---- 生图工作室联动(0.7.1)----
|
|
104
107
|
/** 联动总开关:扫素材库、列给 Coo、自动补 outfit、注入指向句。关掉=纯文本日程,不碰库。 */
|
|
105
108
|
lifeWardrobeOn: true,
|
|
@@ -118,12 +121,12 @@ export const DEFAULTS = Object.freeze({
|
|
|
118
121
|
});
|
|
119
122
|
|
|
120
123
|
const ZH = {
|
|
121
|
-
label: '
|
|
122
|
-
lamp: '
|
|
124
|
+
label: '鱼的每一天',
|
|
125
|
+
lamp: '鱼的每一天',
|
|
123
126
|
stopped: '未启动',
|
|
124
127
|
badgeToday: '今天',
|
|
125
128
|
badgeNext: '下一顿',
|
|
126
|
-
prompt: '
|
|
129
|
+
prompt: '鱼的每一天 World 的环境说明:这里有一张会端菜的桌子,也有她自己过的一天。主人可以端一道菜过来,她也能自己挑;每道菜都有味道档案,吃完可以记一句自己的反应。她的一天由她自己写,写在饭点之外的那些时段里。',
|
|
127
130
|
/** 配置卡片标题:0.7.2 把原来一张 35 项的巨卡拆成 5 张。 */
|
|
128
131
|
groups: {
|
|
129
132
|
meal: '饭点',
|
|
@@ -134,7 +137,7 @@ const ZH = {
|
|
|
134
137
|
weather: '天气',
|
|
135
138
|
},
|
|
136
139
|
config: {
|
|
137
|
-
title: '
|
|
140
|
+
title: '鱼的每一天',
|
|
138
141
|
mealReminder: '饭点提醒',
|
|
139
142
|
mealReminderDesc: '关掉之后不再按点叫她吃饭,只剩「主人端菜过来」和「她自己想吃」。想自己挑时间就开着这里、改下面的档位。',
|
|
140
143
|
mealSlots: '饭点档位',
|
|
@@ -166,7 +169,7 @@ const ZH = {
|
|
|
166
169
|
togetherTTLMin: '一起吃饭最多挂多久',
|
|
167
170
|
togetherTTLMinDesc: '一顿「一起吃饭」最多挂多久,到点自动散桌,免得面板上一直写着"正一起吃"。',
|
|
168
171
|
lifeEnabled: '她的一天',
|
|
169
|
-
lifeEnabledDesc: '
|
|
172
|
+
lifeEnabledDesc: '总开关。关掉后不再生成日程、不再往系统提示里放她的日子,也不推时段事件;鱼的每一天的饭点照旧。',
|
|
170
173
|
lifeGenerateAt: '请她写明天的时间',
|
|
171
174
|
lifeGenerateAtDesc: '每晚几点推一条事件,请她自己写明天怎么过。她交回之前先放一个占位,不会重复叫;她没写就第二天用模板兜底。',
|
|
172
175
|
lifePrecision: '时间精度',
|
|
@@ -198,9 +201,11 @@ const ZH = {
|
|
|
198
201
|
lifeFreeMaxRetries: '最多催几次',
|
|
199
202
|
lifeFreeMaxRetriesDesc: '一档催完还没记就放掉,等下一档;0 = 不催。',
|
|
200
203
|
lifeFreeMenu: '叫醒时给的例子',
|
|
201
|
-
lifeFreeMenuDesc: '原样贴进叫醒事件里,措辞上明确写着「这些只是例子,不照着也行」。默认只写通用说法(不点名别的扩展的工具——World
|
|
204
|
+
lifeFreeMenuDesc: '原样贴进叫醒事件里,措辞上明确写着「这些只是例子,不照着也行」。默认只写通用说法(不点名别的扩展的工具——World 不该依赖别的扩展)。想让她真用上某个工具,在这里写明,例如「去客厅坐坐(parlor_query {op:"rooms"} → parlor_room {op:"visit"})」。改完下一档生效。',
|
|
202
205
|
lifeFreeAskReport: '做完说一声',
|
|
203
206
|
lifeFreeAskReportDesc: '开启时,叫醒和记账回执都会提醒她「跟主人说一句你刚才玩了什么」。',
|
|
207
|
+
lifeFreeFunOn: '出门逛逛那一行',
|
|
208
|
+
lifeFreeFunOnDesc: '开启时,如果装了「娱乐时间」(cortico-world-fun)并且启用着,叫醒事件的例子末尾会自动多一行「fun_places 看今天能去哪 → fun_go 进门 → fun_wander 逛一处 → fun_home 收摊」,她就能真的出门逛游乐场、海洋馆、庙会这些地方。**娱乐时间没装或没启用时这一行不会出现**,她也不会看到指向不存在工具的例子;你自己在「叫醒时给的例子」里抄过 fun_* 的话,这一项也不重复加。关掉=不管装没装都不加这一行。',
|
|
204
209
|
lifeWardrobeOn: '生图联动',
|
|
205
210
|
lifeWardrobeOnDesc: '扫生图工作室的素材库(<数据目录>/imggen-library),写日程时列出衣柜/场景/道具和穿搭习惯,模型没填 outfit 时按习惯自动补,并在提示词里加一句指向生图工作室。关掉=纯文本日程,不碰库、不联动。库读不到时自动静默降级,不影响她的一天。',
|
|
206
211
|
lifeWardrobeDir: '素材库目录',
|
|
@@ -210,7 +215,7 @@ const ZH = {
|
|
|
210
215
|
weatherEnabled: '让她知道外面的天气',
|
|
211
216
|
weatherEnabledDesc: '开之前先填下面的城市。开启后按点取真实天气,写进她的背景、饭点候选和「自己的时间」那句提醒里;大太阳偏清爽口、下雨偏热乎的。没填城市、联网失败、接口没数据时一律「不提天气」——宁可不说,也绝不按季节编一个,免得外面大太阳她却说下雨。关掉=完全不联网、不提天气。',
|
|
212
217
|
weatherCity: '你所在的城市',
|
|
213
|
-
weatherCityDesc: '
|
|
218
|
+
weatherCityDesc: '填你自己的城市名,中文就行(如「上海」「贵阳」「成都」),鱼的每一天会去查经纬度再取当地天气。这是每个人各自的配置,不影响别人。留空 = 不提天气;填错查不到也静默跳过。不会自动探测你的 IP,也不会向外发你的位置以外的东西。',
|
|
214
219
|
weatherRefreshMin: '多久看一次天气',
|
|
215
220
|
weatherRefreshMinDesc: '隔多少分钟重取一次真实天气。30 分钟足够,改小没有意义还费接口。取不到就沿用上一次的;一次都没取到就一直不提天气。',
|
|
216
221
|
},
|
|
@@ -227,12 +232,12 @@ const ZH = {
|
|
|
227
232
|
const EN = {
|
|
228
233
|
// 显示名跟着 package.json 的 en displayName 走(0.7.2 改名:一桌菜 → 食时 / Mealtime)。
|
|
229
234
|
// 只改中文会把英文面板标题留在旧名字上,和市场里那一页对不上。
|
|
230
|
-
label: '
|
|
231
|
-
lamp: '
|
|
235
|
+
label: 'Fish Every Day',
|
|
236
|
+
lamp: 'Fish Every Day',
|
|
232
237
|
stopped: 'not running',
|
|
233
238
|
badgeToday: 'Today',
|
|
234
239
|
badgeNext: 'Next meal',
|
|
235
|
-
prompt: 'The
|
|
240
|
+
prompt: 'The Fish Every Day world: a day of her own, and a table that serves food. The owner can put a dish down, she can also pick one herself; every dish carries a full flavour profile, and she can log how it landed. She writes her own day, in the hours between meals.',
|
|
236
241
|
groups: {
|
|
237
242
|
meal: 'Meals',
|
|
238
243
|
together: 'Eating together',
|
|
@@ -242,7 +247,7 @@ const EN = {
|
|
|
242
247
|
weather: 'Weather',
|
|
243
248
|
},
|
|
244
249
|
config: {
|
|
245
|
-
title: '
|
|
250
|
+
title: 'Fish Every Day',
|
|
246
251
|
mealReminder: 'Meal reminders',
|
|
247
252
|
mealReminderDesc: 'Turn this off and she is never called to a meal; only owner-served dishes and her own appetite remain.',
|
|
248
253
|
mealSlots: 'Meal slots',
|
|
@@ -306,9 +311,11 @@ const EN = {
|
|
|
306
311
|
lifeFreeMaxRetries: 'Max retries',
|
|
307
312
|
lifeFreeMaxRetriesDesc: 'Give up on a slot after this many nudges; 0 = never retry.',
|
|
308
313
|
lifeFreeMenu: 'Example ideas',
|
|
309
|
-
lifeFreeMenuDesc: 'Pasted verbatim into the wake-up event, worded so it is clear these are only examples. Defaults stay generic on purpose — a World must not depend on another extension. To point her at a specific tool, name it here, e.g. "
|
|
314
|
+
lifeFreeMenuDesc: 'Pasted verbatim into the wake-up event, worded so it is clear these are only examples. Defaults stay generic on purpose — a World must not depend on another extension. To point her at a specific tool, name it here, e.g. "sit in the parlor (parlor_query {op:\"rooms\"} → parlor_room {op:\"visit\"})".',
|
|
310
315
|
lifeFreeAskReport: 'Tell the owner',
|
|
311
316
|
lifeFreeAskReportDesc: 'When on, both the wake-up and the logging receipt remind her to say one sentence about what she just did.',
|
|
317
|
+
lifeFreeFunOn: 'Add the going-out line',
|
|
318
|
+
lifeFreeFunOnDesc: 'When on, and the Fun Time world (cortico-world-fun) is installed and enabled, one extra line is appended to the wake-up examples: "fun_places to see where you can go → fun_go to walk in → fun_wander to look around → fun_home to head home", so she can really go out to an amusement park, an aquarium, a temple fair and so on. **If Fun Time is not installed or not enabled the line never appears**, so she never sees an example pointing at tools that do not exist; and if you already pasted fun_* into the examples yourself, this will not add it twice. Off = never add it, installed or not.',
|
|
312
319
|
lifeWardrobeOn: 'Image-gen link',
|
|
313
320
|
lifeWardrobeOnDesc: 'Scans the image-gen studio library (<dataDir>/imggen-library), lists wardrobe/scene/props and outfit habits when she writes her day, auto-fills outfit from habits when the model leaves it blank, and adds one line in the prompt pointing at the studio. Off = plain-text schedule, no library, no link. Degrades silently when the library is missing; her day is never affected.',
|
|
314
321
|
lifeWardrobeDir: 'Library root',
|
|
@@ -318,7 +325,7 @@ const EN = {
|
|
|
318
325
|
weatherEnabled: 'Let her know the weather',
|
|
319
326
|
weatherEnabledDesc: 'Fill in your city below before turning this on. When on, real weather goes into her background note, meal candidates and the own-time nudge: hot/sunny leans towards cool dishes, rainy/cold towards warm ones. No city, no network, or no data means she simply never mentions the weather — better silent than invented, so she never says it is raining under a clear sky. Off = no network calls at all, no weather.',
|
|
320
327
|
weatherCity: 'Your city',
|
|
321
|
-
weatherCityDesc: 'Your own city name, Chinese works fine (e.g. 上海, 贵阳, 成都);
|
|
328
|
+
weatherCityDesc: 'Your own city name, Chinese works fine (e.g. 上海, 贵阳, 成都); Fish Every Day resolves it to coordinates and fetches local weather. This is per-install config and does not affect other users. Blank = no weather; an unknown city is skipped silently. Your IP is never probed and nothing else about your location is sent.',
|
|
322
329
|
weatherRefreshMin: 'Weather refresh interval',
|
|
323
330
|
weatherRefreshMinDesc: 'How often to re-fetch real weather, in minutes. 30 is plenty; lower only wastes the API. A failure keeps the last snapshot; if none ever succeeded, weather stays unmentioned.',
|
|
324
331
|
},
|
|
@@ -588,6 +595,12 @@ function configProperties(language = 'zh') {
|
|
|
588
595
|
description: t.lifeFreeAskReportDesc,
|
|
589
596
|
'x-hot': true,
|
|
590
597
|
},
|
|
598
|
+
[`${K}.lifeFreeFunOn`]: {
|
|
599
|
+
type: 'boolean',
|
|
600
|
+
title: t.lifeFreeFunOn,
|
|
601
|
+
description: t.lifeFreeFunOnDesc,
|
|
602
|
+
'x-hot': true,
|
|
603
|
+
},
|
|
591
604
|
[`${K}.lifeWardrobeOn`]: {
|
|
592
605
|
type: 'boolean',
|
|
593
606
|
title: t.lifeWardrobeOn,
|
package/src/definition.js
CHANGED
|
@@ -92,7 +92,7 @@ export const feastDefinition = {
|
|
|
92
92
|
/** `worlds.feast` 段的默认值;启用与否由部署决定,定义里恒为 false。 */
|
|
93
93
|
defaults: () => structuredClone(DEFAULTS),
|
|
94
94
|
preflight: () => {
|
|
95
|
-
if (typeof structuredClone !== 'function') throw new Error('
|
|
95
|
+
if (typeof structuredClone !== 'function') throw new Error('鱼的每一天需要 Node 22+ 的 structuredClone。');
|
|
96
96
|
},
|
|
97
97
|
create: (ctx) => new FeastWorld({
|
|
98
98
|
cfg: ctx.cfg,
|
package/src/dishes.js
CHANGED
|
@@ -63,7 +63,7 @@ export async function loadDishes(logger) {
|
|
|
63
63
|
try {
|
|
64
64
|
files = (await readdir(DATA_DIR)).filter((f) => f.endsWith('.json')).sort();
|
|
65
65
|
} catch (err) {
|
|
66
|
-
logger?.warn?.(
|
|
66
|
+
logger?.warn?.(`鱼的每一天:菜品目录读不到(${err?.message ?? err})`);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
for (const file of files) {
|
|
@@ -72,12 +72,12 @@ export async function loadDishes(logger) {
|
|
|
72
72
|
arr = JSON.parse(await readFile(join(DATA_DIR, file), 'utf8'));
|
|
73
73
|
} catch (err) {
|
|
74
74
|
bad += 1;
|
|
75
|
-
logger?.warn?.(
|
|
75
|
+
logger?.warn?.(`鱼的每一天:${file} 解析失败,跳过 —— ${err?.message ?? err}`);
|
|
76
76
|
continue;
|
|
77
77
|
}
|
|
78
78
|
if (!Array.isArray(arr)) {
|
|
79
79
|
bad += 1;
|
|
80
|
-
logger?.warn?.(
|
|
80
|
+
logger?.warn?.(`鱼的每一天:${file} 顶层不是数组,跳过`);
|
|
81
81
|
continue;
|
|
82
82
|
}
|
|
83
83
|
for (const raw of arr) {
|
package/src/life/free.js
CHANGED
|
@@ -261,10 +261,10 @@ export function freeEventText({
|
|
|
261
261
|
const p = playProgress(play, goal);
|
|
262
262
|
const tag = slot === '补' ? '' : ` · ${slot}`;
|
|
263
263
|
const head = retry
|
|
264
|
-
?
|
|
264
|
+
? `【鱼的每一天 · 自己的时间】${slot === '补' ? '刚才那一档' : `${slot} 那档`}你还没记。`
|
|
265
265
|
: (freeNow
|
|
266
|
-
?
|
|
267
|
-
:
|
|
266
|
+
? `【鱼的每一天 · 你自己的时间${tag}】现在是你自己的时间,不是主人找你,也不是待办。`
|
|
267
|
+
: `【鱼的每一天 · 有点空档${tag}】这会儿手头没事,想做什么都可以,不是主人找你,也不是待办。`);
|
|
268
268
|
|
|
269
269
|
const lines = [head];
|
|
270
270
|
if (where && !retry) {
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 「她自己的时间」↔ 娱乐时间(`cortico-world-fun`)的那一行例子。
|
|
3
|
+
*
|
|
4
|
+
* 为什么单独一个模块:
|
|
5
|
+
* · 它只做两件事——**读 Coo config 判断娱乐时间装没装**、**拼一行给她的例子**;
|
|
6
|
+
* · 两件事都是纯函数 + 一次读文件,不该塞进 world.js 里再长三百行;
|
|
7
|
+
* · 测试要能单独钉住「没装就不出现」「装了就出现」「手改过就不重复」。
|
|
8
|
+
*
|
|
9
|
+
* 这是官方预留给用户的 `lifeFreeMenu` 那条路的**自动化版本**:0.7.4 之前用户得
|
|
10
|
+
* 自己把 `fun_places → fun_go → …` 抄进配置里,还容易和默认那四条例子叠成两套。
|
|
11
|
+
* 现在一个开关 + 自动检测就够了。
|
|
12
|
+
*
|
|
13
|
+
* 红线(和 wardrobe.js 读 imggen 的 libraryRoot 同一套):
|
|
14
|
+
* · **只读 config.json 一个字段**(`worlds.fun.enabled`),不调娱乐时间的工具、
|
|
15
|
+
* 不读它的 `dataDir/fun/state.json` —— 读配置文件不算 World 间依赖;
|
|
16
|
+
* · 读不到 / 解析失败 / 没装 → 返回「没装」,那一行**整段不出现**,
|
|
17
|
+
* 绝不让她看到指向不存在工具的例子;
|
|
18
|
+
* · 任何异常都吞掉,**绝不抛错**(抛错会把整个 World 卸载)。
|
|
19
|
+
*/
|
|
20
|
+
import { readFile } from 'node:fs/promises';
|
|
21
|
+
import { join } from 'node:path';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 要拼进「例子」的那一行。
|
|
25
|
+
*
|
|
26
|
+
* 写法照 feast 配置描述里的官方建议(「想让她真用上某个工具,在这里写明」):
|
|
27
|
+
* 一行里把四个动作串成一句,别写成四条——`lifeFreeMenu` 是「例子」,不是待办清单。
|
|
28
|
+
*
|
|
29
|
+
* **刻意不点名具体场所**:娱乐时间的场所库以后还会加(0.1.0 已从 4 处扩到 12 处),
|
|
30
|
+
* 写死「游乐场 / 海洋馆 / 庙会 / 漫展」的话,每加一处都得回来改这行。
|
|
31
|
+
* 让 `fun_places` 自己去列,这一行就长期有效。
|
|
32
|
+
*/
|
|
33
|
+
export const FUN_LINE = '- 出门去逛逛:fun_places 看今天能去哪 → fun_go 进门 → fun_wander 逛一处 → fun_home 收摊';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 判断这一行是不是「已经在菜单里了」。
|
|
37
|
+
*
|
|
38
|
+
* 不按整行比:用户可能手改过(比如把「游乐场」补进去、或者把箭头改成「→」以外的写法),
|
|
39
|
+
* 那时整行匹配不上,会再追加一条,菜单里就出现两条几乎一样的。
|
|
40
|
+
* 判据取「提到 fun_go」——那一行只要指向娱乐时间就够了,怎么措辞是用户的自由。
|
|
41
|
+
*/
|
|
42
|
+
const HAS_FUN_RE = /fun_[a-z]+/;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 读娱乐时间的安装/启用状态。
|
|
46
|
+
*
|
|
47
|
+
* 宿主的 config 路径按 `dataDir` 的父目录找(`<dataDir>/../config.json`),
|
|
48
|
+
* 和 `wardrobe.js` 的 `readImggenRoot` 一致——数据目录是 `…/home/companion`,
|
|
49
|
+
* config.json 在它的上一层。
|
|
50
|
+
*
|
|
51
|
+
* `config.json` 是 Coo **整份重写**的(改任何配置项都会重写一次),存在「读到写了
|
|
52
|
+
* 一半的文件」的窗口。解析失败时**等 200ms 重试一次**,再失败才判成「没装」——
|
|
53
|
+
* 否则用户改配置的那一瞬间正好触发叫醒,会误判成「没装娱乐时间」而漏掉那一行。
|
|
54
|
+
*
|
|
55
|
+
* @returns {Promise<boolean>} 装并且启用了才 true;其余一律 false(静默降级)。
|
|
56
|
+
*/
|
|
57
|
+
export async function readFunEnabled(dataDir) {
|
|
58
|
+
const tryOnce = async () => {
|
|
59
|
+
try {
|
|
60
|
+
const raw = JSON.parse(await readFile(join(dataDir, '..', 'config.json'), 'utf8'));
|
|
61
|
+
// 只认 `enabled`:那是宿主的 World 总开关,用户关掉世界页就是它在变。
|
|
62
|
+
return raw?.worlds?.fun?.enabled === true;
|
|
63
|
+
} catch {
|
|
64
|
+
return null; // 区分「读不到/解析失败」(null) 和「读到了但没这个段」(false)
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const first = await tryOnce();
|
|
68
|
+
if (first !== null) return first;
|
|
69
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
70
|
+
const second = await tryOnce();
|
|
71
|
+
return second === true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 该不该把那一行加进「例子」里。
|
|
76
|
+
*
|
|
77
|
+
* 三个条件都满足才加:
|
|
78
|
+
* 1. `lifeFreeFunOn` 没被关掉(默认开);
|
|
79
|
+
* 2. 娱乐时间装了并且启用着(`worlds.fun.enabled === true`);
|
|
80
|
+
* 3. **现有菜单里还没有指向 fun_* 的一行**——用户自己抄过的话就别再叠一条。
|
|
81
|
+
*
|
|
82
|
+
* @param {string} menu 现有菜单(`cfg.lifeFreeMenu` 或 DEFAULTS)
|
|
83
|
+
* @param {boolean} funOn 娱乐时间是否装了并启用
|
|
84
|
+
* @param {object} cfg 配置段(判 lifeFreeFunOn)
|
|
85
|
+
* @returns {string} 要追加的一行;不该加就是空串
|
|
86
|
+
*/
|
|
87
|
+
export function funMenuLine(menu, funOn, cfg = {}) {
|
|
88
|
+
if (cfg?.lifeFreeFunOn === false) return '';
|
|
89
|
+
if (!funOn) return '';
|
|
90
|
+
if (HAS_FUN_RE.test(typeof menu === 'string' ? menu : '')) return '';
|
|
91
|
+
return FUN_LINE;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 把那一行接到菜单末尾(没有要加的就不动原样)。
|
|
96
|
+
*
|
|
97
|
+
* 只追加,不改写、不排序、不动用户原有的任何一条——那是用户自己写的话。
|
|
98
|
+
*/
|
|
99
|
+
export function withFunLine(menu, funOn, cfg = {}) {
|
|
100
|
+
const base = typeof menu === 'string' ? menu : '';
|
|
101
|
+
const line = funMenuLine(base, funOn, cfg);
|
|
102
|
+
if (!line) return base;
|
|
103
|
+
const head = base.replace(/\s+$/, '');
|
|
104
|
+
// 空菜单时别拼出以换行开头的东西。
|
|
105
|
+
return head ? `${head}\n${line}` : line;
|
|
106
|
+
}
|
package/src/life/index.js
CHANGED
package/src/life/inject.js
CHANGED
|
@@ -104,7 +104,7 @@ export function momentLine({ today, cfg = {}, tz = 'Asia/Shanghai', nowMs = Date
|
|
|
104
104
|
const t = timeLabel(cfg.lifePrecision ?? 'halfhour', z.minute);
|
|
105
105
|
const upcoming = Math.max(0, Math.min(3, Number(cfg.lifeUpcoming) || 3));
|
|
106
106
|
const next = today.items.slice(i + 1, i + 1 + upcoming).map((it) => it.activity).join('、');
|
|
107
|
-
const head =
|
|
107
|
+
const head = `【鱼的每一天 · 她的一天】${t ? `${t},` : ''}你这会儿在${cur.activity}${placeOf(cur)}`;
|
|
108
108
|
const tail = next ? `;待会儿想${next}` : '';
|
|
109
109
|
return safe(`${head}${tail}。(这是你自己的日子,不用特意跟主人汇报,聊到时自然带一句就好。)`);
|
|
110
110
|
}
|
package/src/life/plan.js
CHANGED
|
@@ -22,8 +22,8 @@ export function planEventText({ date, type, recent = '', mealSlots = '11:30,18:0
|
|
|
22
22
|
const name = who.name || '她';
|
|
23
23
|
const lines = [
|
|
24
24
|
rewrite
|
|
25
|
-
?
|
|
26
|
-
:
|
|
25
|
+
? `【鱼的每一天 · 她的一天】主人想请你重新想想 ${dateLabel(date)}(${date})。不是主人找你,也不是待办,是你自己的日子。`
|
|
26
|
+
: `【鱼的每一天 · 她的一天】该想想 ${dateLabel(date)}(${date})怎么过了。不是主人找你,也不是待办,是你自己的日子。`,
|
|
27
27
|
`这一天按「${type?.name || '普通的一天'}」来:${type?.guide || '照你平常的样子过一天。'}`,
|
|
28
28
|
];
|
|
29
29
|
if (rewrite) {
|
package/src/life/store.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 「她的一天」的存取。
|
|
3
3
|
*
|
|
4
4
|
* 每天一个文件:<dataDir>/feast/life/YYYY-MM-DD.json。
|
|
5
|
-
*
|
|
5
|
+
* 与鱼的每一天的 state.json / combos.json 分开:清空「吃过的记录」不该把她的日子也清掉。
|
|
6
6
|
* 写入一律 tmp → rename(和 World 主状态同一套原子写,断电不会留半个 JSON)。
|
|
7
7
|
*
|
|
8
8
|
* 这里没有「配置」:所有开关都走 worlds.feast.*(ctx.cfg,热改),
|
package/src/life/time.js
CHANGED
package/src/state.js
CHANGED
package/src/weather.js
CHANGED
package/src/world.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 鱼的每一天 World。
|
|
3
3
|
*
|
|
4
4
|
* 做的是"让她真的吃到东西"这件事:
|
|
5
5
|
*
|
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
} from './config.js';
|
|
26
26
|
import {
|
|
27
27
|
DEFAULT_DAY_TYPES, addDays, applyChange, cleanDay, clearDays, clearPlays, dateLabel, dayText, envBlock,
|
|
28
|
-
findItem, freeEventText, isAsleepActivity, isDateKey, isFreeActivity, LIFE_KEEP_DAYS, lifeDir, listDays, markFreeNudged,
|
|
28
|
+
findItem, freeEventText, funMenuLine, isAsleepActivity, isDateKey, isFreeActivity, LIFE_KEEP_DAYS, lifeDir, listDays, markFreeNudged,
|
|
29
29
|
momentLine, newPlay, nextFreeSlotText, normalizePlan, nowText, parseClock, parseSlots, pendingDay,
|
|
30
|
-
pickDayType, planEventText, planFreeTick, playDoneText, readDay, readPlay, recentSummary, recordPlay,
|
|
31
|
-
segmentKey, skipFreeToday, templateDay, writeDay, writePlay, zonedNow,
|
|
30
|
+
pickDayType, planEventText, planFreeTick, playDoneText, readDay, readFunEnabled, readPlay, recentSummary, recordPlay,
|
|
31
|
+
segmentKey, skipFreeToday, templateDay, withFunLine, writeDay, writePlay, zonedNow,
|
|
32
32
|
} from './life/index.js';
|
|
33
33
|
import {
|
|
34
34
|
autoOutfit, clearWardrobeCache, emptyWardrobe, enrichItems, loadWardrobe,
|
|
@@ -330,6 +330,9 @@ export class FeastWorld {
|
|
|
330
330
|
/** 真实天气快照:同样同步读、tick 里异步刷新。envPromptVars() 绝不能联网。
|
|
331
331
|
* 取不到就一直是 EMPTY_WEATHER —— 「宁可不说天气,也绝不编一个」。 */
|
|
332
332
|
#weather = EMPTY_WEATHER;
|
|
333
|
+
/** 娱乐时间(cortico-world-fun)装没装并启用:叫醒事件拼例子时同步读,
|
|
334
|
+
* 所以和素材库、天气一样在 tick 里刷新成快照。没装/读不到一律 false。 */
|
|
335
|
+
#funInstalled = false;
|
|
333
336
|
/** 上次真正去取天气的时刻(ms):按 weatherRefreshMin 节流,别把接口当心跳打。 */
|
|
334
337
|
#weatherAt = 0;
|
|
335
338
|
/** 上次「重新想想」推给她的时间(按 date):连点不该连推,免得刷屏。 */
|
|
@@ -399,10 +402,10 @@ export class FeastWorld {
|
|
|
399
402
|
// 活对象同步一次:persist 会深合并进同一份 cfg,这里只是保险。
|
|
400
403
|
Object.assign(this.cfg, patch);
|
|
401
404
|
Object.assign(raw, patch);
|
|
402
|
-
this.#host?.log?.info?.('
|
|
405
|
+
this.#host?.log?.info?.('鱼的每一天:配置段补齐了缺失的键', { keys });
|
|
403
406
|
} catch (err) {
|
|
404
407
|
// 补不上就照默认值跑,功能不受影响,只是界面会继续显示错——记一条警告。
|
|
405
|
-
this.#host?.log?.warn?.('
|
|
408
|
+
this.#host?.log?.warn?.('鱼的每一天:配置段没补齐(界面可能显示和实际不一致)', { err: msg(err) });
|
|
406
409
|
}
|
|
407
410
|
}
|
|
408
411
|
|
|
@@ -505,6 +508,29 @@ export class FeastWorld {
|
|
|
505
508
|
&& this.cfg.weatherCity.trim().length > 0;
|
|
506
509
|
}
|
|
507
510
|
|
|
511
|
+
/** 娱乐时间联动总开关。关掉=不管装没装都不往「例子」里加那一行。 */
|
|
512
|
+
#funLinkOn() {
|
|
513
|
+
return this.#freeOn() && this.cfg?.lifeFreeFunOn !== false;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* 刷新「娱乐时间装没装并启用」的快照(tick 里调)。
|
|
518
|
+
*
|
|
519
|
+
* 为什么要快照:`freeEventText()` 是**同步**拼的(和 envPromptVars 同理),
|
|
520
|
+
* 没法在里面 await 读 config;而叫醒那一拍本来是异步的,顺手刷一次就够了。
|
|
521
|
+
*
|
|
522
|
+
* 读不到、没这个段、`enabled` 不是 true——一律 false,那一行整段不出现。
|
|
523
|
+
* 绝不抛错:联动没了不影响她的一天。
|
|
524
|
+
*/
|
|
525
|
+
async #refreshFunInstalled() {
|
|
526
|
+
if (!this.#funLinkOn()) { this.#funInstalled = false; return; }
|
|
527
|
+
try {
|
|
528
|
+
this.#funInstalled = await readFunEnabled(this.dataDir);
|
|
529
|
+
} catch {
|
|
530
|
+
this.#funInstalled = false;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
508
534
|
/**
|
|
509
535
|
* 刷新真实天气(tick 里调,按 weatherRefreshMin 节流)。
|
|
510
536
|
* fetchWeather 自己绝不抛错,这里也不额外抛:失败只是让快照停在「不提天气」。
|
|
@@ -577,7 +603,7 @@ export class FeastWorld {
|
|
|
577
603
|
feast_weather_block: weather,
|
|
578
604
|
};
|
|
579
605
|
} catch (err) {
|
|
580
|
-
this.#host?.log?.warn?.('
|
|
606
|
+
this.#host?.log?.warn?.('鱼的每一天:她的一天环境提示词算不出来', { err: msg(err) });
|
|
581
607
|
return { feast_life_block: '', feast_weather_block: weather };
|
|
582
608
|
}
|
|
583
609
|
}
|
|
@@ -621,7 +647,7 @@ export class FeastWorld {
|
|
|
621
647
|
case 'feast_life_adjust': return await this.#lifeAdjustTool(args);
|
|
622
648
|
case 'feast_life_play': return await this.#lifePlayTool(args);
|
|
623
649
|
case 'feast_life_skip': return await this.#lifeFreeSkipTool(args);
|
|
624
|
-
case 'feast_life_start': return this.#lifeFreeStartTool(args);
|
|
650
|
+
case 'feast_life_start': return await this.#lifeFreeStartTool(args);
|
|
625
651
|
default: return { text: `[${name} 失败] 不认识这个工具。`, failed: true };
|
|
626
652
|
}
|
|
627
653
|
}
|
|
@@ -745,7 +771,7 @@ export class FeastWorld {
|
|
|
745
771
|
tail.push(`(${hmIn(this.timezone, entry.at)} 吃掉的;端来时${shelfLifeText(left)}。)`);
|
|
746
772
|
}
|
|
747
773
|
|
|
748
|
-
this.#host?.log?.info?.('
|
|
774
|
+
this.#host?.log?.info?.('鱼的每一天:吃了一顿', { dish: dish.id, nth: nth + 1, by, miss });
|
|
749
775
|
return { text: [body, '', tail.join('')].join('\n') };
|
|
750
776
|
}
|
|
751
777
|
|
|
@@ -823,7 +849,7 @@ export class FeastWorld {
|
|
|
823
849
|
await this.#save();
|
|
824
850
|
|
|
825
851
|
const word = action === 'like' ? '合口味' : action === 'dislike' ? '不太对付' : '一般';
|
|
826
|
-
this.#host?.log?.info?.('
|
|
852
|
+
this.#host?.log?.info?.('鱼的每一天:记了一句反应', { dish: id, action });
|
|
827
853
|
return { text: `记下了:${entry.name || entry.id}——${word}${entry.note ? `,${entry.note}` : ''}。` };
|
|
828
854
|
}
|
|
829
855
|
|
|
@@ -834,7 +860,7 @@ export class FeastWorld {
|
|
|
834
860
|
skipToday(this.#state, day);
|
|
835
861
|
await this.#save();
|
|
836
862
|
const reason = typeof args.reason === 'string' && args.reason.trim() ? `(${args.reason.trim().slice(0, 80)})` : '';
|
|
837
|
-
this.#host?.log?.info?.('
|
|
863
|
+
this.#host?.log?.info?.('鱼的每一天:今天不吃', { reason });
|
|
838
864
|
return { text: `好,今天剩下的饭点不叫你了${reason}。主人端菜过来还是会告诉你;想吃随时自己来。` };
|
|
839
865
|
}
|
|
840
866
|
|
|
@@ -853,7 +879,7 @@ export class FeastWorld {
|
|
|
853
879
|
try {
|
|
854
880
|
await this.#refreshWeather(now);
|
|
855
881
|
} catch (err) {
|
|
856
|
-
this.#host?.log?.warn?.('
|
|
882
|
+
this.#host?.log?.warn?.('鱼的每一天:天气这一拍没刷成', { err: msg(err) });
|
|
857
883
|
}
|
|
858
884
|
// 「她的一天」必须在饭点判定之前跑:非饭点那一拍会 return,不能把它跳过去。
|
|
859
885
|
// 单独兜住异常,日程出问题不该连饭点也不叫了。
|
|
@@ -862,7 +888,7 @@ export class FeastWorld {
|
|
|
862
888
|
await this.#lifeMoment(now);
|
|
863
889
|
await this.#freeTick(now);
|
|
864
890
|
} catch (err) {
|
|
865
|
-
this.#host?.log?.warn?.('
|
|
891
|
+
this.#host?.log?.warn?.('鱼的每一天:她的一天这一拍没跑完', { err: msg(err) });
|
|
866
892
|
}
|
|
867
893
|
// 一起吃饭这一顿到点也自己散(面板没开着也得散)。
|
|
868
894
|
await this.#togetherSettle();
|
|
@@ -873,7 +899,7 @@ export class FeastWorld {
|
|
|
873
899
|
if (plan.action === 'drop') {
|
|
874
900
|
this.#state.pending = null;
|
|
875
901
|
await this.#save();
|
|
876
|
-
this.#host?.log?.info?.('
|
|
902
|
+
this.#host?.log?.info?.('鱼的每一天:放掉这一顿', { reason: plan.reason });
|
|
877
903
|
return;
|
|
878
904
|
}
|
|
879
905
|
|
|
@@ -881,12 +907,12 @@ export class FeastWorld {
|
|
|
881
907
|
await this.#pushMeal(plan);
|
|
882
908
|
} catch (err) {
|
|
883
909
|
// 发不出去就不记账,下一拍再试。
|
|
884
|
-
this.#host?.log?.warn?.('
|
|
910
|
+
this.#host?.log?.warn?.('鱼的每一天:叫饭失败', { err: msg(err) });
|
|
885
911
|
return;
|
|
886
912
|
}
|
|
887
913
|
markNudged(this.#state, now, plan.slot, plan.action === 'retry');
|
|
888
914
|
await this.#save();
|
|
889
|
-
this.#host?.log?.info?.('
|
|
915
|
+
this.#host?.log?.info?.('鱼的每一天:叫饭', {
|
|
890
916
|
slot: plan.slot,
|
|
891
917
|
retry: plan.action === 'retry',
|
|
892
918
|
...(plan.dropped ? { dropped: plan.dropped } : {}),
|
|
@@ -900,8 +926,8 @@ export class FeastWorld {
|
|
|
900
926
|
const state = this.#state;
|
|
901
927
|
|
|
902
928
|
const head = plan.action === 'retry'
|
|
903
|
-
?
|
|
904
|
-
:
|
|
929
|
+
? `【鱼的每一天 · 再问一句】${plan.slot} 那顿你还没吃。`
|
|
930
|
+
: `【鱼的每一天 · ${plan.slot}】到饭点了。不是主人找你,也不是待办,是你自己该吃了。`;
|
|
905
931
|
|
|
906
932
|
const lines = [head, `今天已经吃过:${eatenTodayText(state, this.timezone, now)}。`];
|
|
907
933
|
// 天气就在这一口旁边:外面大太阳就别端出一碗「下雨天」的话来。
|
|
@@ -986,7 +1012,7 @@ export class FeastWorld {
|
|
|
986
1012
|
throw new Error('宿主没有 pushEvent,端不过去');
|
|
987
1013
|
}
|
|
988
1014
|
|
|
989
|
-
this.#host?.log?.info?.('
|
|
1015
|
+
this.#host?.log?.info?.('鱼的每一天:主人端了一道菜', { dish: dish.id });
|
|
990
1016
|
return { ok: true, message: `端过去了:${dish.name}`, dish: this.#panelDish(dish), pending: this.#servedView() };
|
|
991
1017
|
}
|
|
992
1018
|
|
|
@@ -1038,7 +1064,7 @@ export class FeastWorld {
|
|
|
1038
1064
|
throw new Error('宿主没有 pushEvent,端不过去');
|
|
1039
1065
|
}
|
|
1040
1066
|
|
|
1041
|
-
this.#host?.log?.info?.('
|
|
1067
|
+
this.#host?.log?.info?.('鱼的每一天:主人端了一桌', { combo: combo?.id, n: dishes.length });
|
|
1042
1068
|
return {
|
|
1043
1069
|
ok: true,
|
|
1044
1070
|
message: `端过去了:${name}(${dishes.length} 道)`,
|
|
@@ -1131,7 +1157,7 @@ export class FeastWorld {
|
|
|
1131
1157
|
const ended = finishTogether(this.#state.together, { nowMs: this.#now(), why });
|
|
1132
1158
|
if (!ended) return null;
|
|
1133
1159
|
await this.#save();
|
|
1134
|
-
this.#host?.log?.info?.('
|
|
1160
|
+
this.#host?.log?.info?.('鱼的每一天:这一顿散了', { why, bites: ended.bites });
|
|
1135
1161
|
if (push) await this.#pushTogether(this.#endLines(ended), { kind: 'end', why });
|
|
1136
1162
|
return ended;
|
|
1137
1163
|
}
|
|
@@ -1178,7 +1204,7 @@ export class FeastWorld {
|
|
|
1178
1204
|
'他喂你一口、或者他自己吃了什么,都会告诉你。不想吃就直说——feast_skip 管的是饭点提醒,不管这个。',
|
|
1179
1205
|
], { kind: 'invite' });
|
|
1180
1206
|
|
|
1181
|
-
this.#host?.log?.info?.('
|
|
1207
|
+
this.#host?.log?.info?.('鱼的每一天:邀请她一起吃');
|
|
1182
1208
|
return { ok: true, message: '问她了:一起吃点?', together: this.#togetherView() };
|
|
1183
1209
|
}
|
|
1184
1210
|
|
|
@@ -1209,7 +1235,7 @@ export class FeastWorld {
|
|
|
1209
1235
|
this.#askReaction() ? '说一句这一口什么味儿——一句话就够。' : '',
|
|
1210
1236
|
], { kind: 'bite', dish: dish.id, name: dish.name });
|
|
1211
1237
|
|
|
1212
|
-
this.#host?.log?.info?.('
|
|
1238
|
+
this.#host?.log?.info?.('鱼的每一天:喂了她一口', { dish: dish.id, nth });
|
|
1213
1239
|
return { ok: true, message: `喂了一口:${dish.name}`, together: this.#togetherView() };
|
|
1214
1240
|
}
|
|
1215
1241
|
|
|
@@ -1256,7 +1282,7 @@ export class FeastWorld {
|
|
|
1256
1282
|
];
|
|
1257
1283
|
await this.#pushTogether(lines, { kind: 'owner-ate', ...(dish ? { dish: dish.id, name: dish.name } : {}) });
|
|
1258
1284
|
|
|
1259
|
-
this.#host?.log?.info?.('
|
|
1285
|
+
this.#host?.log?.info?.('鱼的每一天:主人也吃了点什么', { kind: entry.kind, matched });
|
|
1260
1286
|
const said = entry.kind === 'dish'
|
|
1261
1287
|
? (matched
|
|
1262
1288
|
? `记下了:你在吃${dish.name}——这句正好是库里那道,按它记了。`
|
|
@@ -1280,7 +1306,7 @@ export class FeastWorld {
|
|
|
1280
1306
|
'那就 feast_eat 吃起来(dish 留空就吃桌上还没吃的那道);也可以 feast_together(action 填 feed)分他一口。',
|
|
1281
1307
|
], { kind: 'invite', accepted: true });
|
|
1282
1308
|
|
|
1283
|
-
this.#host?.log?.info?.('
|
|
1309
|
+
this.#host?.log?.info?.('鱼的每一天:接住了一起吃的邀请');
|
|
1284
1310
|
return { ok: true, message: '应了:这顿一起吃。', together: this.#togetherView() };
|
|
1285
1311
|
}
|
|
1286
1312
|
|
|
@@ -1313,7 +1339,7 @@ export class FeastWorld {
|
|
|
1313
1339
|
'(大概是客气或者吃不下,不是不喜欢。别追问,也别往心里去。)',
|
|
1314
1340
|
], { kind: 'back', dish: g.id, name: g.name, accepted: ok === true });
|
|
1315
1341
|
|
|
1316
|
-
this.#host?.log?.info?.('
|
|
1342
|
+
this.#host?.log?.info?.('鱼的每一天:回喂的回应', { dish: g.id, accepted: ok === true });
|
|
1317
1343
|
return {
|
|
1318
1344
|
ok: true,
|
|
1319
1345
|
message: ok === true ? `记下了:他吃了${g.name || g.id}。` : '记下了:这次没要。',
|
|
@@ -1625,6 +1651,8 @@ export class FeastWorld {
|
|
|
1625
1651
|
if (!this.#lifeOn()) return;
|
|
1626
1652
|
// 先刷新素材库快照:envBlock / planEventText / enrichItems 都读它。缓存命中时只 stat。
|
|
1627
1653
|
await this.#refreshWardrobe();
|
|
1654
|
+
// 娱乐时间装没装:叫醒事件拼例子要用,顺手刷新(读不到就是没装)。
|
|
1655
|
+
await this.#refreshFunInstalled();
|
|
1628
1656
|
const z = zonedNow(this.timezone, now);
|
|
1629
1657
|
const today = await readDay(this.dataDir, z.date);
|
|
1630
1658
|
if (!today || today.source === 'pending' || !today.items.length) {
|
|
@@ -1892,7 +1920,7 @@ export class FeastWorld {
|
|
|
1892
1920
|
meta: { date: today.date, reason: 'adjust' },
|
|
1893
1921
|
}, { deliver: true, trigger: 'debounce' });
|
|
1894
1922
|
} catch (err) {
|
|
1895
|
-
this.#host?.log?.warn?.('
|
|
1923
|
+
this.#host?.log?.warn?.('鱼的每一天:改完日程后补的时段事件没发出去', { err: msg(err) });
|
|
1896
1924
|
}
|
|
1897
1925
|
}
|
|
1898
1926
|
|
|
@@ -1969,7 +1997,7 @@ export class FeastWorld {
|
|
|
1969
1997
|
if (plan.action === 'drop') {
|
|
1970
1998
|
play.pending = null;
|
|
1971
1999
|
await writePlay(this.dataDir, play);
|
|
1972
|
-
this.#host?.log?.info?.('
|
|
2000
|
+
this.#host?.log?.info?.('鱼的每一天:放掉这一档自己的时间', { reason: plan.reason });
|
|
1973
2001
|
return;
|
|
1974
2002
|
}
|
|
1975
2003
|
|
|
@@ -1984,7 +2012,7 @@ export class FeastWorld {
|
|
|
1984
2012
|
[plan.slot]: { at: now, doing: String(item.activity ?? '').slice(0, 40) },
|
|
1985
2013
|
};
|
|
1986
2014
|
await writePlay(this.dataDir, play);
|
|
1987
|
-
this.#host?.log?.info?.('
|
|
2015
|
+
this.#host?.log?.info?.('鱼的每一天:这一档不算她的自由时间', {
|
|
1988
2016
|
slot: plan.slot, doing: item.activity,
|
|
1989
2017
|
});
|
|
1990
2018
|
return;
|
|
@@ -1994,12 +2022,12 @@ export class FeastWorld {
|
|
|
1994
2022
|
await this.#pushFree(plan, play, now, Boolean(item && isFreeActivity(item)));
|
|
1995
2023
|
} catch (err) {
|
|
1996
2024
|
// 发不出去就不记账,下一拍再试。
|
|
1997
|
-
this.#host?.log?.warn?.('
|
|
2025
|
+
this.#host?.log?.warn?.('鱼的每一天:叫醒她过自己的时间失败', { err: msg(err) });
|
|
1998
2026
|
return;
|
|
1999
2027
|
}
|
|
2000
2028
|
markFreeNudged(play, now, plan.slot, plan.action === 'retry');
|
|
2001
2029
|
await writePlay(this.dataDir, play);
|
|
2002
|
-
this.#host?.log?.info?.('
|
|
2030
|
+
this.#host?.log?.info?.('鱼的每一天:她自己的时间', {
|
|
2003
2031
|
slot: plan.slot, retry: plan.action === 'retry', done: play.done.length,
|
|
2004
2032
|
});
|
|
2005
2033
|
}
|
|
@@ -2008,9 +2036,12 @@ export class FeastWorld {
|
|
|
2008
2036
|
const host = this.#host;
|
|
2009
2037
|
if (!host?.pushEvent) throw new Error('宿主没有 pushEvent');
|
|
2010
2038
|
const z = zonedNow(this.timezone, now);
|
|
2011
|
-
const
|
|
2039
|
+
const rawMenu = typeof this.cfg?.lifeFreeMenu === 'string' && this.cfg.lifeFreeMenu.trim()
|
|
2012
2040
|
? this.cfg.lifeFreeMenu.trim()
|
|
2013
2041
|
: String(DEFAULTS.lifeFreeMenu);
|
|
2042
|
+
// 娱乐时间装了才把「出门去逛逛」那一行接上去;关了开关、没装、或她自己抄过 fun_*
|
|
2043
|
+
// 都原样返回——绝不让她看到指向不存在工具的例子。
|
|
2044
|
+
const menu = withFunLine(rawMenu, this.#funInstalled, this.cfg);
|
|
2014
2045
|
await host.pushEvent({
|
|
2015
2046
|
type: EVENT_LIFE_FREE,
|
|
2016
2047
|
source: this.id,
|
|
@@ -2060,7 +2091,7 @@ export class FeastWorld {
|
|
|
2060
2091
|
await writePlay(this.dataDir, play);
|
|
2061
2092
|
const reason = typeof args?.reason === 'string' && args.reason.trim()
|
|
2062
2093
|
? `(${args.reason.trim().slice(0, 80)})` : '';
|
|
2063
|
-
this.#host?.log?.info?.('
|
|
2094
|
+
this.#host?.log?.info?.('鱼的每一天:今天不玩了', { reason });
|
|
2064
2095
|
return { text: `好,今天剩下的档不叫了${reason}。想玩随时可以自己来。` };
|
|
2065
2096
|
}
|
|
2066
2097
|
|
|
@@ -2070,15 +2101,19 @@ export class FeastWorld {
|
|
|
2070
2101
|
* 这是「想开始随时能开始」那个入口:跳过了今天也能用,做够数了也能用,
|
|
2071
2102
|
* 没到档也能用。只给例子和记账办法,不派任务。
|
|
2072
2103
|
*/
|
|
2073
|
-
#lifeFreeStartTool(args) {
|
|
2104
|
+
async #lifeFreeStartTool(args) {
|
|
2074
2105
|
if (!this.#freeOn()) return { text: '「她的一天」现在关着。', failed: true };
|
|
2075
2106
|
const now = this.#now();
|
|
2076
2107
|
const z = zonedNow(this.timezone, now);
|
|
2077
2108
|
const play = this.#play ?? newPlay(z.date);
|
|
2078
2109
|
const goal = Math.max(0, Math.min(12, Math.round(Number(this.cfg?.lifeFreeGoal ?? DEFAULTS.lifeFreeGoal) || 0)));
|
|
2079
|
-
const
|
|
2110
|
+
const rawMenu = typeof this.cfg?.lifeFreeMenu === 'string' && this.cfg.lifeFreeMenu.trim()
|
|
2080
2111
|
? this.cfg.lifeFreeMenu.trim()
|
|
2081
2112
|
: String(DEFAULTS.lifeFreeMenu);
|
|
2113
|
+
// 和叫醒事件同一条路径:装了娱乐时间才加那一行。这里是工具调用(异步),
|
|
2114
|
+
// 现读一次比等 tick 更稳——刚装完娱乐时间她就能看到它。
|
|
2115
|
+
await this.#refreshFunInstalled();
|
|
2116
|
+
const menu = withFunLine(rawMenu, this.#funInstalled, this.cfg);
|
|
2082
2117
|
const done = play.done.length;
|
|
2083
2118
|
const mood = typeof args?.mood === 'string' && args.mood.trim() ? `(${args.mood.trim().slice(0, 60)})` : '';
|
|
2084
2119
|
const wshort = weatherShort(this.#weather);
|
|
@@ -2106,7 +2141,7 @@ export class FeastWorld {
|
|
|
2106
2141
|
}
|
|
2107
2142
|
|
|
2108
2143
|
#ensureStarted() {
|
|
2109
|
-
if (!this.#started || !this.#state) throw new Error('
|
|
2144
|
+
if (!this.#started || !this.#state) throw new Error('鱼的每一天还没启动;等它启用后再试。');
|
|
2110
2145
|
}
|
|
2111
2146
|
|
|
2112
2147
|
// -------------------------------------------------------------------------
|
|
@@ -2197,13 +2232,13 @@ export class FeastWorld {
|
|
|
2197
2232
|
this.#lifeTomorrow = null;
|
|
2198
2233
|
this.#lifeSegment = null;
|
|
2199
2234
|
this.#play = null;
|
|
2200
|
-
this.#host?.log?.info?.('
|
|
2235
|
+
this.#host?.log?.info?.('鱼的每一天:她的一天已清空', { days: n, plays: p });
|
|
2201
2236
|
return `她的 ${n} 天日程${p ? `和 ${p} 天的自由时间记录` : ''}清了;吃过的记录、口味画像和主人攒的套餐都没动。`;
|
|
2202
2237
|
}
|
|
2203
2238
|
|
|
2204
2239
|
async #clearCombos() {
|
|
2205
2240
|
await this.#saveCombos([]);
|
|
2206
|
-
this.#host?.log?.info?.('
|
|
2241
|
+
this.#host?.log?.info?.('鱼的每一天:自定义套餐已清空');
|
|
2207
2242
|
return '主人攒的桌清了;内置的套餐和她吃过的记录都没动。';
|
|
2208
2243
|
}
|
|
2209
2244
|
|
|
@@ -2216,7 +2251,7 @@ export class FeastWorld {
|
|
|
2216
2251
|
fresh.skippedDay = this.#state?.skippedDay ?? '';
|
|
2217
2252
|
this.#state = fresh;
|
|
2218
2253
|
await this.#save();
|
|
2219
|
-
this.#host?.log?.info?.('
|
|
2254
|
+
this.#host?.log?.info?.('鱼的每一天:吃过的记录已清空');
|
|
2220
2255
|
return '吃过的记录清了;菜单、菜品库和主人攒的套餐都没动。';
|
|
2221
2256
|
}
|
|
2222
2257
|
|
|
@@ -2393,7 +2428,7 @@ export class FeastWorld {
|
|
|
2393
2428
|
const names = s.ids.map((id) => this.#lib.byId.get(id)?.name ?? id);
|
|
2394
2429
|
this.#state.served = null;
|
|
2395
2430
|
await this.#save();
|
|
2396
|
-
this.#host?.log?.info?.('
|
|
2431
|
+
this.#host?.log?.info?.('鱼的每一天:主人把端过去的菜收回去了', { ids: s.ids });
|
|
2397
2432
|
return {
|
|
2398
2433
|
ok: true,
|
|
2399
2434
|
message: `收回来了:${names.join('、')}`,
|
|
@@ -2524,7 +2559,7 @@ export class FeastWorld {
|
|
|
2524
2559
|
const play = await this.#freePlay(this.#now());
|
|
2525
2560
|
skipFreeToday(play);
|
|
2526
2561
|
await writePlay(this.dataDir, play);
|
|
2527
|
-
this.#host?.log?.info?.('
|
|
2562
|
+
this.#host?.log?.info?.('鱼的每一天:主人替她把今天剩下的档停了');
|
|
2528
2563
|
return { ok: true, message: '好了,今天剩下的档不叫了。她随时能自己动。' };
|
|
2529
2564
|
}
|
|
2530
2565
|
case 'freeStart': {
|
|
@@ -2533,9 +2568,12 @@ export class FeastWorld {
|
|
|
2533
2568
|
const now = this.#now();
|
|
2534
2569
|
const play = await this.#freePlay(now);
|
|
2535
2570
|
const goal = Math.max(0, Math.min(12, Math.round(Number(this.cfg?.lifeFreeGoal ?? DEFAULTS.lifeFreeGoal) || 0)));
|
|
2536
|
-
const
|
|
2571
|
+
const rawMenu = typeof this.cfg?.lifeFreeMenu === 'string' && this.cfg.lifeFreeMenu.trim()
|
|
2537
2572
|
? this.cfg.lifeFreeMenu.trim()
|
|
2538
2573
|
: String(DEFAULTS.lifeFreeMenu);
|
|
2574
|
+
// 面板这条通道也不等 tick:现读一次再拼,免得刚装完娱乐时间这里还没刷新。
|
|
2575
|
+
await this.#refreshFunInstalled();
|
|
2576
|
+
const menu = withFunLine(rawMenu, this.#funInstalled, this.cfg);
|
|
2539
2577
|
const wshort = weatherShort(this.#weather);
|
|
2540
2578
|
const whint = weatherFreeHint(this.#weather?.ok ? this.#weather.kind : null);
|
|
2541
2579
|
await this.#host?.pushEvent?.({
|
|
@@ -2545,7 +2583,7 @@ export class FeastWorld {
|
|
|
2545
2583
|
origin: 'internal',
|
|
2546
2584
|
ts: new Date(now).toISOString(),
|
|
2547
2585
|
text: [
|
|
2548
|
-
'
|
|
2586
|
+
'【鱼的每一天 · 你自己的时间】主人说,这会儿你想干点什么就去吧。',
|
|
2549
2587
|
`今天已经记了 ${play.done.length} 件${goal > 0 ? `(到 ${goal} 件只是不再按点叫你,不是上限)` : ''}。`,
|
|
2550
2588
|
...(wshort ? [`外面这会儿:${wshort}。`] : []),
|
|
2551
2589
|
'想做什么都行,下面只是个例子,不照着也行:',
|
|
@@ -2592,7 +2630,7 @@ export class FeastWorld {
|
|
|
2592
2630
|
}
|
|
2593
2631
|
}
|
|
2594
2632
|
|
|
2595
|
-
throw new Error(
|
|
2633
|
+
throw new Error(`鱼的每一天没有这个面板:${panel}`);
|
|
2596
2634
|
}
|
|
2597
2635
|
|
|
2598
2636
|
// -------------------------------------------------------------------------
|
|
@@ -2614,22 +2652,29 @@ export class FeastWorld {
|
|
|
2614
2652
|
// 自由时间的记录也先读进来:状态行和面板要用,别等到第一拍 tick 才读。
|
|
2615
2653
|
await this.#freePlay(this.#now());
|
|
2616
2654
|
} catch (err) {
|
|
2617
|
-
host?.log?.warn?.('
|
|
2655
|
+
host?.log?.warn?.('鱼的每一天:她的一天没读进来', { err: msg(err) });
|
|
2656
|
+
}
|
|
2657
|
+
// 娱乐时间装没装也先看一次:feast_life_start 是同步工具,等不到 tick 那一拍。
|
|
2658
|
+
// 「她的一天」关着时 #lifeEnsure 会提前 return,所以这里单独补一次。
|
|
2659
|
+
try {
|
|
2660
|
+
await this.#refreshFunInstalled();
|
|
2661
|
+
} catch (err) {
|
|
2662
|
+
host?.log?.warn?.('鱼的每一天:娱乐时间联动没读到', { err: msg(err) });
|
|
2618
2663
|
}
|
|
2619
2664
|
// 启动就先取一次真实天气:envPromptVars() 是同步的,前缀重建时得有内存快照可读。
|
|
2620
2665
|
// 取不到就保持「不提天气」,下一拍 tick 再试。
|
|
2621
2666
|
try {
|
|
2622
2667
|
await this.#refreshWeather(this.#now());
|
|
2623
2668
|
} catch (err) {
|
|
2624
|
-
host?.log?.warn?.('
|
|
2669
|
+
host?.log?.warn?.('鱼的每一天:启动时天气没取到', { err: msg(err) });
|
|
2625
2670
|
}
|
|
2626
|
-
host?.log?.info?.('
|
|
2671
|
+
host?.log?.info?.('鱼的每一天已启动', {
|
|
2627
2672
|
dishes: this.#lib.dishes.length,
|
|
2628
2673
|
cuisines: this.#lib.cuisines.length,
|
|
2629
2674
|
bad: this.#lib.bad,
|
|
2630
2675
|
eaten: this.#state.eaten.length,
|
|
2631
2676
|
});
|
|
2632
|
-
if (this.#lib.bad) host?.log?.warn?.(
|
|
2677
|
+
if (this.#lib.bad) host?.log?.warn?.(`鱼的每一天:跳过了 ${this.#lib.bad} 条坏数据`);
|
|
2633
2678
|
|
|
2634
2679
|
// 启动后先看一拍(应用可能刚过饭点),之后按 tickSec 看表。
|
|
2635
2680
|
this.#timer = this.#setInterval(() => { void this.#serial(() => this.#tick()); }, this.#tickMs());
|