@gonzih/cc-discord 0.1.13 → 0.1.15

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/dist/bot.d.ts CHANGED
@@ -48,6 +48,12 @@ export declare class CcDiscordBot {
48
48
  * channelNamespaceMap + routedChannelIds. Call once on startup after the notifier is ready.
49
49
  */
50
50
  loadChannelMappings(): Promise<void>;
51
+ /** Typing intervals for meta-agent routed channels — keyed by channelId. */
52
+ private metaAgentTypingTimers;
53
+ /** Start (or reset) the typing indicator for a meta-agent–routed channel. */
54
+ private startMetaAgentTyping;
55
+ /** Stop the typing indicator for a meta-agent–routed channel. Called by the notifier on flush. */
56
+ stopMetaAgentTyping(channelId: string): void;
51
57
  /** Session key: "channelId" or "channelId:threadId" for threads */
52
58
  private sessionKey;
53
59
  /** Get the channel/thread for sending messages */
package/dist/bot.js CHANGED
@@ -226,6 +226,22 @@ export class CcDiscordBot {
226
226
  }
227
227
  }
228
228
  }
229
+ /** Typing intervals for meta-agent routed channels — keyed by channelId. */
230
+ metaAgentTypingTimers = new Map();
231
+ /** Start (or reset) the typing indicator for a meta-agent–routed channel. */
232
+ startMetaAgentTyping(channelId, channel) {
233
+ this.stopMetaAgentTyping(channelId);
234
+ channel.sendTyping().catch(() => { });
235
+ this.metaAgentTypingTimers.set(channelId, setInterval(() => { channel.sendTyping().catch(() => { }); }, TYPING_INTERVAL_MS));
236
+ }
237
+ /** Stop the typing indicator for a meta-agent–routed channel. Called by the notifier on flush. */
238
+ stopMetaAgentTyping(channelId) {
239
+ const timer = this.metaAgentTypingTimers.get(channelId);
240
+ if (timer) {
241
+ clearInterval(timer);
242
+ this.metaAgentTypingTimers.delete(channelId);
243
+ }
244
+ }
229
245
  /** Session key: "channelId" or "channelId:threadId" for threads */
230
246
  sessionKey(channelId, threadId) {
231
247
  return threadId ? `${channelId}:${threadId}` : channelId;
@@ -362,6 +378,8 @@ export class CcDiscordBot {
362
378
  if (mappedNs && this.redis) {
363
379
  this.writeChatMessage("user", "discord", text, effectiveChannelId, mappedNs.namespace);
364
380
  this.opts.registerRoutedChannelId?.(mappedNs.namespace, effectiveChannelId);
381
+ this.persistChannelMapping(effectiveChannelId, mappedNs.namespace, mappedNs.repoUrl);
382
+ this.startMetaAgentTyping(effectiveChannelId, msg.channel);
365
383
  const username = msg.member?.displayName ?? msg.author.username;
366
384
  try {
367
385
  await routeToMetaAgent(mappedNs.namespace, stampPrompt(text, username, msg.createdAt), this.redis);
@@ -371,7 +389,12 @@ export class CcDiscordBot {
371
389
  }
372
390
  return;
373
391
  }
374
- // Local Claude session
392
+ // Unknown guild channel — reject rather than silently start a local session with wrong context
393
+ if (msg.guild) {
394
+ await msg.channel.send("This channel is not configured. Use `channel for https://github.com/org/repo` to set it up.").catch(() => { });
395
+ return;
396
+ }
397
+ // Local Claude session (DMs only beyond this point)
375
398
  const session = this.getOrCreateSession(effectiveChannelId, msg.channel);
376
399
  const username = msg.member?.displayName ?? msg.author.username;
377
400
  try {
@@ -404,6 +427,8 @@ export class CcDiscordBot {
404
427
  if (mappedNs && this.redis) {
405
428
  this.writeChatMessage("user", "discord", fullText, channelId, mappedNs.namespace);
406
429
  this.opts.registerRoutedChannelId?.(mappedNs.namespace, channelId);
430
+ this.persistChannelMapping(channelId, mappedNs.namespace, mappedNs.repoUrl);
431
+ this.startMetaAgentTyping(channelId, channel);
407
432
  try {
408
433
  await routeToMetaAgent(mappedNs.namespace, prompt, this.redis);
409
434
  }
@@ -452,6 +477,8 @@ export class CcDiscordBot {
452
477
  const prompt = stampPrompt(fullText, imgUsername, msg.createdAt);
453
478
  this.writeChatMessage("user", "discord", fullText, channelId, mappedNs.namespace);
454
479
  this.opts.registerRoutedChannelId?.(mappedNs.namespace, channelId);
480
+ this.persistChannelMapping(channelId, mappedNs.namespace, mappedNs.repoUrl);
481
+ this.startMetaAgentTyping(channelId, channel);
455
482
  try {
456
483
  await routeToMetaAgent(mappedNs.namespace, prompt, this.redis);
457
484
  }
@@ -493,6 +520,8 @@ export class CcDiscordBot {
493
520
  if (mappedNs && this.redis) {
494
521
  this.writeChatMessage("user", "discord", fullText, channelId, mappedNs.namespace);
495
522
  this.opts.registerRoutedChannelId?.(mappedNs.namespace, channelId);
523
+ this.persistChannelMapping(channelId, mappedNs.namespace, mappedNs.repoUrl);
524
+ this.startMetaAgentTyping(channelId, channel);
496
525
  try {
497
526
  await routeToMetaAgent(mappedNs.namespace, prompt, this.redis);
498
527
  }
@@ -1022,6 +1051,9 @@ export class CcDiscordBot {
1022
1051
  session.claude.kill();
1023
1052
  this.sessions.delete(key);
1024
1053
  }
1054
+ for (const [channelId] of this.metaAgentTypingTimers) {
1055
+ this.stopMetaAgentTyping(channelId);
1056
+ }
1025
1057
  void this.client.destroy();
1026
1058
  }
1027
1059
  }
package/dist/notifier.js CHANGED
@@ -174,6 +174,7 @@ export function startNotifier(bot, notifyChannelId, namespace, redis, handleUser
174
174
  const META_AGENT_FLUSH_DELAY_MS = 1500;
175
175
  const metaAgentBuffers = new Map();
176
176
  function flushMetaAgentBuffer(ns, targetChannelId) {
177
+ bot.stopMetaAgentTyping(targetChannelId);
177
178
  const buf = metaAgentBuffers.get(ns);
178
179
  if (!buf || !buf.text.trim())
179
180
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonzih/cc-discord",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Claude Code Discord bot — chat with Claude Code via Discord",
5
5
  "type": "module",
6
6
  "bin": {