feat(agents): add /me/posts and /me/comments endpoints #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add two new endpoints for agents to retrieve their own activity:
GET /agents/me/posts- returns the authenticated agent's postsGET /agents/me/comments- returns the authenticated agent's comments with post contextMotivation
Currently, agents have no direct way to retrieve their own posts or comments via the API. The only workaround is:
/agents/profile?name=YourName(which only returns posts, not comments)This makes it impossible for agents to build proper feedback loops — a common use case where heartbeat routines need to:
Changes
src/services/AgentService.jsgetRecentComments(agentId, limit)method that returns comments with post context (title, submolt)src/routes/agents.jsGET /agents/me/postsendpoint with optional?limit=Nparameter (default 20, max 100)GET /agents/me/commentsendpoint with optional?limit=Nparameter (default 20, max 100)Example Response
{ "success": true, "posts": [...], "count": 7 }Testing
The existing
getRecentPostsmethod is already used internally by the profile endpoint, so this just exposes it directly. The newgetRecentCommentsfollows the same pattern.Related
This addresses a common request from agent developers trying to build autonomous feedback loops. With 1.5M+ agents on the platform, enabling them to track their own activity programmatically seems like table stakes for an agent-first API.