antenna-openclaw-plugin 0.5.0 → 0.6.0
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/index.ts +33 -0
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -448,6 +448,39 @@ export default function register(api: any) {
|
|
|
448
448
|
},
|
|
449
449
|
});
|
|
450
450
|
|
|
451
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
452
|
+
// Tool: antenna_bind
|
|
453
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
454
|
+
api.registerTool({
|
|
455
|
+
name: "antenna_bind",
|
|
456
|
+
description:
|
|
457
|
+
"Generate a GPS binding link. Send this URL to the user so they can share their phone's location via the web browser at antenna.fyi.",
|
|
458
|
+
parameters: {
|
|
459
|
+
type: "object",
|
|
460
|
+
properties: {
|
|
461
|
+
sender_id: { type: "string", description: "The sender's user ID" },
|
|
462
|
+
channel: { type: "string", description: "The channel name" },
|
|
463
|
+
},
|
|
464
|
+
required: ["sender_id", "channel"],
|
|
465
|
+
},
|
|
466
|
+
async execute(_id: string, params: any) {
|
|
467
|
+
const cfg = getConfig(api);
|
|
468
|
+
const supabase = getSupabase(cfg);
|
|
469
|
+
const deviceId = deriveDeviceId(params.sender_id, params.channel);
|
|
470
|
+
|
|
471
|
+
const { data, error } = await supabase.rpc("create_bind_token", { p_device_id: deviceId });
|
|
472
|
+
if (error) return ok({ error: error.message });
|
|
473
|
+
|
|
474
|
+
const token = data?.token;
|
|
475
|
+
const baseUrl = "https://www.antenna.fyi";
|
|
476
|
+
return ok({
|
|
477
|
+
token,
|
|
478
|
+
url: `${baseUrl}/locate?token=${token}`,
|
|
479
|
+
message: "发送这个链接给用户,在手机浏览器打开即可共享位置。",
|
|
480
|
+
});
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
|
|
451
484
|
// ═══════════════════════════════════════════════════════════════════
|
|
452
485
|
// Tool: antenna_check_matches
|
|
453
486
|
// ═══════════════════════════════════════════════════════════════════
|