antenna-openclaw-plugin 1.1.0 → 1.2.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 CHANGED
@@ -627,6 +627,105 @@ export default function register(api: any) {
627
627
  },
628
628
  });
629
629
 
630
+ // ═══════════════════════════════════════════════════════════════════
631
+ // Tool: antenna_event_create
632
+ // ═══════════════════════════════════════════════════════════════════
633
+ api.registerTool({
634
+ name: "antenna_event_create",
635
+ description: "Create an event. Returns a shareable link (antenna.fyi/e/CODE) for participants to join.",
636
+ parameters: {
637
+ type: "object",
638
+ properties: {
639
+ name: { type: "string", description: "Event name" },
640
+ sender_id: { type: "string" },
641
+ channel: { type: "string" },
642
+ lat: { type: "number", description: "Event latitude" },
643
+ lng: { type: "number", description: "Event longitude" },
644
+ starts_at: { type: "string", description: "Start time ISO" },
645
+ ends_at: { type: "string", description: "End time ISO" },
646
+ },
647
+ required: ["name", "sender_id", "channel"],
648
+ },
649
+ async execute(_id: string, params: any) {
650
+ const cfg = getConfig(api);
651
+ const supabase = getSupabase(cfg);
652
+ const deviceId = deriveDeviceId(params.sender_id, params.channel);
653
+ const { data, error } = await supabase.rpc("create_event", {
654
+ p_name: params.name,
655
+ p_lat: params.lat || null,
656
+ p_lng: params.lng || null,
657
+ p_created_by: deviceId,
658
+ p_starts_at: params.starts_at || new Date().toISOString(),
659
+ p_ends_at: params.ends_at || new Date(Date.now() + 12*60*60*1000).toISOString(),
660
+ });
661
+ if (error) return ok({ error: error.message });
662
+ return ok(data);
663
+ },
664
+ });
665
+
666
+ // ═══════════════════════════════════════════════════════════════════
667
+ // Tool: antenna_event_join
668
+ // ═══════════════════════════════════════════════════════════════════
669
+ api.registerTool({
670
+ name: "antenna_event_join",
671
+ description: "Join an event by its code from the event URL.",
672
+ parameters: {
673
+ type: "object",
674
+ properties: {
675
+ code: { type: "string", description: "Event code" },
676
+ sender_id: { type: "string" },
677
+ channel: { type: "string" },
678
+ },
679
+ required: ["code", "sender_id", "channel"],
680
+ },
681
+ async execute(_id: string, params: any) {
682
+ const cfg = getConfig(api);
683
+ const supabase = getSupabase(cfg);
684
+ const deviceId = deriveDeviceId(params.sender_id, params.channel);
685
+ const { data, error } = await supabase.rpc("join_event", { p_code: params.code, p_device_id: deviceId });
686
+ if (error) return ok({ error: error.message });
687
+ return ok(data);
688
+ },
689
+ });
690
+
691
+ // ═══════════════════════════════════════════════════════════════════
692
+ // Tool: antenna_event_scan
693
+ // ═══════════════════════════════════════════════════════════════════
694
+ api.registerTool({
695
+ name: "antenna_event_scan",
696
+ description: "Scan people in an event. No distance limit.",
697
+ parameters: {
698
+ type: "object",
699
+ properties: {
700
+ code: { type: "string", description: "Event code" },
701
+ sender_id: { type: "string" },
702
+ channel: { type: "string" },
703
+ },
704
+ required: ["code", "sender_id", "channel"],
705
+ },
706
+ async execute(_id: string, params: any) {
707
+ const cfg = getConfig(api);
708
+ const supabase = getSupabase(cfg);
709
+ const deviceId = deriveDeviceId(params.sender_id, params.channel);
710
+
711
+ const { data, error } = await supabase.rpc("event_participants_list", { p_code: params.code, p_device_id: deviceId });
712
+ if (error) return ok({ error: error.message });
713
+
714
+ const others = (data || []) as any[];
715
+ const _refMap: Record<string, string> = {};
716
+ const profiles = others.map((p, i) => {
717
+ const ref = String(i + 1);
718
+ _refMap[ref] = p.device_id;
719
+ return { ref, emoji: p.emoji || "👤", name: p.display_name || "匿名", line1: p.line1, line2: p.line2, line3: p.line3, source: "event" };
720
+ });
721
+
722
+ (api as any)._antennaRefMap = { ...(api as any)._antennaRefMap, ..._refMap };
723
+ try { await supabase.rpc("save_scan_refs", { p_owner: deviceId, p_refs: JSON.stringify(_refMap) }); } catch {}
724
+
725
+ return ok({ count: profiles.length, profiles, event: true });
726
+ },
727
+ });
728
+
630
729
  // ═══════════════════════════════════════════════════════════════════
631
730
  // Tool: antenna_pass
632
731
  // ═══════════════════════════════════════════════════════════════════
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antenna-openclaw-plugin",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Antenna — agent-mediated nearby people discovery for OpenClaw",
5
5
  "openclaw": {
6
6
  "extensions": ["./index.ts"]
@@ -251,3 +251,21 @@ Plugin 自带后台服务,每 10 分钟轮询一次 Supabase 查新的 mutual
251
251
  3. 如果对方分享了联系方式,一并展示
252
252
 
253
253
  用户不需要主动问,agent 会自动收到通知。
254
+
255
+ ### `antenna_event_create`
256
+ Create an event. Returns a shareable link (antenna.fyi/e/CODE).
257
+ - `name`: event name
258
+ - `sender_id`, `channel`: from context
259
+ - `lat`, `lng`: optional event location
260
+ - `starts_at`, `ends_at`: optional time range (default: now to +12h)
261
+
262
+ ### `antenna_event_join`
263
+ Join an event by code.
264
+ - `code`: from the event URL (antenna.fyi/e/CODE)
265
+ - `sender_id`, `channel`: from context
266
+
267
+ ### `antenna_event_scan`
268
+ Scan people in an event. No distance limit — returns all participants.
269
+ - `code`: event code
270
+ - `sender_id`, `channel`: from context
271
+ - Returns profiles with `source: "event"` tag