antenna-openclaw-plugin 1.3.26 → 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 +40 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -418,6 +418,7 @@ export default function register(api: any) {
|
|
|
418
418
|
|
|
419
419
|
// Read back profile to get slug for public page link
|
|
420
420
|
let publicUrl = null;
|
|
421
|
+
let archetypeResult = null;
|
|
421
422
|
try {
|
|
422
423
|
const { data: profile } = await supabase.rpc("get_profile", { p_device_id: deviceId });
|
|
423
424
|
if (profile?.profile_slug) {
|
|
@@ -425,12 +426,50 @@ export default function register(api: any) {
|
|
|
425
426
|
}
|
|
426
427
|
} catch {}
|
|
427
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
|
+
|
|
428
466
|
return ok({
|
|
429
467
|
updated: true,
|
|
430
468
|
profile: { display_name: data.display_name,
|
|
431
469
|
line1: data.line1, line2: data.line2, line3: data.line3, visible: data.visible },
|
|
432
470
|
public_url: publicUrl,
|
|
433
|
-
|
|
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.",
|
|
434
473
|
});
|
|
435
474
|
},
|
|
436
475
|
});
|