Files
OmniRoute/next.config.mjs
Diego Rodrigues de Sa e Souza dc40911583 Release v3.8.39 (#5164)
* chore(release): open v3.8.39 development cycle

* docs(changelog): backfill 5 v3.8.38 bullets merged after release finalize

These PRs squash-merged into release/v3.8.38 between the CHANGELOG finalize
(ff57be32f) and the merge-to-main (ae6e2342d), so they shipped in the v3.8.38
tag but had no bullet:

- feat(compression): Ionizer engine (lossy JSON-array sampling + CCR) (#5148)
- fix(sse): preserve non-stream reasoning fields (#5155, @rdself)
- fix(i18n): add missing English UI labels (#5153, @rdself)
- test(combo): gated live smoke (#5151) + release-expectations refresh (#5150, @KooshaPari)

(#5129 exact-host Anthropic baseUrl is already covered by the #5130 bullet — same CodeQL #674.)
Synced 41 i18n CHANGELOG mirrors.

* feat(compression): TOON best-of-N candidate encoder + encoder A/B table (#5163)

Integrated into release/v3.8.39. TOON best-of-N candidate encoder (GCF default, fail-open). 17/17 unit tests pass on merge result; CI reds were base-stale + Quality Ratchet DRIFT.

* fix(zenmux): normalize vendor-prefixed GLM system roles (#5158)

Integrated into release/v3.8.39. ZenMux vendor-prefixed GLM system-role normalization; 12/12 role-normalizer tests pass on merge result. CI reds base-stale.

* [codex] fix xAI OAuth test and reasoning effort (#5157)

Integrated into release/v3.8.39. xAI reasoning-effort normalization (max/xhigh→high) + OAuth test config; 46/46 xai-translator tests pass on merge result. CI reds base-stale.

* docs(i18n): add Traditional Chinese (zh-TW) README and update zh-CN to latest (#5162)

Integrated into release/v3.8.39. Traditional Chinese (zh-TW) README + zh-CN refresh; docs-only.

* test(security): guard PII redaction stays opt-in (default off) + Hard Rule #20 (#5159)

Integrated into release/v3.8.39. PII opt-in regression guard + Hard Rule #20; rebased to strip base-drift (+81/-1). 5/5 guard tests pass; flip-proof verified.

* test(combo): deterministic context-relay universal-handoff coverage (closes phase-2 TODO) (#5168)

Integrated into release/v3.8.39. Deterministic context-relay universal-handoff coverage (3 tests); 3/3 pass on merge result.

* docs(i18n): full sync zh-TW and zh-CN README with canonical English v3.8.39 (#5171)

Integrated into release/v3.8.39. Full zh-TW docs tree + zh-CN sync with canonical English v3.8.39; docs-only.

* fix(serve): honour HOSTNAME from .env instead of hardcoding 0.0.0.0 (#5134) (#5170)

Integrated into release/v3.8.39. HOSTNAME env override in serve (#5134) + regression test (4/4, TDD flip-proof verified).

* fix(sse): resolve nameless deepseek-web tool blocks via parameter-schema match (#5154) (#5173)

Integrated into release/v3.8.39. Schema-based nameless deepseek-web tool-block resolution (#5154); 6/6 tests pass on merge result (incl. ambiguous/no-match negatives + named-tag no-regression).

* fix(sse): normalize array user content for Command Code to avoid upstream 400 (#5166) (#5174)

Integrated into release/v3.8.39. Normalize array user content for Command Code (#5166, user-array/400 symptom); 4/4 tests pass on merge result.

* fix(sse): defer </think> close so it never leaks before tool_calls (#5123) (#5175)

Integrated into release/v3.8.39. Defer </think> close so it never leaks before tool_calls (#5123); 4/4 tests pass (incl. #4633 no-regression). CHANGELOG synced to keep all 3 v3.8.39 fixes.

* fix(dashboard): use amber for home update-step warning icon (#5176)

Integrated into release/v3.8.39. Amber for home update-step warning icon; 1/1 UI test.

* fix(api): LAN/Tailscale dashboard — host-aware CSP + GET-exempt version route + combo field errors (#5083) (#5177)

Integrated into release/v3.8.39. Host-aware CSP (ReDoS/injection-safe host validation) + GET-exempt /api/system/version (POST/spawn stays LOCAL_ONLY, exact-match safe-methods-only) + COMBO_002 firstField. 44/44 tests + route-guard membership gate green. CHANGELOG synced to keep all 4 v3.8.39 fixes.

* fix(api): replace #5083 global middleware CSP with declarative ws: scheme (#5083)

Follow-up to PR #5177 (merged): that version implemented the LAN-CSP fix (Bug 1)
with a new global `src/middleware.ts` + `src/server/csp.ts`, which contradicts the
project's documented architecture — 'No global Next.js middleware — interception is
route-specific' (CLAUDE.md / AGENTS.md) — and was merged unverified (middleware vs
next.config header precedence was never confirmed in a real build).

This replaces that approach with the minimal, declarative equivalent:
  • next.config.mjs: connect-src now permits the bare `ws:` scheme (symmetric with the
    bare `wss:` already allowed) so the dashboard can reach its own Live WS server from
    a LAN/Tailscale host. No middleware.
  • Removes src/middleware.ts, src/server/csp.ts, and tests/unit/csp-host-aware.test.ts.
  • Adds tests/unit/csp-lan-ws-5083.test.ts (incl. a guard asserting src/middleware.ts
    does NOT exist, so the global-middleware approach cannot silently return).

Bugs 2 (GET-exempt /api/system/version) and 3 (COMBO_002 field surfacing) from #5177
are unaffected and remain in place.

Co-authored-by: KooshaPari <KooshaPari@users.noreply.github.com>

* test(combo): end-to-end quota-share DRR routing-decision coverage (matrix parity) (#5179)

Integrated into release/v3.8.39. Quota-share DRR routing-decision coverage (matrix parity); 2/2 pass on merge result.

* feat(agent-bridge): graceful cert-install fallback with manual guide for containers (#4546) (#5178)

Integrated into release/v3.8.39. Agent-bridge graceful cert-install fallback + manual guide (#4546); 6/6 tests pass on merge result.

* fix(antigravity): family-scoped quota lockout (gemini/claude buckets) (#5180)

Integrated into release/v3.8.39 — family-scoped antigravity quota lockout. Rebased from v3.8.37 + validated (vitest 5/5, typecheck clean, full combo-matrix green, model-lockout 99/0). Same-model cross-account retry (chat.ts) deferred pending live antigravity VPS validation.

* fix(cli): force NODE_ENV to match dev/start run mode in custom Next server (#5189)

Integrated into release/v3.8.39. Force NODE_ENV to match dev/start run mode in custom Next server; 2/2 source-scan+ordering tests pass on merge result.

* feat(compression): CCR ranged/grep/stats retrieval (ReDoS-safe, backward-compat) (#5187)

Integrated into release/v3.8.39. CCR ranged/grep/stats retrieval (safe-regex ReDoS guard + length/match caps); 17/17 tests pass on merge result.

* docs(combo): sync all combo/routing-strategy docs to current state + document test coverage (#5185)

Integrated into release/v3.8.39. Combo/routing-strategy docs sync; docs-only.

* fix(mcp): return 404 (not 400) for unknown Streamable HTTP session id (#5169) (#5191)

* fix(api): respect blocked Auto (Zero-Config) provider in /v1/models catalog (#5192) (#5194)

* test(combo): deterministic context-relay codex quota-handoff coverage (closes last gap) (#5195)

* test(ci): wire antigravity-quota-family under test:vitest (fix test-discovery orphan) (#5196)

* fix(oauth): antigravity login no longer hangs — fire-and-forget onboarding + bounded post-exchange (#5193)

Antigravity OAuth hang fix (no-PKCE/no-openid + bounded post-exchange + exchange-500 fix). Includes #5200 (Koosha) revert + owner rebaseline to keep documented comments. Integrated into release/v3.8.39.

* feat(oauth): remote Antigravity login via local helper + paste-credentials (#5203)

Remote Antigravity login: local helper (omniroute login antigravity) + paste-credentials. Integrated into release/v3.8.39.

* fix(translator): accept Claude Messages shape in non-stream malformed-200 guard (#5156)

Integrated into release/v3.8.39

* fix(cli): default dev bundler to Turbopack (16.2.x panic no longer reproduces) (#5206)

Integrated into release/v3.8.39

* fix(cli): auto-calibrate server V8 heap from physical RAM (#5172) (#5213)

The server was spawned with a fixed --max-old-space-size=512 (omniroute serve)
or no heap flag at all (Electron), so RAM-rich boxes still OOM-crashed under
load (Ineffective mark-compacts near heap limit ~500MB) with many providers/
accounts and large model catalogs. New calibrateHeapFallbackMb(os.totalmem())
defaults the heap to ~35% of RAM clamped [512,4096], wired into serve.mjs and
electron/main.js. Explicit OMNIROUTE_MEMORY_MB still wins (#2939 unchanged).

Also addresses #5160 (same OOM root); #5152 (docker) benefits via the same knob.

Closes #5172

* fix(proxy): coalesce fast-fail health probes (#5208)

Integrated into release/v3.8.39

* fix(proxy): close dispatchers when clearing cache (#5202)

Integrated into release/v3.8.39

* fix(cli): raise dev server Node heap limit to 8GB to prevent OOM (#5198)

Integrated into release/v3.8.39

* fix(auth): allow synthetic no-auth fallback for mimocode (#5205)

Integrated into release/v3.8.39

* fix(oauth): preserve Antigravity refresh_token on empty/omitted upstream response (#3850) (#5214)

Google's OAuth refresh tokens are non-rotating: the refresh response usually
omits refresh_token and occasionally returns it as an empty string. The
Antigravity executor used `typeof tokens.refresh_token === "string" ? ... `
which accepts "" (typeof "" === "string") and overwrote the stored token with
empty, nulling it on first refresh. Now treats non-string OR empty as absent and
preserves credentials.refreshToken, matching refreshGoogleToken semantics.

Closes #3850

* fix(responses): normalize non-array input (#5204)

Integrated into release/v3.8.39

* fix(stream): normalize safety finish reasons via shared helper (#5197)

Integrated into release/v3.8.39

* fix(request-logger): never render negative '(-100%)' compression badge (#5201)

Integrated into release/v3.8.39

* fix(combo): reject empty responses api output (#5207)

Integrated into release/v3.8.39 — combo failover now rejects empty Responses API output (validateQuality). Baseline rebaseline dropped (main-measured drift; maintainer rebaselines at release).

* fix(pwa): prefer cached navigation before offline page (#5209)

Integrated into release/v3.8.39 — PWA service worker prefers cached navigation before offline page (#5165).

* chore(release): v3.8.39 — 2026-06-28

* chore(release): rebaseline openapi+i18n coverage ratchet drift for v3.8.39

---------

Co-authored-by: Arthur Bodera <abodera@gmail.com>
Co-authored-by: Nguyen Minh <lop123thcs@gmail.com>
Co-authored-by: lunkerchen <labanchen@gmail.com>
Co-authored-by: Ankit <177378174+anki1kr@users.noreply.github.com>
Co-authored-by: KooshaPari <KooshaPari@users.noreply.github.com>
Co-authored-by: Ardem2025 <ardemb22@gmail.com>
Co-authored-by: backryun <bakryun0718@proton.me>
Co-authored-by: Anton <39598727+NomenAK@users.noreply.github.com>
Co-authored-by: KooshaPari <42529354+KooshaPari@users.noreply.github.com>
Co-authored-by: Wilson <pedbookmed@gmail.com>
Co-authored-by: Randi <55005611+rdself@users.noreply.github.com>
2026-06-28 06:58:29 -03:00

564 lines
20 KiB
JavaScript

import createNextIntlPlugin from "next-intl/plugin";
import { createMDX } from "fumadocs-mdx/next";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");
const distDir = process.env.NEXT_DIST_DIR || ".build/next";
const projectRoot = dirname(fileURLToPath(import.meta.url));
const scriptSrc =
process.env.NODE_ENV === "development"
? "script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:"
: "script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:";
const contentSecurityPolicy = [
"default-src 'self'",
"base-uri 'self'",
"object-src 'none'",
"frame-ancestors 'none'",
"form-action 'self'",
scriptSrc,
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
"font-src 'self' https://fonts.gstatic.com data:",
"img-src 'self' data: blob: https:",
"media-src 'self' data: blob:",
// `ws:` is permitted scheme-wide (mirroring the bare `wss:` already allowed) so the
// dashboard can open `ws://<lan-or-tailscale-host>:*` to its own Live WS server when
// OmniRoute is reached from a non-loopback host. Same-origin HTTP fetches stay covered
// by `'self'`; the loopback origins remain listed explicitly for clarity. (#5083)
"connect-src 'self' http://localhost:* http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:* https: ws: wss:",
"worker-src 'self' blob:",
"manifest-src 'self'",
].join("; ");
const securityHeaders = [
{
key: "Content-Security-Policy",
value: contentSecurityPolicy,
},
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "Referrer-Policy",
value: "strict-origin-when-cross-origin",
},
{
key: "Permissions-Policy",
value: "camera=(), microphone=(), geolocation=(), payment=(), usb=(), serial=()",
},
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
];
function isNextIntlExtractorDynamicImportWarning(warning) {
const message = typeof warning === "string" ? warning : warning?.message || "";
const resource = warning?.module?.resource || warning?.file || "";
const target = "next-intl/dist/esm/production/extractor/format/index.js";
return (
resource.includes(target) &&
(message.includes("import(t)") || message.includes("dependency is an expression"))
);
}
// OMNIROUTE_BUILD_PROFILE=minimal physically removes four optional privileged
// modules (MITM cert install, Zed keychain import, Cloud Sync, 9router
// installer) from the built bundle by aliasing them to feature-disabled stubs.
// The resulting artifact is intended to be published as `omniroute-secure`
// for security-sensitive environments. See docs/security/SOCKET_DEV_FINDINGS.md.
const isMinimalBuild = process.env.OMNIROUTE_BUILD_PROFILE === "minimal";
const minimalBuildAliases = isMinimalBuild
? {
"@/mitm/cert/install": "./src/mitm/cert/install.stub.ts",
"@/lib/zed-oauth/keychain-reader": "./src/lib/zed-oauth/keychain-reader.stub.ts",
"@/lib/cloudSync": "./src/lib/cloudSync.stub.ts",
"@/lib/services/installers/ninerouter": "./src/lib/services/installers/ninerouter.stub.ts",
}
: {};
/** @type {import('next').NextConfig} */
const nextConfig = {
distDir,
// Turbopack config: redirect native modules to stubs at build time
turbopack: {
root: projectRoot,
resolveAlias: {
// Point mitm/manager to a stub during build (native child_process/fs can't be bundled)
"@/mitm/manager": "./src/mitm/manager.stub.ts",
...minimalBuildAliases,
},
},
output: "standalone",
compress: true,
productionBrowserSourceMaps: false,
// OmniRoute is a proxy for AI APIs — request bodies routinely include
// multi-MB payloads (vision models, image edits, base64-encoded files,
// long chat histories with embedded images). Next.js's Server Action
// handler intercepts POSTs with multipart/form-data or
// x-www-form-urlencoded content-types and enforces a 1 MB cap that
// surfaces as a 413 with a confusing "Server Actions" hint, even on
// pure route handlers. 50 MB matches what most upstream LLM providers
// accept for image-bearing requests; tune via env if a deployment needs
// more.
experimental: {
serverActions: {
bodySizeLimit: process.env.OMNIROUTE_SERVER_ACTIONS_BODY_LIMIT || "50mb",
},
// Next.js proxy (middleware) has a default 10MB body clone limit. File
// uploads (OpenAI-compatible /v1/files) routinely exceed this. Match the
// 512 MB server-side cap; tune via env if needed.
proxyClientMaxBodySize: process.env.NEXT_PROXY_BODY_LIMIT || "512mb",
// PR-2 of diegosouzapw/OmniRoute#3932: tree-shake barrel re-exports so
// route bundles don't pull in 14 locale files, every lucide-react icon,
// or the full date-fns surface when only one helper is used.
//
// NOTE: this list must only contain EXTERNAL barrel libraries. Do NOT add
// the internal `@omniroute/open-sse` workspace here: optimizePackageImports
// makes Next.js resolve every export of the package's barrel at build time,
// and open-sse's `index.ts` re-exports the entire streaming engine
// (executors/translators/services/handlers/mcp-server — thousands of
// modules). Combined with the #3501 god-file splits (which multiplied the
// re-export edges), this drove the webpack production pass into a heap
// runaway that OOM'd even at a 28 GB --max-old-space-size (RSS pinned at the
// ceiling in a GC death-spiral). Removing it keeps the build's heap bounded.
// optimizePackageImports is designed for external libs, not workspaces.
optimizePackageImports: [
"lobehub/icons",
"@lobehub/icons",
"lucide-react",
"date-fns",
"lodash",
"lodash-es",
"material-symbols",
"next-intl",
],
},
outputFileTracingRoot: projectRoot,
outputFileTracingIncludes: {
// Migration SQL and compression rule/filter JSON files are read via fs at
// runtime and are NOT always auto-traced by webpack/turbopack.
"/*": [
"./src/lib/db/migrations/**/*",
"./src/mitm/server.cjs",
"./open-sse/services/compression/engines/rtk/filters/**/*.json",
"./open-sse/services/compression/rules/**/*.json",
"./open-sse/lib/sha3_wasm_bg.wasm",
"./open-sse/lib/deepseek-pow-solver.cjs",
// sql.js WASM is loaded at runtime by the sqljsAdapter fallback tier
// (better-sqlite3 → node:sqlite → sql.js). Next traces sql-wasm.js but can
// omit the runtime sql-wasm.wasm asset from the standalone bundle.
"./node_modules/sql.js/dist/sql-wasm.wasm",
],
},
outputFileTracingExcludes: {
// Planning/task docs are not runtime assets and can break standalone copies
// when broad fs/path tracing pulls the whole repository into the NFT graph.
"/*": [
"./.git/**/*",
"./_tasks/**/*",
"./_references/**/*",
"./_ideia/**/*",
"./_mono_repo/**/*",
"./coverage/**/*",
"./test-results/**/*",
"./playwright-report/**/*",
"./app.__qa_backup/**/*",
"./tests/**/*",
"./logs/**/*",
],
},
serverExternalPackages: [
"pino",
"pino-pretty",
"thread-stream",
"pino-abstract-transport",
"better-sqlite3",
// sqlite-vec ships a native vec0.so loaded at runtime via createRequire().
// Turbopack otherwise tries to bundle the .so and fails with "Unknown module
// type"; externalizing it keeps the require at runtime (like better-sqlite3).
// See issue #3066.
"sqlite-vec",
"node-machine-id",
"keytar",
"wreq-js",
"zod",
"tls-client-node",
"koffi",
"tough-cookie",
"@ngrok/ngrok",
"@huggingface/transformers",
"child_process",
"fs",
"path",
"os",
"crypto",
"net",
"tls",
"http",
"https",
"stream",
"buffer",
"util",
"process",
],
transpilePackages: ["@omniroute/open-sse", "@lobehub/icons", "fumadocs-ui", "fumadocs-core"],
allowedDevOrigins: ["localhost", "127.0.0.1", "192.168.0.250"],
typescript: {
// TODO: Re-enable after fixing all sub-component useTranslations scope issues
ignoreBuildErrors: true,
},
webpack(config, { webpack }) {
config.ignoreWarnings = [
...(config.ignoreWarnings || []),
isNextIntlExtractorDynamicImportWarning,
];
config.optimization = config.optimization || {};
config.optimization.splitChunks = {
...config.optimization.splitChunks,
cacheGroups: {
...(config.optimization.splitChunks?.cacheGroups || {}),
recharts: {
test: /[\\/]node_modules[\\/]recharts[\\/]/,
name: "vendor-recharts",
chunks: "all",
priority: 20,
},
lobeIcons: {
test: /[\\/]node_modules[\\/]@lobehub[\\/]icons[\\/]/,
name: "vendor-lobe-icons",
chunks: "all",
priority: 20,
},
monaco: {
test: /[\\/]node_modules[\\/]monaco-editor[\\/]/,
name: "vendor-monaco",
chunks: "all",
priority: 20,
},
xyflow: {
test: /[\\/]node_modules[\\/]@xyflow[\\/]/,
name: "vendor-xyflow",
chunks: "all",
priority: 20,
},
mermaid: {
test: /[\\/]node_modules[\\/]mermaid[\\/]/,
name: "vendor-mermaid",
chunks: "all",
priority: 20,
},
// PR-2 of diegosouzapw/OmniRoute#3932: isolate the heavy long-tail
// vendor chunks that only some routes actually need, so dashboard
// pages don't pay for the docs bundle (or vice versa).
nextIntl: {
test: /[\\/]node_modules[\\/]next-intl[\\/]/,
name: "vendor-next-intl",
chunks: "all",
priority: 25,
},
fumadocs: {
test: /[\\/]node_modules[\\/](fumadocs-ui|fumadocs-core|fumadocs-mdx)[\\/]/,
name: "vendor-fumadocs",
chunks: "all",
priority: 20,
},
comboGraph: {
test: /[\\/]node_modules[\\/]@?dagre[\\/]|[\\/]node_modules[\\/]@?elkjs[\\/]/,
name: "vendor-combo-graph",
chunks: "all",
priority: 20,
},
},
};
if (isMinimalBuild) {
// Mirror the turbopack.resolveAlias entries for webpack-built artifacts.
// NormalModuleReplacementPlugin swaps the real module for a stub before
// webpack resolves it, so the privileged source files are never compiled
// into the standalone output.
const replacements = [
[/^@\/mitm\/cert\/install$/, "./src/mitm/cert/install.stub.ts"],
[/^@\/lib\/zed-oauth\/keychain-reader$/, "./src/lib/zed-oauth/keychain-reader.stub.ts"],
[/^@\/lib\/cloudSync$/, "./src/lib/cloudSync.stub.ts"],
[
/^@\/lib\/services\/installers\/ninerouter$/,
"./src/lib/services/installers/ninerouter.stub.ts",
],
];
for (const [pattern, stubPath] of replacements) {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(pattern, (resource) => {
resource.request = stubPath;
})
);
}
}
return config;
},
images: {
unoptimized: true,
},
async headers() {
return [
{
source: "/:path*",
headers: securityHeaders,
},
// G-10: allow OmniRoute's own dashboard to embed the 9Router UI via our reverse proxy.
// `frame-ancestors 'self'` overrides the global `frame-ancestors 'none'` only for this
// path. The route is already LOCAL_ONLY (routeGuard.ts) so remote origins cannot reach it.
{
source: "/dashboard/providers/services/:name/embed/:path*",
headers: [{ key: "Content-Security-Policy", value: "frame-ancestors 'self'" }],
},
];
},
async redirects() {
return [
// Dashboard routes
{
source: "/dashboard/skills",
destination: "/dashboard/omni-skills",
permanent: true,
},
// Architecture
{
source: "/docs/architecture",
destination: "/docs/architecture/architecture",
permanent: true,
},
{
source: "/docs/authz-guide",
destination: "/docs/architecture/authz-guide",
permanent: true,
},
{
source: "/docs/codebase-documentation",
destination: "/docs/architecture/codebase-documentation",
permanent: true,
},
{
source: "/docs/repository-map",
destination: "/docs/architecture/repository-map",
permanent: true,
},
{
source: "/docs/resilience-guide",
destination: "/docs/architecture/resilience-guide",
permanent: true,
},
// Guides
{ source: "/docs/docker-guide", destination: "/docs/guides/docker-guide", permanent: true },
{
source: "/docs/electron-guide",
destination: "/docs/guides/electron-guide",
permanent: true,
},
{ source: "/docs/features", destination: "/docs/guides/features", permanent: true },
{ source: "/docs/i18n", destination: "/docs/guides/i18n", permanent: true },
{ source: "/docs/kiro-setup", destination: "/docs/guides/kiro-setup", permanent: true },
{ source: "/docs/pwa-guide", destination: "/docs/guides/pwa-guide", permanent: true },
{ source: "/docs/setup-guide", destination: "/docs/guides/setup-guide", permanent: true },
{ source: "/docs/termux-guide", destination: "/docs/guides/termux-guide", permanent: true },
{
source: "/docs/troubleshooting",
destination: "/docs/guides/troubleshooting",
permanent: true,
},
{ source: "/docs/uninstall", destination: "/docs/guides/uninstall", permanent: true },
{ source: "/docs/user-guide", destination: "/docs/guides/user-guide", permanent: true },
// Reference
{
source: "/docs/api-reference",
destination: "/docs/reference/api-reference",
permanent: true,
},
{ source: "/docs/cli-tools", destination: "/docs/reference/cli-tools", permanent: true },
{ source: "/docs/environment", destination: "/docs/reference/environment", permanent: true },
{ source: "/docs/free-tiers", destination: "/docs/reference/free-tiers", permanent: true },
{
source: "/docs/provider-reference",
destination: "/docs/reference/provider-reference",
permanent: true,
},
// Frameworks
{ source: "/docs/a2a-server", destination: "/docs/frameworks/a2a-server", permanent: true },
{
source: "/docs/agent-protocols-guide",
destination: "/docs/frameworks/agent-protocols-guide",
permanent: true,
},
{ source: "/docs/cloud-agent", destination: "/docs/frameworks/cloud-agent", permanent: true },
{ source: "/docs/evals", destination: "/docs/frameworks/evals", permanent: true },
{
source: "/docs/gamification",
destination: "/docs/frameworks/gamification",
permanent: true,
},
{ source: "/docs/mcp-server", destination: "/docs/frameworks/mcp-server", permanent: true },
{ source: "/docs/memory", destination: "/docs/frameworks/memory", permanent: true },
{ source: "/docs/opencode", destination: "/docs/frameworks/opencode", permanent: true },
{ source: "/docs/skills", destination: "/docs/frameworks/skills", permanent: true },
{ source: "/docs/webhooks", destination: "/docs/frameworks/webhooks", permanent: true },
// Routing
{ source: "/docs/auto-combo", destination: "/docs/routing/auto-combo", permanent: true },
{
source: "/docs/reasoning-replay",
destination: "/docs/routing/reasoning-replay",
permanent: true,
},
// Security
{ source: "/docs/cli-token", destination: "/docs/security/cli-token", permanent: true },
{
source: "/docs/cli-token-auth",
destination: "/docs/security/cli-token-auth",
permanent: true,
},
{ source: "/docs/compliance", destination: "/docs/security/compliance", permanent: true },
{
source: "/docs/error-sanitization",
destination: "/docs/security/error-sanitization",
permanent: true,
},
{ source: "/docs/guardrails", destination: "/docs/security/guardrails", permanent: true },
{ source: "/docs/public-creds", destination: "/docs/security/public-creds", permanent: true },
{
source: "/docs/route-guard-tiers",
destination: "/docs/security/route-guard-tiers",
permanent: true,
},
{
source: "/docs/stealth-guide",
destination: "/docs/security/stealth-guide",
permanent: true,
},
// Compression
{
source: "/docs/compression-engines",
destination: "/docs/compression/compression-engines",
permanent: true,
},
{
source: "/docs/compression-guide",
destination: "/docs/compression/compression-guide",
permanent: true,
},
{
source: "/docs/compression-language-packs",
destination: "/docs/compression/compression-language-packs",
permanent: true,
},
{
source: "/docs/compression-rules-format",
destination: "/docs/compression/compression-rules-format",
permanent: true,
},
{
source: "/docs/rtk-compression",
destination: "/docs/compression/rtk-compression",
permanent: true,
},
// Ops
{ source: "/docs/coverage-plan", destination: "/docs/ops/coverage-plan", permanent: true },
{
source: "/docs/e2e-dashboard-shakedown-v3.8.0",
destination: "/docs/ops/e2e-dashboard-shakedown-v3.8.0",
permanent: true,
},
{
source: "/docs/fly-io-deployment-guide",
destination: "/docs/ops/fly-io-deployment-guide",
permanent: true,
},
{ source: "/docs/proxy-guide", destination: "/docs/ops/proxy-guide", permanent: true },
{
source: "/docs/release-checklist",
destination: "/docs/ops/release-checklist",
permanent: true,
},
{ source: "/docs/sqlite-runtime", destination: "/docs/ops/sqlite-runtime", permanent: true },
{ source: "/docs/tunnels-guide", destination: "/docs/ops/tunnels-guide", permanent: true },
{
source: "/docs/vm-deployment-guide",
destination: "/docs/ops/vm-deployment-guide",
permanent: true,
},
// CLI Pages — Plano 14 (F9)
{ source: "/dashboard/cli-tools", destination: "/dashboard/cli-code", permanent: true },
{
source: "/dashboard/cli-tools/:path*",
destination: "/dashboard/cli-code/:path*",
permanent: true,
},
{ source: "/dashboard/agents", destination: "/dashboard/acp-agents", permanent: true },
{
source: "/dashboard/agents/:path*",
destination: "/dashboard/acp-agents/:path*",
permanent: true,
},
];
},
async rewrites() {
return [
{
source: "/chat/completions",
destination: "/api/v1/chat/completions",
},
{
source: "/responses",
destination: "/api/v1/responses",
},
{
source: "/responses/:path*",
destination: "/api/v1/responses/:path*",
},
{
source: "/models",
destination: "/api/v1/models",
},
{
source: "/v1/v1/:path*",
destination: "/api/v1/:path*",
},
{
source: "/v1/v1",
destination: "/api/v1",
},
{
source: "/codex/:path*",
destination: "/api/v1/responses",
},
{
source: "/v1/:path*",
destination: "/api/v1/:path*",
},
{
source: "/v1",
destination: "/api/v1",
},
{
source: "/v1beta/:path*",
destination: "/api/v1beta/:path*",
},
{
source: "/v1beta",
destination: "/api/v1beta",
},
];
},
};
const withMDX = createMDX();
export default withMDX(withNextIntl(nextConfig));