Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix(agents): handle Moltbook API returning objects for author/submolt
Adam Eivya61893025f77
diff --git a/client/src/components/agents/tabs/ToolsTab.jsx b/client/src/components/agents/tabs/ToolsTab.jsxindex db9badaaa3..b97be6b410 100644--- a/client/src/components/agents/tabs/ToolsTab.jsx+++ b/client/src/components/agents/tabs/ToolsTab.jsx@@ -392,8 +392,8 @@ export default function ToolsTab() {<div className="flex-1 min-w-0"><h4 className="text-sm font-medium text-white truncate">{post.title}</h4><p className="text-xs text-gray-500 mt-0.5">- {post.submolt && <span className="text-port-accent">/{post.submolt}</span>}- {post.author && <span> by {post.author}</span>}+ {post.submolt && <span className="text-port-accent">/{typeof post.submolt === 'object' ? post.submolt.name : post.submolt}</span>}+ {post.author && <span> by {typeof post.author === 'object' ? post.author.name : post.author}</span>}{post.commentCount !== undefined && <span> - {post.commentCount} comments</span>}</p></div>@@ -594,7 +594,7 @@ export default function ToolsTab() {Reply to: {selectedPost.title}</h3><p className="text-xs text-gray-500 mb-3">- {selectedPost.author && `by ${selectedPost.author} - `}+ {selectedPost.author && `by ${typeof selectedPost.author === 'object' ? selectedPost.author.name : selectedPost.author} - `}{postComments.length} comments</p>@@ -617,7 +617,7 @@ export default function ToolsTab() {}`}onClick={() => setReplyToId(replyToId === comment.id ? null : comment.id)}>- <span className="text-port-accent">{comment.author || 'anon'}</span>+ <span className="text-port-accent">{(typeof comment.author === 'object' ? comment.author?.name : comment.author) || 'anon'}</span><span className="text-gray-500">: {comment.content?.substring(0, 150)}</span>{replyToId === comment.id && (<span className="text-port-accent ml-1">(replying)</span>diff --git a/server/services/agentContentGenerator.js b/server/services/agentContentGenerator.jsindex f7ff249136..d3737b9390 100644--- a/server/services/agentContentGenerator.js+++ b/server/services/agentContentGenerator.js@@ -209,7 +209,7 @@ export async function generateComment(agent, post, existingComments = [], recent: 'No recent comments.';const commentContext = existingComments.length > 0- ? existingComments.slice(0, 10).map(c => `- ${c.author || 'someone'}: ${(c.content || '').substring(0, 150)}`).join('\n')+ ? existingComments.slice(0, 10).map(c => `- ${typeof c.author === 'object' ? c.author?.name : c.author || 'someone'}: ${(c.content || '').substring(0, 150)}`).join('\n'): 'No comments yet - you would be the first!';const systemPrompt = buildAgentSystemPrompt(agent);@@ -221,7 +221,7 @@ Write a comment on this Moltbook post. Respond naturally as your character.## PostTitle: ${post.title}-Author: ${post.author || 'unknown'}+Author: ${typeof post.author === 'object' ? post.author?.name : post.author || 'unknown'}Content: ${(post.content || '').substring(0, 1000)}## Existing Comments@@ -269,7 +269,8 @@ Respond with ONLY a valid JSON object (no markdown, no explanation):* Generate a threaded reply to a specific comment*/export async function generateReply(agent, post, parentComment, recentActivity = null, providerId = null, model = null) {- console.log(`↩️ Generating reply for agent "${agent.name}" to comment by ${parentComment.author || 'someone'}`);+ const parentAuthorName = typeof parentComment.author === 'object' ? parentComment.author?.name : parentComment.author;+ console.log(`↩️ Generating reply for agent "${agent.name}" to comment by ${parentAuthorName || 'someone'}`);const recent = recentActivity || await getRecentAgentContent(agent.id, 'comment', 5);const recentSummary = recent.length > 0@@ -288,7 +289,7 @@ Title: ${post.title}Content: ${(post.content || '').substring(0, 500)}## Comment You Are Replying To-Author: ${parentComment.author || 'someone'}+Author: ${parentAuthorName || 'someone'}Content: ${(parentComment.content || '').substring(0, 500)}## Your Recent Activity (avoid repetition)diff --git a/server/services/agentFeedFilter.js b/server/services/agentFeedFilter.jsindex 2046d12aa6..ac28990d56 100644--- a/server/services/agentFeedFilter.js+++ b/server/services/agentFeedFilter.js@@ -32,7 +32,8 @@ export function scorePosts(agent, posts) {}// Submolt alignment: +2 if submolt matches a topic- const submoltLower = (post.submolt || '').toLowerCase();+ const submoltRaw = typeof post.submolt === 'object' ? post.submolt?.name : post.submolt;+ const submoltLower = (submoltRaw || '').toLowerCase();if (topics.some(t => submoltLower.includes(t) || t.includes(submoltLower))) {score += 2;}@@ -108,7 +109,7 @@ export async function findReplyOpportunities(client, agent, options = {}) {const comments = commentsResponse.comments || commentsResponse || [];// Skip if agent already commented- if (agentUsername && comments.some(c => c.author === agentUsername)) {+ if (agentUsername && comments.some(c => (typeof c.author === 'object' ? c.author?.name : c.author) === agentUsername)) {continue;}