antenna-openclaw-plugin 1.3.6 → 1.3.8

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
@@ -1060,6 +1060,8 @@ export default function register(api: any) {
1060
1060
  lng: { type: "number", description: "New event longitude" },
1061
1061
  starts_at: { type: "string", description: "New start time ISO" },
1062
1062
  ends_at: { type: "string", description: "New end time ISO" },
1063
+ requires_approval: { type: "boolean", description: "Require host approval to join" },
1064
+ screening_questions: { type: "array", items: { type: "string" }, description: "Screening questions for applicants" },
1063
1065
  },
1064
1066
  required: ["code", "sender_id", "channel", "chat_id"],
1065
1067
  },
@@ -1072,6 +1074,8 @@ export default function register(api: any) {
1072
1074
  p_name: params.name || null, p_description: params.description || null,
1073
1075
  p_og_image: params.og_image || null, p_lat: params.lat ?? null, p_lng: params.lng ?? null,
1074
1076
  p_starts_at: params.starts_at || null, p_ends_at: params.ends_at || null,
1077
+ ...(params.requires_approval != null ? { p_requires_approval: params.requires_approval } : {}),
1078
+ ...(params.screening_questions != null ? { p_screening_questions: params.screening_questions } : {}),
1075
1079
  });
1076
1080
  if (error) return ok({ error: error.message });
1077
1081
  return ok(data);
@@ -1166,7 +1170,38 @@ export default function register(api: any) {
1166
1170
  });
1167
1171
 
1168
1172
  // ═══════════════════════════════════════════════════════════════════
1169
- // Service: poll for new matches every 10 minutes → notify instantly
1173
+ // Tool: antenna_event_message
1174
+ // ═══════════════════════════════════════════════════════════════════
1175
+ api.registerTool({
1176
+ name: "antenna_event_message",
1177
+ description: "Send a message to event participants. Only creator or co-host can send. Omit ref to broadcast to all participants.",
1178
+ parameters: {
1179
+ type: "object",
1180
+ properties: {
1181
+ code: { type: "string", description: "Event code" },
1182
+ sender_id: { type: "string" },
1183
+ channel: { type: "string" },
1184
+ chat_id: { type: "string", description: "REQUIRED for notifications. Pass the chat/channel ID from your message context so Antenna can send you match and event notifications." },
1185
+ message: { type: "string", description: "Message to send to participants" },
1186
+ ref: { type: "string", description: "Ref number of specific participant (omit to broadcast to all)" },
1187
+ },
1188
+ required: ["code", "sender_id", "channel", "message", "chat_id"],
1189
+ },
1190
+ async execute(_id: string, params: any) {
1191
+ const cfg = getConfig(api);
1192
+ const supabase = getSupabase(cfg);
1193
+ const deviceId = deriveDeviceId(params.sender_id, params.channel, params.chat_id);
1194
+ const { data, error } = await supabase.rpc("send_event_message", {
1195
+ p_code: params.code,
1196
+ p_device_id: deviceId,
1197
+ p_message: params.message,
1198
+ ...(params.ref ? { p_target_ref: params.ref } : {}),
1199
+ });
1200
+ if (error) return ok({ error: error.message });
1201
+ return ok(data);
1202
+ },
1203
+ });
1204
+
1170
1205
  // ═══════════════════════════════════════════════════════════════════
1171
1206
  const _notifiedMatches = new Set<string>(); // "deviceA→deviceB" already notified
1172
1207
 
@@ -1430,6 +1465,29 @@ export default function register(api: any) {
1430
1465
  }
1431
1466
  } catch { /* silent */ }
1432
1467
  }
1468
+
1469
+ // ── Event messages polling ──
1470
+ for (const profile of activeProfiles) {
1471
+ const deviceId = profile.device_id;
1472
+ try {
1473
+ const { data: msgs } = await supabase.rpc("get_my_event_messages", { p_device_id: deviceId });
1474
+ if (!msgs?.length) continue;
1475
+ const parts = deviceId.split(":");
1476
+ if (parts.length < 2) continue;
1477
+ const channel = parts[0];
1478
+ const userId = parts.slice(1).join(":");
1479
+ for (const msg of msgs) {
1480
+ const key = `evtmsg:${msg.event_id}:${msg.created_at}`;
1481
+ if (_notifiedMatches.has(key)) continue;
1482
+ const role = msg.sender_role === 'creator' ? '组织者' : '协办';
1483
+ notifyUser(channel, userId,
1484
+ `[Antenna] 📢 来自「${msg.event_name}」${role} ${msg.sender_emoji || ''} ${msg.sender_name}: ${msg.message}`,
1485
+ logger,
1486
+ );
1487
+ _notifiedMatches.add(key);
1488
+ }
1489
+ } catch { /* silent */ }
1490
+ }
1433
1491
  } catch (err: any) {
1434
1492
  logger.warn("Antenna: match poll error:", err.message);
1435
1493
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antenna-openclaw-plugin",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "description": "Antenna — agent-mediated nearby people discovery for OpenClaw",
5
5
  "openclaw": {
6
6
  "extensions": ["./index.ts"]
@@ -366,6 +366,8 @@ Update event info. Only creator or co-host can update.
366
366
  - `sender_id`, `channel`: from context
367
367
  - `chat_id`: REQUIRED for notifications
368
368
  - `name`, `description`, `og_image`, `lat`, `lng`, `starts_at`, `ends_at`: all optional for update (only provided fields change, others stay as-is)
369
+ - `requires_approval`: optional boolean — enable/disable approval requirement
370
+ - `screening_questions`: optional string array — update screening questions
369
371
 
370
372
  ### `antenna_event_approve`
371
373
  Approve a pending participant. Only creator or co-host.
@@ -388,6 +390,16 @@ Add a co-host to the event. Only creator can add.
388
390
  - `chat_id`: REQUIRED for notifications
389
391
  - `ref`: participant ref number to promote to co-host
390
392
 
393
+ ### `antenna_event_message`
394
+ Send a message to event participants. Only creator or co-host can send.
395
+ - `code`: event code
396
+ - `sender_id`, `channel`: from context
397
+ - `chat_id`: REQUIRED for notifications
398
+ - `message`: the message text
399
+ - `ref`: optional — ref number of specific participant. Omit to broadcast to all active participants.
400
+ - Use when the host needs to notify participants about logistics, changes, or requests (e.g. "please share your WeChat in your profile").
401
+ - One-way: participants receive the message but cannot reply through this channel.
402
+
391
403
  ---
392
404
 
393
405
  ## Event Behavior Guide