Add pxpipe as an experimental fifth Token Saver: Claude-format request bodies above a configurable size threshold are rendered as dense PNGs via the pxpipe-proxy library API (transformAnthropicMessages) before dispatch, cutting estimated input tokens by ~35-60% on token-dense contexts. Integration follows the Headroom pattern: applied to the final body in chatCore just before dispatch, fail-open on any error/timeout. Managed npm install into DATA_DIR/pxpipe, dynamic loader with per-version cache-bust, JSONL event log with rotation, /api/pxpipe/* endpoints, Token Saver card (marked experimental) + /dashboard/pxpipe page, and per-request Activated/Skipped annotation in Request Details. Disabled by default.
16 lines
497 B
JavaScript
16 lines
497 B
JavaScript
import { NextResponse } from "next/server";
|
|
import { runHealthCheck } from "@/lib/pxpipe/service.js";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function POST() {
|
|
try {
|
|
const result = await runHealthCheck();
|
|
return NextResponse.json(result);
|
|
} catch (error) {
|
|
return NextResponse.json({ healthy: false, checks: [], error: error.message }, { status: 500 });
|
|
}
|
|
}
|
|
|
|
// GET mirrors POST so the card can probe on page load without a mutation call.
|
|
export const GET = POST;
|