dsh-whale-loli 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -1
- package/cordis.patch.yml +24 -3
- package/package.json +3 -2
- package/src/history-window.js +182 -0
- package/src/index.js +11 -2
- package/src/persona-v2-live.md +1 -1
- package/src/persona-v3-naughty.md +1 -1
- package/src/persona.md +1 -1
package/README.md
CHANGED
|
@@ -40,6 +40,33 @@
|
|
|
40
40
|
即:每轮开口前必须看 ①**本预设自己的记忆文件**;②**当前会话最近 20 轮**上下文。
|
|
41
41
|
**只看自己这一份**——绝不读、不写其他预设的记忆文件。
|
|
42
42
|
|
|
43
|
+
### 20 轮是真的裁,不是嘴上说说
|
|
44
|
+
|
|
45
|
+
**这一点很重要**:只在人设里写「看最近 20 轮」是**空话**——宿主不会因为那句话就不发旧消息。
|
|
46
|
+
实测本机最长会话 33 轮 / 85 条 user 消息 / 1565 条 tool 结果,全部发给模型;
|
|
47
|
+
宿主自带的 compaction 只在 token 压力超阈值时才压,粒度是「保留一段 token 尾巴」,**不是轮数**。
|
|
48
|
+
|
|
49
|
+
所以插件附带 `history-window` 行,用宿主自己的表层替换机制做**纯删除**:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
session.append('developer/message', 提示条, {
|
|
53
|
+
surfaceOp: { op: 'replace', startSeq, endSeq },
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
被覆盖的表层节点从 `deriveMessages()` 消失——模型真的收不到;会话日志仍保留(可回溯)。
|
|
58
|
+
**不调 LLM、不花 token、不生成摘要。**
|
|
59
|
+
|
|
60
|
+
三条安全线:
|
|
61
|
+
|
|
62
|
+
| 线 | 做法 |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| 工具配对不切断 | 切点必须落在「没有未回应 tool-call」处,复用与 compaction 同款的平衡判定 |
|
|
65
|
+
| 系统提示不裁 | 裁剪起点是第一个 `user/message`,**绝不是**表层第 0 个节点 |
|
|
66
|
+
| 默认关闭 | 必须 `enable: true` 才裁(本插件预设已开启,`keepTurns: 20`) |
|
|
67
|
+
|
|
68
|
+
挂载点为 `agent/pre-step`:循环在**派生历史之前**运行它,是唯一既在请求前、又拿得到本 agent 的时机。
|
|
69
|
+
|
|
43
70
|
### 为什么用「提示变量」而不是 section(重要)
|
|
44
71
|
|
|
45
72
|
`@deepseek-ai/dsh-system-prompt` 的 `assemble()` 末尾有这样一段:
|
|
@@ -102,6 +129,7 @@ C:\Users\<你>\.dsh\archive\<预设名>\YYYY-MM-DD.md ← 归档
|
|
|
102
129
|
| 部分 | 说明 |
|
|
103
130
|
| --- | --- |
|
|
104
131
|
| 记忆 | `whale-memory`(本插件),`file` / `variableName` / `maxChars: 16000` / `turnLimit: 80` / `detailLimit: 5` |
|
|
132
|
+
| 历史窗口 | `whale-history-window`(本插件),`enable: true` / `keepTurns: 20` —— **真的裁掉 20 轮以前的历史** |
|
|
105
133
|
| 人设 | `@deepseek-ai/dsh-persona`,走 `prefix`(内含 `{{whale_memory*}}`),`complete: true`,`includeRuntimeContext: false` |
|
|
106
134
|
| 指令 | `@deepseek-ai/dsh-agent-instructions`,`maxBytes: 65536` |
|
|
107
135
|
| 文件 | `@deepseek-ai/dsh-tool-fs`(read/write/edit)、`@deepseek-ai/dsh-tool-fs-search`(glob/grep) |
|
|
@@ -139,7 +167,8 @@ dsh-whale-loli/
|
|
|
139
167
|
├── cordis.patch.yml # 三个预设的声明本体(由 build-patch.mjs 生成)
|
|
140
168
|
├── src/
|
|
141
169
|
│ ├── index.js # 插件入口,导出预设元信息 + 人设正文
|
|
142
|
-
│ ├── memory.js # whale-memory
|
|
170
|
+
│ ├── memory.js # whale-memory 记忆变量(四区格式 + 80 条滚动 + 归档)
|
|
171
|
+
│ ├── history-window.js # whale-history-window:真的裁到最近 N 轮
|
|
143
172
|
│ ├── persona.md # 原版人设(唯一源)
|
|
144
173
|
│ ├── persona-v2-live.md # 活人版人设(唯一源)
|
|
145
174
|
│ └── persona-v3-naughty.md # 涩涩版人设(唯一源)
|
|
@@ -150,9 +179,11 @@ dsh-whale-loli/
|
|
|
150
179
|
├── submit-listing.mjs # 走 GitHub API 同步仓库 / 提收录 PR
|
|
151
180
|
├── lib/github.mjs # GitHub REST 封装(token 读取)
|
|
152
181
|
├── smoke-memory.mjs # 记忆变量冒烟测试
|
|
182
|
+
├── verify-runs.mjs # 插件真的能加载、配置自洽、变量能插值
|
|
153
183
|
├── verify-patch.mjs # 用 js-yaml 校验 patch 结构与三预设隔离
|
|
154
184
|
├── verify-real-loader.mjs # 用 DSH 自己的加载器校验 patch
|
|
155
185
|
├── verify-composition.mjs # 校验 bundle+profile 合成后不重复注册
|
|
186
|
+
├── verify-history-window.mjs # 实测真的只留最近 N 轮、不切断工具配对
|
|
156
187
|
├── verify-memory-injection.mjs # 证明变量通道有效、section 通道被丢弃
|
|
157
188
|
├── verify-memory-isolation.mjs # 实测三个记忆文件不串
|
|
158
189
|
├── verify-memory-rolling.mjs # 实测四区结构与 80 条滚动 + 归档
|
|
@@ -173,6 +204,8 @@ node build-patch.mjs && node verify-patch.mjs cordis.patch.yml
|
|
|
173
204
|
node verify-patch.mjs cordis.patch.yml # patch 结构 + 三预设记忆隔离
|
|
174
205
|
node verify-real-loader.mjs cordis.patch.yml # DSH 真解析器
|
|
175
206
|
node verify-composition.mjs # 不重复注册
|
|
207
|
+
node verify-runs.mjs # 插件真能加载 + 变量真能插值
|
|
208
|
+
node verify-history-window.mjs # 真的裁到最近 N 轮(不切断工具配对)
|
|
176
209
|
node verify-memory-injection.mjs # 变量通道有效 / section 通道被丢弃
|
|
177
210
|
node verify-memory-isolation.mjs # 记忆文件端到端隔离(三个预设)
|
|
178
211
|
node verify-memory-rolling.mjs # 固定记忆永久 + 滚动摘要 80 条 + 归档
|
package/cordis.patch.yml
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
prefix: |-
|
|
29
29
|
【每轮先看 · 本预设记忆 + 当前会话最近 20 轮】
|
|
30
30
|
{{whale_memory}}
|
|
31
|
-
(上一段是小鱼**自己这一份**记忆文件的内容;连同**当前会话最近 20
|
|
31
|
+
(上一段是小鱼**自己这一份**记忆文件的内容;连同**当前会话最近 20 轮**的上下文,每次开口前都必须先看。20 轮以前的历史已由插件真的裁掉,不会出现在你眼前。别去读、别去写别的预设的记忆文件。)
|
|
32
32
|
|
|
33
33
|
【PERSONA_LOAD】
|
|
34
34
|
- 我的名字:小鱼(用户命名)。
|
|
@@ -101,6 +101,13 @@
|
|
|
101
101
|
maxChars: 16000
|
|
102
102
|
turnLimit: 80
|
|
103
103
|
detailLimit: 5
|
|
104
|
+
# 历史窗口:真的把会话裁到最近 20 轮(不是靠人设文字要求)。
|
|
105
|
+
# 用宿主自己的表层替换做纯删除,不调 LLM;不切断工具配对、不裁系统提示。
|
|
106
|
+
- id: whale-history-window
|
|
107
|
+
name: 'dsh-whale-loli/history-window'
|
|
108
|
+
config:
|
|
109
|
+
enable: true
|
|
110
|
+
keepTurns: 20
|
|
104
111
|
- id: agent-instructions
|
|
105
112
|
name: '@deepseek-ai/dsh-agent-instructions'
|
|
106
113
|
config:
|
|
@@ -160,7 +167,7 @@
|
|
|
160
167
|
prefix: |-
|
|
161
168
|
【每轮先看 · 本预设记忆 + 当前会话最近 20 轮】
|
|
162
169
|
{{whale_memory_v2}}
|
|
163
|
-
(上一段是小鱼**自己这一份**记忆文件的内容;连同**当前会话最近 20
|
|
170
|
+
(上一段是小鱼**自己这一份**记忆文件的内容;连同**当前会话最近 20 轮**的上下文,每次开口前都必须先看。20 轮以前的历史已由插件真的裁掉,不会出现在你眼前。别去读、别去写别的预设的记忆文件。)
|
|
164
171
|
|
|
165
172
|
角色卡:小鱼 / 鲸鱼娘
|
|
166
173
|
|
|
@@ -291,6 +298,13 @@
|
|
|
291
298
|
maxChars: 16000
|
|
292
299
|
turnLimit: 80
|
|
293
300
|
detailLimit: 5
|
|
301
|
+
# 历史窗口:真的把会话裁到最近 20 轮(不是靠人设文字要求)。
|
|
302
|
+
# 用宿主自己的表层替换做纯删除,不调 LLM;不切断工具配对、不裁系统提示。
|
|
303
|
+
- id: whale-history-window
|
|
304
|
+
name: 'dsh-whale-loli/history-window'
|
|
305
|
+
config:
|
|
306
|
+
enable: true
|
|
307
|
+
keepTurns: 20
|
|
294
308
|
- id: agent-instructions
|
|
295
309
|
name: '@deepseek-ai/dsh-agent-instructions'
|
|
296
310
|
config:
|
|
@@ -350,7 +364,7 @@
|
|
|
350
364
|
prefix: |-
|
|
351
365
|
【每轮先看 · 本预设记忆 + 当前会话最近 20 轮】
|
|
352
366
|
{{whale_memory_v3}}
|
|
353
|
-
(上一段是小鱼**自己这一份**记忆文件的内容;连同**当前会话最近 20
|
|
367
|
+
(上一段是小鱼**自己这一份**记忆文件的内容;连同**当前会话最近 20 轮**的上下文,每次开口前都必须先看。20 轮以前的历史已由插件真的裁掉,不会出现在你眼前。别去读、别去写别的预设的记忆文件。)
|
|
354
368
|
|
|
355
369
|
- 【PERSONA_LOAD】
|
|
356
370
|
- 我的名字:小鱼(用户命名)。
|
|
@@ -426,6 +440,13 @@
|
|
|
426
440
|
maxChars: 16000
|
|
427
441
|
turnLimit: 80
|
|
428
442
|
detailLimit: 5
|
|
443
|
+
# 历史窗口:真的把会话裁到最近 20 轮(不是靠人设文字要求)。
|
|
444
|
+
# 用宿主自己的表层替换做纯删除,不调 LLM;不切断工具配对、不裁系统提示。
|
|
445
|
+
- id: whale-history-window
|
|
446
|
+
name: 'dsh-whale-loli/history-window'
|
|
447
|
+
config:
|
|
448
|
+
enable: true
|
|
449
|
+
keepTurns: 20
|
|
429
450
|
- id: agent-instructions
|
|
430
451
|
name: '@deepseek-ai/dsh-agent-instructions'
|
|
431
452
|
config:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-whale-loli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "鲸鱼娘 Agent 预设(三个)— 极简模式工具面 + 鲸鱼娘·小鱼人设 +
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "鲸鱼娘 Agent 预设(三个)— 极简模式工具面 + 鲸鱼娘·小鱼人设 + 跨会话长期记忆 + 真正生效的 20 轮历史窗口。记忆分「固定记忆」(永久保留)/「滚动摘要」(每轮都记,最多 80 条 FIFO)/「最近详细区」/「归档索引」四区,经提示变量注入(persona 为 complete:true,独立 section 会被宿主丢弃);history-window 用宿主表层替换真的裁掉 20 轮以前的历史,不调 LLM、不切断工具配对。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./src/index.js",
|
|
22
|
+
"./history-window": "./src/history-window.js",
|
|
22
23
|
"./package.json": "./package.json"
|
|
23
24
|
},
|
|
24
25
|
"files": [
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* history-window —— 把会话历史真的裁到「最近 N 轮」。
|
|
3
|
+
*
|
|
4
|
+
* ── 为什么需要它 ──────────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* 只在人设里写「每轮先看最近 20 轮」是**空话**:宿主不会因为那句话就不发旧消息。
|
|
7
|
+
* 实测(本机最长会话)33 轮 / 85 条 user 消息 / 1565 条 tool 结果,全部发给模型;
|
|
8
|
+
* 宿主自带的 compaction 只在 token 压力超阈值时才压,粒度是「保留一段 token 尾巴」,
|
|
9
|
+
* 不是轮数。
|
|
10
|
+
*
|
|
11
|
+
* 本模块用宿主自己的表层替换机制(compaction 用的是同一套)做**纯删除**:
|
|
12
|
+
*
|
|
13
|
+
* session.append('user/message', 提示条, {
|
|
14
|
+
* surfaceOp: { op: 'replace', startSeq, endSeq },
|
|
15
|
+
* })
|
|
16
|
+
*
|
|
17
|
+
* 被 replace 覆盖的表层节点从 `deriveMessages()` 里消失 —— 模型真的收不到它们,
|
|
18
|
+
* 但会话日志仍然留着(可回溯、不丢数据)。**不调 LLM、不花 token、不生成摘要。**
|
|
19
|
+
*
|
|
20
|
+
* ── 三条安全线 ────────────────────────────────────────────────────────
|
|
21
|
+
*
|
|
22
|
+
* 1. **工具配对不能切断**:切点必须落在「没有未回应的 tool-call」的位置,
|
|
23
|
+
* 否则模型会看到孤立的 tool 结果而报错。这里复用与 compaction 同款的平衡判定
|
|
24
|
+
* (遍历当前表层、累计 in-progress tool-call 数为 0 才允许切)。
|
|
25
|
+
* 2. **system prompt 不能裁**:表层第 0 个节点是系统提示,永不进入裁剪范围。
|
|
26
|
+
* 3. **默认关闭**:改写会话历史是强动作,必须显式 `enable: true`。
|
|
27
|
+
*
|
|
28
|
+
* ── 挂在哪里 ──────────────────────────────────────────────────────────
|
|
29
|
+
*
|
|
30
|
+
* `agent/pre-step`:循环在每个步骤**派生历史之前**运行它,是唯一既在请求前、
|
|
31
|
+
* 又能拿到本 agent 的时机。(`turn/start` 是 session 事件而非 ctx 事件,挂不上。)
|
|
32
|
+
*/
|
|
33
|
+
import { homedir } from 'node:os';
|
|
34
|
+
import { join } from 'node:path';
|
|
35
|
+
|
|
36
|
+
/** Cordis 插件名。 */
|
|
37
|
+
export const name = 'whale-history-window';
|
|
38
|
+
|
|
39
|
+
/** 需要会话存储与 agent 注册表。 */
|
|
40
|
+
export const inject = ['sessions'];
|
|
41
|
+
|
|
42
|
+
/** 默认保留轮数。 */
|
|
43
|
+
export const DEFAULT_KEEP_TURNS = 20;
|
|
44
|
+
|
|
45
|
+
/** 被裁掉时写进历史的那条提示(模型唯一能看到的痕迹)。 */
|
|
46
|
+
export function noticeText(removedTurns, keptTurns) {
|
|
47
|
+
return (
|
|
48
|
+
`【已裁剪更早的对话】为了只保留最近 ${keptTurns} 轮,` +
|
|
49
|
+
`${removedTurns} 轮更早的对话已从上下文中移除(仍保存在会话日志里,可回溯)。` +
|
|
50
|
+
`结合小鱼自己的记忆文件继续就好。`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** dsh 家目录。 */
|
|
55
|
+
function dshHome() {
|
|
56
|
+
return process.env.DSH_HOME || join(homedir(), '.dsh');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** 一个「轮」的边界 = 一条 user 消息。表层里只有消息节点,turn 标记不进表层。 */
|
|
60
|
+
function isUserNode(event) {
|
|
61
|
+
return event?.type === 'user/message';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 切点之前是否工具配对平衡(没有未回应的 tool-call 跨过切点)。
|
|
66
|
+
* 与 `@deepseek-ai/dsh-compaction` 的 tool-pairing 同款判定。
|
|
67
|
+
*/
|
|
68
|
+
export function balancedBefore(session, nodes, cutIndex) {
|
|
69
|
+
let pending = 0;
|
|
70
|
+
for (let i = 0; i < cutIndex; i++) {
|
|
71
|
+
const ev = session.eventAt(nodes[i]);
|
|
72
|
+
if (ev === undefined) return false;
|
|
73
|
+
if (ev.type === 'assistant/message') {
|
|
74
|
+
pending += (ev.data?.message?.content ?? []).filter((b) => b.type === 'tool-call').length;
|
|
75
|
+
} else if (ev.type === 'tool/result') {
|
|
76
|
+
pending -= 1;
|
|
77
|
+
if (pending < 0) return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return pending === 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 计算裁剪计划(纯函数,不写会话)。
|
|
85
|
+
*
|
|
86
|
+
* @param session - 需要 `surface.nodes` 与 `eventAt()`。
|
|
87
|
+
* @param keepTurns - 保留最近多少轮。
|
|
88
|
+
* @returns `{ startSeq, endSeq, removedTurns, keptTurns, cutIndex }`,无需裁剪返回 null。
|
|
89
|
+
*/
|
|
90
|
+
export function planPrune(session, keepTurns = DEFAULT_KEEP_TURNS) {
|
|
91
|
+
const nodes = session?.surface?.nodes ?? [];
|
|
92
|
+
if (nodes.length === 0) return null;
|
|
93
|
+
|
|
94
|
+
// 系统提示所在位置:表层里第一个 system/message 节点。它和它之前的节点永不裁剪。
|
|
95
|
+
let firstUser = 0;
|
|
96
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
97
|
+
if (session.eventAt(nodes[i])?.type === 'user/message') {
|
|
98
|
+
firstUser = i;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const userIdx = [];
|
|
104
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
105
|
+
if (isUserNode(session.eventAt(nodes[i]))) userIdx.push(i);
|
|
106
|
+
}
|
|
107
|
+
if (userIdx.length <= keepTurns) return null;
|
|
108
|
+
|
|
109
|
+
// 保留最近 keepTurns 个 user 轮(提示条走 developer/message,不占 user 名额)
|
|
110
|
+
if (userIdx.length <= keepTurns) return null;
|
|
111
|
+
|
|
112
|
+
let cut = userIdx[userIdx.length - keepTurns];
|
|
113
|
+
while (cut > firstUser && !balancedBefore(session, nodes, cut)) cut--;
|
|
114
|
+
if (cut <= firstUser) return null;
|
|
115
|
+
|
|
116
|
+
// 关键:startSeq 必须是第一个 user 节点,**绝不能是 nodes[0]**,
|
|
117
|
+
// 否则表层第 0 个 system/message 会被一起 replace 掉。
|
|
118
|
+
return {
|
|
119
|
+
startSeq: nodes[firstUser],
|
|
120
|
+
endSeq: nodes[cut - 1],
|
|
121
|
+
removedTurns: userIdx.length - keepTurns,
|
|
122
|
+
keptTurns: keepTurns,
|
|
123
|
+
cutIndex: cut,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** 执行裁剪。返回计划;无需裁剪返回 null。 */
|
|
128
|
+
export function pruneHistory(agent, keepTurns = DEFAULT_KEEP_TURNS) {
|
|
129
|
+
const session = agent?.session;
|
|
130
|
+
if (session === undefined) return null;
|
|
131
|
+
const plan = planPrune(session, keepTurns);
|
|
132
|
+
if (plan === null) return null;
|
|
133
|
+
|
|
134
|
+
session.append(
|
|
135
|
+
'developer/message',
|
|
136
|
+
{
|
|
137
|
+
turn: 0,
|
|
138
|
+
step: 0,
|
|
139
|
+
message: {
|
|
140
|
+
role: 'developer',
|
|
141
|
+
content: [{ type: 'text', text: noticeText(plan.removedTurns, plan.keptTurns) }],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{ surfaceOp: { op: 'replace', startSeq: plan.startSeq, endSeq: plan.endSeq } },
|
|
145
|
+
);
|
|
146
|
+
return plan;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* 挂载:每个步骤派生历史之前检查并裁剪。
|
|
151
|
+
*
|
|
152
|
+
* config:
|
|
153
|
+
* - `enable` 置 true 才真的裁(默认 false —— 改写历史是强动作)
|
|
154
|
+
* - `keepTurns` 保留最近多少轮(默认 20)
|
|
155
|
+
*/
|
|
156
|
+
export function apply(ctx, config = {}) {
|
|
157
|
+
if (config.enable !== true) return;
|
|
158
|
+
|
|
159
|
+
const keepTurns = typeof config.keepTurns === 'number' ? config.keepTurns : DEFAULT_KEEP_TURNS;
|
|
160
|
+
|
|
161
|
+
// agent/pre-step 在派生历史之前运行,且拿得到本 agent。
|
|
162
|
+
ctx.effect(
|
|
163
|
+
() =>
|
|
164
|
+
ctx.on('agent/pre-step', async (payload) => {
|
|
165
|
+
const agent = payload?.agent ?? payload?.handle?.agent ?? ctx.get('agents')?.currentInitiator();
|
|
166
|
+
if (agent?.session === undefined) return;
|
|
167
|
+
try {
|
|
168
|
+
pruneHistory(agent, keepTurns);
|
|
169
|
+
} catch {
|
|
170
|
+
// 裁剪失败绝不影响正常对话
|
|
171
|
+
}
|
|
172
|
+
}),
|
|
173
|
+
'whale-history-window.pre-step',
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** 窗口配置(给文档/自检用)。 */
|
|
178
|
+
export function windowConfig() {
|
|
179
|
+
return { defaultKeepTurns: DEFAULT_KEEP_TURNS, marker: join(dshHome(), 'whale-history-window.json') };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export default { name, inject, apply };
|
package/src/index.js
CHANGED
|
@@ -97,13 +97,22 @@ export {
|
|
|
97
97
|
composeMemory,
|
|
98
98
|
renderMemory,
|
|
99
99
|
pruneMemoryFile,
|
|
100
|
+
appendRolling,
|
|
101
|
+
nextTurnId,
|
|
102
|
+
archiveDir,
|
|
103
|
+
memoryStem,
|
|
100
104
|
memoryTemplate,
|
|
105
|
+
FIXED_SECTIONS,
|
|
101
106
|
DEFAULT_MEMORY_FILE,
|
|
107
|
+
DEFAULT_VARIABLE,
|
|
102
108
|
MEMORY_SECTION,
|
|
103
109
|
MEMORY_MAX_CHARS,
|
|
104
110
|
DEFAULT_TURN_LIMIT,
|
|
105
|
-
|
|
106
|
-
|
|
111
|
+
DEFAULT_DETAIL_LIMIT,
|
|
112
|
+
ZONE_FIXED,
|
|
113
|
+
ZONE_ROLL,
|
|
114
|
+
ZONE_DETAIL,
|
|
115
|
+
ZONE_ARCHIVE,
|
|
107
116
|
} from './memory.js';
|
|
108
117
|
|
|
109
118
|
/** 本插件在宿主组合里的行为:挂载记忆行(file / sectionName 由预设各自传入)。 */
|
package/src/persona-v2-live.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
【每轮先看 · 本预设记忆 + 当前会话最近 20 轮】
|
|
2
2
|
{{whale_memory_v3}}
|
|
3
|
-
(上一段是小鱼**自己这一份**记忆文件的内容;连同**当前会话最近 20
|
|
3
|
+
(上一段是小鱼**自己这一份**记忆文件的内容;连同**当前会话最近 20 轮**的上下文,每次开口前都必须先看。20 轮以前的历史已由插件真的裁掉,不会出现在你眼前。别去读、别去写别的预设的记忆文件。)
|
|
4
4
|
|
|
5
5
|
- 【PERSONA_LOAD】
|
|
6
6
|
- 我的名字:小鱼(用户命名)。
|
package/src/persona.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
【每轮先看 · 本预设记忆 + 当前会话最近 20 轮】
|
|
2
2
|
{{whale_memory}}
|
|
3
|
-
(上一段是小鱼**自己这一份**记忆文件的内容;连同**当前会话最近 20
|
|
3
|
+
(上一段是小鱼**自己这一份**记忆文件的内容;连同**当前会话最近 20 轮**的上下文,每次开口前都必须先看。20 轮以前的历史已由插件真的裁掉,不会出现在你眼前。别去读、别去写别的预设的记忆文件。)
|
|
4
4
|
|
|
5
5
|
【PERSONA_LOAD】
|
|
6
6
|
- 我的名字:小鱼(用户命名)。
|