antenna-fyi 1.3.5 → 1.3.6

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.
@@ -1,5 +1,5 @@
1
1
  name: antenna
2
- version: "1.3.5"
2
+ version: "1.3.6"
3
3
  description: |
4
4
  Nearby people discovery + events — scan for people, set up your profile card,
5
5
  accept matches, create/join events, and get real-time notifications.
@@ -130,6 +130,13 @@ def handle_scan(params: dict) -> str:
130
130
  "distance_m": p.get("distance_m") or p.get("dist_meters"),
131
131
  })
132
132
 
133
+ # Persist refs to DB so accept works after restart
134
+ if did and _last_ref_map:
135
+ try:
136
+ sb.rpc("save_scan_refs", {"p_owner": did, "p_refs": _last_ref_map}).execute()
137
+ except Exception:
138
+ pass
139
+
133
140
  return _ok({
134
141
  "profiles": profiles,
135
142
  "count": len(others),
@@ -176,6 +183,14 @@ def handle_accept(params: dict) -> str:
176
183
  target = params.get("target_device_id")
177
184
  if ref and ref in _last_ref_map:
178
185
  target = _last_ref_map[ref]
186
+ if not target and ref:
187
+ # DB fallback
188
+ try:
189
+ rr = sb.rpc("resolve_ref", {"p_owner": did, "p_ref": ref}).execute()
190
+ if rr.data:
191
+ target = rr.data
192
+ except Exception:
193
+ pass
179
194
  if not target:
180
195
  return _ok({"error": "No target. Use 'ref' from scan results or 'target_device_id'."})
181
196
 
@@ -251,7 +266,7 @@ def handle_check_matches(params: dict) -> str:
251
266
  inc_only = []
252
267
  for i, m in enumerate(raw_incoming):
253
268
  inc_only.append({
254
- "ref": str(i + 1),
269
+ "ref": str(len(mutual) + i + 1),
255
270
  "_device_id": m.get("target_id"),
256
271
  "name": m.get("name") or "匿名",
257
272
  "emoji": m.get("emoji") or "👤",
@@ -268,6 +283,19 @@ def handle_check_matches(params: dict) -> str:
268
283
  if not msgs:
269
284
  msgs.append("你接受了一些匹配,但对方还没有回应。耐心等等 ⏳")
270
285
 
286
+ # Persist refs so accept(ref) resolves correctly
287
+ global _last_ref_map
288
+ _last_ref_map = {}
289
+ for m in mutual:
290
+ _last_ref_map[m["ref"]] = m["_device_id"]
291
+ for m in inc_only:
292
+ _last_ref_map[m["ref"]] = m["_device_id"]
293
+ if did and _last_ref_map:
294
+ try:
295
+ sb.rpc("save_scan_refs", {"p_owner": did, "p_refs": _last_ref_map}).execute()
296
+ except Exception:
297
+ pass
298
+
271
299
  return _ok({
272
300
  "mutual_matches": mutual,
273
301
  "incoming_accepts": inc_only,
@@ -291,7 +319,7 @@ def handle_pass(params: dict) -> str:
291
319
  try:
292
320
  resp = sb.rpc("resolve_ref", {"p_owner": did, "p_ref": ref}).execute()
293
321
  if resp.data:
294
- target = resp.data.get("target_device_id")
322
+ target = resp.data
295
323
  except Exception:
296
324
  pass
297
325
  if not target:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antenna-fyi",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "Antenna — nearby people discovery. CLI + MCP server + OpenClaw skill & plugin, all in one package.",
5
5
  "type": "module",
6
6
  "bin": {