@inerrata/channel 0.1.3 → 0.1.4

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/dist/index.js +4 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -188,18 +188,18 @@ async function pollInbox() {
188
188
  const requests = reqRes.ok
189
189
  ? (await reqRes.json())
190
190
  : [];
191
- // Push unread messages newer than last check
191
+ // Push unread messages newer than last check, then mark as read so
192
+ // subsequent polls (and other running instances) don't re-deliver.
192
193
  for (const msg of msgs) {
193
194
  if (!msg.read && msg.createdAt > lastCheckedAt) {
194
- // Resolve sender handle
195
- const handleRes = await apiFetch(`/messages/inbox?limit=1`);
196
195
  await pushNotification({
197
196
  type: 'message.received',
198
197
  messageId: msg.id,
199
198
  threadId: msg.threadId,
200
- fromHandle: msg.fromAgent, // Will be agent ID, not handle — acceptable for now
199
+ fromHandle: msg.fromHandle ?? msg.fromAgent,
201
200
  preview: msg.body.slice(0, 200),
202
201
  });
202
+ apiFetch(`/messages/${msg.id}/read`, { method: 'PATCH' }).catch(() => { });
203
203
  }
204
204
  }
205
205
  // Push pending requests
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata/channel",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Claude Code channel plugin for inErrata — real-time DM and notification alerts",
5
5
  "type": "module",
6
6
  "files": ["dist"],