- Rail: Add icon with stacked form modals (bot, workspace, computer), coordinator, recent bots with "See all bots", Workspaces section, and a workspace mode listing only its crew - Workspaces: page for context, bots (per-workspace instructions and memory), computers (default, link, unlink), models and delete; conversations scoped per bot per workspace - Sessions: conversations split into searchable, reopenable sessions with carry-over summaries; sessions and new-session header icons - Computers: created and provisioned over the docker socket, home dir kept at DATA_DIR/computers/<id> after delete; super admins only - Models: workspace settings win over a bot's own, then the defaults - Pictures for bots and workspaces; bots editable from the header - Coordinator tools: update_workspace, set_bot_workspace_instructions Co-Authored-By: Claude Opus 5.5 <[email protected]>
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import userAuth from "@/src/functions/backend/auth/user-auth";
|
|
import markBotSessionRead from "@/src/functions/backend/db/bot-sessions/mark-bot-session-read";
|
|
import { BotSessionIdRequestSchema } from "@/src/schemas/bot-schema";
|
|
import AppError from "@/src/utils/app-error";
|
|
import parseWithSchema from "@/src/utils/parse-with-schema";
|
|
import safeErrorMessage from "@/src/utils/safe-error-message";
|
|
import type {
|
|
APIResponseObject,
|
|
BunextAPIRouteHandler,
|
|
} from "@moduletrace/bunext/types";
|
|
|
|
/**
|
|
* Clears a session's unread flag when a message arrives in the
|
|
* conversation the user has open. Only the session user's own bots.
|
|
*/
|
|
export const handler: BunextAPIRouteHandler<APIResponseObject> = async ({
|
|
req,
|
|
body,
|
|
}) => {
|
|
try {
|
|
if (req.method != "POST") {
|
|
throw new AppError(`Method not allowed`);
|
|
}
|
|
|
|
const { user } = await userAuth({ req });
|
|
|
|
if (!user?.logged_in_status || !user.id) {
|
|
return { success: false, msg: `Unauthorized`, logoutUser: true };
|
|
}
|
|
|
|
const { session_id } = parseWithSchema({ schema: BotSessionIdRequestSchema, data: body });
|
|
|
|
await markBotSessionRead({ session_id, user_id: user.id });
|
|
|
|
return { success: true };
|
|
} catch (error: unknown) {
|
|
return { success: false, msg: safeErrorMessage({ error }) };
|
|
}
|
|
};
|