antenna-fyi 1.2.18 → 1.2.20
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/cli.js +60 -5
- package/package.json +1 -1
- package/skill/EVENTS.md +11 -5
package/lib/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// antenna CLI command handlers
|
|
2
2
|
|
|
3
|
-
import { scan, getProfile, setProfile, accept, checkMatches, checkin, createBindToken, discover, createEvent, endEvent, eventCheckin, joinEvent, eventScan, pass as passUser, uploadEventImage, getClient } from "./core.js";
|
|
3
|
+
import { scan, getProfile, setProfile, accept, checkMatches, checkin, createBindToken, discover, createEvent, endEvent, eventCheckin, joinEvent, eventScan, pass as passUser, uploadEventImage, updateEvent, approveParticipant, rejectParticipant, addCohost, getClient } from "./core.js";
|
|
4
4
|
import { createInterface } from "readline";
|
|
5
5
|
import { existsSync, mkdirSync, copyFileSync, readFileSync } from "fs";
|
|
6
6
|
import { join, dirname, extname } from "path";
|
|
@@ -177,7 +177,7 @@ export async function handleEvent(f) {
|
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
if (f.create || (!f.join && !f.scan && !f.end && f.name)) {
|
|
180
|
+
if (f.create || (!f.join && !f.scan && !f.end && !f.update && !f.approve && !f.reject && !f['add-host'] && f.name)) {
|
|
181
181
|
if (!f.name) return console.error("Usage: antenna event --create --name 'AI Meetup' [--desc 'description'] [--og-image 'url'] [--requires-approval] [--screening-questions 'Q1|Q2']");
|
|
182
182
|
const result = await createEvent({ name: f.name, device_id: f.id || null, lat: f.lat ? +f.lat : undefined, lng: f.lng ? +f.lng : undefined, description: f.desc || undefined, og_image: f['og-image'] || undefined, requires_approval: f['requires-approval'] === true || f['requires-approval'] === 'true' || undefined, screening_questions: f['screening-questions'] ? f['screening-questions'].split('|') : undefined });
|
|
183
183
|
console.log(`\n🎉 Event created!\n`);
|
|
@@ -192,9 +192,18 @@ export async function handleEvent(f) {
|
|
|
192
192
|
if (!f.code || !f.id) return console.error("Usage: antenna event --join --code abc123 --id telegram:123");
|
|
193
193
|
const result = await joinEvent({ code: f.code, device_id: f.id, lat: f.lat ? +f.lat : undefined, lng: f.lng ? +f.lng : undefined, application_context: f['application-context'] || undefined });
|
|
194
194
|
if (result.joined) {
|
|
195
|
-
|
|
195
|
+
if (result.status === 'pending') {
|
|
196
|
+
console.log(`\n🟡 申请已提交,等待主办方审批\n`);
|
|
197
|
+
} else {
|
|
198
|
+
console.log(`\n✅ Joined "${result.event}"\n`);
|
|
199
|
+
if (result.checked_in) console.log(` 自动签到 ✅\n`);
|
|
200
|
+
}
|
|
201
|
+
} else if (result.needs_screening) {
|
|
202
|
+
console.log(`\n📝 这个活动需要审批。请回答以下问题:`);
|
|
203
|
+
(result.screening_questions || []).forEach((q, i) => console.log(` ${i + 1}. ${q}`));
|
|
204
|
+
console.log(`\n回答后用 --application-context '你的回答' 重新 join\n`);
|
|
196
205
|
} else {
|
|
197
|
-
console.log(`\n❌ ${result.error}\n`);
|
|
206
|
+
console.log(`\n❌ ${result.error || result.message}\n`);
|
|
198
207
|
}
|
|
199
208
|
return;
|
|
200
209
|
}
|
|
@@ -207,13 +216,59 @@ export async function handleEvent(f) {
|
|
|
207
216
|
result.profiles.forEach((p) => {
|
|
208
217
|
const badge = p.checked_in ? " ✅" : "";
|
|
209
218
|
const creatorTag = p.role === "creator" ? " [主办]" : "";
|
|
210
|
-
|
|
219
|
+
const statusTag = p.status === "pending" ? " 🟡待审批" : "";
|
|
220
|
+
console.log(` ${p.emoji} ${p.name}${creatorTag}${badge}${statusTag}`);
|
|
211
221
|
if (p.line1) console.log(` ${p.line1}`);
|
|
222
|
+
if (p.application_context) console.log(` 📝 ${p.application_context}`);
|
|
212
223
|
console.log(` ref: ${p.ref}\n`);
|
|
213
224
|
});
|
|
214
225
|
return;
|
|
215
226
|
}
|
|
216
227
|
|
|
228
|
+
if (f.approve) {
|
|
229
|
+
if (!f.code || !f.id || !f.ref) return console.error("Usage: antenna event --approve --code abc123 --id telegram:123 --ref 1");
|
|
230
|
+
const result = await approveParticipant({ code: f.code, device_id: f.id, ref: f.ref });
|
|
231
|
+
if (result.approved) {
|
|
232
|
+
console.log("\n✅ Participant approved\n");
|
|
233
|
+
} else {
|
|
234
|
+
console.log(`\n❌ ${result.error}\n`);
|
|
235
|
+
}
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (f.reject) {
|
|
240
|
+
if (!f.code || !f.id || !f.ref) return console.error("Usage: antenna event --reject --code abc123 --id telegram:123 --ref 1");
|
|
241
|
+
const result = await rejectParticipant({ code: f.code, device_id: f.id, ref: f.ref });
|
|
242
|
+
if (result.rejected) {
|
|
243
|
+
console.log("\n✅ Participant rejected\n");
|
|
244
|
+
} else {
|
|
245
|
+
console.log(`\n❌ ${result.error}\n`);
|
|
246
|
+
}
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (f.update) {
|
|
251
|
+
if (!f.code || !f.id) return console.error("Usage: antenna event --update --code abc123 --id telegram:123 [--name 'New Name'] [--desc 'New desc']");
|
|
252
|
+
const result = await updateEvent({ code: f.code, device_id: f.id, name: f.name, description: f.desc, og_image: f['og-image'], lat: f.lat ? +f.lat : undefined, lng: f.lng ? +f.lng : undefined, starts_at: f['starts-at'], ends_at: f['ends-at'] });
|
|
253
|
+
if (result.updated) {
|
|
254
|
+
console.log("\n✅ Event updated\n");
|
|
255
|
+
} else {
|
|
256
|
+
console.log(`\n❌ ${result.error}\n`);
|
|
257
|
+
}
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (f['add-host']) {
|
|
262
|
+
if (!f.code || !f.id || !f.ref) return console.error("Usage: antenna event --add-host --code abc123 --id telegram:123 --ref 1");
|
|
263
|
+
const result = await addCohost({ code: f.code, device_id: f.id, ref: f.ref });
|
|
264
|
+
if (result.added) {
|
|
265
|
+
console.log("\n✅ Co-host added\n");
|
|
266
|
+
} else {
|
|
267
|
+
console.log(`\n❌ ${result.error}\n`);
|
|
268
|
+
}
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
217
272
|
console.log(`Usage:
|
|
218
273
|
antenna event --create --name 'AI Meetup' [--id telegram:123] [--desc 'description'] [--og-image 'url'] [--requires-approval] [--screening-questions 'Q1|Q2']
|
|
219
274
|
antenna event --join --code abc123 --id telegram:123
|
package/package.json
CHANGED
package/skill/EVENTS.md
CHANGED
|
@@ -82,11 +82,17 @@ Generate a GPS link for setting event location.
|
|
|
82
82
|
## Agent Behavior
|
|
83
83
|
|
|
84
84
|
### When someone says "create an event"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
Collect the following info through conversation (ask one by one, don't dump all at once):
|
|
86
|
+
1. **Event name** (required) — "活动叫什么名字?"
|
|
87
|
+
2. **Description** — "简单描述一下这个活动?"
|
|
88
|
+
3. **Time** — "什么时候开始?大概多长?" (convert to starts_at / ends_at ISO strings)
|
|
89
|
+
4. **Location** — "活动在哪里?" If user gives an address, geocode it. If vague, generate a bind link after creation.
|
|
90
|
+
5. **Approval** — "需要审批参与者吗?" If yes:
|
|
91
|
+
6. **Screening questions** — "你想问报名者什么问题?" Collect as a list.
|
|
92
|
+
|
|
93
|
+
Then call `antenna_event_create` with all collected info.
|
|
94
|
+
If no GPS, call `antenna_bind(purpose="event", event_code=CODE)` and send the link.
|
|
95
|
+
Share the event URL with the user.
|
|
90
96
|
|
|
91
97
|
### When someone shares an event link
|
|
92
98
|
1. Extract the code from `antenna.fyi/events/CODE`
|