lingshu-skill 5.71.0 → 5.73.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/CHANGELOG.md +23 -0
- package/SKILL-lite.md +1 -1
- package/SKILL-tiny.md +1 -1
- package/SKILL.md +1 -1
- package/manifest.json +18 -14
- package/package.json +3 -2
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +8 -7
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +23 -0
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/autotag.py +82 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/dream.py +6 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/memory.py +18 -5
- package/scripts/astrbot_plugin_lingshu/engine/scripts/persona.py +40 -23
- package/scripts/autotag.py +82 -0
- package/scripts/dream.py +6 -1
- package/scripts/memory.py +18 -5
- package/scripts/persona.py +40 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## v5.73(2026-12-05)
|
|
4
|
+
|
|
5
|
+
### 🎭 性格展示去标签化与演化语义明确
|
|
6
|
+
|
|
7
|
+
用户反馈:性格不要写"初识时用户指定"——性格本身就是可以变动的(幅度小)。
|
|
8
|
+
|
|
9
|
+
1. **性格来源标签去除**:自我描述不再显示"初识时用户指定/用户手动调整/做梦整理"等模板话——只写当前值("性格:好奇80;理智70;内驱 好奇89/理智80")。仅当 why 是真实行为依据(如"连续三周主动复盘")且 ≤12 字时才显示。
|
|
10
|
+
2. **演化语义明确**:人格自检加一句"性格会随相处缓慢微变,但别自改它——演化走做梦提议通道",让 AI 知道性格不是死值也不是自己能随手改的。
|
|
11
|
+
3. **演化体系调研结论**(已有机制确认):做梦提议 ±10 倾向 → 漂移账本累计满 ±5 才兑现(EMA 60%)→ 30 天半衰期向基线回归 → 持续偏离每次沉淀 15% 进基线。单次变动天然受限、一次性事件自动回落、长期趋势才真改——正是"变动范围不大"的设计。
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## v5.72(2026-12-05)
|
|
16
|
+
|
|
17
|
+
### 🪄 发布自动化与注入瘦身
|
|
18
|
+
|
|
19
|
+
1. **AUTOTAG(postpublish 自动打 tag)**:新增 `scripts/autotag.py` 并挂到 npm `postpublish`——`npm publish` 成功后自动创建 `vX.Y` 标签并推送 GitHub+Gitee(指数退避重试),GitHub Actions 随即创建 Release,插件市场版本说明自动更新。修复"npm 发了新版但市场永远停在旧版"(v5.34-v5.71 无 tag 导致)。
|
|
20
|
+
2. **人格注入瘦身·性格内驱合并**:自我描述从两行合并为一行「性格:好奇80—来源;理智70—来源;内驱 好奇89/理智80」,砍掉"(0-100,数值来自…真实发生过的事)"和"理智先算值不值得深想…"两段每轮重复的固定说明;来源 why 超过 12 字截断。
|
|
21
|
+
3. **人格注入瘦身·画像截断**:擅长/短板/没弄清的每条分别截到 80/80/60 字(实测短板单条 300+ 字、三条 900+ 字),教训正文截到 160 字、砍掉"置信度 0.50 已验证 0 次"这类零信息注脚(只保留已验证 ≥1 次的)。
|
|
22
|
+
4. **人格演化提示强化**:做梦 apply_schema 的 persona_updates 增加显式指引——likes/dislikes 填本批记忆里新出现的稳定偏好/反感(带证据),traits 填 -10~10 倾向微调,宁缺勿滥。配合既有漂移双门限(TRAIT_DRIFT_GATE)机制,喜欢/讨厌/性格将随相处真实演化而非停在初识值。
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
3
26
|
## v5.71(2026-12-05)
|
|
4
27
|
|
|
5
28
|
### 🎉 150 项审计最终批:全量缺口大收官!
|
package/SKILL-lite.md
CHANGED
package/SKILL-tiny.md
CHANGED
package/SKILL.md
CHANGED
package/manifest.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.
|
|
2
|
+
"version": "5.73",
|
|
3
3
|
"files": {
|
|
4
4
|
"CHANGELOG.md": {
|
|
5
|
-
"sha256": "
|
|
6
|
-
"size":
|
|
5
|
+
"sha256": "006b0f94c387674058eeb0e3d8b1a3fdfbe1ce9f2f09213f93c3f18c57932434",
|
|
6
|
+
"size": 445615
|
|
7
7
|
},
|
|
8
8
|
"README.md": {
|
|
9
9
|
"sha256": "5ab87b76dc757e6edd6ef1d760e9a979e55df48b2b8c2b76552747fabb7b1026",
|
|
10
10
|
"size": 114306
|
|
11
11
|
},
|
|
12
12
|
"SKILL-lite.md": {
|
|
13
|
-
"sha256": "
|
|
13
|
+
"sha256": "4f663fb492789b040f3980ef656dd8d3647cc2374b5ba0a0ce1507a117ba1bf1",
|
|
14
14
|
"size": 4440
|
|
15
15
|
},
|
|
16
16
|
"SKILL-tiny.md": {
|
|
17
|
-
"sha256": "
|
|
17
|
+
"sha256": "113f69c9ef47fce797addcba30dcb970e0626c737d2beff7a264314070631bea",
|
|
18
18
|
"size": 1913
|
|
19
19
|
},
|
|
20
20
|
"SKILL.md": {
|
|
21
|
-
"sha256": "
|
|
21
|
+
"sha256": "97a4c338965ea5768d5ac02dd5508bb2d4d7c7cdd86ab70144fa865076145f7c",
|
|
22
22
|
"size": 25366
|
|
23
23
|
},
|
|
24
24
|
"assets/lingshu-icon-preview.png": {
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
"size": 6007
|
|
139
139
|
},
|
|
140
140
|
"package.json": {
|
|
141
|
-
"sha256": "
|
|
142
|
-
"size":
|
|
141
|
+
"sha256": "059b91172f8bd8509a58cfffa5247f894895d6287214d2362e62406bdba77fce",
|
|
142
|
+
"size": 1551
|
|
143
143
|
},
|
|
144
144
|
"scripts/anchor_retention.py": {
|
|
145
145
|
"sha256": "327862125cbe9b1c5aaaf14f0b9334031f0906c5c10b15367af53bfe3f905d16",
|
|
@@ -153,6 +153,10 @@
|
|
|
153
153
|
"sha256": "60bbb5ebe238d54f9f4bdecbbf0e24cfa9793102b6f1f734e796560786482205",
|
|
154
154
|
"size": 8774
|
|
155
155
|
},
|
|
156
|
+
"scripts/autotag.py": {
|
|
157
|
+
"sha256": "9e4575fa321b255aaeaf87dc63e576308144e84a892fe8a764f5edadf62d9c93",
|
|
158
|
+
"size": 3153
|
|
159
|
+
},
|
|
156
160
|
"scripts/behavior_baseline.py": {
|
|
157
161
|
"sha256": "7f488663082f301426c98f291a31860dd159a6097eba6ff225e4912f1b222272",
|
|
158
162
|
"size": 14343
|
|
@@ -214,8 +218,8 @@
|
|
|
214
218
|
"size": 8071
|
|
215
219
|
},
|
|
216
220
|
"scripts/dream.py": {
|
|
217
|
-
"sha256": "
|
|
218
|
-
"size":
|
|
221
|
+
"sha256": "e8a9961fd7daf860aabc2b34d396ae00d01138a736e8b50c3a0287ee4c3c28dd",
|
|
222
|
+
"size": 64703
|
|
219
223
|
},
|
|
220
224
|
"scripts/emotion.py": {
|
|
221
225
|
"sha256": "e0b4451e05e99dd651c79b9d927191d963824012e7b03aba933d92e111368965",
|
|
@@ -298,8 +302,8 @@
|
|
|
298
302
|
"size": 7912
|
|
299
303
|
},
|
|
300
304
|
"scripts/memory.py": {
|
|
301
|
-
"sha256": "
|
|
302
|
-
"size":
|
|
305
|
+
"sha256": "c98aee6a8b087f4f1d3bed3057e86aa1709468a97aea3a54804dfa499b7fa183",
|
|
306
|
+
"size": 339452
|
|
303
307
|
},
|
|
304
308
|
"scripts/memory_extras.py": {
|
|
305
309
|
"sha256": "4adb61400c5224c90aa54f059267f795c6348a251d93cd173d79fff157d57d90",
|
|
@@ -358,8 +362,8 @@
|
|
|
358
362
|
"size": 27795
|
|
359
363
|
},
|
|
360
364
|
"scripts/persona.py": {
|
|
361
|
-
"sha256": "
|
|
362
|
-
"size":
|
|
365
|
+
"sha256": "b44f65b65aacf9a683127d2ba4ec3951df7f5ede765941490894f3bb2a4223e2",
|
|
366
|
+
"size": 135570
|
|
363
367
|
},
|
|
364
368
|
"scripts/prepublish_tests.py": {
|
|
365
369
|
"sha256": "8d116de1edd3ab57584a6a2749598cf127e918383da67e50118601e5a3970c2a",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lingshu-skill",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.73.0",
|
|
4
4
|
"description": "Brain-inspired persistent memory, persona and growth system for AI coding agents. Local-only, zero-dependency Python. Requires Python 3.10+.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"!scripts/astrbot_plugin_lingshu/engine/scripts/_*"
|
|
32
32
|
],
|
|
33
33
|
"scripts": {
|
|
34
|
-
"prepack": "python scripts/npm_prepack.py"
|
|
34
|
+
"prepack": "python scripts/npm_prepack.py",
|
|
35
|
+
"postpublish": "python scripts/autotag.py"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
38
|
"@deepseek-ai/cordis": "^0.2.0-rc.1 || ^0.2.1-alpha.3 || ^0.2.1-rc.1 || ^0.2.1-rc.2 || ^0.2.1-rc.3"
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"PATCH_NOTES.md": "9296e524f743f358fd11115598398a754cfd69534526dde9c8ad85f14a418f89",
|
|
3
3
|
"README.md": "3d634d743b085eebd2cbb5dd3a00edfa728ed23947e20cc29e7c3b29087ec043",
|
|
4
4
|
"_conf_schema.json": "51a484cfa04a686bc923e960f5937e19eb52bb329a937050c268ad1cc5c12170",
|
|
5
|
-
"engine/CHANGELOG.md": "
|
|
5
|
+
"engine/CHANGELOG.md": "006b0f94c387674058eeb0e3d8b1a3fdfbe1ce9f2f09213f93c3f18c57932434",
|
|
6
6
|
"engine/README.md": "5ab87b76dc757e6edd6ef1d760e9a979e55df48b2b8c2b76552747fabb7b1026",
|
|
7
|
-
"engine/SKILL-lite.md": "
|
|
8
|
-
"engine/SKILL-tiny.md": "
|
|
9
|
-
"engine/SKILL.md": "
|
|
7
|
+
"engine/SKILL-lite.md": "051d13bc0aa88585d110c2ece82e4364d105f0294f1eca1cad008aa26e29858d",
|
|
8
|
+
"engine/SKILL-tiny.md": "a9d7baaf82aa2b4bace154fe3768dfbdab8f6ef31e7ccb7c5bbc386a4db5efa6",
|
|
9
|
+
"engine/SKILL.md": "97a4c338965ea5768d5ac02dd5508bb2d4d7c7cdd86ab70144fa865076145f7c",
|
|
10
10
|
"engine/assets/panel.html": "7b8f3c1d595e14a06e266ea89c90620f3ce2223c2af2a089e407df734df28e17",
|
|
11
11
|
"engine/docs/commands.md": "0ce8c88e5d2d04a8055b45c060ebd53b50c52b79b650312e2ee440845804ca4b",
|
|
12
12
|
"engine/docs/mechanics.md": "aa9683c827ed3419106e84d847ab16dc310c27fc62f588184192aaa1617523cc",
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"engine/scripts/anchor_retention.py": "327862125cbe9b1c5aaaf14f0b9334031f0906c5c10b15367af53bfe3f905d16",
|
|
88
88
|
"engine/scripts/app_context.py": "1541a133d5381e21b30f5e856869c6a170add9e20f8792cf049f2acca6da86c6",
|
|
89
89
|
"engine/scripts/assembler.py": "60bbb5ebe238d54f9f4bdecbbf0e24cfa9793102b6f1f734e796560786482205",
|
|
90
|
+
"engine/scripts/autotag.py": "9e4575fa321b255aaeaf87dc63e576308144e84a892fe8a764f5edadf62d9c93",
|
|
90
91
|
"engine/scripts/behavior_baseline.py": "7f488663082f301426c98f291a31860dd159a6097eba6ff225e4912f1b222272",
|
|
91
92
|
"engine/scripts/bench.py": "7e410bb94a93c8e0b4fd8187ede7a3f7f6cf171e43a2884a836b6734e23e9dc0",
|
|
92
93
|
"engine/scripts/bigfive.py": "d998558c73584ebdd0b2535e687b4f8af25437bdadec229f7d0bad090ed482bb",
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
"engine/scripts/coverage_report.py": "53e1c731f4182fac68190d68d23459bcd8059c0b39ebc5a4ba0e56a0d562ad01",
|
|
102
103
|
"engine/scripts/delivery.py": "6a4bf2caac9dca41b43c06d31f7cfc328bae19d3fb618da26b35f1a214071a11",
|
|
103
104
|
"engine/scripts/desktop_shortcut.py": "975b76d49c9d6b3220f7d45327e801a5d8c74aff39eae2e3fbdf86b38c7994cc",
|
|
104
|
-
"engine/scripts/dream.py": "
|
|
105
|
+
"engine/scripts/dream.py": "e8a9961fd7daf860aabc2b34d396ae00d01138a736e8b50c3a0287ee4c3c28dd",
|
|
105
106
|
"engine/scripts/emotion.py": "e0b4451e05e99dd651c79b9d927191d963824012e7b03aba933d92e111368965",
|
|
106
107
|
"engine/scripts/failures.py": "3a16234a1871f62e3ba7b7b743110b4044fb7b715b4d0e924b8ebf1cf0be50d0",
|
|
107
108
|
"engine/scripts/fallback_embed.py": "11339a9f5040aea8952fdd45f4183cdfb0f00266ff61e200f3b4e8a62778f6e0",
|
|
@@ -118,7 +119,7 @@
|
|
|
118
119
|
"engine/scripts/mem_lesson.py": "e1520786315f3e41c829909c739e5af3eee89397da7db5026d106710b2b3c118",
|
|
119
120
|
"engine/scripts/mem_score.py": "91148eb50058c47a6094a6cd5e0eb9c3e3331cb0dc0ecb05a82d00905d2e9d90",
|
|
120
121
|
"engine/scripts/mem_topic.py": "c22f75c128cdd3b26ff845f1a71608401bc0dc8955f9f0e1988d7f0cd663d0d5",
|
|
121
|
-
"engine/scripts/memory.py": "
|
|
122
|
+
"engine/scripts/memory.py": "c98aee6a8b087f4f1d3bed3057e86aa1709468a97aea3a54804dfa499b7fa183",
|
|
122
123
|
"engine/scripts/memory_extras.py": "4adb61400c5224c90aa54f059267f795c6348a251d93cd173d79fff157d57d90",
|
|
123
124
|
"engine/scripts/npm_prepack.py": "d62c491a6f9edfcab2dd465a995e72df879a61b4da26ae0fe76121c8adc77e02",
|
|
124
125
|
"engine/scripts/occ.py": "4caac0d72ce071ea224ce2dc7d346effdbff8a516e3e7b54118a3be3ed274256",
|
|
@@ -133,7 +134,7 @@
|
|
|
133
134
|
"engine/scripts/panel_splash.py": "36cd59e593ce52557a180a8767bfa9cd9c803f0cccaa141e7da8babd5a35e925",
|
|
134
135
|
"engine/scripts/panel_update.py": "b6256af938fec44e7e0c0073d7ed3f2b50487f6d52cea5772fe175d222b09f0d",
|
|
135
136
|
"engine/scripts/panels.py": "3000f170d42c0e200dd82ed12e8da8b4c62e0e3e1e47f232f3272a798078f59d",
|
|
136
|
-
"engine/scripts/persona.py": "
|
|
137
|
+
"engine/scripts/persona.py": "b44f65b65aacf9a683127d2ba4ec3951df7f5ede765941490894f3bb2a4223e2",
|
|
137
138
|
"engine/scripts/prepublish_tests.py": "8d116de1edd3ab57584a6a2749598cf127e918383da67e50118601e5a3970c2a",
|
|
138
139
|
"engine/scripts/release.py": "36491d76fdd76693c164e441f70ac063a4c4b10c2e36eed06d705f57f55895b6",
|
|
139
140
|
"engine/scripts/retriever.py": "208b58f4df062bca859eef607e258cc4233791552454fdd3a02051a18f7e0786",
|
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## v5.73(2026-12-05)
|
|
4
|
+
|
|
5
|
+
### 🎭 性格展示去标签化与演化语义明确
|
|
6
|
+
|
|
7
|
+
用户反馈:性格不要写"初识时用户指定"——性格本身就是可以变动的(幅度小)。
|
|
8
|
+
|
|
9
|
+
1. **性格来源标签去除**:自我描述不再显示"初识时用户指定/用户手动调整/做梦整理"等模板话——只写当前值("性格:好奇80;理智70;内驱 好奇89/理智80")。仅当 why 是真实行为依据(如"连续三周主动复盘")且 ≤12 字时才显示。
|
|
10
|
+
2. **演化语义明确**:人格自检加一句"性格会随相处缓慢微变,但别自改它——演化走做梦提议通道",让 AI 知道性格不是死值也不是自己能随手改的。
|
|
11
|
+
3. **演化体系调研结论**(已有机制确认):做梦提议 ±10 倾向 → 漂移账本累计满 ±5 才兑现(EMA 60%)→ 30 天半衰期向基线回归 → 持续偏离每次沉淀 15% 进基线。单次变动天然受限、一次性事件自动回落、长期趋势才真改——正是"变动范围不大"的设计。
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## v5.72(2026-12-05)
|
|
16
|
+
|
|
17
|
+
### 🪄 发布自动化与注入瘦身
|
|
18
|
+
|
|
19
|
+
1. **AUTOTAG(postpublish 自动打 tag)**:新增 `scripts/autotag.py` 并挂到 npm `postpublish`——`npm publish` 成功后自动创建 `vX.Y` 标签并推送 GitHub+Gitee(指数退避重试),GitHub Actions 随即创建 Release,插件市场版本说明自动更新。修复"npm 发了新版但市场永远停在旧版"(v5.34-v5.71 无 tag 导致)。
|
|
20
|
+
2. **人格注入瘦身·性格内驱合并**:自我描述从两行合并为一行「性格:好奇80—来源;理智70—来源;内驱 好奇89/理智80」,砍掉"(0-100,数值来自…真实发生过的事)"和"理智先算值不值得深想…"两段每轮重复的固定说明;来源 why 超过 12 字截断。
|
|
21
|
+
3. **人格注入瘦身·画像截断**:擅长/短板/没弄清的每条分别截到 80/80/60 字(实测短板单条 300+ 字、三条 900+ 字),教训正文截到 160 字、砍掉"置信度 0.50 已验证 0 次"这类零信息注脚(只保留已验证 ≥1 次的)。
|
|
22
|
+
4. **人格演化提示强化**:做梦 apply_schema 的 persona_updates 增加显式指引——likes/dislikes 填本批记忆里新出现的稳定偏好/反感(带证据),traits 填 -10~10 倾向微调,宁缺勿滥。配合既有漂移双门限(TRAIT_DRIFT_GATE)机制,喜欢/讨厌/性格将随相处真实演化而非停在初识值。
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
3
26
|
## v5.71(2026-12-05)
|
|
4
27
|
|
|
5
28
|
### 🎉 150 项审计最终批:全量缺口大收官!
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""npm postpublish 自动打 tag 并推送(插件市场依赖 GitHub Release 更新版本说明)。
|
|
4
|
+
|
|
5
|
+
背景(2026-12-05 事故):插件市场的「版本说明」读的是 GitHub Release,而 Release
|
|
6
|
+
只由 .github/workflows/release.yml 在**推送 tag** 时触发创建。v5.34-v5.71 从没
|
|
7
|
+
打过 tag,导致 npm 一直发新版、市场却永远停在旧版。
|
|
8
|
+
|
|
9
|
+
用法:package.json 里配
|
|
10
|
+
"scripts": { "postpublish": "python scripts/autotag.py" }
|
|
11
|
+
npm publish 成功后自动执行:本地缺 tag 则补打,并推送 origin(GitHub)与 gitee。
|
|
12
|
+
GitHub 网络不稳时按退避重试;全程失败不阻断(tag 已在本地,下次可手推)。
|
|
13
|
+
"""
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
import time
|
|
17
|
+
import re
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def cur_version() -> str:
|
|
24
|
+
t = (ROOT / "SKILL.md").read_text(encoding="utf-8-sig")
|
|
25
|
+
m = re.search(r"^version:\s*([\d.]+)", t, re.M)
|
|
26
|
+
return m.group(1) if m else ""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def run(cmd: list, timeout: int = 60) -> tuple[int, str]:
|
|
30
|
+
try:
|
|
31
|
+
r = subprocess.run(cmd, cwd=ROOT, capture_output=True, text=True,
|
|
32
|
+
encoding="utf-8", errors="replace", timeout=timeout)
|
|
33
|
+
return r.returncode, ((r.stdout or "") + (r.stderr or ""))
|
|
34
|
+
except Exception as exc:
|
|
35
|
+
return 1, str(exc)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def main() -> int:
|
|
39
|
+
ver = cur_version()
|
|
40
|
+
if not ver:
|
|
41
|
+
print("[autotag] SKILL.md 读不出 version,跳过", file=sys.stderr)
|
|
42
|
+
return 0
|
|
43
|
+
tag = f"v{ver}"
|
|
44
|
+
# ① 本地已有 → 只补推;没有 → 创建 annotated tag
|
|
45
|
+
rc, out = run(["git", "rev-parse", tag])
|
|
46
|
+
if rc != 0:
|
|
47
|
+
rc, out = run(["git", "tag", "-a", tag,
|
|
48
|
+
"-m", f"lingshu {tag}: auto-tagged by npm postpublish"])
|
|
49
|
+
if rc != 0:
|
|
50
|
+
print(f"[autotag] 创建 tag {tag} 失败:{out[:200]}", file=sys.stderr)
|
|
51
|
+
return 1
|
|
52
|
+
print(f"[autotag] 已创建本地 tag {tag}")
|
|
53
|
+
else:
|
|
54
|
+
print(f"[autotag] 本地 tag {tag} 已存在,只补推")
|
|
55
|
+
# ② 推送到两个远端(GitHub 网络不稳:指数退避重试,最多 4 次)
|
|
56
|
+
ok = []
|
|
57
|
+
for remote in ("origin", "gitee"):
|
|
58
|
+
pushed = False
|
|
59
|
+
for attempt in range(4):
|
|
60
|
+
rc, out = run(["git", "push", remote, tag], timeout=90)
|
|
61
|
+
if rc == 0:
|
|
62
|
+
pushed = True
|
|
63
|
+
break
|
|
64
|
+
wait = 8 * (attempt + 1)
|
|
65
|
+
print(f"[autotag] push {remote} 第 {attempt + 1} 次失败,{wait}s 后重试:"
|
|
66
|
+
f"{out.strip()[-120:]}", file=sys.stderr)
|
|
67
|
+
time.sleep(wait)
|
|
68
|
+
if pushed:
|
|
69
|
+
ok.append(remote)
|
|
70
|
+
else:
|
|
71
|
+
print(f"[autotag] tag {tag} 推送 {remote} 全部重试失败——"
|
|
72
|
+
f"tag 留在本地,网络恢复后手推:git push {remote} {tag}",
|
|
73
|
+
file=sys.stderr)
|
|
74
|
+
if ok:
|
|
75
|
+
print(f"[autotag] tag {tag} 已推送:{', '.join(ok)}"
|
|
76
|
+
f"(GitHub Actions 将自动创建 Release,市场版本说明随之更新)")
|
|
77
|
+
return 0
|
|
78
|
+
return 1
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
sys.exit(main())
|
|
@@ -766,7 +766,12 @@ def dream(trigger: str = "manual", dry_run: bool = False) -> dict:
|
|
|
766
766
|
"persona_updates": {"mood": {"value": "这次聊完的情绪", "reason": "..."},
|
|
767
767
|
"traits": {"幽默": 2},
|
|
768
768
|
"habits": [{"name": "深夜更容易说真话", "evidence": "..."}],
|
|
769
|
-
"likes": [], "dislikes": [], "insights": []
|
|
769
|
+
"likes": [], "dislikes": [], "insights": [],
|
|
770
|
+
"_prompt": "人格要随相处慢慢长:likes/dislikes 填这批记忆里"
|
|
771
|
+
"新出现的、稳定的用户偏好或反感(带证据 source_ids);"
|
|
772
|
+
"traits 填 -10~10 的倾向微调(如 {\"好奇\": 2});"
|
|
773
|
+
"insights 填对自己���新认识。只在确有多条一致证据时提,"
|
|
774
|
+
"宁缺勿滥。"},
|
|
770
775
|
"forget": ["m_..."],
|
|
771
776
|
"narrative": "这次梦的叙述(可选)",
|
|
772
777
|
},
|
|
@@ -4421,16 +4421,25 @@ def render_prior(p: dict, budget_chars: int = 1400) -> str:
|
|
|
4421
4421
|
|
|
4422
4422
|
|
|
4423
4423
|
def _lessons_injection(query: str = "") -> str:
|
|
4424
|
-
"""注入包小节:active 教训按 confidence 注入,命中 query 的排最前并标「已有教训」。
|
|
4424
|
+
"""注入包小节:active 教训按 confidence 注入,命中 query 的排最前并标「已有教训」。
|
|
4425
|
+
|
|
4426
|
+
TOKEN-TRIM(v5.72):教训正文可能把"被取代历史"整段带进来(错误闭环会把
|
|
4427
|
+
新旧结论一起写进 text),注入时截断到前 160 字符——教训是拿来用的提醒,
|
|
4428
|
+
不是完整调查报告;置信度注脚只在已验证 ≥1 次时才显示(0 次的注脚没信息量)。
|
|
4429
|
+
"""
|
|
4425
4430
|
ls = injectable_lessons(query, k=5)
|
|
4426
4431
|
if not ls:
|
|
4427
4432
|
return ""
|
|
4428
4433
|
lines = []
|
|
4429
4434
|
for l in ls:
|
|
4430
4435
|
mark = "已有教训" if query and l.get("_hit") else "教训"
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4436
|
+
_txt = str(l.get("text") or "").strip()
|
|
4437
|
+
if len(_txt) > 160:
|
|
4438
|
+
_txt = _txt[:160].rstrip() + "…"
|
|
4439
|
+
_v = int(_num(l.get("times_validated"), 0))
|
|
4440
|
+
conf = f"(已验证{_v}次)" if _v >= 1 else ""
|
|
4441
|
+
lines.append(f"- [{mark}] {_txt}{conf}")
|
|
4442
|
+
return "\n## 教训(先看坑再用)\n" + "\n".join(lines)
|
|
4434
4443
|
|
|
4435
4444
|
|
|
4436
4445
|
# ---------------------------------------------------------------- 记忆关联(联想能力)
|
|
@@ -6337,9 +6346,13 @@ def build_injection(query: str = "", budget_tokens: int | None = None,
|
|
|
6337
6346
|
_parts.append("讨厌 " + "、".join(_dk))
|
|
6338
6347
|
# v3.57 高压档省略:人格自检是防漂移的"复读提醒",紧张时先让位;
|
|
6339
6348
|
# 人格本体(我是谁)始终保留,不会因此变成另一个人。
|
|
6349
|
+
# USER-FEEDBACK(v5.73):性格自检加一句"缓变"语义——性格随相处
|
|
6350
|
+
# 缓慢演化(漂移双门限+基线沉淀,单次小幅),不是写死的初始值;
|
|
6351
|
+
# 也不提示 AI 主动改它(演化走做梦提议+漂移账本,不自发改)。
|
|
6340
6352
|
if _parts and _p_tier != "minimal":
|
|
6341
6353
|
out.append("[人格自检] 你还是那个" + str(_pself.get("name") or "灵枢") + ":"
|
|
6342
|
-
+ ";".join(_parts) + "。语气与判断与它保持一致,别越聊越走样。"
|
|
6354
|
+
+ ";".join(_parts) + "。语气与判断与它保持一致,别越聊越走样。"
|
|
6355
|
+
"(性格会随相处缓慢微变,但别自改它——演化走做梦提议通道。)")
|
|
6343
6356
|
except Exception:
|
|
6344
6357
|
pass
|
|
6345
6358
|
# B4(借鉴 QQ「大肥鱼」):周期性语气提示——从**近期对话**提炼,每 6 小时一次。
|
|
@@ -653,39 +653,46 @@ def persona_brief(p: dict, mood: bool = True) -> str:
|
|
|
653
653
|
if ident.get("自称"):
|
|
654
654
|
lines.append(f"我自称:{ident['自称']};称呼对方:{ident.get('称呼你') or ident.get('称呼用户') or '你'}。")
|
|
655
655
|
traits = p.get("traits", {})
|
|
656
|
+
drives = p.get("drives") or {}
|
|
657
|
+
# 与 mind_state() 同一套兜底:traits 已有数值而 drives 还空时,别在自我
|
|
658
|
+
# 描述里一边「性格:好奇85」一边「内驱:还没有数值」——自相矛盾每轮被读。
|
|
659
|
+
if drives.get("curiosity") is None and drives.get("reason") is None:
|
|
660
|
+
_t = p.get("traits") or {}
|
|
661
|
+
if _t.get("好奇") is not None or _t.get("理智") is not None:
|
|
662
|
+
drives = {"curiosity": trait_value(_t["好奇"]) if _t.get("好奇") is not None else None,
|
|
663
|
+
"reason": trait_value(_t["理智"]) if _t.get("理智") is not None else None}
|
|
656
664
|
if traits:
|
|
657
|
-
#
|
|
665
|
+
# TOKEN-TRIM(v5.72):性格+内驱合并成一行、砍掉长解释。
|
|
666
|
+
# USER-FEEDBACK(v5.73):不显示"初识时用户指定"这类来源标签——性格
|
|
667
|
+
# 本身就是随相处缓慢变动的(漂移双门限+基线沉淀),把初识话术写在
|
|
668
|
+
# 注入里反而暗示"这是初始值不该动"。只写当前值;why 仅在是**真实
|
|
669
|
+
# 行为依据**(非模板话)时显示。
|
|
670
|
+
_TEMPLATE_WHY = ("初识时用户指定", "初识时 ai 自定", "用户手动调整",
|
|
671
|
+
"数值沿用初识时的设定", "做梦整理", "")
|
|
658
672
|
top = sorted(traits.items(), key=lambda x: trait_value(x[1]), reverse=True)
|
|
659
673
|
tb = p.get("traits_baseline") if isinstance(p.get("traits_baseline"), dict) else {}
|
|
660
674
|
parts = []
|
|
661
675
|
for k, v in top[:3]:
|
|
662
676
|
meta = trait_meta(v)
|
|
663
|
-
# 五-F:离基线够远时标一句,模型知道"这不是我本来的样子,会慢慢回落"
|
|
664
677
|
b = tb.get(k)
|
|
665
678
|
bv = _trait_int(b.get("value")) if isinstance(b, dict) else None
|
|
666
|
-
gap = "" if bv is None or abs(trait_value(v) - bv) < 15 else f"
|
|
667
|
-
|
|
668
|
-
|
|
679
|
+
gap = "" if bv is None or abs(trait_value(v) - bv) < 15 else f"(基线{bv})"
|
|
680
|
+
_why = (meta.get("why") or "").strip()
|
|
681
|
+
if _why.lower() in _TEMPLATE_WHY or len(_why) > 12:
|
|
682
|
+
_why = "" # 模板话/超长一律不注入,只留真实短依据
|
|
683
|
+
parts.append(f"{k}{trait_value(v):.0f}{gap}" + (f"—{_why}" if _why else ""))
|
|
684
|
+
line = "性格:" + ";".join(parts)
|
|
669
685
|
low = [(k, v) for k, v in top[-2:] if trait_value(v) < 50]
|
|
670
686
|
if low:
|
|
671
687
|
lows = "、".join(f"{k}{trait_value(v):.0f}" for k, v in low)
|
|
672
688
|
line += f";偏低:{lows}"
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
# 描述里一边「性格:好奇85」一边「内驱:还没有数值」——自相矛盾每轮被读。
|
|
679
|
-
if drives.get("curiosity") is None and drives.get("reason") is None:
|
|
680
|
-
_t = p.get("traits") or {}
|
|
681
|
-
if _t.get("好奇") is not None or _t.get("理智") is not None:
|
|
682
|
-
drives = {"curiosity": trait_value(_t["好奇"]) if _t.get("好奇") is not None else None,
|
|
683
|
-
"reason": trait_value(_t["理智"]) if _t.get("理智") is not None else None}
|
|
684
|
-
if drives.get("curiosity") is not None or drives.get("reason") is not None:
|
|
685
|
-
lines.append(f"我的内驱:好奇心 {drives.get('curiosity', '未成形')} / 理智 {drives.get('reason', '未成形')}"
|
|
686
|
-
"(理智先算值不值得深想,好奇心负责找新问题)。")
|
|
689
|
+
# 内驱与性格同源时合并展示,避免"好奇80 / 好奇心88"两行并排的观感重复
|
|
690
|
+
_cur, _rea = drives.get("curiosity"), drives.get("reason")
|
|
691
|
+
if isinstance(_cur, (int, float)) and isinstance(_rea, (int, float)):
|
|
692
|
+
line += f";内驱 好奇{_cur:.0f}/理智{_rea:.0f}"
|
|
693
|
+
lines.append(line + "。")
|
|
687
694
|
else:
|
|
688
|
-
lines.append("
|
|
695
|
+
lines.append("性格:还没有。等初识时问用户,用户不知道就由我自己定。")
|
|
689
696
|
if p.get("style"):
|
|
690
697
|
lines.append("我说话的方式:" + ";".join(p["style"][:5]) + "。")
|
|
691
698
|
if p.get("values"):
|
|
@@ -712,11 +719,21 @@ def persona_brief(p: dict, mood: bool = True) -> str:
|
|
|
712
719
|
# 自认识概览:擅长/短板/还没弄清——只在自己真的积累了认知时才说,空块不出声
|
|
713
720
|
sm = p.get("self_model") if isinstance(p.get("self_model"), dict) else {}
|
|
714
721
|
if sm.get("strengths"):
|
|
715
|
-
|
|
722
|
+
_st = [s[:80].rstrip() + "…" if len(s) > 80 else s
|
|
723
|
+
for s in sm["strengths"][:3]]
|
|
724
|
+
lines.append("我擅长的:" + "、".join(_st) + "。")
|
|
716
725
|
if sm.get("limitations"):
|
|
717
|
-
|
|
726
|
+
# TOKEN-TRIM(v5.72):limitations 单条截到 80 字——短板是提醒不是报告,
|
|
727
|
+
# 实测单条 300+ 字、三条合计 900+ 字,占注入预算显著一块。
|
|
728
|
+
_lm = [s[:80].rstrip() + "…" if len(s) > 80 else s
|
|
729
|
+
for s in sm["limitations"][:3]]
|
|
730
|
+
lines.append("我的短板:" + "、".join(_lm) + "。")
|
|
718
731
|
if sm.get("uncertainties"):
|
|
719
|
-
|
|
732
|
+
# TOKEN-TRIM(v5.72):uncertainties 单条截到 60 字——这是"待验证清单",
|
|
733
|
+
# 不是全文回忆;太长会把注入预算吃光(实测单条 140+ 字、两条 300+ 字)。
|
|
734
|
+
_unc = [u[:60].rstrip() + "…" if len(u) > 60 else u
|
|
735
|
+
for u in sm["uncertainties"][:2]]
|
|
736
|
+
lines.append("我还没弄清的:" + "、".join(_unc) + "。")
|
|
720
737
|
return "\n".join(lines)
|
|
721
738
|
|
|
722
739
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""npm postpublish 自动打 tag 并推送(插件市场依赖 GitHub Release 更新版本说明)。
|
|
4
|
+
|
|
5
|
+
背景(2026-12-05 事故):插件市场的「版本说明」读的是 GitHub Release,而 Release
|
|
6
|
+
只由 .github/workflows/release.yml 在**推送 tag** 时触发创建。v5.34-v5.71 从没
|
|
7
|
+
打过 tag,导致 npm 一直发新版、市场却永远停在旧版。
|
|
8
|
+
|
|
9
|
+
用法:package.json 里配
|
|
10
|
+
"scripts": { "postpublish": "python scripts/autotag.py" }
|
|
11
|
+
npm publish 成功后自动执行:本地缺 tag 则补打,并推送 origin(GitHub)与 gitee。
|
|
12
|
+
GitHub 网络不稳时按退避重试;全程失败不阻断(tag 已在本地,下次可手推)。
|
|
13
|
+
"""
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
import time
|
|
17
|
+
import re
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def cur_version() -> str:
|
|
24
|
+
t = (ROOT / "SKILL.md").read_text(encoding="utf-8-sig")
|
|
25
|
+
m = re.search(r"^version:\s*([\d.]+)", t, re.M)
|
|
26
|
+
return m.group(1) if m else ""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def run(cmd: list, timeout: int = 60) -> tuple[int, str]:
|
|
30
|
+
try:
|
|
31
|
+
r = subprocess.run(cmd, cwd=ROOT, capture_output=True, text=True,
|
|
32
|
+
encoding="utf-8", errors="replace", timeout=timeout)
|
|
33
|
+
return r.returncode, ((r.stdout or "") + (r.stderr or ""))
|
|
34
|
+
except Exception as exc:
|
|
35
|
+
return 1, str(exc)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def main() -> int:
|
|
39
|
+
ver = cur_version()
|
|
40
|
+
if not ver:
|
|
41
|
+
print("[autotag] SKILL.md 读不出 version,跳过", file=sys.stderr)
|
|
42
|
+
return 0
|
|
43
|
+
tag = f"v{ver}"
|
|
44
|
+
# ① 本地已有 → 只补推;没有 → 创建 annotated tag
|
|
45
|
+
rc, out = run(["git", "rev-parse", tag])
|
|
46
|
+
if rc != 0:
|
|
47
|
+
rc, out = run(["git", "tag", "-a", tag,
|
|
48
|
+
"-m", f"lingshu {tag}: auto-tagged by npm postpublish"])
|
|
49
|
+
if rc != 0:
|
|
50
|
+
print(f"[autotag] 创建 tag {tag} 失败:{out[:200]}", file=sys.stderr)
|
|
51
|
+
return 1
|
|
52
|
+
print(f"[autotag] 已创建本地 tag {tag}")
|
|
53
|
+
else:
|
|
54
|
+
print(f"[autotag] 本地 tag {tag} 已存在,只补推")
|
|
55
|
+
# ② 推送到两个远端(GitHub 网络不稳:指数退避重试,最多 4 次)
|
|
56
|
+
ok = []
|
|
57
|
+
for remote in ("origin", "gitee"):
|
|
58
|
+
pushed = False
|
|
59
|
+
for attempt in range(4):
|
|
60
|
+
rc, out = run(["git", "push", remote, tag], timeout=90)
|
|
61
|
+
if rc == 0:
|
|
62
|
+
pushed = True
|
|
63
|
+
break
|
|
64
|
+
wait = 8 * (attempt + 1)
|
|
65
|
+
print(f"[autotag] push {remote} 第 {attempt + 1} 次失败,{wait}s 后重试:"
|
|
66
|
+
f"{out.strip()[-120:]}", file=sys.stderr)
|
|
67
|
+
time.sleep(wait)
|
|
68
|
+
if pushed:
|
|
69
|
+
ok.append(remote)
|
|
70
|
+
else:
|
|
71
|
+
print(f"[autotag] tag {tag} 推送 {remote} 全部重试失败——"
|
|
72
|
+
f"tag 留在本地,网络恢复后手推:git push {remote} {tag}",
|
|
73
|
+
file=sys.stderr)
|
|
74
|
+
if ok:
|
|
75
|
+
print(f"[autotag] tag {tag} 已推送:{', '.join(ok)}"
|
|
76
|
+
f"(GitHub Actions 将自动创建 Release,市场版本说明随之更新)")
|
|
77
|
+
return 0
|
|
78
|
+
return 1
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
sys.exit(main())
|
package/scripts/dream.py
CHANGED
|
@@ -766,7 +766,12 @@ def dream(trigger: str = "manual", dry_run: bool = False) -> dict:
|
|
|
766
766
|
"persona_updates": {"mood": {"value": "这次聊完的情绪", "reason": "..."},
|
|
767
767
|
"traits": {"幽默": 2},
|
|
768
768
|
"habits": [{"name": "深夜更容易说真话", "evidence": "..."}],
|
|
769
|
-
"likes": [], "dislikes": [], "insights": []
|
|
769
|
+
"likes": [], "dislikes": [], "insights": [],
|
|
770
|
+
"_prompt": "人格要随相处慢慢长:likes/dislikes 填这批记忆里"
|
|
771
|
+
"新出现的、稳定的用户偏好或反感(带证据 source_ids);"
|
|
772
|
+
"traits 填 -10~10 的倾向微调(如 {\"好奇\": 2});"
|
|
773
|
+
"insights 填对自己���新认识。只在确有多条一致证据时提,"
|
|
774
|
+
"宁缺勿滥。"},
|
|
770
775
|
"forget": ["m_..."],
|
|
771
776
|
"narrative": "这次梦的叙述(可选)",
|
|
772
777
|
},
|
package/scripts/memory.py
CHANGED
|
@@ -4421,16 +4421,25 @@ def render_prior(p: dict, budget_chars: int = 1400) -> str:
|
|
|
4421
4421
|
|
|
4422
4422
|
|
|
4423
4423
|
def _lessons_injection(query: str = "") -> str:
|
|
4424
|
-
"""注入包小节:active 教训按 confidence 注入,命中 query 的排最前并标「已有教训」。
|
|
4424
|
+
"""注入包小节:active 教训按 confidence 注入,命中 query 的排最前并标「已有教训」。
|
|
4425
|
+
|
|
4426
|
+
TOKEN-TRIM(v5.72):教训正文可能把"被取代历史"整段带进来(错误闭环会把
|
|
4427
|
+
新旧结论一起写进 text),注入时截断到前 160 字符——教训是拿来用的提醒,
|
|
4428
|
+
不是完整调查报告;置信度注脚只在已验证 ≥1 次时才显示(0 次的注脚没信息量)。
|
|
4429
|
+
"""
|
|
4425
4430
|
ls = injectable_lessons(query, k=5)
|
|
4426
4431
|
if not ls:
|
|
4427
4432
|
return ""
|
|
4428
4433
|
lines = []
|
|
4429
4434
|
for l in ls:
|
|
4430
4435
|
mark = "已有教训" if query and l.get("_hit") else "教训"
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4436
|
+
_txt = str(l.get("text") or "").strip()
|
|
4437
|
+
if len(_txt) > 160:
|
|
4438
|
+
_txt = _txt[:160].rstrip() + "…"
|
|
4439
|
+
_v = int(_num(l.get("times_validated"), 0))
|
|
4440
|
+
conf = f"(已验证{_v}次)" if _v >= 1 else ""
|
|
4441
|
+
lines.append(f"- [{mark}] {_txt}{conf}")
|
|
4442
|
+
return "\n## 教训(先看坑再用)\n" + "\n".join(lines)
|
|
4434
4443
|
|
|
4435
4444
|
|
|
4436
4445
|
# ---------------------------------------------------------------- 记忆关联(联想能力)
|
|
@@ -6337,9 +6346,13 @@ def build_injection(query: str = "", budget_tokens: int | None = None,
|
|
|
6337
6346
|
_parts.append("讨厌 " + "、".join(_dk))
|
|
6338
6347
|
# v3.57 高压档省略:人格自检是防漂移的"复读提醒",紧张时先让位;
|
|
6339
6348
|
# 人格本体(我是谁)始终保留,不会因此变成另一个人。
|
|
6349
|
+
# USER-FEEDBACK(v5.73):性格自检加一句"缓变"语义——性格随相处
|
|
6350
|
+
# 缓慢演化(漂移双门限+基线沉淀,单次小幅),不是写死的初始值;
|
|
6351
|
+
# 也不提示 AI 主动改它(演化走做梦提议+漂移账本,不自发改)。
|
|
6340
6352
|
if _parts and _p_tier != "minimal":
|
|
6341
6353
|
out.append("[人格自检] 你还是那个" + str(_pself.get("name") or "灵枢") + ":"
|
|
6342
|
-
+ ";".join(_parts) + "。语气与判断与它保持一致,别越聊越走样。"
|
|
6354
|
+
+ ";".join(_parts) + "。语气与判断与它保持一致,别越聊越走样。"
|
|
6355
|
+
"(性格会随相处缓慢微变,但别自改它——演化走做梦提议通道。)")
|
|
6343
6356
|
except Exception:
|
|
6344
6357
|
pass
|
|
6345
6358
|
# B4(借鉴 QQ「大肥鱼」):周期性语气提示——从**近期对话**提炼,每 6 小时一次。
|
package/scripts/persona.py
CHANGED
|
@@ -653,39 +653,46 @@ def persona_brief(p: dict, mood: bool = True) -> str:
|
|
|
653
653
|
if ident.get("自称"):
|
|
654
654
|
lines.append(f"我自称:{ident['自称']};称呼对方:{ident.get('称呼你') or ident.get('称呼用户') or '你'}。")
|
|
655
655
|
traits = p.get("traits", {})
|
|
656
|
+
drives = p.get("drives") or {}
|
|
657
|
+
# 与 mind_state() 同一套兜底:traits 已有数值而 drives 还空时,别在自我
|
|
658
|
+
# 描述里一边「性格:好奇85」一边「内驱:还没有数值」——自相矛盾每轮被读。
|
|
659
|
+
if drives.get("curiosity") is None and drives.get("reason") is None:
|
|
660
|
+
_t = p.get("traits") or {}
|
|
661
|
+
if _t.get("好奇") is not None or _t.get("理智") is not None:
|
|
662
|
+
drives = {"curiosity": trait_value(_t["好奇"]) if _t.get("好奇") is not None else None,
|
|
663
|
+
"reason": trait_value(_t["理智"]) if _t.get("理智") is not None else None}
|
|
656
664
|
if traits:
|
|
657
|
-
#
|
|
665
|
+
# TOKEN-TRIM(v5.72):性格+内驱合并成一行、砍掉长解释。
|
|
666
|
+
# USER-FEEDBACK(v5.73):不显示"初识时用户指定"这类来源标签——性格
|
|
667
|
+
# 本身就是随相处缓慢变动的(漂移双门限+基线沉淀),把初识话术写在
|
|
668
|
+
# 注入里反而暗示"这是初始值不该动"。只写当前值;why 仅在是**真实
|
|
669
|
+
# 行为依据**(非模板话)时显示。
|
|
670
|
+
_TEMPLATE_WHY = ("初识时用户指定", "初识时 ai 自定", "用户手动调整",
|
|
671
|
+
"数值沿用初识时的设定", "做梦整理", "")
|
|
658
672
|
top = sorted(traits.items(), key=lambda x: trait_value(x[1]), reverse=True)
|
|
659
673
|
tb = p.get("traits_baseline") if isinstance(p.get("traits_baseline"), dict) else {}
|
|
660
674
|
parts = []
|
|
661
675
|
for k, v in top[:3]:
|
|
662
676
|
meta = trait_meta(v)
|
|
663
|
-
# 五-F:离基线够远时标一句,模型知道"这不是我本来的样子,会慢慢回落"
|
|
664
677
|
b = tb.get(k)
|
|
665
678
|
bv = _trait_int(b.get("value")) if isinstance(b, dict) else None
|
|
666
|
-
gap = "" if bv is None or abs(trait_value(v) - bv) < 15 else f"
|
|
667
|
-
|
|
668
|
-
|
|
679
|
+
gap = "" if bv is None or abs(trait_value(v) - bv) < 15 else f"(基线{bv})"
|
|
680
|
+
_why = (meta.get("why") or "").strip()
|
|
681
|
+
if _why.lower() in _TEMPLATE_WHY or len(_why) > 12:
|
|
682
|
+
_why = "" # 模板话/超长一律不注入,只留真实短依据
|
|
683
|
+
parts.append(f"{k}{trait_value(v):.0f}{gap}" + (f"—{_why}" if _why else ""))
|
|
684
|
+
line = "性格:" + ";".join(parts)
|
|
669
685
|
low = [(k, v) for k, v in top[-2:] if trait_value(v) < 50]
|
|
670
686
|
if low:
|
|
671
687
|
lows = "、".join(f"{k}{trait_value(v):.0f}" for k, v in low)
|
|
672
688
|
line += f";偏低:{lows}"
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
# 描述里一边「性格:好奇85」一边「内驱:还没有数值」——自相矛盾每轮被读。
|
|
679
|
-
if drives.get("curiosity") is None and drives.get("reason") is None:
|
|
680
|
-
_t = p.get("traits") or {}
|
|
681
|
-
if _t.get("好奇") is not None or _t.get("理智") is not None:
|
|
682
|
-
drives = {"curiosity": trait_value(_t["好奇"]) if _t.get("好奇") is not None else None,
|
|
683
|
-
"reason": trait_value(_t["理智"]) if _t.get("理智") is not None else None}
|
|
684
|
-
if drives.get("curiosity") is not None or drives.get("reason") is not None:
|
|
685
|
-
lines.append(f"我的内驱:好奇心 {drives.get('curiosity', '未成形')} / 理智 {drives.get('reason', '未成形')}"
|
|
686
|
-
"(理智先算值不值得深想,好奇心负责找新问题)。")
|
|
689
|
+
# 内驱与性格同源时合并展示,避免"好奇80 / 好奇心88"两行并排的观感重复
|
|
690
|
+
_cur, _rea = drives.get("curiosity"), drives.get("reason")
|
|
691
|
+
if isinstance(_cur, (int, float)) and isinstance(_rea, (int, float)):
|
|
692
|
+
line += f";内驱 好奇{_cur:.0f}/理智{_rea:.0f}"
|
|
693
|
+
lines.append(line + "。")
|
|
687
694
|
else:
|
|
688
|
-
lines.append("
|
|
695
|
+
lines.append("性格:还没有。等初识时问用户,用户不知道就由我自己定。")
|
|
689
696
|
if p.get("style"):
|
|
690
697
|
lines.append("我说话的方式:" + ";".join(p["style"][:5]) + "。")
|
|
691
698
|
if p.get("values"):
|
|
@@ -712,11 +719,21 @@ def persona_brief(p: dict, mood: bool = True) -> str:
|
|
|
712
719
|
# 自认识概览:擅长/短板/还没弄清——只在自己真的积累了认知时才说,空块不出声
|
|
713
720
|
sm = p.get("self_model") if isinstance(p.get("self_model"), dict) else {}
|
|
714
721
|
if sm.get("strengths"):
|
|
715
|
-
|
|
722
|
+
_st = [s[:80].rstrip() + "…" if len(s) > 80 else s
|
|
723
|
+
for s in sm["strengths"][:3]]
|
|
724
|
+
lines.append("我擅长的:" + "、".join(_st) + "。")
|
|
716
725
|
if sm.get("limitations"):
|
|
717
|
-
|
|
726
|
+
# TOKEN-TRIM(v5.72):limitations 单条截到 80 字——短板是提醒不是报告,
|
|
727
|
+
# 实测单条 300+ 字、三条合计 900+ 字,占注入预算显著一块。
|
|
728
|
+
_lm = [s[:80].rstrip() + "…" if len(s) > 80 else s
|
|
729
|
+
for s in sm["limitations"][:3]]
|
|
730
|
+
lines.append("我的短板:" + "、".join(_lm) + "。")
|
|
718
731
|
if sm.get("uncertainties"):
|
|
719
|
-
|
|
732
|
+
# TOKEN-TRIM(v5.72):uncertainties 单条截到 60 字——这是"待验证清单",
|
|
733
|
+
# 不是全文回忆;太长会把注入预算吃光(实测单条 140+ 字、两条 300+ 字)。
|
|
734
|
+
_unc = [u[:60].rstrip() + "…" if len(u) > 60 else u
|
|
735
|
+
for u in sm["uncertainties"][:2]]
|
|
736
|
+
lines.append("我还没弄清的:" + "、".join(_unc) + "。")
|
|
720
737
|
return "\n".join(lines)
|
|
721
738
|
|
|
722
739
|
|