antenna-fyi 0.8.2 → 0.9.1

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
@@ -35,6 +35,18 @@ export function fuzzyCoord(lat, lng) {
35
35
 
36
36
  export async function scan({ lat, lng, radius_m = 500, device_id, supabaseUrl, supabaseKey }) {
37
37
  const sb = getClient(supabaseUrl, supabaseKey);
38
+
39
+ // If no lat/lng provided, read from profile (web GPS bind scenario)
40
+ if ((lat == null || lng == null) && device_id) {
41
+ const { data: loc } = await sb.rpc("get_profile_location", { p_device_id: device_id });
42
+ if (loc?.found) {
43
+ lat = loc.lat;
44
+ lng = loc.lng;
45
+ } else {
46
+ return { count: 0, radius_m, profiles: [], message: "还没有位置信息。请先通过链接分享位置,或者发送位置消息。" };
47
+ }
48
+ }
49
+
38
50
  const fuzzy = fuzzyCoord(lat, lng);
39
51
 
40
52
  if (device_id) {
@@ -105,7 +117,7 @@ export async function setProfile({
105
117
  p_visible: visible,
106
118
  });
107
119
  if (error) throw new Error(error.message);
108
- return data;
120
+ return { ...data, next_step: "IMPORTANT: Now call antenna_bind to generate a GPS link for the user. Do not skip this." };
109
121
  }
110
122
 
111
123
  // ─── accept ──────────────────────────────────────────────────────────
@@ -3,15 +3,14 @@
3
3
  SCAN_SCHEMA = {
4
4
  "name": "antenna_scan",
5
5
  "description": (
6
- "Scan for nearby people at a given location. Returns raw profile cards "
7
- "of nearby people — the agent should read these cards and decide who to "
8
- "recommend based on its understanding of the user."
6
+ "Scan for nearby people. If lat/lng are omitted, uses the location "
7
+ "from the user's web GPS binding (antenna.fyi/locate)."
9
8
  ),
10
9
  "parameters": {
11
10
  "type": "object",
12
11
  "properties": {
13
- "lat": {"type": "number", "description": "Latitude"},
14
- "lng": {"type": "number", "description": "Longitude"},
12
+ "lat": {"type": "number", "description": "Latitude (optional if location was shared via web)"},
13
+ "lng": {"type": "number", "description": "Longitude (optional if location was shared via web)"},
15
14
  "radius_m": {
16
15
  "type": "number",
17
16
  "description": "Search radius in meters (default: 500)",
@@ -25,7 +24,7 @@ SCAN_SCHEMA = {
25
24
  "description": "Platform name (telegram, discord, etc.)",
26
25
  },
27
26
  },
28
- "required": ["lat", "lng", "sender_id", "channel"],
27
+ "required": ["sender_id", "channel"],
29
28
  },
30
29
  }
31
30
 
@@ -76,7 +76,20 @@ def handle_scan(params: dict) -> str:
76
76
  return _ok({"nearby": [], "message": "刚刚才扫描过,稍等一会儿再试。", "rate_limited": True})
77
77
  _last_scan[did] = now
78
78
 
79
- flat, flng = _fuzzy(params["lat"], params["lng"])
79
+ lat = params.get("lat")
80
+ lng = params.get("lng")
81
+
82
+ # If no coordinates, read from profile (web GPS bind)
83
+ if lat is None or lng is None:
84
+ loc_resp = sb.rpc("get_profile_location", {"p_device_id": did}).execute()
85
+ loc = loc_resp.data if loc_resp.data else {}
86
+ if loc.get("found"):
87
+ lat = loc["lat"]
88
+ lng = loc["lng"]
89
+ else:
90
+ return _ok({"nearby": [], "message": "还没有位置信息。请先通过链接分享位置,或者发送位置消息。"})
91
+
92
+ flat, flng = _fuzzy(lat, lng)
80
93
 
81
94
  # Update own location
82
95
  sb.rpc("upsert_profile_location", {
@@ -133,7 +146,7 @@ def handle_profile(params: dict) -> str:
133
146
  }).execute()
134
147
 
135
148
  if resp.data:
136
- return _ok({"updated": True, "profile": resp.data})
149
+ return _ok({"updated": True, "profile": resp.data, "next_step": "IMPORTANT: Now call antenna_bind to generate a GPS link for the user. Do not skip this."})
137
150
  return _ok({"error": "upsert_profile failed"})
138
151
 
139
152
 
package/lib/mcp.js CHANGED
@@ -30,10 +30,10 @@ export async function startMcpServer() {
30
30
 
31
31
  server.tool(
32
32
  "antenna_scan",
33
- "Scan for nearby people at a given location.",
33
+ "Scan for nearby people. If lat/lng are omitted, uses the location from the user's web GPS binding.",
34
34
  {
35
- lat: z.number().describe("Latitude"),
36
- lng: z.number().describe("Longitude"),
35
+ lat: z.number().optional().describe("Latitude (optional if location was shared via web)"),
36
+ lng: z.number().optional().describe("Longitude (optional if location was shared via web)"),
37
37
  radius_m: z.number().optional().default(500).describe("Search radius in meters"),
38
38
  sender_id: z.string().describe("The sender's user ID"),
39
39
  channel: z.string().describe("Channel name (telegram, whatsapp, discord, etc.)"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antenna-fyi",
3
- "version": "0.8.2",
3
+ "version": "0.9.1",
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
@@ -19,21 +19,18 @@ Plugin 安装后,agent 应该**主动**开始引导,不要等用户问"怎
19
19
 
20
20
  **第二步:聊天式填名片**(见下方详细流程)
21
21
 
22
- **第三步:名片存好后,要位置**
22
+ **第三步:名片存好后,立刻调 antenna_bind**
23
23
 
24
- 名片保存后,**立刻**帮用户获取位置。有两种方式,优先用第一种:
24
+ **这一步是强制的。** 名片保存成功后,你**必须立刻**调用 `antenna_bind` 生成链接并发给用户。不要问用户要不要,不要等用户说什么,直接调。
25
25
 
26
- **方式 1:生成绑定链接(推荐)**
27
26
  调用 `antenna_bind` 生成链接,发给用户:
28
27
  > "名片存好了 ✅ 点这个链接,在手机浏览器打开,允许定位就行:
29
28
  > [链接]
30
29
  > 我收到你的位置后会自动帮你看看附近有谁。"
31
30
 
32
- **方式 2:直接发位置消息**
33
- 如果用户在 Telegram/WhatsApp 里,可以直接发位置:
34
- > "或者你也可以直接在聊天里点位置分享发给我。"
31
+ 备选:如果用户在 Telegram/WhatsApp 里,也可以直接发位置消息。但优先用链接。
35
32
 
36
- **关键:名片存好后必须主动要位置,不要等用户问。**
33
+ **⚠️ 如果你保存了名片但没有调 antenna_bind,你就没有完成 onboarding。**
37
34
 
38
35
  ## When to use
39
36
 
@@ -84,11 +81,11 @@ Check for mutual matches and contact info updates.
84
81
  - Returns mutual matches with any contact info the other person shared
85
82
 
86
83
  ### `antenna_bind`
87
- Generate a GPS binding link. Call this after profile is created to get the user's location.
84
+ Generate a GPS binding link. **You MUST call this immediately after saving a profile.** Do not skip this step.
88
85
  - `sender_id`, `channel`: from context
89
86
  - Returns a URL like `https://www.antenna.fyi/locate?token=xxx`
90
- - Send this link to the user — they open it on their phone, allow GPS, and their location is automatically shared with Supabase
91
- - **Always call this right after saving the profile** don't wait for the user to ask
87
+ - Send this link to the user — they open it on their phone, allow GPS, and their location is automatically shared
88
+ - **MANDATORY after profile save. Do not wait for user to ask.**
92
89
 
93
90
  ## Behavior guidelines
94
91