dsh-whale-loli 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -212,13 +212,14 @@ dsh-whale-loli/
212
212
  ├── lib/github.mjs # GitHub REST 封装(token 读取)
213
213
  ├── smoke-memory.mjs # 变量 + 工具的注册形态冒烟测试
214
214
  ├── verify-runs.mjs # 插件真的能加载、配置自洽、变量能插值
215
- ├── verify-patch.mjs # 用 js-yaml 校验 patch 结构与三预设隔离(file/variable/tool 三组名字)
215
+ ├── verify-patch.mjs # 用 js-yaml 校验 patch 结构与四预设隔离(file/variable/tool 三组名字)
216
216
  ├── verify-real-loader.mjs # 用 DSH 自己的加载器校验 patch
217
217
  ├── verify-composition.mjs # 校验 bundle+profile 合成后不重复注册
218
+ ├── verify-live-runtime.mjs # 在真机 desktop profile 上合成,确认四个预设各注册一次、order 互异
218
219
  ├── verify-history-window.mjs # 实测真的只留最近 N 轮、不切断工具配对
219
220
  ├── verify-memory-injection.mjs # 证明变量通道有效、section 通道被丢弃
220
221
  ├── verify-memory-tool.mjs # 实测写入工具:编号、计数、落盘、详细区同步
221
- ├── verify-memory-isolation.mjs # 实测三个记忆文件不串(读 + 写)
222
+ ├── verify-memory-isolation.mjs # 实测四个记忆文件不串(读 + 写)
222
223
  ├── verify-memory-rolling.mjs # 实测四区结构与 80 条滚动 + 归档
223
224
  ├── verify-memory-archive.mjs # 超 80 条时真的归档并瘦身(idle 触发,四预设互不覆盖)
224
225
  ├── verify-live-assembly.mjs # 用真实 patch + 真实记忆文件复刻宿主装配,比对字节数
@@ -239,6 +240,7 @@ node build-patch.mjs && node verify-patch.mjs cordis.patch.yml
239
240
  node verify-patch.mjs cordis.patch.yml # patch 结构 + 四预设记忆隔离(file/variable/tool)
240
241
  node verify-real-loader.mjs cordis.patch.yml # DSH 真解析器
241
242
  node verify-composition.mjs # 不重复注册
243
+ node verify-live-runtime.mjs # 真机 profile 合成后四预设各注册一次、order 互异
242
244
  node verify-runs.mjs # 插件真能加载 + 变量真能插值
243
245
  node verify-history-window.mjs # 真的裁到最近 N 轮(不切断工具配对)
244
246
  node verify-memory-injection.mjs # 变量通道有效 / section 通道被丢弃
package/listing.json CHANGED
@@ -9,5 +9,5 @@
9
9
  "zh": "把 Agent 预设打包成插件:装上就会在 Agent 预设列表里注册「鲸鱼娘Agent预设」「鲸鱼娘活人版Agent预设」「鲸鱼娘涩涩版Agent预设」和「鲸鱼娘女儿版Agent预设」,直接在模式下拉里选用,不用手改配置。每个预设本体是官方极简模式(只开放 shell)+ 文件工具 + 鲸鱼娘人设 + 自己那份持久记忆文件,以提示变量形式注入,开口前就已经读过;另外每个预设各配一个专用写入工具(whale_memory_add / whale_memory_v2_add / whale_memory_v3_add / whale_memory_v4_add),用来把每轮的一行摘要追加进去,记忆会自己长,不会停在手写那几条。四个预设完全隔离:记忆文件不同、提示变量不同、写入工具也不同。女儿版称呼「爸爸」,性格天真活泼可爱(好奇心重、黏人、没心机),不是甜腻那一型。"
10
10
  },
11
11
  "npm": "dsh-whale-loli",
12
- "version": "0.7.3"
12
+ "version": "0.7.5"
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-whale-loli",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "鲸鱼娘 Agent 预设(四个:原版 / 活人版 / 涩涩版 / 女儿版)— 极简模式工具面 + 鲸鱼娘·小鱼人设 + 跨会话长期记忆(四区格式:固定记忆永久、滚动摘要 80 条 FIFO、最近详细区、归档索引)。记忆读写各一条通道:提示变量负责每轮注入,专用工具 whale_memory*_add 负责让她自己记,四个预设各自独立文件、独立变量、独立工具、互不相通。女儿版称呼「爸爸」、性格天真活泼可爱。上下文压缩交给 billion-context 插件;本插件不挂 history-window(预设作用域取不到宿主的 compaction 服务,挂载会拖挂会话 resume)。",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.js CHANGED
@@ -149,6 +149,10 @@ function apply(ctx, config = {}) {
149
149
 
150
150
  export default {
151
151
  name: 'dsh-whale-loli',
152
+ // 注意:`inject` 是静态声明,只能写预设作用域里**一直存在**的服务名。
153
+ // 千万别把不存在的服务名写进来 —— 宿主会一直等它,结果是**所有**预设
154
+ // 都挂在 `agent-preset/invalid` 上加载失败,而且报错只提插件名不提字段,
155
+ // 极难定位。现在的值是 `./memory.js` 里的 `inject`(只有必然存在的那个)。
152
156
  inject: memoryInject,
153
157
  apply,
154
158
  };
package/src/memory.js CHANGED
@@ -579,7 +579,16 @@ export function apply(ctx, config = {}) {
579
579
  };
580
580
 
581
581
  // 主通道:变量。人设 prefix 里写 {{variableName}},随 complete section 一起进提示。
582
- ctx.effect(() => ctx.systemPrompt.variable(variableName, read), `whale-memory.variable(${variableName})`);
582
+ // 容错:少了 systemPrompt 服务时不能让整个预设被判 invalid(那会让四个预设全挂),
583
+ // 只在控制台留一句警告,写入工具照常注册。
584
+ ctx.effect(() => {
585
+ const prompt = ctx.systemPrompt;
586
+ if (typeof prompt?.variable !== 'function') {
587
+ console.warn(`[whale-memory] 当前作用域没有 systemPrompt.variable,记忆 ${file} 这一轮不会自动注入`);
588
+ return () => {};
589
+ }
590
+ return prompt.variable(variableName, read);
591
+ }, `whale-memory.variable(${variableName})`);
583
592
 
584
593
  /**
585
594
  * 写通道:把记忆注册成一个真工具,让 agent 自己往里加条目。
@@ -592,9 +601,14 @@ export function apply(ctx, config = {}) {
592
601
  * 挂在一个 scope 里也不会撞名;而且模型看到工具名就知道自己该写哪一份。
593
602
  */
594
603
  const toolName = typeof config.toolName === 'string' && config.toolName ? config.toolName : `${variableName}_add`;
595
- ctx.effect(
596
- () =>
597
- ctx.tools.register({
604
+ // 容错同上:没有 tools 服务时只警告,不把预设判成 invalid。
605
+ ctx.effect(() => {
606
+ const tools = ctx.tools;
607
+ if (typeof tools?.register !== 'function') {
608
+ console.warn(`[whale-memory] 当前作用域没有 tools.register,写入工具 ${toolName} 未注册`);
609
+ return () => {};
610
+ }
611
+ return tools.register({
598
612
  name: toolName,
599
613
  description: [
600
614
  `把一句摘要追加到小鱼自己的记忆文件 ${file} 的「滚动摘要」区。`,
@@ -616,16 +630,20 @@ export function apply(ctx, config = {}) {
616
630
  required: ['summary'],
617
631
  },
618
632
  output: {
633
+ // 注意:dsh-tools 的 JSON-Schema 方言要求 `required` 是**对象层级**的
634
+ // 字符串数组,不能写在单个属性上(`{ type:'string', required:true }`
635
+ // 会被判成 unsupported JSON schema,整个预设加载失败)。
619
636
  schema: {
620
637
  type: 'object',
621
638
  additionalProperties: false,
622
639
  properties: {
623
- id: { type: 'string', required: true },
624
- path: { type: 'string', required: true },
625
- count: { type: 'integer', required: true },
626
- limit: { type: 'integer', required: true },
627
- archived: { type: 'integer', required: true },
640
+ id: { type: 'string' },
641
+ path: { type: 'string' },
642
+ count: { type: 'integer' },
643
+ limit: { type: 'integer' },
644
+ archived: { type: 'integer' },
628
645
  },
646
+ required: ['id', 'path', 'count', 'limit', 'archived'],
629
647
  },
630
648
  render: (_args, value) => [
631
649
  {
@@ -647,9 +665,8 @@ export function apply(ctx, config = {}) {
647
665
  kind: 'other',
648
666
  rawInput: args.summary,
649
667
  }),
650
- }),
651
- `whale-memory.tool(${toolName})`,
652
- );
668
+ });
669
+ }, `whale-memory.tool(${toolName})`);
653
670
 
654
671
  /**
655
672
  * 每轮结束(agent 转为 idle)时,把超出 turnLimit 的滚动条目**归档并瘦身文件**。