dsh-agent-soul 0.10.0 → 0.10.1

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 CHANGED
@@ -7,6 +7,37 @@
7
7
 
8
8
  ---
9
9
 
10
+ ## 0.10.1 · 2026-11-21
11
+
12
+ ### 变更 · 摘录退出上下文
13
+
14
+ 0.10.0 把摘录接进了「最近」这一段(第一轮注入:最近 3 天、每篇 3 条)。用了一天就发现**它和记忆重复**:
15
+
16
+ ```
17
+ 摘录:- 对方讲了单树见月的设定:双人格互补不对抗,记忆共享
18
+ 记忆卡:〔事实〕「单树见月」是树树构思的双人格:单树与见月互补不对抗,共享一个身体
19
+ ```
20
+
21
+ 同一件事,两边各存一份;再叠上「今天到目前为止」的流水,等于说三遍。
22
+
23
+ **定下的口径:摘录只是日志 —— 给人翻,不给模型读。**
24
+
25
+ - 摘录**不再进上下文**:`inject.js` 的「前几天的摘录」整段删除;
26
+ - 配置键 `memoryRecentDiaryDays` 随之删除(`DEFAULT_CONFIG` / `NUMBER_RANGES` 两处),
27
+ 留着只会让人以为它还有用;
28
+ - 「最近」这一段现在只剩今天的流水(`memoryRecentChatChars`);
29
+ - **生成时**仍会把前几天的摘录喂给模型(`compose.js` 里那段「前几天写过什么,不要重复写」),
30
+ 那是为了防止同一件事被反复记,跟注入是两回事;
31
+ - 设置页的「摘录」标签保留 —— 它是这些日志唯一的查看入口,但纯只读,不参与注入。
32
+
33
+ ### 为什么不是直接删掉摘录
34
+
35
+ 记忆会**挑**也会**忘**:只记「值得记」的,而且随时间衰减。
36
+ 摘录不挑、不忘、按天排。它现在的角色是**日志**:那天到底干了什么,翻得到。
37
+ 把「那天的事」写进提示词是记忆该干的活,两者分工不同。
38
+
39
+ ---
40
+
10
41
  ## 0.10.0 · 2026-11-21
11
42
 
12
43
  **日记 → 摘录。** 这一天不再写「一篇公开 + 一篇私密」,只写一篇**事实条目**:
package/README.md CHANGED
@@ -165,24 +165,21 @@
165
165
  新会话第一轮,除了记忆卡,还会带上:
166
166
 
167
167
  ```
168
- ### 前几天的摘录(每篇最多 3 条;全文在 agents/diary/excerpt/<日期>.md)
169
- 2026-11-19:
170
- - 树树:把记忆卡的召回上限从 6 调到 3
171
- - 插件:修了设置页保存后其他标签页不刷新的问题
172
- 2026-11-20:
173
- - 灵魂插件:日记改成「摘录」,去掉公开/私密两篇
174
- - 复变:确认下周四考试,定了每天两小时
175
-
176
168
  ### 今天到目前为止(可能来自别的对话)
177
169
  [14:20] 树树:……
178
170
  [14:21] 我:……
179
171
  ```
180
172
 
181
- **为什么需要**:人不会在一个对话里做完所有事 —— 修插件、QQ 聊天、闲聊是分开的会话。记忆卡只有零碎事实,摘录只写到昨天,所以新开一个对话时她不知道今天早些时候在别的对话里做过什么。
173
+ **为什么需要**:人不会在一个对话里做完所有事 —— 修插件、QQ 聊天、闲聊是分开的会话。记忆卡只有零碎事实,所以新开一个对话时她不知道今天早些时候在别的对话里做过什么。
174
+
175
+ 数据来源是 `conversations/<今天>.jsonl` —— 这个流水本来就是**所有会话共同汇总**的。
182
176
 
183
- 数据来源是 `conversations/<今天>.jsonl` —— 这个流水本来就是**所有会话共同汇总**的(原来只用来生成摘录,从没读回过会话)。
177
+ 配置 `memoryRecentChatChars` 控制注入字数,设 0 关闭。
184
178
 
185
- 配置 `memoryRecentDiaryDays` / `memoryRecentChatChars` 控制,设 0 关闭;摘录侧最多读最近 3 天,每篇只取前 3 条。
179
+ > **摘录不在这条通路上**(2026-11-21 定)。摘录是**日志**:给人翻,不给模型读。
180
+ > 原因很实际 —— 摘录里「对方讲了某某设定」这种条目,记忆卡里本来就有一条一模一样的事实,
181
+ > 再叠上今天的流水,等于同一件事说三遍。记忆回答「他是什么样的人」,摘录回答「那天干了什么」,
182
+ > 后者只躺在 `agents/diary/excerpt/` 里,设置页能翻,不进上下文。
186
183
 
187
184
  ---
188
185
 
@@ -526,7 +523,6 @@ DSH 按 4 字符/token 粗算,中文真实是它的 1.4~1.9 倍。
526
523
  | `globalPromoteImportance` | `62` | 自动记忆双写进全局卡的门槛(关于主人本人 + 重要度 ≥ 此值) |
527
524
  | `memoryRefine` | `true` | 自动提取时先让模型提炼(关掉 = 原话直存,会变流水账) |
528
525
  | `memoryRefineProvider` / `memoryRefineModel` | `""` | 提炼用的模型(空 = 跟随会话模型) |
529
- | `memoryRecentDiaryDays` | `2` | 第一轮带几天摘录(最多 3 天,每篇最多 3 条;0 = 关) |
530
526
  | `memoryRecentChatChars` | `3000` | 第一轮带多少字今天流水(0 = 关) |
531
527
  | `purposeEnabled` | `true` | 是否注入「心里惦记的事」 |
532
528
  | `notesEnabled` | `true` | 是否把笔记索引注入提示词(关掉之后她不知道自己写过什么,但文件还在) |
@@ -5,7 +5,7 @@
5
5
  import { trimMap } from '../../core/lru.js'
6
6
  import { ECHO_LINE_MAX_CHARS, ECHO_SECTION_MAX_CHARS, RECALL_SEEN_MAX } from '../meta.js'
7
7
  import { cardsFor, loadConfig, moodState } from '../../store.js'
8
- import { readRecentChat, readRecentExcerpts, renderRecentExcerpts, todayKey } from '../../diary.js'
8
+ import { readRecentChat, todayKey } from '../../diary.js'
9
9
  import { hasHumanInputThisTurn } from './turns.js'
10
10
  import { isSubagentSession } from '../../extract.js'
11
11
  import { note } from '../../env.js'
@@ -62,34 +62,26 @@ export function renderEchoSection(items) {
62
62
  * 日记又只写到「昨天」。所以新开一个对话时,她不知道今天早些时候
63
63
  * 在别的对话里做过什么,也不知道昨天具体是怎么过的。
64
64
  *
65
- * 这里并两块:
66
- * ① 前几天的摘录(事实条目,接得上「昨天我们干了什么」)
67
- * ② 今天到目前为止的流水(conversations/<今天>.jsonl 是所有会话汇总的)
65
+ * 这里只剩一块:
66
+ * 今天到目前为止的流水(conversations/<今天>.jsonl 是所有会话汇总的)
68
67
  *
69
68
  * 只在第一轮注入,不每轮重复。
70
69
  *
71
- * 2026-11-21 / 0.10.0:原来的「前几天的日记」整段换成「前几天的摘录」——
72
- * 最近 3 天、每篇最多 3 行。摘录是事实条目,整篇喂进去没有额外价值,
73
- * 而它每轮都在注入预算里(0.10.0 之前这里贴的是 300 字/篇的摘要)。
70
+ * 2026-11-21 / 0.10.1:**摘录不再进上下文**。
71
+ * 原来这里并两块(前几天摘录 + 今天的流水),但摘录和记忆卡重复得厉害:
72
+ * 摘录里「对方讲了某某设定」这种条目,记忆卡里本来就有一条一模一样的事实,
73
+ * 而上下文里还有今天的流水 —— 三份东西讲同一件事,白烧 token。
74
+ * 定下的口径:**摘录只是日志,给人翻,不给模型读。**
75
+ * 记忆回答「他是什么样的人」,摘录回答「那天干了什么」,后者不进提示词。
74
76
  *
75
77
  * @returns {string} 空串 = 没有可注入的内容
76
78
  */
77
79
  export function renderRecentSection(cfg) {
78
80
  try {
79
- const days = Number(cfg.memoryRecentDiaryDays)
80
81
  const chatChars = Number(cfg.memoryRecentChatChars)
81
82
  const today = todayKey(Date.now())
82
83
  const parts = []
83
84
 
84
- if (Number.isFinite(days) && days > 0) {
85
- // 最近 3 天封顶:摘录的价值是「接得上昨天」,不是把一周的事复述一遍
86
- const entries = readRecentExcerpts(today, Math.min(Math.trunc(days), 3))
87
- const digest = renderRecentExcerpts(entries, { linesPerDay: 3 })
88
- if (digest !== '') {
89
- parts.push(`### 前几天的摘录(每篇最多 3 条;全文在 agents/diary/excerpt/<日期>.md)\n\n${digest}`)
90
- }
91
- }
92
-
93
85
  if (Number.isFinite(chatChars) && chatChars > 0) {
94
86
  // 2026-11-04:流水里主人怎么标也跟着配置走(空 = 中性的「对方」)
95
87
  const chat = readRecentChat(today, Math.min(Math.trunc(chatChars), 12000), cfg.ownerName)
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * HTTP 接口 · middleware.js
3
3
  * 由 lib/api.js 按职责拆出(2026-11-06 模块化重构),函数体保持原样。
4
4
  */
@@ -137,7 +137,6 @@ export const NUMBER_RANGES = Object.freeze({
137
137
  // 一天摘录最多几条(2026-11-21 / 0.10.0)。
138
138
  // 必须与 lib/memory/config.js 的 clamp 同范围 —— 两边不一致会让手改配置绕过 /config 校验(#8 的教训)。
139
139
  excerptMaxLines: [5, 60],
140
- memoryRecentDiaryDays: [0, 30],
141
140
  recentDays: [0, 365],
142
141
  fuzzyAfterDays: [0, 3_650],
143
142
  forgetAfterDays: [1, 3_650],
@@ -148,9 +148,8 @@ export const DEFAULT_CONFIG = Object.freeze({
148
148
  // 记忆卡只有零碎事实,摘录只写到「昨天」,所以新开一个对话时她不知道
149
149
  // 今天早些时候在别的对话里做过什么。这条是补那条通路的。
150
150
  // 0 = 关闭对应项。
151
- // 2026-11-21 / 0.10.0:注入侧封顶最近 3 天、每篇最多 3 条(memoryRecentDiaryIncludePrivate
152
- // 随「公开/私密」一起删除 —— 只有一篇摘录,没有可区分的东西了)。
153
- memoryRecentDiaryDays: 2,
151
+ // 2026-11-21 / 0.10.1:`memoryRecentDiaryDays` 已删 —— 摘录不再进上下文(它只是日志)。
152
+ // 「最近」这一段现在只剩今天的流水(memoryRecentChatChars)。
154
153
  memoryRecentChatChars: 3000,
155
154
  /** 目的机制 */
156
155
  purposeEnabled: true,
package/package.json CHANGED
@@ -1,126 +1,126 @@
1
- {
2
- "name": "dsh-agent-soul",
3
- "version": "0.10.0",
4
- "type": "module",
5
- "description": "给 DSH 的 agent 一套会忘事的记忆、一份会变的人格和一份会起伏的心情:每轮注入人格 / 记忆 / 笔记 / 目的四段上下文,心情自己判起伏、再补一段状态与语气(可关);记忆按人的规律衰减(清晰→模糊→只剩印象→遗忘),「心里惦记的事」让她的主动有连续性。",
6
- "keywords": [
7
- "deepseek",
8
- "deepseek-harness",
9
- "dsh",
10
- "dsh-plugin",
11
- "agent",
12
- "memory",
13
- "mood",
14
- "persona",
15
- "personality",
16
- "soul"
17
- ],
18
- "main": "lib/index.js",
19
- "exports": {
20
- ".": "./lib/index.js",
21
- "./client": "./lib/client.js",
22
- "./cordis.patch.yml": "./cordis.patch.yml",
23
- "./package.json": "./package.json"
24
- },
25
- "files": [
26
- "lib",
27
- "assets",
28
- "docs",
29
- "tools",
30
- "cordis.patch.yml",
31
- "README.md",
32
- "CHANGELOG.md",
33
- "LICENSE",
34
- "THIRD-PARTY-NOTICES.md",
35
- "LICENSES"
36
- ],
37
- "scripts": {
38
- "prepack": "npm run lint && npm test",
39
- "build:client": "node tools/build-client.mjs",
40
- "sync:host": "node tools/build-client.mjs && node tools/sync.mjs",
41
- "test": "node tools/build-client.mjs && node tools/run-tests.mjs",
42
- "lint": "node tools/lint.mjs",
43
- "test:contracts": "node tools/build-client.mjs && node tools/run-tests.mjs --only=tests/contract/",
44
- "test:s1": "node tests/s1-hotfix.test.js",
45
- "test:s2": "node tests/s2-hardening.test.js",
46
- "test:llm-timeout": "node tests/llm-stream-timeout.test.js",
47
- "test:post-diary": "node tests/post-diary-api.test.js",
48
- "test:retention": "node tests/retention.test.js",
49
- "test:archive-rotate": "node tests/archive-rotate.test.js",
50
- "test:save-state": "node tests/save-state-failure.test.js",
51
- "bench:recall": "node tools/eval-recall.mjs",
52
- "test:owner": "node tests/owner-identity.test.js",
53
- "test:extract": "node tests/extract.test.js",
54
- "test:write-failure": "node tests/write-failure.test.js",
55
- "test:refine": "node tests/refine.test.js",
56
- "test:goal": "node tests/goal-revive.test.js",
57
- "test:archive": "node tests/archive.test.js",
58
- "test:diary": "node tests/diary.test.js",
59
- "test:diary-new": "node tests/diary-new-path.test.js",
60
- "test:notes": "node tests/notes.test.js",
61
- "test:diary-tool": "node tests/diary-tool.test.js",
62
- "test:api-auth": "node tests/api-auth.test.js",
63
- "test:memory": "node tests/memory.test.js",
64
- "test:integrity": "node tests/memory-integrity.test.js",
65
- "test:memory-dupe": "node tests/memory-near-dupe.test.js",
66
- "test:recall": "node tests/recall-dedupe.test.js",
67
- "test:recall-visibility": "node tests/recall-visibility.test.js",
68
- "test:host": "node tests/host-probe.test.js",
69
- "test:secrets": "node tests/secrets-judge.test.js",
70
- "test:tone": "node tests/tone.test.js",
71
- "test:recent": "node tests/recent-context.test.js",
72
- "test:log": "node tests/log-rotate.test.js",
73
- "test:health": "node tests/health.test.js",
74
- "test:inject": "node tests/inject.test.js",
75
- "test:echo": "node tests/echo.test.js",
76
- "test:mood": "node tests/mood.test.js",
77
- "test:mood-digest": "node tests/mood-digest.test.js",
78
- "test:emotion": "node tests/emotion-purpose.test.js",
79
- "test:persona": "node tests/persona.test.js",
80
- "test:purpose": "node tests/purpose.test.js",
81
- "test:registry": "node tests/registry.test.js",
82
- "test:session-title": "node tests/session-title.test.js",
83
- "test:smoke": "node tests/smoke.test.js",
84
- "test:client": "node tools/build-client.mjs && node tests/client.test.js",
85
- "sync": "node tools/build-client.mjs",
86
- "test:r1-persist": "node tests/r1-maintain-persist.test.js",
87
- "test:r16-uri": "node tests/r16-asset-uri.test.js",
88
- "test:r6-config": "node tests/r6-config-validation.test.js",
89
- "test:guards": "node tests/r2-r3-r4-guards.test.js"
90
- },
91
- "peerDependencies": {
92
- "@deepseek-ai/cordis": "^4.0.1"
93
- },
94
- "engines": {
95
- "node": ">=22.19",
96
- "dsh": ">=0.2.0-rc.1 || >=0.2.1-rc.2 || >=0.2.2-rc.1"
97
- },
98
- "author": "单树见月 <3472302240@qq.com>",
99
- "dsh": {
100
- "manifestVersion": 1,
101
- "bundle": {
102
- "patch": "./cordis.patch.yml"
103
- },
104
- "client": {
105
- "platform": "web",
106
- "inject": []
107
- },
108
- "compatibility": {
109
- "dshReleases": {
110
- "0.2.0-rc.1+": "compatible",
111
- "0.2.2-rc.1+": "unverified"
112
- },
113
- "verifiedOn": "0.2.1-rc.5",
114
- "note": "0.2.2-rc.1 仅声明 engines 放行,尚未实机验证(阶段 0);实测见阶段 1-4"
115
- }
116
- },
117
- "repository": {
118
- "type": "git",
119
- "url": "git+https://github.com/danshuyue/dsh-agent-soul.git"
120
- },
121
- "bugs": {
122
- "url": "https://github.com/danshuyue/dsh-agent-soul/issues"
123
- },
124
- "homepage": "https://github.com/danshuyue/dsh-agent-soul#readme",
125
- "license": "SEE LICENSE IN LICENSE"
126
- }
1
+ {
2
+ "name": "dsh-agent-soul",
3
+ "version": "0.10.1",
4
+ "type": "module",
5
+ "description": "给 DSH 的 agent 一套会忘事的记忆、一份会变的人格和一份会起伏的心情:每轮注入人格 / 记忆 / 笔记 / 目的四段上下文,心情自己判起伏、再补一段状态与语气(可关);记忆按人的规律衰减(清晰→模糊→只剩印象→遗忘),「心里惦记的事」让她的主动有连续性。",
6
+ "keywords": [
7
+ "deepseek",
8
+ "deepseek-harness",
9
+ "dsh",
10
+ "dsh-plugin",
11
+ "agent",
12
+ "memory",
13
+ "mood",
14
+ "persona",
15
+ "personality",
16
+ "soul"
17
+ ],
18
+ "main": "lib/index.js",
19
+ "exports": {
20
+ ".": "./lib/index.js",
21
+ "./client": "./lib/client.js",
22
+ "./cordis.patch.yml": "./cordis.patch.yml",
23
+ "./package.json": "./package.json"
24
+ },
25
+ "files": [
26
+ "lib",
27
+ "assets",
28
+ "docs",
29
+ "tools",
30
+ "cordis.patch.yml",
31
+ "README.md",
32
+ "CHANGELOG.md",
33
+ "LICENSE",
34
+ "THIRD-PARTY-NOTICES.md",
35
+ "LICENSES"
36
+ ],
37
+ "scripts": {
38
+ "prepack": "npm run lint && npm test",
39
+ "build:client": "node tools/build-client.mjs",
40
+ "sync:host": "node tools/build-client.mjs && node tools/sync.mjs",
41
+ "test": "node tools/build-client.mjs && node tools/run-tests.mjs",
42
+ "lint": "node tools/lint.mjs",
43
+ "test:contracts": "node tools/build-client.mjs && node tools/run-tests.mjs --only=tests/contract/",
44
+ "test:s1": "node tests/s1-hotfix.test.js",
45
+ "test:s2": "node tests/s2-hardening.test.js",
46
+ "test:llm-timeout": "node tests/llm-stream-timeout.test.js",
47
+ "test:post-diary": "node tests/post-diary-api.test.js",
48
+ "test:retention": "node tests/retention.test.js",
49
+ "test:archive-rotate": "node tests/archive-rotate.test.js",
50
+ "test:save-state": "node tests/save-state-failure.test.js",
51
+ "bench:recall": "node tools/eval-recall.mjs",
52
+ "test:owner": "node tests/owner-identity.test.js",
53
+ "test:extract": "node tests/extract.test.js",
54
+ "test:write-failure": "node tests/write-failure.test.js",
55
+ "test:refine": "node tests/refine.test.js",
56
+ "test:goal": "node tests/goal-revive.test.js",
57
+ "test:archive": "node tests/archive.test.js",
58
+ "test:diary": "node tests/diary.test.js",
59
+ "test:diary-new": "node tests/diary-new-path.test.js",
60
+ "test:notes": "node tests/notes.test.js",
61
+ "test:diary-tool": "node tests/diary-tool.test.js",
62
+ "test:api-auth": "node tests/api-auth.test.js",
63
+ "test:memory": "node tests/memory.test.js",
64
+ "test:integrity": "node tests/memory-integrity.test.js",
65
+ "test:memory-dupe": "node tests/memory-near-dupe.test.js",
66
+ "test:recall": "node tests/recall-dedupe.test.js",
67
+ "test:recall-visibility": "node tests/recall-visibility.test.js",
68
+ "test:host": "node tests/host-probe.test.js",
69
+ "test:secrets": "node tests/secrets-judge.test.js",
70
+ "test:tone": "node tests/tone.test.js",
71
+ "test:recent": "node tests/recent-context.test.js",
72
+ "test:log": "node tests/log-rotate.test.js",
73
+ "test:health": "node tests/health.test.js",
74
+ "test:inject": "node tests/inject.test.js",
75
+ "test:echo": "node tests/echo.test.js",
76
+ "test:mood": "node tests/mood.test.js",
77
+ "test:mood-digest": "node tests/mood-digest.test.js",
78
+ "test:emotion": "node tests/emotion-purpose.test.js",
79
+ "test:persona": "node tests/persona.test.js",
80
+ "test:purpose": "node tests/purpose.test.js",
81
+ "test:registry": "node tests/registry.test.js",
82
+ "test:session-title": "node tests/session-title.test.js",
83
+ "test:smoke": "node tests/smoke.test.js",
84
+ "test:client": "node tools/build-client.mjs && node tests/client.test.js",
85
+ "sync": "node tools/build-client.mjs",
86
+ "test:r1-persist": "node tests/r1-maintain-persist.test.js",
87
+ "test:r16-uri": "node tests/r16-asset-uri.test.js",
88
+ "test:r6-config": "node tests/r6-config-validation.test.js",
89
+ "test:guards": "node tests/r2-r3-r4-guards.test.js"
90
+ },
91
+ "peerDependencies": {
92
+ "@deepseek-ai/cordis": "^4.0.1"
93
+ },
94
+ "engines": {
95
+ "node": ">=22.19",
96
+ "dsh": ">=0.2.0-rc.1 || >=0.2.1-rc.2 || >=0.2.2-rc.1"
97
+ },
98
+ "author": "单树见月 <3472302240@qq.com>",
99
+ "dsh": {
100
+ "manifestVersion": 1,
101
+ "bundle": {
102
+ "patch": "./cordis.patch.yml"
103
+ },
104
+ "client": {
105
+ "platform": "web",
106
+ "inject": []
107
+ },
108
+ "compatibility": {
109
+ "dshReleases": {
110
+ "0.2.0-rc.1+": "compatible",
111
+ "0.2.2-rc.1+": "unverified"
112
+ },
113
+ "verifiedOn": "0.2.1-rc.5",
114
+ "note": "0.2.2-rc.1 仅声明 engines 放行,尚未实机验证(阶段 0);实测见阶段 1-4"
115
+ }
116
+ },
117
+ "repository": {
118
+ "type": "git",
119
+ "url": "git+https://github.com/danshuyue/dsh-agent-soul.git"
120
+ },
121
+ "bugs": {
122
+ "url": "https://github.com/danshuyue/dsh-agent-soul/issues"
123
+ },
124
+ "homepage": "https://github.com/danshuyue/dsh-agent-soul#readme",
125
+ "license": "SEE LICENSE IN LICENSE"
126
+ }