Disable cache storage on live detail routes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { listAiAccounts, saveAiAccount } from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
function isValidRole(value: string): value is "primary" | "backup" | "api_fallback" {
|
||||
return value === "primary" || value === "backup" || value === "api_fallback";
|
||||
@@ -13,10 +14,10 @@ function isValidProvider(value: string): value is "master_codex_node" | "openai_
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
const result = await listAiAccounts();
|
||||
return NextResponse.json({ ok: true, ...result });
|
||||
return jsonNoStore({ ok: true, ...result });
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
|
||||
@@ -2,11 +2,12 @@ import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { authorizeDeviceWriteRequest } from "@/lib/boss-device-auth";
|
||||
import { appendAppLog, readState } from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const limit = Math.min(Math.max(Number(request.nextUrl.searchParams.get("limit") ?? "20"), 1), 100);
|
||||
@@ -40,7 +41,7 @@ export async function GET(request: NextRequest) {
|
||||
const entries = filtered.slice(0, limit);
|
||||
const nextCursor = filtered.length > limit ? entries.at(-1)?.createdAt : null;
|
||||
|
||||
return NextResponse.json({
|
||||
return jsonNoStore({
|
||||
ok: true,
|
||||
entries,
|
||||
nextCursor,
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { NextRequest } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { getAuditSummaryView } from "@/lib/boss-projections";
|
||||
import { readState } from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
const state = await readState();
|
||||
return NextResponse.json({ ok: true, ...getAuditSummaryView(state) });
|
||||
return jsonNoStore({ ok: true, ...getAuditSummaryView(state) });
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { authorizeDeviceWriteRequest } from "@/lib/boss-device-auth";
|
||||
import { readState, upsertDeviceSkills } from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
@@ -9,16 +10,16 @@ export async function GET(
|
||||
) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
const { deviceId } = await context.params;
|
||||
const state = await readState();
|
||||
const device = state.devices.find((item) => item.id === deviceId);
|
||||
if (!device) {
|
||||
return NextResponse.json({ ok: false, message: "DEVICE_NOT_FOUND" }, { status: 404 });
|
||||
return jsonNoStore({ ok: false, message: "DEVICE_NOT_FOUND" }, { status: 404 });
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
return jsonNoStore({
|
||||
ok: true,
|
||||
device,
|
||||
skills: state.deviceSkills
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { createDeviceEnrollment, readState } from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
const state = await readState();
|
||||
return NextResponse.json({ ok: true, enrollments: state.deviceEnrollments });
|
||||
return jsonNoStore({ ok: true, enrollments: state.deviceEnrollments });
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { NextRequest } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { getOpsSummaryView } from "@/lib/boss-projections";
|
||||
import { readState } from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
const state = await readState();
|
||||
return NextResponse.json({ ok: true, ...getOpsSummaryView(state) });
|
||||
return jsonNoStore({ ok: true, ...getOpsSummaryView(state) });
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
updateProjectAgentControls,
|
||||
} from "@/lib/boss-data";
|
||||
import { getClawBackendAvailability } from "@/lib/execution/backends/claw-config";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
const reasoningEffortValues = new Set(["low", "medium", "high"]);
|
||||
|
||||
@@ -16,19 +17,19 @@ export async function GET(
|
||||
const { projectId } = await context.params;
|
||||
const projectExists = await hasPersistedProject(projectId);
|
||||
if (!projectExists) {
|
||||
return NextResponse.json({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
return jsonNoStore({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
}
|
||||
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const [controls, clawAvailability] = await Promise.all([
|
||||
getProjectAgentControls(projectId, session.account),
|
||||
getClawBackendAvailability(),
|
||||
]);
|
||||
return NextResponse.json({ ok: true, controls, clawAvailability });
|
||||
return jsonNoStore({ ok: true, controls, clawAvailability });
|
||||
}
|
||||
|
||||
export async function POST(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { NextRequest } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { listDispatchPlansByProject, readState } from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
@@ -8,19 +9,19 @@ export async function GET(
|
||||
) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const { projectId } = await context.params;
|
||||
const state = await readState();
|
||||
const project = state.projects.find((item) => item.id === projectId);
|
||||
if (!project) {
|
||||
return NextResponse.json({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
return jsonNoStore({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
}
|
||||
if (!project.isGroup) {
|
||||
return NextResponse.json({ ok: false, message: "PROJECT_NOT_GROUP_CHAT" }, { status: 400 });
|
||||
return jsonNoStore({ ok: false, message: "PROJECT_NOT_GROUP_CHAT" }, { status: 400 });
|
||||
}
|
||||
|
||||
const plans = await listDispatchPlansByProject(projectId);
|
||||
return NextResponse.json({ ok: true, plans });
|
||||
return jsonNoStore({ ok: true, plans });
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
hasPersistedProject,
|
||||
listUserMasterMemories,
|
||||
} from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
const memoryTypeValues = new Set([
|
||||
"user_preference",
|
||||
@@ -28,13 +29,13 @@ export async function GET(
|
||||
) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const { projectId } = await context.params;
|
||||
const projectExists = await hasPersistedProject(projectId);
|
||||
if (!projectExists) {
|
||||
return NextResponse.json({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
return jsonNoStore({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
}
|
||||
|
||||
const [globalMemories, projectMemories] = await Promise.all([
|
||||
@@ -44,7 +45,7 @@ export async function GET(
|
||||
: listUserMasterMemories(session.account, { scope: "project", projectId }),
|
||||
]);
|
||||
|
||||
return NextResponse.json({
|
||||
return jsonNoStore({
|
||||
ok: true,
|
||||
projectId,
|
||||
memories: {
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
getProjectOrchestrationBackendState,
|
||||
updateProjectOrchestrationBackend,
|
||||
} from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
function normalizeRequestedBackendId(value: unknown) {
|
||||
return value === "omx-team" ? "omx-team" : "boss-native-orchestrator";
|
||||
@@ -13,12 +14,12 @@ function normalizeRequestedBackendId(value: unknown) {
|
||||
async function readGroupProjectOrNotFound(projectId: string) {
|
||||
const project = await getProject(projectId);
|
||||
if (!project) {
|
||||
return { ok: false as const, response: NextResponse.json({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 }) };
|
||||
return { ok: false as const, response: jsonNoStore({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 }) };
|
||||
}
|
||||
if (!project.isGroup) {
|
||||
return {
|
||||
ok: false as const,
|
||||
response: NextResponse.json({ ok: false, message: "PROJECT_NOT_GROUP_CHAT" }, { status: 400 }),
|
||||
response: jsonNoStore({ ok: false, message: "PROJECT_NOT_GROUP_CHAT" }, { status: 400 }),
|
||||
};
|
||||
}
|
||||
return { ok: true as const, project };
|
||||
@@ -30,7 +31,7 @@ export async function GET(
|
||||
) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const { projectId } = await context.params;
|
||||
@@ -41,10 +42,10 @@ export async function GET(
|
||||
|
||||
const state = await getProjectOrchestrationBackendState(projectId);
|
||||
if (!state) {
|
||||
return NextResponse.json({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
return jsonNoStore({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
return jsonNoStore({
|
||||
ok: true,
|
||||
...state,
|
||||
requestedBackendId: projectCheck.project.orchestrationBackendOverride ?? null,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { isDispatchableThreadProject, readState, replaceGroupChatMembers } from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
type ConversationParticipant = {
|
||||
projectId: string;
|
||||
@@ -124,16 +125,16 @@ export async function GET(
|
||||
) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const { projectId } = await context.params;
|
||||
const state = await readState();
|
||||
const payload = buildParticipantsPayload(state, projectId);
|
||||
if (!payload) {
|
||||
return NextResponse.json({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
return jsonNoStore({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
}
|
||||
return NextResponse.json(payload);
|
||||
return jsonNoStore(payload);
|
||||
}
|
||||
|
||||
export async function POST(
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
updateUserMasterPrompt,
|
||||
} from "@/lib/boss-data";
|
||||
import { getClawBackendAvailability } from "@/lib/execution/backends/claw-config";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
@@ -17,13 +18,13 @@ export async function GET(
|
||||
) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const { projectId } = await context.params;
|
||||
const projectExists = await hasPersistedProject(projectId);
|
||||
if (!projectExists) {
|
||||
return NextResponse.json({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
return jsonNoStore({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
}
|
||||
|
||||
const [promptPolicy, userPrompt, projectControls, clawAvailability] = await Promise.all([
|
||||
@@ -33,7 +34,7 @@ export async function GET(
|
||||
getClawBackendAvailability(),
|
||||
]);
|
||||
|
||||
return NextResponse.json({
|
||||
return jsonNoStore({
|
||||
ok: true,
|
||||
projectId,
|
||||
promptPolicy,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { NextRequest } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { readState } from "@/lib/boss-data";
|
||||
import { getProjectDetailView } from "@/lib/boss-projections";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
@@ -9,14 +10,14 @@ export async function GET(
|
||||
) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const { projectId } = await context.params;
|
||||
const state = await readState();
|
||||
const detail = getProjectDetailView(state, projectId, session.account);
|
||||
if (!detail) {
|
||||
return NextResponse.json({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
return jsonNoStore({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
|
||||
}
|
||||
|
||||
const threadStatusDocument =
|
||||
@@ -26,7 +27,7 @@ export async function GET(
|
||||
.sort((a, b) => b.createdAt.localeCompare(a.createdAt))
|
||||
.slice(0, 5);
|
||||
|
||||
return NextResponse.json({
|
||||
return jsonNoStore({
|
||||
ok: true,
|
||||
projectId,
|
||||
threadStatusDocument,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { NextRequest } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { getThreadContextDetailView } from "@/lib/boss-projections";
|
||||
import { readState } from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
@@ -9,15 +10,15 @@ export async function GET(
|
||||
) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
const { threadId } = await context.params;
|
||||
const state = await readState();
|
||||
const detail = getThreadContextDetailView(state, threadId);
|
||||
|
||||
if (!detail) {
|
||||
return NextResponse.json({ ok: false, message: "THREAD_NOT_FOUND" }, { status: 404 });
|
||||
return jsonNoStore({ ok: false, message: "THREAD_NOT_FOUND" }, { status: 404 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ ok: true, ...detail });
|
||||
return jsonNoStore({ ok: true, ...detail });
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { checkForOta, getOtaStatus, performOta } from "@/lib/boss-data";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
const status = await getOtaStatus();
|
||||
return NextResponse.json({ ok: true, ...status });
|
||||
return jsonNoStore({ ok: true, ...status });
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
|
||||
Reference in New Issue
Block a user