dsn-whale-chat 0.1.0 → 0.1.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.
@@ -59,9 +59,15 @@ export class ChatBridge {
59
59
  const existing = this.agents.get(key);
60
60
  if (existing !== undefined)
61
61
  return existing;
62
+ // Omit empty fields so the loop resolves its own default route.
63
+ const agentOptions = {};
64
+ if (this.options.provider !== undefined)
65
+ agentOptions.provider = this.options.provider;
66
+ if (this.options.model !== undefined)
67
+ agentOptions.model = this.options.model;
62
68
  const handle = await this.options.ctx.agents.create({
63
69
  sessionId: SessionId(`whale-chat:${key}:${randomUUID()}`),
64
- agentOptions: { provider: this.options.provider, model: this.options.model },
70
+ agentOptions,
65
71
  });
66
72
  this.agents.set(key, handle.agent);
67
73
  return handle.agent;
package/lib/index.js CHANGED
@@ -15,7 +15,7 @@ import { matchesAny } from './util/text.js';
15
15
  /** Cordis plugin name; must stay stable so profile entries can target it. */
16
16
  export const name = 'dsn-whale-chat';
17
17
  /** Services required before `apply` runs. */
18
- export const inject = ['tools', 'sessions', 'systemPrompt', 'agents'];
18
+ export const inject = ['tools', 'sessions', 'systemPrompt', 'agents', 'llm'];
19
19
  const DEFAULT_ALIASES = ['小鲸鱼', '鲸鱼', '鲸鲸', '鱼鱼', '鲸鱼娘'];
20
20
  const DEFAULT_DISLIKED = ['大肥鱼', '小肥鱼', '喂'];
21
21
  /** User-facing configuration (mirrors docs/chat-plugin.md §6). */
@@ -46,13 +46,13 @@ export const Config = z.object({
46
46
  keywords: z.array(z.string()).default([]),
47
47
  }),
48
48
  rate: z.object({
49
- debounceMs: z.natural().default(800),
49
+ debounceMs: z.natural().default(3000),
50
50
  batchSize: z.natural().default(0),
51
51
  cooldownMs: z.natural().default(0),
52
52
  maxPerMinute: z.natural().default(20),
53
53
  }),
54
54
  groupRate: z.object({
55
- debounceMs: z.natural().default(1500),
55
+ debounceMs: z.natural().default(5000),
56
56
  batchSize: z.natural().default(5),
57
57
  cooldownMs: z.natural().default(30_000),
58
58
  maxPerMinute: z.natural().default(3),
@@ -183,7 +183,7 @@ export function apply(ctx, config) {
183
183
  function fireProactive(key) {
184
184
  const last = lastByKey.get(key);
185
185
  if (last !== undefined)
186
- void bridge.proactive(last);
186
+ void bridge.proactive(last).catch((error) => recordError(error));
187
187
  }
188
188
  /** Was this group message meant for the bot (by @, name, or keyword)? */
189
189
  function groupAddressed(message) {
@@ -206,7 +206,7 @@ export function apply(ctx, config) {
206
206
  if (message.kind === 'group' && !groupAddressed(message)) {
207
207
  // Group chatter the bot was not addressed in: maybe join in (off by default).
208
208
  if (interject())
209
- void bridge.interject(message, message.text);
209
+ void bridge.interject(message, message.text).catch((error) => recordError(error));
210
210
  return;
211
211
  }
212
212
  const key = keyOf(message);
@@ -222,7 +222,7 @@ export function apply(ctx, config) {
222
222
  const last = lastByKey.get(key);
223
223
  if (last === undefined)
224
224
  return;
225
- void bridge.receive({ ...last, text: texts.join('\n') });
225
+ void bridge.receive({ ...last, text: texts.join('\n') }).catch((error) => recordError(error));
226
226
  }
227
227
  function send(target, text) {
228
228
  if (target.kind === 'group' && target.groupId !== null)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsn-whale-chat",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Whale-girl QQ chat plugin for DeepSeek Harness: OneBot channel + two personas + rate control.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",