relay-companion 0.1.43 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relay-companion",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "description": "Relay companion: connects local coding agents to Relay tasks, approvals, and connector tools.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -249,6 +249,24 @@ function writeCompanionState(statePath, state) {
249
249
  fs.renameSync(tmp, statePath);
250
250
  }
251
251
 
252
+ /** Apply server tombstones to rows already staged by this companion. */
253
+ export function removeSuppressedCompanionItems(itemIds, { statePath = companionStatePath() } = {}) {
254
+ const suppressed = new Set((itemIds || []).filter(Boolean).map(String));
255
+ if (!suppressed.size) return 0;
256
+ return withJsonLock(statePath, () => {
257
+ const state = readCompanionState(statePath);
258
+ state.packets ||= {};
259
+ let removed = 0;
260
+ for (const id of suppressed) {
261
+ if (!state.packets[id]) continue;
262
+ delete state.packets[id];
263
+ removed += 1;
264
+ }
265
+ if (removed) writeCompanionState(statePath, state);
266
+ return removed;
267
+ });
268
+ }
269
+
252
270
  function accountMarker({ user = currentUser(), deviceId = readConfig().deviceId || "" } = {}) {
253
271
  return {
254
272
  userId: user?.id || "",
@@ -14,6 +14,7 @@ import {
14
14
  defaultStageRelayCompanionItem,
15
15
  freshNotifications,
16
16
  markNotificationsProcessed,
17
+ removeSuppressedCompanionItems,
17
18
  reconcileAnsweredQuestions,
18
19
  stagePlainRelayItem as defaultStagePlainRelayItem,
19
20
  } from "./notifications.js";
@@ -171,6 +172,8 @@ async function pollHumanNotifications({ client, ledger, stageCompanionItem, stag
171
172
  client.listConnectors(),
172
173
  ]);
173
174
  const events = await pollVisibleTaskEvents({ client, ledger, tasks, log });
175
+ const removed = removeSuppressedCompanionItems(relays.inboxState?.suppressedItemIds || []);
176
+ if (removed) log(`removed ${removed} Relay item(s) moved to Recently Deleted elsewhere`);
174
177
  const notifications = buildHumanNotifications({
175
178
  user: me.user,
176
179
  tasks: tasks.tasks || [],