Files
DeepSeek-Reasonix/desktop/frontend-next/vite.config.ts
T
yhh b18d8ef3aa feat(studio): storage relocation, composer intake, and the checkpoint agreement
Accumulated work from the branch, carried across the rebase onto origin/studio
and merged with what landed there in the meantime.

Storage: a workspace can name where its state lives, and the server tracks the
one relocation it may be running (internal/storage, config/storage_roots,
serve/storage, the Storage panel).

Composer intake: what a drop or a long paste becomes is one pure function —
payload in, action out — so "what happens if I drop a folder" is a test rather
than a branch of an onDrop handler. It sits on the drop router that landed
upstream: that one answers which pane a drop hit, this one answers what it
means and says so before the pointer is released. A paste long enough to bury
the composer becomes a chip beside it instead.

Session: the checkpoint agreement and the lineage/torn-log recovery cases,
plus the conflict diagnostic learning where two transcripts parted and which
roles stood there — a position and a role tell a local reshape from a foreign
write without recording any content.

Model refs: the default-model write checks the live catalog, so an extension
model the runtime knows can be persisted as the default.
2026-08-19 23:52:04 -07:00

58 lines
2.4 KiB
TypeScript

import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
interface ProxyEvents {
on(event: "proxyReq", cb: (req: { setHeader(k: string, v: string): void }) => void): void;
}
// Prefixes: vite matches a proxy key against the head of the path, so "/mcp"
// also carries /mcp/reconnect. A route missing here answers with the SPA shell
// instead of JSON, which is indistinguishable from a broken endpoint.
const ROUTES = [
// The hub's own surface, plus /rt — every pane's requests carry that prefix,
// so without it a second session's traffic answers with the SPA shell.
"/runtimes", "/tree", "/rt",
"/appearance",
"/events", "/history", "/status", "/submit", "/cancel", "/approve", "/answer",
"/plan", "/goal", "/resume", "/models", "/tool-approval-mode", "/preset",
"/model", "/effort", "/new", "/sessions", "/delete-session", "/provider-setup",
"/inbox", "/trajectory", "/mcp", "/skills", "/complete", "/workspace", "/capability-scope",
"/providers", "/roles", "/account", "/hooks", "/memory", "/network", "/shell", "/todos",
"/changes", "/attachments", "/drop", "/checkpoints", "/branches", "/compact", "/rewind",
"/extensions", "/themes", "/plugins", "/surfaces",
"/fork", "/summarize", "/forget", "/bypass", "/auto-approve-tools",
"/permissions", "/sandbox", "/context", "/storage",
"/slash", "/workspaces", "/welcome",
];
// REASONIX_SERVE points at a running `reasonix serve`; without it the app boots
// on MockPort so the UI can be developed with no Go process at all.
export default defineConfig(({ mode }) => {
const serve = loadEnv(mode, ".", "REASONIX").REASONIX_SERVE;
return {
base: "./",
plugins: [react()],
server: {
port: 5273,
// The dev server is cross-origin to serve, which its CSRF guard rejects.
// Rewriting Origin makes the hop look same-origin, matching production
// and the Wails shell where the UI really is served from the kernel.
proxy: serve
? Object.fromEntries(
ROUTES.map((r) => [
r,
{
target: serve,
changeOrigin: true,
configure: (proxy: unknown) => {
(proxy as ProxyEvents).on("proxyReq", (req) => req.setHeader("origin", serve));
},
},
]),
)
: undefined,
},
build: { outDir: "dist", emptyOutDir: true },
};
});