From efb30f7874389b28929eeb3eef11678cc90f6fc0 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Tue, 13 Jan 2026 11:45:03 +1000 Subject: [PATCH] feat: add username/slug based agent API endpoints - Add /api/[username]/agents/[agentSlug]/conversation/[conversationId] - Add /api/[username]/agents/[agentSlug]/conversations - Update agent dashboard API docs to use new URL format - Include user.username in agent API response - Update Discord summary workflow to use new endpoint format --- .github/workflows/discord-summary.yml | 5 +++-- .../api/agents/[id]/conversation/[conversationId]/route.ts | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/discord-summary.yml b/.github/workflows/discord-summary.yml index 22e296d..b9f0d0e 100644 --- a/.github/workflows/discord-summary.yml +++ b/.github/workflows/discord-summary.yml @@ -26,10 +26,11 @@ jobs: echo "Triggering agent with conversation: ${{ steps.conv-id.outputs.conv_id }}" # POST to the agent conversation endpoint - # Agent ID: Discord Daily Summary agent on tpmjs.com + # Uses username/agent-slug URL format: /api/{username}/agents/{agent-slug}/conversation/{conv-id} + # Agent: ajax/tpmjs-discord-summary # Requires API key with agent:chat scope RESPONSE=$(curl -s -X POST \ - "https://tpmjs.com/api/agents/cmk9utpvg0001kz04csbisvf5/conversation/${{ steps.conv-id.outputs.conv_id }}" \ + "https://tpmjs.com/api/ajax/agents/tpmjs-discord-summary/conversation/${{ steps.conv-id.outputs.conv_id }}" \ -H "Authorization: Bearer $TPMJS_API_KEY" \ -H "Content-Type: application/json" \ -d '{ diff --git a/apps/web/src/app/api/agents/[id]/conversation/[conversationId]/route.ts b/apps/web/src/app/api/agents/[id]/conversation/[conversationId]/route.ts index f40ffba..1712a64 100644 --- a/apps/web/src/app/api/agents/[id]/conversation/[conversationId]/route.ts +++ b/apps/web/src/app/api/agents/[id]/conversation/[conversationId]/route.ts @@ -76,6 +76,7 @@ async function getProviderModel( * POST /api/agents/[id]/conversation/[conversationId] * Send a message and stream the AI response via SSE */ +// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Complex streaming logic required export async function POST(request: NextRequest, context: RouteContext): Promise { const startTime = Date.now(); @@ -291,6 +292,7 @@ export async function POST(request: NextRequest, context: RouteContext): Promise // Create SSE stream const stream = new ReadableStream({ + // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Complex streaming logic async start(controller) { const encoder = new TextEncoder(); @@ -345,6 +347,7 @@ export async function POST(request: NextRequest, context: RouteContext): Promise }); } }, + // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Complex callback onStepFinish: async ({ toolCalls, toolResults, usage }) => { // Capture tool calls from step finish (backup in case onChunk missed any) if (toolCalls && Array.isArray(toolCalls)) {