@gonzih/cc-discord 0.2.43 → 0.2.44

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.
@@ -223,53 +223,24 @@ function wireStdoutToRedis(proc, ns, wire) {
223
223
  result: resultText,
224
224
  is_error: parsed.is_error ?? false,
225
225
  };
226
- if (resultText && !parsed.is_error) {
227
- const msg = {
228
- id: crypto.randomUUID(),
229
- source: "claude",
230
- role: "assistant",
231
- content: resultText,
232
- timestamp: new Date().toISOString(),
233
- chatId: 0,
234
- };
235
- // Publish text first (logs to chat history), then signal done for immediate finalization
236
- wire.discord.publishOutgoing(ns, msg).then(() => {
237
- rawRedis.publish(discordChatOutgoing(ns), JSON.stringify({
238
- id: crypto.randomUUID(), source: "claude", role: "assistant",
239
- content: "", event: "done", timestamp: new Date().toISOString(), chatId: 0,
240
- })).catch(() => { });
241
- }).catch((err) => {
242
- console.warn(`[meta-agent-manager] publishOutgoing (result) failed (ns=${ns}):`, err.message);
243
- // Still signal done even if text publish failed
244
- rawRedis.publish(discordChatOutgoing(ns), JSON.stringify({
245
- id: crypto.randomUUID(), source: "claude", role: "assistant",
246
- content: "", event: "done", timestamp: new Date().toISOString(), chatId: 0,
247
- })).catch(() => { });
248
- });
249
- }
250
- else if (parsed.is_error) {
251
- // Error result: publish error text and signal done
226
+ if (parsed.is_error && resultText) {
227
+ // Error case: assistant event may not carry the error message — publish it directly
252
228
  const errMsg = {
253
229
  id: crypto.randomUUID(),
254
230
  source: "claude",
255
231
  role: "assistant",
256
- content: `⚠️ Error: ${resultText || "unknown error"}`,
232
+ content: `⚠️ Error: ${resultText}`,
257
233
  timestamp: new Date().toISOString(),
258
234
  chatId: 0,
259
235
  };
260
236
  wire.discord.publishOutgoing(ns, errMsg).catch(() => { });
261
- rawRedis.publish(discordChatOutgoing(ns), JSON.stringify({
262
- id: crypto.randomUUID(), source: "claude", role: "assistant",
263
- content: "", event: "done", timestamp: new Date().toISOString(), chatId: 0,
264
- })).catch(() => { });
265
- }
266
- else {
267
- // Empty result — just signal done
268
- rawRedis.publish(discordChatOutgoing(ns), JSON.stringify({
269
- id: crypto.randomUUID(), source: "claude", role: "assistant",
270
- content: "", event: "done", timestamp: new Date().toISOString(), chatId: 0,
271
- })).catch(() => { });
272
237
  }
238
+ // Signal turn completion — text was already published via the assistant event above.
239
+ // Do NOT re-publish resultText here: that would double-deliver the same content.
240
+ rawRedis.publish(discordChatOutgoing(ns), JSON.stringify({
241
+ id: crypto.randomUUID(), source: "claude", role: "assistant",
242
+ content: "", event: "done", timestamp: new Date().toISOString(), chatId: 0,
243
+ })).catch(() => { });
273
244
  }
274
245
  else {
275
246
  structuredEvent = parsed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonzih/cc-discord",
3
- "version": "0.2.43",
3
+ "version": "0.2.44",
4
4
  "description": "Claude Code Discord bot — chat with Claude Code via Discord",
5
5
  "type": "module",
6
6
  "bin": {