antenna-fyi 1.2.8 → 1.2.9

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 CHANGED
@@ -515,6 +515,15 @@ export async function endEvent({ code, device_id, supabaseUrl, supabaseKey }) {
515
515
 
516
516
  export async function eventCheckin({ code, device_id, lat, lng, supabaseUrl, supabaseKey }) {
517
517
  const sb = getClient(supabaseUrl, supabaseKey);
518
+
519
+ // Auto-read profile location if not provided
520
+ if (lat == null || lng == null) {
521
+ try {
522
+ const { data: loc } = await sb.rpc("get_profile_location", { p_device_id: device_id });
523
+ if (loc?.lat && loc?.lng) { lat = loc.lat; lng = loc.lng; }
524
+ } catch {}
525
+ }
526
+
518
527
  const fuzzy = (lat != null && lng != null) ? fuzzyCoord(lat, lng) : { lat: null, lng: null };
519
528
  const { data, error } = await sb.rpc("event_checkin", {
520
529
  p_code: code, p_device_id: device_id,
@@ -577,14 +586,21 @@ export async function getEvent({ code, supabaseUrl, supabaseKey }) {
577
586
  return data;
578
587
  }
579
588
 
580
- export async function createBindToken({ device_id, supabaseUrl, supabaseKey }) {
589
+ export async function createBindToken({ device_id, purpose, event_code, supabaseUrl, supabaseKey }) {
581
590
  const sb = getClient(supabaseUrl, supabaseKey);
582
- const { data, error } = await sb.rpc("create_bind_token", { p_device_id: device_id });
591
+ const { data, error } = await sb.rpc("create_bind_token", {
592
+ p_device_id: device_id,
593
+ p_purpose: purpose || "profile",
594
+ p_event_code: event_code || null,
595
+ });
583
596
  if (error) throw new Error(error.message);
584
597
  const baseUrl = "https://www.antenna.fyi";
585
598
  return {
586
599
  token: data.token,
587
600
  url: `${baseUrl}/locate?token=${data.token}`,
588
- message: "发送这个链接给用户,在手机浏览器打开即可共享位置。",
601
+ purpose: purpose || "profile",
602
+ message: purpose === "event"
603
+ ? "发送这个链接给活动创建者,在活动地点打开即可设定活动位置。"
604
+ : "发送这个链接给用户,在手机浏览器打开即可共享位置。",
589
605
  };
590
606
  }
@@ -122,14 +122,15 @@ CHECK_MATCHES_SCHEMA = {
122
122
  BIND_SCHEMA = {
123
123
  "name": "antenna_bind",
124
124
  "description": (
125
- "Generate a GPS binding link. Send this URL to the user so they can "
126
- "share their phone's location via the web browser."
125
+ "Generate a GPS binding link. Use purpose='event' + event_code when setting an event's location."
127
126
  ),
128
127
  "parameters": {
129
128
  "type": "object",
130
129
  "properties": {
131
130
  "sender_id": {"type": "string"},
132
131
  "channel": {"type": "string"},
132
+ "purpose": {"type": "string", "description": "'profile' (default) or 'event'"},
133
+ "event_code": {"type": "string", "description": "Event code (when purpose=event)"},
133
134
  },
134
135
  "required": ["sender_id", "channel"],
135
136
  },
@@ -452,16 +452,28 @@ def handle_event_scan(params: dict) -> str:
452
452
  def handle_bind(params: dict) -> str:
453
453
  sb = _sb()
454
454
  did = _device_id(params["sender_id"], params["channel"])
455
+ purpose = params.get("purpose", "profile")
456
+ event_code = params.get("event_code")
455
457
 
456
- resp = sb.rpc("create_bind_token", {"p_device_id": did}).execute()
458
+ resp = sb.rpc("create_bind_token", {
459
+ "p_device_id": did,
460
+ "p_purpose": purpose,
461
+ "p_event_code": event_code,
462
+ }).execute()
457
463
  if not resp.data:
458
464
  return _ok({"error": "Failed to create bind token"})
459
465
 
460
466
  token = resp.data.get("token")
467
+ msg = (
468
+ "发送这个链接给活动创建者,在活动地点打开即可设定活动位置。"
469
+ if purpose == "event"
470
+ else "发送这个链接给用户,在手机浏览器打开即可共享位置。"
471
+ )
461
472
  return _ok({
462
473
  "token": token,
463
474
  "url": f"{BASE_URL}/locate?token={token}",
464
- "message": "发送这个链接给用户,在手机浏览器打开即可共享位置。",
475
+ "purpose": purpose,
476
+ "message": msg,
465
477
  })
466
478
 
467
479
 
package/lib/mcp.js CHANGED
@@ -163,14 +163,16 @@ export async function startMcpServer() {
163
163
 
164
164
  server.tool(
165
165
  "antenna_bind",
166
- "Generate a GPS binding link. Send this to the user so they can share their phone's location via the web.",
166
+ "Generate a GPS binding link. Send this to the user so they can share their phone's location via the web. Use purpose='event' + event_code when creating a link for setting an event's location.",
167
167
  {
168
168
  sender_id: z.string().describe("The sender's user ID"),
169
169
  channel: z.string().describe("Channel name"),
170
+ purpose: z.string().optional().describe("'profile' (default) or 'event'"),
171
+ event_code: z.string().optional().describe("Event code (required when purpose=event)"),
170
172
  },
171
- async ({ sender_id, channel }) => {
173
+ async ({ sender_id, channel, purpose, event_code }) => {
172
174
  try {
173
- const result = await createBindToken({ device_id: deriveDeviceId(sender_id, channel) });
175
+ const result = await createBindToken({ device_id: deriveDeviceId(sender_id, channel), purpose, event_code });
174
176
  return jsonResult(result);
175
177
  } catch (e) {
176
178
  return jsonResult({ error: e.message });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antenna-fyi",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Antenna — nearby people discovery. CLI + MCP server + OpenClaw skill & plugin, all in one package.",
5
5
  "type": "module",
6
6
  "bin": {
package/skill/SKILL.md CHANGED
@@ -112,9 +112,12 @@ Check for mutual matches and contact info updates.
112
112
  ### `antenna_bind`
113
113
  Generate a GPS binding link. **You MUST call this immediately after saving a profile.** Do not skip this step.
114
114
  - `sender_id`, `channel`: from context
115
+ - `purpose`: optional — `'profile'` (default) updates user location; `'event'` sets event location
116
+ - `event_code`: required when `purpose='event'`
115
117
  - Returns a URL like `https://www.antenna.fyi/locate?token=xxx`
116
118
  - Send this link to the user — they open it on their phone, allow GPS, and their location is automatically shared
117
119
  - **MANDATORY after profile save. Do not wait for user to ask.**
120
+ - **For events:** When a creator needs to set event location, call with `purpose='event'` and `event_code`. The GPS will update the event's coordinates, NOT the user's profile.
118
121
 
119
122
  ### `antenna_discover`
120
123
  Get today's global recommendation — the person most similar to you worldwide. 1 per day, no repeats.
@@ -282,7 +285,7 @@ Create an event. Returns a shareable link (antenna.fyi/e/CODE).
282
285
  - `description`: optional event description
283
286
  - `og_image`: optional OG image URL for social sharing preview
284
287
 
285
- **GPS flow for events:** If the user doesn't provide coordinates, generate a bind link (`antenna_bind`) and ask them to open it at the event location. Once GPS comes in, use those coordinates for `lat`/`lng`. Don't use profile location the user may create an event at a different place.
288
+ **GPS flow for events:** If the user doesn't provide coordinates, generate a bind link (`antenna_bind`) and ask them to open it at the event location. Once GPS comes in, use those coordinates for the event's `lat`/`lng` do NOT treat this as the user's personal location. The bind link GPS for event creation goes to the event, not the user's profile. Only use `antenna_checkin` when the user wants to update their own location.
286
289
 
287
290
  ### `antenna_event_end`
288
291
  End an event. Only the creator can end it.