antenna-openclaw-plugin 1.3.25 → 1.3.27
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 +51 -2
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -416,11 +416,60 @@ export default function register(api: any) {
|
|
|
416
416
|
|
|
417
417
|
if (error) return ok({ error: error.message });
|
|
418
418
|
|
|
419
|
+
// Read back profile to get slug for public page link
|
|
420
|
+
let publicUrl = null;
|
|
421
|
+
let archetypeResult = null;
|
|
422
|
+
try {
|
|
423
|
+
const { data: profile } = await supabase.rpc("get_profile", { p_device_id: deviceId });
|
|
424
|
+
if (profile?.profile_slug) {
|
|
425
|
+
publicUrl = `https://www.antenna.fyi/p/${profile.profile_slug}`;
|
|
426
|
+
}
|
|
427
|
+
} catch {}
|
|
428
|
+
|
|
429
|
+
// Generate personalized archetype description via LLM (best-effort)
|
|
430
|
+
try {
|
|
431
|
+
const profileText = [data.line1, data.line2, data.line3, params.matching_context].filter(Boolean).join(". ");
|
|
432
|
+
if (profileText) {
|
|
433
|
+
const corpus = profileText.toLowerCase();
|
|
434
|
+
const archetypeKw: Record<string, string[]> = {
|
|
435
|
+
Prometheus: ["ai", "agent", "llm", "founder", "startup", "build", "developer", "tools"],
|
|
436
|
+
Athena: ["product", "strategy", "research", "design", "craft", "pm", "ux"],
|
|
437
|
+
Hermes: ["network", "connect", "community", "social", "bridge"],
|
|
438
|
+
Apollo: ["music", "media", "content", "creator", "writing", "taste"],
|
|
439
|
+
Artemis: ["independent", "explore", "freelance", "health", "outdoor"],
|
|
440
|
+
Aphrodite: ["beauty", "brand", "fashion", "relationship"],
|
|
441
|
+
Dionysus: ["event", "culture", "party", "art", "festival"],
|
|
442
|
+
Hades: ["finance", "invest", "infrastructure", "backend", "security"],
|
|
443
|
+
Persephone: ["transform", "cross", "research", "academic", "bridge"],
|
|
444
|
+
Odysseus: ["founder", "journey", "resilience", "travel", "startup"],
|
|
445
|
+
};
|
|
446
|
+
let bestRole = "Prometheus"; let bestScore = 0;
|
|
447
|
+
for (const [role, kws] of Object.entries(archetypeKw)) {
|
|
448
|
+
const score = kws.reduce((s, kw) => s + (corpus.includes(kw) ? 1 : 0), 0);
|
|
449
|
+
if (score > bestScore) { bestScore = score; bestRole = role; }
|
|
450
|
+
}
|
|
451
|
+
const cfg2 = getConfig(api);
|
|
452
|
+
const supabaseUrl = cfg2.supabaseUrl || "https://bcudjloikmpcqwcptuyd.supabase.co";
|
|
453
|
+
const supabaseKey = cfg2.supabaseKey || BUILTIN_SUPABASE_ANON_KEY;
|
|
454
|
+
const res = await fetch(`${supabaseUrl}/functions/v1/generate-archetype`, {
|
|
455
|
+
method: "POST",
|
|
456
|
+
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${supabaseKey}` },
|
|
457
|
+
body: JSON.stringify({ archetype: bestRole, profile_text: profileText }),
|
|
458
|
+
});
|
|
459
|
+
if (res.ok) {
|
|
460
|
+
const archData = await res.json();
|
|
461
|
+
if (archData?.reason) archetypeResult = { archetype: bestRole, ...archData };
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
} catch {}
|
|
465
|
+
|
|
419
466
|
return ok({
|
|
420
467
|
updated: true,
|
|
421
|
-
profile: { display_name: data.display_name,
|
|
468
|
+
profile: { display_name: data.display_name,
|
|
422
469
|
line1: data.line1, line2: data.line2, line3: data.line3, visible: data.visible },
|
|
423
|
-
|
|
470
|
+
public_url: publicUrl,
|
|
471
|
+
archetype: archetypeResult || null,
|
|
472
|
+
next_step: "IMPORTANT: 1) Send the public_url to the user — this is their shareable profile link. 2) Tell the user their archetype and the personalized reason. 3) Call antenna_bind to generate a GPS link. Do not skip any step.",
|
|
424
473
|
});
|
|
425
474
|
},
|
|
426
475
|
});
|