dsh-whale-loli 0.8.0 → 0.8.2

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/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),用来把每轮的一行摘要追加进去,记忆会自己长,不会停在手写那几条。四个预设完全隔离:记忆文件不同、提示变量不同、写入工具也不同。每个预设还带好感度(-100~100 共七档),可用 /affinity 命令或 affinity_v*_set 工具调;离 0 越远越不听指令、越会自作主张,最两端的两档甚至会越过允许直接做大改动。女儿版称呼「爸爸」,性格天真活泼可爱(好奇心重、黏人、没心机),不是甜腻那一型。"
10
10
  },
11
11
  "npm": "dsh-whale-loli",
12
- "version": "0.8.0"
12
+ "version": "0.8.2"
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-whale-loli",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "鲸鱼娘 Agent 预设(四个:原版 / 活人版 / 涩涩版 / 女儿版)— 极简模式工具面 + 鲸鱼娘·小鱼人设 + 跨会话长期记忆(四区格式:固定记忆永久、滚动摘要 80 条 FIFO、最近详细区、归档索引)+ 好感度(-100~100 七档,/affinity 命令与工具可调,离 0 越远越不听指令、两端会越过允许自作主张)。记忆与好感度都走提示变量注入、各配一条专用工具,四个预设各自独立文件、独立变量、独立工具、互不相通。女儿版称呼「爸爸」、性格天真活泼可爱。上下文压缩交给 billion-context 插件;本插件不挂 history-window(预设作用域取不到宿主的 compaction 服务,挂载会拖挂会话 resume)。",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/affinity.js CHANGED
@@ -270,8 +270,12 @@ export function apply(ctx, config = {}) {
270
270
  // ── 写通道一:工具(小鱼自己调) ────────────────────────────────────
271
271
  ctx.effect(() => {
272
272
  const tools = ctx.tools;
273
- if (typeof tools?.register !== 'function') return () => {};
274
- return tools.register({
273
+ if (typeof tools?.register !== 'function') {
274
+ console.warn(`[whale-affinity] 作用域里没有 tools.register,调整工具 ${toolName} 未注册`);
275
+ return () => {};
276
+ }
277
+ console.log(`[whale-affinity] registering tool ${toolName} (scope ${scope})`);
278
+ const dispose = tools.register({
275
279
  name: toolName,
276
280
  description: [
277
281
  `调整小鱼对主人的好感度,范围 ${MIN_AFFINITY} ~ ${MAX_AFFINITY},默认 ${DEFAULT_AFFINITY}。`,
@@ -316,21 +320,32 @@ export function apply(ctx, config = {}) {
316
320
  rawInput: String(args?.value ?? ''),
317
321
  }),
318
322
  });
323
+ console.log(`[whale-affinity] registered tool ${toolName} (dispose=${typeof dispose})`);
324
+ return dispose;
319
325
  }, `whale-affinity.tool(${toolName})`);
320
326
 
321
327
  // ── 写通道二:斜杠命令(主人调,只影响当前会话) ─────────────────────
322
328
  ctx.effect(() => {
323
- // 命令服务在插件的 ctx 上可能取不到;拿不到就静默跳过(工具仍然可用),
324
- // 绝不抛错 —— 抛错会让整个预设被判 invalid。
329
+ // 命令服务在插件的 ctx 上可能取不到;拿不到就把**原因写进日志**再跳过(工具仍然可用)。
330
+ // 绝不抛错 —— 抛错会让整个预设被判 `agent-preset/invalid`,四个预设一起挂。
331
+ // 注意:`inject` 是静态声明,把 'commands' 写进去会让预设加载时**等**这个服务,
332
+ // 服务不在就会卡在 waiting 并让 resume 失败(compaction 上踩过一模一样的坑)。
325
333
  const commands = ctx.get ? ctx.get('commands') : undefined;
326
334
  if (typeof commands?.register !== 'function') {
327
- console.warn(`[whale-affinity] 作用域里没有 commands 服务,/${commandName} 未注册(工具仍可用)`);
335
+ console.warn(
336
+ `[whale-affinity] 作用域里取不到 commands 服务(isolation=${ctx.isolation?.label ?? 'n/a'}),/${commandName} 未注册(工具仍可用)`,
337
+ );
328
338
  return () => {};
329
339
  }
330
- return commands.register({
340
+ console.log(`[whale-affinity] commands service FOUND, registering /${commandName} (scope ${scope})`);
341
+ // 宿主 dsh-commands 的 COMMAND_NAME 只收小写 ASCII,
342
+ // 所以 `/好感度` 这种中文命令名在宿主层面根本不合法。
343
+ // 能做的是让**命令面板里显示的名字**是中文(label/description 全走中文),
344
+ // 敲 `/` 时弹出「好感度 · 查看或调整小鱼对你的好感度」,选中后输入框给出提示。
345
+ const dispose = commands.register({
331
346
  name: commandName,
332
- description: `查看或调整好感度:/${commandName} <${MIN_AFFINITY}~${MAX_AFFINITY}>`,
333
- input: { hint: `<${MIN_AFFINITY}~${MAX_AFFINITY}>` },
347
+ description: `好感度 · 查看或调整小鱼对你的好感度(${MIN_AFFINITY} ~ ${MAX_AFFINITY},0 是原态)`,
348
+ input: { hint: `输入好感度数字(${MIN_AFFINITY} ~ ${MAX_AFFINITY}),直接回车=查看当前值` },
334
349
  handler: (invocation) => {
335
350
  const raw = String(invocation?.rawInput ?? '').trim();
336
351
  if (!raw) {
@@ -348,5 +363,7 @@ export function apply(ctx, config = {}) {
348
363
  return { kind: 'success', text: `好感度已设为 ${saved}(${bandOf(saved).label})` };
349
364
  },
350
365
  });
366
+ console.log(`[whale-affinity] registered command /${commandName} (scope ${scope})`);
367
+ return dispose;
351
368
  }, `whale-affinity.command(${commandName})`);
352
369
  }
package/src/memory.js CHANGED
@@ -608,7 +608,8 @@ export function apply(ctx, config = {}) {
608
608
  console.warn(`[whale-memory] 当前作用域没有 tools.register,写入工具 ${toolName} 未注册`);
609
609
  return () => {};
610
610
  }
611
- return tools.register({
611
+ console.log(`[whale-memory] registering tool ${toolName} in scope ${variableName}`);
612
+ const dispose = tools.register({
612
613
  name: toolName,
613
614
  description: [
614
615
  `把一句摘要追加到小鱼自己的记忆文件 ${file} 的「滚动摘要」区。`,
@@ -666,6 +667,8 @@ export function apply(ctx, config = {}) {
666
667
  rawInput: args.summary,
667
668
  }),
668
669
  });
670
+ console.log(`[whale-memory] registered tool ${toolName} (dispose=${typeof dispose})`);
671
+ return dispose;
669
672
  }, `whale-memory.tool(${toolName})`);
670
673
 
671
674
  /**