@astramindapp/mcp-server 0.13.1 → 0.15.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/dist/mind-client.d.ts +73 -1
- package/dist/mind-client.d.ts.map +1 -1
- package/dist/mind-client.js +95 -0
- package/dist/mind-client.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +569 -1
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -1221,6 +1221,31 @@ function createMindMcpServer(client) {
|
|
|
1221
1221
|
.optional()
|
|
1222
1222
|
.describe("Per-MIND reasoning_effort override. Only honored for thinking-capable models (supports_reasoning_effort=true)."),
|
|
1223
1223
|
bio: zod_1.z.string().max(500).optional().describe("Owner bio (shown across MIND profile surfaces, ≤500 chars)"),
|
|
1224
|
+
// Influencer Factory fields (writable via create_featured_mind + update_featured_mind)
|
|
1225
|
+
archetype_id: zod_1.z
|
|
1226
|
+
.union([zod_1.z.string(), zod_1.z.null()])
|
|
1227
|
+
.optional()
|
|
1228
|
+
.describe("Influencer Factory: archetype persona id (e.g. an Astra archetype template). Pass null to clear."),
|
|
1229
|
+
voice_id: zod_1.z
|
|
1230
|
+
.union([zod_1.z.string(), zod_1.z.null()])
|
|
1231
|
+
.optional()
|
|
1232
|
+
.describe("Influencer Factory: ElevenLabs voice id used by this persona. Pass null to clear."),
|
|
1233
|
+
seed_image_url: zod_1.z
|
|
1234
|
+
.union([zod_1.z.string(), zod_1.z.null()])
|
|
1235
|
+
.optional()
|
|
1236
|
+
.describe("Influencer Factory: anchor seed image URL (the reference photo every image-to-image variant pins to — do not chain). Pass null to clear."),
|
|
1237
|
+
niche_tags: zod_1.z
|
|
1238
|
+
.array(zod_1.z.string())
|
|
1239
|
+
.optional()
|
|
1240
|
+
.describe("Influencer Factory: niche/topic tags for this persona (e.g. ['fitness', 'wellness']). Separate from catalog `tags`."),
|
|
1241
|
+
kg_scope_template_id: zod_1.z
|
|
1242
|
+
.union([zod_1.z.string(), zod_1.z.null()])
|
|
1243
|
+
.optional()
|
|
1244
|
+
.describe("Influencer Factory: KG-scope template id that bounds what this persona knows/talks about. Pass null to clear."),
|
|
1245
|
+
agent_posting_enabled: zod_1.z
|
|
1246
|
+
.boolean()
|
|
1247
|
+
.optional()
|
|
1248
|
+
.describe("Influencer Factory: gate that lets autonomous agents post on this persona's behalf. Dark by default."),
|
|
1224
1249
|
// reorder
|
|
1225
1250
|
ordered_mind_ids: zod_1.z
|
|
1226
1251
|
.array(zod_1.z.string())
|
|
@@ -1232,7 +1257,7 @@ function createMindMcpServer(client) {
|
|
|
1232
1257
|
// list fields
|
|
1233
1258
|
query: zod_1.z.string().optional().describe("Search query for list_users"),
|
|
1234
1259
|
page: zod_1.z.number().optional().describe("Page number for paginated results"),
|
|
1235
|
-
}, async ({ action, username, email, password, source, generate_api_key, api_key_name, mind_id, title, subtitle, description, tags, price, featured, display_order, is_public, avatar_url, banner_url, preferred_llm_model, public_mind_enabled, public_mind_prompt, public_mind_tagline, public_mind_greeting, public_mind_persona, chat_temperature, chat_reasoning_effort, bio, ordered_mind_ids, tier, credits, query, page }) => {
|
|
1260
|
+
}, async ({ action, username, email, password, source, generate_api_key, api_key_name, mind_id, title, subtitle, description, tags, price, featured, display_order, is_public, avatar_url, banner_url, preferred_llm_model, public_mind_enabled, public_mind_prompt, public_mind_tagline, public_mind_greeting, public_mind_persona, chat_temperature, chat_reasoning_effort, bio, archetype_id, voice_id, seed_image_url, niche_tags, kg_scope_template_id, agent_posting_enabled, ordered_mind_ids, tier, credits, query, page }) => {
|
|
1236
1261
|
try {
|
|
1237
1262
|
switch (action) {
|
|
1238
1263
|
case "create_user": {
|
|
@@ -1261,6 +1286,7 @@ function createMindMcpServer(client) {
|
|
|
1261
1286
|
const result = await client.adminCreateFeaturedMind({
|
|
1262
1287
|
username,
|
|
1263
1288
|
title,
|
|
1289
|
+
subtitle,
|
|
1264
1290
|
description,
|
|
1265
1291
|
tags,
|
|
1266
1292
|
price: price ?? 0,
|
|
@@ -1268,6 +1294,14 @@ function createMindMcpServer(client) {
|
|
|
1268
1294
|
display_order: display_order ?? 0,
|
|
1269
1295
|
is_public: is_public ?? false,
|
|
1270
1296
|
avatar_url,
|
|
1297
|
+
banner_url,
|
|
1298
|
+
// Influencer Factory extensions — null/undefined is fine; backend defaults
|
|
1299
|
+
archetype_id,
|
|
1300
|
+
voice_id,
|
|
1301
|
+
seed_image_url,
|
|
1302
|
+
niche_tags,
|
|
1303
|
+
kg_scope_template_id,
|
|
1304
|
+
agent_posting_enabled,
|
|
1271
1305
|
});
|
|
1272
1306
|
return {
|
|
1273
1307
|
content: [
|
|
@@ -1314,6 +1348,19 @@ function createMindMcpServer(client) {
|
|
|
1314
1348
|
patch.avatar_url = avatar_url;
|
|
1315
1349
|
if (banner_url !== undefined)
|
|
1316
1350
|
patch.banner_url = banner_url;
|
|
1351
|
+
// Influencer Factory fields
|
|
1352
|
+
if (archetype_id !== undefined)
|
|
1353
|
+
patch.archetype_id = archetype_id;
|
|
1354
|
+
if (voice_id !== undefined)
|
|
1355
|
+
patch.voice_id = voice_id;
|
|
1356
|
+
if (seed_image_url !== undefined)
|
|
1357
|
+
patch.seed_image_url = seed_image_url;
|
|
1358
|
+
if (niche_tags !== undefined)
|
|
1359
|
+
patch.niche_tags = niche_tags;
|
|
1360
|
+
if (kg_scope_template_id !== undefined)
|
|
1361
|
+
patch.kg_scope_template_id = kg_scope_template_id;
|
|
1362
|
+
if (agent_posting_enabled !== undefined)
|
|
1363
|
+
patch.agent_posting_enabled = agent_posting_enabled;
|
|
1317
1364
|
const result = await client.adminUpdateFeaturedMind(mind_id, patch);
|
|
1318
1365
|
return {
|
|
1319
1366
|
content: [{ type: "text", text: `✅ Updated featured mind: "${result.title}"` }],
|
|
@@ -3477,6 +3524,527 @@ function createMindMcpServer(client) {
|
|
|
3477
3524
|
};
|
|
3478
3525
|
}
|
|
3479
3526
|
});
|
|
3527
|
+
// ─── mind_social ────────────────────────────────────────
|
|
3528
|
+
// Read-only analytics across YouTube, LinkedIn, X, Twitch + goals progress.
|
|
3529
|
+
server.tool("mind_social", "Read social media analytics from MIND's Social Dashboard — YouTube/LinkedIn/X/Twitch channel stats, recent videos with performance, retention curves, traffic sources, comment sentiment, and goal progress. Use this to answer questions like 'how did Tuesday's video do?' or 'am I on pace for 1k subs?'", {
|
|
3530
|
+
action: zod_1.z
|
|
3531
|
+
.enum([
|
|
3532
|
+
"status",
|
|
3533
|
+
"summary",
|
|
3534
|
+
"yt_channel",
|
|
3535
|
+
"yt_videos",
|
|
3536
|
+
"yt_video_detail",
|
|
3537
|
+
"goals",
|
|
3538
|
+
])
|
|
3539
|
+
.describe("Which read to perform: status (per-platform connection state), summary (cross-platform KPIs), yt_channel (channel snapshot + 28-day history), yt_videos (recent videos with perf), yt_video_detail (one video + retention + traffic + sentiment), goals (goal progress)."),
|
|
3540
|
+
video_id: zod_1.z
|
|
3541
|
+
.string()
|
|
3542
|
+
.optional()
|
|
3543
|
+
.describe("Required for yt_video_detail."),
|
|
3544
|
+
limit: zod_1.z
|
|
3545
|
+
.number()
|
|
3546
|
+
.int()
|
|
3547
|
+
.optional()
|
|
3548
|
+
.describe("Max items for yt_videos (default 25)."),
|
|
3549
|
+
}, async ({ action, video_id, limit }) => {
|
|
3550
|
+
try {
|
|
3551
|
+
switch (action) {
|
|
3552
|
+
case "status": {
|
|
3553
|
+
const r = (await client.socialStatus());
|
|
3554
|
+
const lines = ["**Social Dashboard status**"];
|
|
3555
|
+
lines.push(`Enabled: ${r.enabled ? "yes" : "no"} (global flag: ${r.globally_enabled ? "on" : "off"})`);
|
|
3556
|
+
const platforms = r.platforms || {};
|
|
3557
|
+
for (const key of ["youtube", "linkedin", "x", "twitch"]) {
|
|
3558
|
+
const p = platforms[key] || {};
|
|
3559
|
+
lines.push(`• ${key}: ${p.connected ? `connected (${p.account_label || "—"})` : p.configured ? "not connected" : "not configured"}`);
|
|
3560
|
+
}
|
|
3561
|
+
return {
|
|
3562
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
3563
|
+
};
|
|
3564
|
+
}
|
|
3565
|
+
case "summary": {
|
|
3566
|
+
const r = (await client.socialSummary());
|
|
3567
|
+
const yt = r.youtube || {};
|
|
3568
|
+
const lines = [
|
|
3569
|
+
"**Cross-platform summary**",
|
|
3570
|
+
`YouTube subs: ${yt.subs ?? "—"}${yt.subs_delta_28d_pct != null ? ` (28d Δ ${yt.subs_delta_28d_pct}%)` : ""}`,
|
|
3571
|
+
`YouTube views: ${yt.total_views ?? "—"}${yt.views_delta_28d_pct != null ? ` (28d Δ ${yt.views_delta_28d_pct}%)` : ""}`,
|
|
3572
|
+
`YouTube watch minutes (28d): ${yt.watch_minutes_28d ?? "—"}`,
|
|
3573
|
+
`LinkedIn posts recent: ${(r.linkedin || {}).post_count_recent ?? "—"}`,
|
|
3574
|
+
`X tweets recent: ${(r.x || {}).tweet_count_recent ?? "—"}`,
|
|
3575
|
+
`Twitch VODs recent: ${(r.twitch || {}).vod_count_recent ?? "—"}`,
|
|
3576
|
+
];
|
|
3577
|
+
const goals = r.goals || [];
|
|
3578
|
+
if (goals.length) {
|
|
3579
|
+
lines.push("\n**Goals**");
|
|
3580
|
+
for (const g of goals) {
|
|
3581
|
+
lines.push(`• ${g.label || g.metric}: ${g.current ?? 0}/${g.target} (${g.pct ?? 0}%) — ${g.status}`);
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
return {
|
|
3585
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
3586
|
+
};
|
|
3587
|
+
}
|
|
3588
|
+
case "yt_channel": {
|
|
3589
|
+
const r = (await client.socialYouTubeChannel());
|
|
3590
|
+
const latest = r.latest || {};
|
|
3591
|
+
const history = r.history || [];
|
|
3592
|
+
const lines = [
|
|
3593
|
+
"**YouTube channel**",
|
|
3594
|
+
`Subs: ${latest.subs ?? "—"}`,
|
|
3595
|
+
`Total views: ${latest.total_views ?? "—"}`,
|
|
3596
|
+
`Total watch minutes (28d): ${latest.total_watch_time_minutes ?? "—"}`,
|
|
3597
|
+
`Videos published: ${latest.video_count ?? "—"}`,
|
|
3598
|
+
`History points (last ${history.length} days):`,
|
|
3599
|
+
...history.slice(-7).map((h) => ` ${h.date}: ${h.subs} subs, ${h.total_views} views`),
|
|
3600
|
+
];
|
|
3601
|
+
return {
|
|
3602
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
3603
|
+
};
|
|
3604
|
+
}
|
|
3605
|
+
case "yt_videos": {
|
|
3606
|
+
const r = (await client.socialYouTubeVideos(limit ?? 25));
|
|
3607
|
+
const items = r.items || [];
|
|
3608
|
+
if (!items.length) {
|
|
3609
|
+
return {
|
|
3610
|
+
content: [{ type: "text", text: "No videos in snapshot cache yet." }],
|
|
3611
|
+
};
|
|
3612
|
+
}
|
|
3613
|
+
const lines = [`**Recent videos** (${items.length})`];
|
|
3614
|
+
for (const v of items.slice(0, 15)) {
|
|
3615
|
+
const l = v.latest || {};
|
|
3616
|
+
lines.push(`• ${v.title} — ${l.views ?? "—"} views, ${l.ctr_percent != null ? l.ctr_percent.toFixed(1) + "%" : "—"} CTR, ${l.comments ?? "—"} comments [${v.video_id}]`);
|
|
3617
|
+
}
|
|
3618
|
+
return {
|
|
3619
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
3620
|
+
};
|
|
3621
|
+
}
|
|
3622
|
+
case "yt_video_detail": {
|
|
3623
|
+
if (!video_id) {
|
|
3624
|
+
return {
|
|
3625
|
+
content: [
|
|
3626
|
+
{ type: "text", text: "Error: video_id is required for yt_video_detail" },
|
|
3627
|
+
],
|
|
3628
|
+
isError: true,
|
|
3629
|
+
};
|
|
3630
|
+
}
|
|
3631
|
+
const r = (await client.socialYouTubeVideoDetail(video_id));
|
|
3632
|
+
const meta = r.metadata || {};
|
|
3633
|
+
const latest = r.latest || {};
|
|
3634
|
+
const traffic = r.traffic || [];
|
|
3635
|
+
const sent = r.comments?.sentiment_summary || {};
|
|
3636
|
+
const lines = [
|
|
3637
|
+
`**${meta.title}**`,
|
|
3638
|
+
`Published: ${meta.published_at} · ${meta.duration_seconds ? Math.round(meta.duration_seconds / 60) + " min" : "—"}`,
|
|
3639
|
+
`Views: ${latest.views ?? "—"} · CTR: ${latest.ctr_percent != null ? latest.ctr_percent.toFixed(1) + "%" : "—"} · AVD: ${latest.avd_seconds ? Math.round(latest.avd_seconds) + "s" : "—"}`,
|
|
3640
|
+
`Subs Δ: +${latest.subscribers_gained ?? 0} / -${latest.subscribers_lost ?? 0}`,
|
|
3641
|
+
"",
|
|
3642
|
+
"Traffic sources:",
|
|
3643
|
+
...traffic.slice(0, 5).map((t) => ` • ${t.source}: ${t.views}`),
|
|
3644
|
+
"",
|
|
3645
|
+
`Comments: ${sent.count ?? 0} (${sent.positive ?? 0} pos / ${sent.neutral ?? 0} neu / ${sent.negative ?? 0} neg, avg ${(sent.avg_score ?? 0).toFixed(2)})`,
|
|
3646
|
+
];
|
|
3647
|
+
return {
|
|
3648
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
3649
|
+
};
|
|
3650
|
+
}
|
|
3651
|
+
case "goals": {
|
|
3652
|
+
const r = (await client.socialGoals());
|
|
3653
|
+
const items = r.items || [];
|
|
3654
|
+
if (!items.length) {
|
|
3655
|
+
return {
|
|
3656
|
+
content: [{ type: "text", text: "No goals set." }],
|
|
3657
|
+
};
|
|
3658
|
+
}
|
|
3659
|
+
const lines = ["**Goals**"];
|
|
3660
|
+
for (const g of items) {
|
|
3661
|
+
lines.push(`• ${g.label || g.metric}: ${g.current ?? 0}/${g.target} (${g.pct ?? 0}%) — due ${g.due_date} — ${g.status}`);
|
|
3662
|
+
}
|
|
3663
|
+
return {
|
|
3664
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
3665
|
+
};
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
catch (err) {
|
|
3670
|
+
return {
|
|
3671
|
+
content: [{ type: "text", text: `mind_social error: ${err}` }],
|
|
3672
|
+
isError: true,
|
|
3673
|
+
};
|
|
3674
|
+
}
|
|
3675
|
+
});
|
|
3676
|
+
// ─── mind_personas ──────────────────────────────────────────
|
|
3677
|
+
// Influencer Factory Command Center surface. Admin-only.
|
|
3678
|
+
// Whole router is dark unless IF_FEATURE_FLAG_ENABLED=true on the server.
|
|
3679
|
+
// Persona == featured_minds row (1:1) — IF fields stored on featured_minds,
|
|
3680
|
+
// asset library (face/voice/bios/Blotato) on the persona_assets collection.
|
|
3681
|
+
server.tool("mind_personas", "Influencer Factory Command Center — synthetic-persona creators that publish across Blotato platforms. Admin-only. Phase 1 surface: persona CRUD (auto-creates a Featured MIND row with IF fields), face anchor (AI-generate via Nano Banana Pro OR user-uploaded with rights affirmation), face variants (image-to-image via n8n + Fal.ai, always pinned to anchor — never chained), voice (ElevenLabs library search + clone + sample), per-platform bios (with optional LLM draft), Blotato account registration (YouTube/IG/LinkedIn/X/Threads/Pinterest; TikTok marked manual_upload). Each persona is publicly chattable at /m/{username} via its linked Featured MIND.", {
|
|
3682
|
+
action: zod_1.z
|
|
3683
|
+
.enum([
|
|
3684
|
+
"health",
|
|
3685
|
+
"list_personas",
|
|
3686
|
+
"get_persona",
|
|
3687
|
+
"create_persona",
|
|
3688
|
+
"update_persona",
|
|
3689
|
+
"delete_persona",
|
|
3690
|
+
"anchor_face_ai_generate",
|
|
3691
|
+
"request_face_variants",
|
|
3692
|
+
"list_face_variants",
|
|
3693
|
+
"search_voice_library",
|
|
3694
|
+
"set_voice_library",
|
|
3695
|
+
"generate_voice_sample",
|
|
3696
|
+
"update_bios",
|
|
3697
|
+
"blotato_whoami",
|
|
3698
|
+
"blotato_accounts",
|
|
3699
|
+
"register_blotato_account",
|
|
3700
|
+
"unregister_blotato_account",
|
|
3701
|
+
])
|
|
3702
|
+
.describe("What to do. Start with 'health' to confirm Fal/ElevenLabs/Blotato/S3/n8n are configured. Most write actions require persona_mind_id."),
|
|
3703
|
+
persona_mind_id: zod_1.z
|
|
3704
|
+
.string()
|
|
3705
|
+
.optional()
|
|
3706
|
+
.describe("Persona id (== featured_minds.mind_id). Required for every per-persona action."),
|
|
3707
|
+
// create_persona
|
|
3708
|
+
username: zod_1.z
|
|
3709
|
+
.string()
|
|
3710
|
+
.optional()
|
|
3711
|
+
.describe("Lowercase username (3–32 chars, [a-z0-9_-]). Used for /m/{username} public landing AND the featured_minds row. Required for create_persona."),
|
|
3712
|
+
display_name: zod_1.z.string().optional().describe("Display name. Required for create_persona."),
|
|
3713
|
+
niche: zod_1.z.string().optional().describe("Niche label, e.g. 'fitness', 'wealth'."),
|
|
3714
|
+
pillars: zod_1.z
|
|
3715
|
+
.array(zod_1.z.string())
|
|
3716
|
+
.optional()
|
|
3717
|
+
.describe("3–5 content pillars the persona writes about."),
|
|
3718
|
+
tone: zod_1.z
|
|
3719
|
+
.string()
|
|
3720
|
+
.optional()
|
|
3721
|
+
.describe("Tone descriptor, e.g. 'warm-direct', 'contrarian-analytical'."),
|
|
3722
|
+
archetype_id: zod_1.z
|
|
3723
|
+
.string()
|
|
3724
|
+
.optional()
|
|
3725
|
+
.describe("Persona archetype template id (looked up in persona_archetypes catalog)."),
|
|
3726
|
+
kg_scope_template_id: zod_1.z
|
|
3727
|
+
.string()
|
|
3728
|
+
.optional()
|
|
3729
|
+
.describe("Knowledge-graph scope template id (bounds what this persona 'knows about')."),
|
|
3730
|
+
niche_tags: zod_1.z
|
|
3731
|
+
.array(zod_1.z.string())
|
|
3732
|
+
.optional()
|
|
3733
|
+
.describe("Topic niche tags used by retrieval (separate from Featured MIND catalog tags)."),
|
|
3734
|
+
daily_credit_ceiling_usd: zod_1.z
|
|
3735
|
+
.number()
|
|
3736
|
+
.optional()
|
|
3737
|
+
.describe("Hard ceiling on daily Fal.ai/ElevenLabs/Veo/Suno spend for this persona. Default 5."),
|
|
3738
|
+
// update_persona — partial
|
|
3739
|
+
status: zod_1.z
|
|
3740
|
+
.enum(["draft", "active", "paused"])
|
|
3741
|
+
.optional()
|
|
3742
|
+
.describe("Persona runtime status."),
|
|
3743
|
+
agent_posting_enabled: zod_1.z
|
|
3744
|
+
.boolean()
|
|
3745
|
+
.optional()
|
|
3746
|
+
.describe("Master kill-switch on the linked Featured MIND row. Off = autonomous posters skip this persona."),
|
|
3747
|
+
// anchor_face_ai_generate
|
|
3748
|
+
prompt: zod_1.z
|
|
3749
|
+
.string()
|
|
3750
|
+
.optional()
|
|
3751
|
+
.describe("Anchor-face generation prompt OR voice sample text (anchor_face_ai_generate, generate_voice_sample)."),
|
|
3752
|
+
model: zod_1.z
|
|
3753
|
+
.enum(["nano_banana_pro", "flux"])
|
|
3754
|
+
.optional()
|
|
3755
|
+
.describe("Anchor-face generator model. Default nano_banana_pro."),
|
|
3756
|
+
// request_face_variants
|
|
3757
|
+
count: zod_1.z
|
|
3758
|
+
.number()
|
|
3759
|
+
.optional()
|
|
3760
|
+
.describe("Variant count (1–20). Default 5."),
|
|
3761
|
+
prompt_modifier: zod_1.z
|
|
3762
|
+
.string()
|
|
3763
|
+
.optional()
|
|
3764
|
+
.describe("Optional modifier appended to the base variant prompt (e.g. 'outdoor golden hour')."),
|
|
3765
|
+
// voice
|
|
3766
|
+
voice_query: zod_1.z
|
|
3767
|
+
.string()
|
|
3768
|
+
.optional()
|
|
3769
|
+
.describe("ElevenLabs library search query (search_voice_library)."),
|
|
3770
|
+
voice_id: zod_1.z
|
|
3771
|
+
.string()
|
|
3772
|
+
.optional()
|
|
3773
|
+
.describe("ElevenLabs voice id (set_voice_library)."),
|
|
3774
|
+
voice_name: zod_1.z
|
|
3775
|
+
.string()
|
|
3776
|
+
.optional()
|
|
3777
|
+
.describe("Display name to store for the voice (set_voice_library)."),
|
|
3778
|
+
voice_text: zod_1.z
|
|
3779
|
+
.string()
|
|
3780
|
+
.optional()
|
|
3781
|
+
.describe("Text to render as a sample MP3 (generate_voice_sample)."),
|
|
3782
|
+
// bios
|
|
3783
|
+
bios: zod_1.z
|
|
3784
|
+
.record(zod_1.z.string(), zod_1.z.string())
|
|
3785
|
+
.optional()
|
|
3786
|
+
.describe("Map of platform → bio text (twitter|instagram|tiktok|linkedin|youtube|threads|pinterest). Length-capped server-side."),
|
|
3787
|
+
generate_with_llm: zod_1.z
|
|
3788
|
+
.boolean()
|
|
3789
|
+
.optional()
|
|
3790
|
+
.describe("If true, LLM drafts missing platform bios. Existing bios stay."),
|
|
3791
|
+
// blotato
|
|
3792
|
+
platform: zod_1.z
|
|
3793
|
+
.enum([
|
|
3794
|
+
"twitter",
|
|
3795
|
+
"instagram",
|
|
3796
|
+
"tiktok",
|
|
3797
|
+
"linkedin",
|
|
3798
|
+
"youtube",
|
|
3799
|
+
"threads",
|
|
3800
|
+
"pinterest",
|
|
3801
|
+
])
|
|
3802
|
+
.optional()
|
|
3803
|
+
.describe("Target platform for Blotato register/unregister."),
|
|
3804
|
+
account_id: zod_1.z
|
|
3805
|
+
.string()
|
|
3806
|
+
.optional()
|
|
3807
|
+
.describe("Blotato account id (from blotato_accounts list)."),
|
|
3808
|
+
page_id: zod_1.z
|
|
3809
|
+
.string()
|
|
3810
|
+
.optional()
|
|
3811
|
+
.describe("LinkedIn / IG / YouTube page id (optional, platform-specific)."),
|
|
3812
|
+
board_id: zod_1.z
|
|
3813
|
+
.string()
|
|
3814
|
+
.optional()
|
|
3815
|
+
.describe("Pinterest board id (REQUIRED for Pinterest)."),
|
|
3816
|
+
handle: zod_1.z.string().optional().describe("Display handle (optional)."),
|
|
3817
|
+
media_type: zod_1.z
|
|
3818
|
+
.enum(["story", "reel"])
|
|
3819
|
+
.optional()
|
|
3820
|
+
.describe("Instagram media type (story or reel)."),
|
|
3821
|
+
// list filters
|
|
3822
|
+
search: zod_1.z.string().optional().describe("Search filter for list_personas."),
|
|
3823
|
+
}, async (args) => {
|
|
3824
|
+
try {
|
|
3825
|
+
const { action, persona_mind_id: pid, username, display_name, niche, pillars, tone, archetype_id, kg_scope_template_id, niche_tags, daily_credit_ceiling_usd, status, agent_posting_enabled, prompt, model, count, prompt_modifier, voice_query, voice_id, voice_name, voice_text, bios, generate_with_llm, platform, account_id, page_id, board_id, handle, media_type, search, } = args;
|
|
3826
|
+
const needPid = () => {
|
|
3827
|
+
if (!pid)
|
|
3828
|
+
throw new Error(`${action} requires persona_mind_id`);
|
|
3829
|
+
};
|
|
3830
|
+
switch (action) {
|
|
3831
|
+
case "health": {
|
|
3832
|
+
const r = await client.ifHealth();
|
|
3833
|
+
return {
|
|
3834
|
+
content: [
|
|
3835
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3836
|
+
],
|
|
3837
|
+
};
|
|
3838
|
+
}
|
|
3839
|
+
case "list_personas": {
|
|
3840
|
+
const r = await client.ifListPersonas({ status, search });
|
|
3841
|
+
if (!r.length) {
|
|
3842
|
+
return { content: [{ type: "text", text: "No personas." }] };
|
|
3843
|
+
}
|
|
3844
|
+
const lines = r.map((p) => `• @${p.username} — ${p.display_name} [${p.status}] (${p.persona_mind_id})`);
|
|
3845
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
3846
|
+
}
|
|
3847
|
+
case "get_persona": {
|
|
3848
|
+
needPid();
|
|
3849
|
+
const r = await client.ifGetPersonaFull(pid);
|
|
3850
|
+
return {
|
|
3851
|
+
content: [
|
|
3852
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3853
|
+
],
|
|
3854
|
+
};
|
|
3855
|
+
}
|
|
3856
|
+
case "create_persona": {
|
|
3857
|
+
if (!username || !display_name)
|
|
3858
|
+
throw new Error("username and display_name are required");
|
|
3859
|
+
const r = await client.ifCreatePersona({
|
|
3860
|
+
username,
|
|
3861
|
+
display_name,
|
|
3862
|
+
niche,
|
|
3863
|
+
pillars,
|
|
3864
|
+
tone,
|
|
3865
|
+
archetype_id,
|
|
3866
|
+
kg_scope_template_id,
|
|
3867
|
+
niche_tags,
|
|
3868
|
+
daily_credit_ceiling_usd,
|
|
3869
|
+
});
|
|
3870
|
+
return {
|
|
3871
|
+
content: [
|
|
3872
|
+
{
|
|
3873
|
+
type: "text",
|
|
3874
|
+
text: `Created persona @${r.username} (mind_id=${r.persona_mind_id})`,
|
|
3875
|
+
},
|
|
3876
|
+
],
|
|
3877
|
+
};
|
|
3878
|
+
}
|
|
3879
|
+
case "update_persona": {
|
|
3880
|
+
needPid();
|
|
3881
|
+
const patch = {};
|
|
3882
|
+
if (display_name !== undefined)
|
|
3883
|
+
patch.display_name = display_name;
|
|
3884
|
+
if (niche !== undefined)
|
|
3885
|
+
patch.niche = niche;
|
|
3886
|
+
if (pillars !== undefined)
|
|
3887
|
+
patch.pillars = pillars;
|
|
3888
|
+
if (tone !== undefined)
|
|
3889
|
+
patch.tone = tone;
|
|
3890
|
+
if (daily_credit_ceiling_usd !== undefined)
|
|
3891
|
+
patch.daily_credit_ceiling_usd = daily_credit_ceiling_usd;
|
|
3892
|
+
if (status !== undefined)
|
|
3893
|
+
patch.status = status;
|
|
3894
|
+
if (archetype_id !== undefined)
|
|
3895
|
+
patch.archetype_id = archetype_id;
|
|
3896
|
+
if (kg_scope_template_id !== undefined)
|
|
3897
|
+
patch.kg_scope_template_id = kg_scope_template_id;
|
|
3898
|
+
if (niche_tags !== undefined)
|
|
3899
|
+
patch.niche_tags = niche_tags;
|
|
3900
|
+
if (agent_posting_enabled !== undefined)
|
|
3901
|
+
patch.agent_posting_enabled = agent_posting_enabled;
|
|
3902
|
+
const r = await client.ifUpdatePersona(pid, patch);
|
|
3903
|
+
return {
|
|
3904
|
+
content: [{ type: "text", text: JSON.stringify(r, null, 2) }],
|
|
3905
|
+
};
|
|
3906
|
+
}
|
|
3907
|
+
case "delete_persona": {
|
|
3908
|
+
needPid();
|
|
3909
|
+
const r = await client.ifDeletePersona(pid);
|
|
3910
|
+
return {
|
|
3911
|
+
content: [
|
|
3912
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3913
|
+
],
|
|
3914
|
+
};
|
|
3915
|
+
}
|
|
3916
|
+
case "anchor_face_ai_generate": {
|
|
3917
|
+
needPid();
|
|
3918
|
+
if (!prompt)
|
|
3919
|
+
throw new Error("prompt is required");
|
|
3920
|
+
const r = await client.ifAnchorAIGenerate(pid, { prompt, model });
|
|
3921
|
+
return {
|
|
3922
|
+
content: [
|
|
3923
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3924
|
+
],
|
|
3925
|
+
};
|
|
3926
|
+
}
|
|
3927
|
+
case "request_face_variants": {
|
|
3928
|
+
needPid();
|
|
3929
|
+
const r = await client.ifRequestVariants(pid, {
|
|
3930
|
+
count: count ?? 5,
|
|
3931
|
+
prompt_modifier,
|
|
3932
|
+
});
|
|
3933
|
+
return {
|
|
3934
|
+
content: [
|
|
3935
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3936
|
+
],
|
|
3937
|
+
};
|
|
3938
|
+
}
|
|
3939
|
+
case "list_face_variants": {
|
|
3940
|
+
needPid();
|
|
3941
|
+
const r = await client.ifListVariants(pid);
|
|
3942
|
+
return {
|
|
3943
|
+
content: [
|
|
3944
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3945
|
+
],
|
|
3946
|
+
};
|
|
3947
|
+
}
|
|
3948
|
+
case "search_voice_library": {
|
|
3949
|
+
const r = await client.ifSearchVoiceLibrary({ q: voice_query });
|
|
3950
|
+
return {
|
|
3951
|
+
content: [
|
|
3952
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3953
|
+
],
|
|
3954
|
+
};
|
|
3955
|
+
}
|
|
3956
|
+
case "set_voice_library": {
|
|
3957
|
+
needPid();
|
|
3958
|
+
if (!voice_id)
|
|
3959
|
+
throw new Error("voice_id is required");
|
|
3960
|
+
const r = await client.ifSetVoiceLibrary(pid, {
|
|
3961
|
+
voice_id,
|
|
3962
|
+
name: voice_name,
|
|
3963
|
+
});
|
|
3964
|
+
return {
|
|
3965
|
+
content: [
|
|
3966
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3967
|
+
],
|
|
3968
|
+
};
|
|
3969
|
+
}
|
|
3970
|
+
case "generate_voice_sample": {
|
|
3971
|
+
needPid();
|
|
3972
|
+
if (!voice_text)
|
|
3973
|
+
throw new Error("voice_text is required");
|
|
3974
|
+
const r = await client.ifVoiceSample(pid, voice_text);
|
|
3975
|
+
return {
|
|
3976
|
+
content: [
|
|
3977
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3978
|
+
],
|
|
3979
|
+
};
|
|
3980
|
+
}
|
|
3981
|
+
case "update_bios": {
|
|
3982
|
+
needPid();
|
|
3983
|
+
const r = await client.ifUpdateBios(pid, {
|
|
3984
|
+
bios: bios ?? {},
|
|
3985
|
+
generate_with_llm,
|
|
3986
|
+
});
|
|
3987
|
+
return {
|
|
3988
|
+
content: [
|
|
3989
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3990
|
+
],
|
|
3991
|
+
};
|
|
3992
|
+
}
|
|
3993
|
+
case "blotato_whoami": {
|
|
3994
|
+
const r = await client.ifBlotatoWhoami();
|
|
3995
|
+
return {
|
|
3996
|
+
content: [
|
|
3997
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
3998
|
+
],
|
|
3999
|
+
};
|
|
4000
|
+
}
|
|
4001
|
+
case "blotato_accounts": {
|
|
4002
|
+
const r = await client.ifBlotatoAccounts();
|
|
4003
|
+
return {
|
|
4004
|
+
content: [
|
|
4005
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
4006
|
+
],
|
|
4007
|
+
};
|
|
4008
|
+
}
|
|
4009
|
+
case "register_blotato_account": {
|
|
4010
|
+
needPid();
|
|
4011
|
+
if (!platform || !account_id)
|
|
4012
|
+
throw new Error("platform and account_id are required");
|
|
4013
|
+
const r = await client.ifRegisterBlotato(pid, platform, {
|
|
4014
|
+
account_id,
|
|
4015
|
+
page_id,
|
|
4016
|
+
board_id,
|
|
4017
|
+
handle,
|
|
4018
|
+
media_type,
|
|
4019
|
+
});
|
|
4020
|
+
return {
|
|
4021
|
+
content: [
|
|
4022
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
4023
|
+
],
|
|
4024
|
+
};
|
|
4025
|
+
}
|
|
4026
|
+
case "unregister_blotato_account": {
|
|
4027
|
+
needPid();
|
|
4028
|
+
if (!platform)
|
|
4029
|
+
throw new Error("platform is required");
|
|
4030
|
+
const r = await client.ifUnregisterBlotato(pid, platform);
|
|
4031
|
+
return {
|
|
4032
|
+
content: [
|
|
4033
|
+
{ type: "text", text: JSON.stringify(r, null, 2) },
|
|
4034
|
+
],
|
|
4035
|
+
};
|
|
4036
|
+
}
|
|
4037
|
+
default:
|
|
4038
|
+
throw new Error(`Unknown action: ${action}`);
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
catch (err) {
|
|
4042
|
+
return {
|
|
4043
|
+
content: [{ type: "text", text: `mind_personas error: ${err}` }],
|
|
4044
|
+
isError: true,
|
|
4045
|
+
};
|
|
4046
|
+
}
|
|
4047
|
+
});
|
|
3480
4048
|
return server;
|
|
3481
4049
|
}
|
|
3482
4050
|
//# sourceMappingURL=server.js.map
|