Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
efb0172
fix(chat-workflow): persist the assistant message after a successful …
sweetmantech May 25, 2026
5ec88cc
Merge remote-tracking branch 'origin/main' into test
sweetmantech May 25, 2026
d56aa31
feat(credits): charge credits per chat turn (atomic wallet debit + au…
sweetmantech May 25, 2026
fda1df2
Merge remote-tracking branch 'origin/main' into test
sweetmantech May 25, 2026
86295b8
feat(chat-workflow): auto-commit + push after natural finish (#614)
sweetmantech May 25, 2026
8dd29fa
Merge remote-tracking branch 'origin/main' into test
sweetmantech May 25, 2026
9562e6b
feat(api): migrate /api/sessions/[sessionId]/chats/[chatId] from open…
arpitgupta1214 May 26, 2026
85f7ece
Merge remote-tracking branch 'origin/main' into test
sweetmantech May 26, 2026
977ef2c
feat(chat-workflow): persist assistant message per step (#603)
arpitgupta1214 May 26, 2026
6c6a6e4
Merge remote-tracking branch 'origin/main' into test
sweetmantech May 26, 2026
61ebc51
feat(sessions): ensure personal repo on POST /api/sessions (#618)
sweetmantech May 26, 2026
529c469
Merge remote-tracking branch 'origin/main' into test
sweetmantech May 26, 2026
f05b050
feat(sessions): replace body cloneUrl+branch with organizationId (#620)
sweetmantech May 26, 2026
c264b50
Merge remote-tracking branch 'origin/main' into test
sweetmantech May 26, 2026
88bc870
feat(sessions): enhance session patching with sandbox state managemen…
ahmednahima0-beep May 27, 2026
18a6acf
Merge remote-tracking branch 'origin/main' into test
sweetmantech May 28, 2026
ed3d425
feat(backfill): Phase 2 rooms→sessions/chats/chat_messages script (#623)
sweetmantech May 29, 2026
49c327f
fix(backfill): store full UIMessage in chat_messages.parts (#627)
sweetmantech May 29, 2026
290783c
Feat(api) - migrate post chat read (#624)
ahmednahima0-beep May 29, 2026
743b066
feat(sessions): accept artistId on POST /api/sessions (#628)
arpitgupta1214 May 30, 2026
94821f6
feat(api): migrate GET /api/chats to session-scoped shape (#626)
arpitgupta1214 May 31, 2026
a8c91b0
feat(backfill): include artist_id in session migration (#629)
ahmednahima0-beep Jun 1, 2026
0f8bdf1
feat(chats): exclude archived sessions from GET /api/chats (#630)
arpitgupta1214 Jun 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions app/api/chats/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ export async function OPTIONS() {
/**
* GET /api/chats
*
* Retrieves chat rooms for an account.
* Retrieves chats joined with their owning session. Each row carries
* `sessionId` and the owning `accountId` so clients can render canonical
* `/sessions/{sessionId}/chats/{chatId}` URLs.
*
* Authentication: x-api-key header or Authorization Bearer token required.
*
* Query parameters:
* - account_id (required): UUID of the account whose chats to retrieve
* - artist_account_id (optional): Filter to chats for a specific artist (UUID)
* - account_id (optional): UUID of the target account (validated for access).
* - artist_account_id (optional): Accepted for backward compatibility but
* ignored — reserved for the artist-surface migration.
Comment on lines +32 to +33

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: JSDoc claims artist_account_id is "ignored", but the implementation still actively filters on it. This mismatch will mislead API consumers into thinking the parameter is a no-op when it actually scopes results to a specific artist context.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/api/chats/route.ts, line 32:

<comment>JSDoc claims `artist_account_id` is "ignored", but the implementation still actively filters on it. This mismatch will mislead API consumers into thinking the parameter is a no-op when it actually scopes results to a specific artist context.</comment>

<file context>
@@ -21,13 +21,16 @@ export async function OPTIONS() {
- * - account_id (required): UUID of the account whose chats to retrieve
- * - artist_account_id (optional): Filter to chats for a specific artist (UUID)
+ * - account_id (optional): UUID of the target account (validated for access).
+ * - artist_account_id (optional): Accepted for backward compatibility but
+ *   ignored — reserved for the artist-surface migration.
  *
</file context>
Suggested change
* - artist_account_id (optional): Accepted for backward compatibility but
* ignored reserved for the artist-surface migration.
+ * - artist_account_id (optional): UUID of the artist account to scope chats to
+ * (via `sessions.artist_id`). Composes with `account_id` when both are set.
+ * Reserved for the artist-surface migration.

*
* @param request - The request object containing query parameters
* @returns A NextResponse with chats data or an error
Expand Down
2 changes: 2 additions & 0 deletions app/api/sessions/[sessionId]/__tests__/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function makePatchReqRaw(
const mockRow: SessionRow = {
id: "sess_1",
account_id: "acc-uuid-1",
artist_id: null,
title: "Test session",
status: "running",
repo_owner: "acme",
Expand Down Expand Up @@ -186,6 +187,7 @@ describe("GET /api/sessions/[sessionId]", () => {
session: {
id: "sess_1",
userId: "acc-uuid-1",
artistId: null,
title: "Test session",
status: "running",
repoOwner: "acme",
Expand Down
38 changes: 38 additions & 0 deletions app/api/sessions/[sessionId]/chats/[chatId]/read/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { NextRequest, NextResponse } from "next/server";
import { getCorsHeaders } from "@/lib/networking/getCorsHeaders";
import { markChatReadHandler } from "@/lib/sessions/chats/markChatReadHandler";

/**
* OPTIONS handler for CORS preflight requests.
*
* @returns A NextResponse with CORS headers.
*/
export async function OPTIONS() {
return new NextResponse(null, {
status: 200,
headers: getCorsHeaders(),
});
}

/**
* POST /api/sessions/{sessionId}/chats/{chatId}/read
*
* Marks a chat as read for the authenticated account. Authenticates via
* Privy Bearer token or x-api-key header.
*
* @param request - The incoming request.
* @param options - Route options containing the async params.
* @param options.params - Route params containing sessionId and chatId.
* @returns A NextResponse with `{ success: true }` on 200, or an error.
*/
export async function POST(
request: NextRequest,
options: { params: Promise<{ sessionId: string; chatId: string }> },
) {
const { sessionId, chatId } = await options.params;
return markChatReadHandler(request, sessionId, chatId);
}

export const dynamic = "force-dynamic";
export const fetchCache = "force-no-store";
export const revalidate = 0;
Loading
Loading