@goodandready/dsh-messenger-gateway 0.4.22 → 0.4.23

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.
Files changed (2) hide show
  1. package/lib/gateway.js +11 -2
  2. package/package.json +1 -1
package/lib/gateway.js CHANGED
@@ -430,8 +430,13 @@ export class Gateway {
430
430
  if (body.startsWith('/')) {
431
431
  const commandsService = this.ctx.get ? this.ctx.get('commands') : this.ctx?.commands
432
432
  if (commandsService && typeof commandsService.execute === 'function') {
433
+ const cmdAbort = chat.abort || new AbortController()
434
+ const createdAbort = !chat.abort
435
+ if (createdAbort) {
436
+ chat.abort = cmdAbort
437
+ }
433
438
  try {
434
- const outcome = await commandsService.execute(chat.agent, cleanBody, attachments || [], chat.abort?.signal)
439
+ const outcome = await commandsService.execute(chat.agent, cleanBody, attachments || [], cmdAbort.signal)
435
440
  if (outcome !== undefined) {
436
441
  const replyText = outcome?.result?.kind === 'text'
437
442
  ? outcome.result.text
@@ -446,11 +451,15 @@ export class Gateway {
446
451
  return
447
452
  }
448
453
  } catch (cmdErr) {
449
- if (chat.abort?.signal?.aborted) return
454
+ if (cmdAbort.signal.aborted) return
450
455
  const errMsg = cmdErr instanceof Error ? cmdErr.message : String(cmdErr)
451
456
  this.ctx.logger?.warn?.(`dsh-messenger-gateway: runtime command: ${errMsg}`)
452
457
  try { await reply(t('msg.exception', { message: errMsg }, this.resolveLocale(input))) } catch (repErr) { this.recordApiFailure('reply.exception', repErr) }
453
458
  return
459
+ } finally {
460
+ if (createdAbort && chat.abort === cmdAbort) {
461
+ chat.abort = undefined
462
+ }
454
463
  }
455
464
  }
456
465
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-messenger-gateway",
3
- "version": "0.4.22",
3
+ "version": "0.4.23",
4
4
  "description": "Telegram messenger bridge for DeepSeek Harness: sessions, steer, homes, inline asks, notify bridge, and optional TTS voice notes.",
5
5
  "license": "MIT",
6
6
  "type": "module",