switchroom 0.14.48 → 0.14.50

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.
@@ -124,6 +124,27 @@ describe('buildResumeInterruptedInbound', () => {
124
124
  const msg = buildResumeInterruptedInbound({ turn: makeTurn({ thread_id: null }) })
125
125
  expect(msg.threadId).toBeUndefined()
126
126
  })
127
+
128
+ // Origin routing + ack-ability (the resume-deliver hardening). meta.chat_id
129
+ // makes the gateway build a currentTurn (progress card + silence-poke) and
130
+ // fire ackDelivery; meta.message_id round-trips so the deliver-until-acked
131
+ // queue can ack THIS synthetic by its own enqueue id (no re-deliver storm).
132
+ it('carries origin chat_id + message_id in meta (DM)', () => {
133
+ const turn = makeTurn({ chat_id: '12345', thread_id: null })
134
+ const msg = buildResumeInterruptedInbound({ turn, nowMs: 1_700_000_000_000 })
135
+ expect(msg.meta.chat_id).toBe('12345')
136
+ expect(msg.meta.message_id).toBe('1700000000000')
137
+ expect(msg.messageId).toBe(1_700_000_000_000)
138
+ expect(msg.meta.message_thread_id).toBeUndefined()
139
+ })
140
+
141
+ it('carries message_thread_id in meta for a forum topic (supergroup routing)', () => {
142
+ const turn = makeTurn({ chat_id: '-1001234567890', thread_id: '42' })
143
+ const msg = buildResumeInterruptedInbound({ turn })
144
+ expect(msg.meta.chat_id).toBe('-1001234567890')
145
+ expect(msg.meta.message_thread_id).toBe('42')
146
+ expect(msg.threadId).toBe(42)
147
+ })
127
148
  })
128
149
 
129
150
  describe('buildResumeWatchdogReportInbound', () => {
@@ -163,6 +184,18 @@ describe('buildResumeWatchdogReportInbound', () => {
163
184
  const msg = buildResumeWatchdogReportInbound({ turn, idleMs: 300_000 })
164
185
  expect(msg.text).not.toContain('tool call')
165
186
  })
187
+
188
+ // The report turn ALSO gets origin routing (currentTurn + topic) — a "your
189
+ // last turn was interrupted" notice should land in the topic the work lived
190
+ // in — but it is NOT deliver-until-acked tracked, so it carries NO
191
+ // message_id (only the 'resume_interrupted' builder does, gating tracking).
192
+ it('carries origin chat_id + message_thread_id but NO message_id (report is untracked)', () => {
193
+ const turn = makeTurn({ ended_via: 'timeout', chat_id: '-1001234567890', thread_id: '42' })
194
+ const msg = buildResumeWatchdogReportInbound({ turn, idleMs: 300_000 })
195
+ expect(msg.meta.chat_id).toBe('-1001234567890')
196
+ expect(msg.meta.message_thread_id).toBe('42')
197
+ expect(msg.meta.message_id).toBeUndefined()
198
+ })
166
199
  })
167
200
 
168
201
  describe('selectResumeBuilder', () => {