antenna-fyi 1.3.4 → 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.
- package/lib/core.js +10 -1
- package/lib/hermes-plugin/plugin.yaml +1 -1
- package/lib/hermes-plugin/tools.py +30 -2
- package/package.json +1 -1
- package/skill/SKILL.md +3 -1
package/lib/core.js
CHANGED
|
@@ -334,8 +334,9 @@ export async function checkMatches({ device_id, supabaseUrl, supabaseKey }) {
|
|
|
334
334
|
you_shared: m.you_shared || null,
|
|
335
335
|
}));
|
|
336
336
|
|
|
337
|
+
const incomingOffset = mutualMatches.length;
|
|
337
338
|
const incomingAccepts = (raw.incoming_accepts || []).map((m, i) => ({
|
|
338
|
-
ref: String(i + 1),
|
|
339
|
+
ref: String(incomingOffset + i + 1),
|
|
339
340
|
_device_id: m.target_id,
|
|
340
341
|
name: m.name || "匿名",
|
|
341
342
|
emoji: m.emoji || "👤",
|
|
@@ -353,6 +354,14 @@ export async function checkMatches({ device_id, supabaseUrl, supabaseKey }) {
|
|
|
353
354
|
messages.push("你接受了一些匹配,但对方还没有回应。耐心等等 ⏳");
|
|
354
355
|
}
|
|
355
356
|
|
|
357
|
+
// Persist ref map so accept(ref) resolves correctly
|
|
358
|
+
const _refMap = {};
|
|
359
|
+
for (const m of mutualMatches) _refMap[m.ref] = m._device_id;
|
|
360
|
+
for (const m of incomingAccepts) _refMap[m.ref] = m._device_id;
|
|
361
|
+
if (device_id && Object.keys(_refMap).length > 0) {
|
|
362
|
+
try { await sb.rpc("save_scan_refs", { p_owner: device_id, p_refs: _refMap }); } catch { /* best effort */ }
|
|
363
|
+
}
|
|
364
|
+
|
|
356
365
|
return {
|
|
357
366
|
mutual_matches: mutualMatches,
|
|
358
367
|
incoming_accepts: incomingAccepts,
|
|
@@ -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
|
|
322
|
+
target = resp.data
|
|
295
323
|
except Exception:
|
|
296
324
|
pass
|
|
297
325
|
if not target:
|
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -344,7 +344,7 @@ Scan people in an event. No distance limit - returns all participants.
|
|
|
344
344
|
- Returns profiles with `source: "event"` tag
|
|
345
345
|
|
|
346
346
|
### `antenna_event_checkin`
|
|
347
|
-
Check in at an event
|
|
347
|
+
Check in at an event — marks you as present at the event location. Optionally updates GPS.
|
|
348
348
|
- `code`: event code
|
|
349
349
|
- `sender_id`, `channel`: from context
|
|
350
350
|
- `chat_id`: REQUIRED for notifications
|
|
@@ -352,6 +352,7 @@ Check in at an event - marks you as present at the event location. Optionally up
|
|
|
352
352
|
- **Event must have started** (`starts_at <= now`). Cannot check in before start time.
|
|
353
353
|
- **Must be within 1km** of event location.
|
|
354
354
|
- **Must have `status: active`** (approved participants only, not pending).
|
|
355
|
+
- **Check-in is automatic on join.** Only call this manually if the user explicitly asks to check in. Do not prompt the user about check-in.
|
|
355
356
|
|
|
356
357
|
### `antenna_event_upload_image`
|
|
357
358
|
Upload an image for an event OG preview. Returns a public URL.
|
|
@@ -414,6 +415,7 @@ Share the event URL with the user.
|
|
|
414
415
|
- If screening questions returned: **ask the user each question**, collect answers, then call `antenna_event_join(code, application_context="answers")` again
|
|
415
416
|
- If `status: pending` → "waiting for organizer approval"
|
|
416
417
|
- If `status: active` → user is in! Auto check-in if event started + GPS within 1km.
|
|
418
|
+
- **Do NOT ask the user about check-in.** Check-in is automatic — if the response has `checked_in: true`, just confirm they're in. If `checked_in: false`, ignore it silently. Users don't need to know about or manage check-in.
|
|
417
419
|
|
|
418
420
|
### Scanning an event
|
|
419
421
|
1. Call `antenna_event_scan(code)`
|