Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions hindsight-control-plane/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,28 @@ const distDir = process.env.PORT && process.env.PORT !== '9999'
? `.next-${process.env.PORT}`
: '.next';

// Maximum upload/request body size for file retain. Next.js buffers request
// bodies that pass through middleware/proxy (the auth middleware does, for
// /api/files/retain) and truncates anything over this limit (default 10MB),
// which silently corrupts large document uploads. Default to 100MB to match the
// dataplane's HINDSIGHT_API_FILE_CONVERSION_MAX_BATCH_SIZE_MB default; accepts a
// human-readable size string ('100mb', '1gb') or a number of bytes.
type SizeLimit = NonNullable<NonNullable<NextConfig['experimental']>['proxyClientMaxBodySize']>;
const maxUploadEnv = process.env.HINDSIGHT_CP_MAX_UPLOAD_SIZE;
const maxUploadBodySize: SizeLimit = maxUploadEnv
? (/^\d+$/.test(maxUploadEnv) ? Number(maxUploadEnv) : (maxUploadEnv as SizeLimit))
: '100mb';

const nextConfig: NextConfig = {
output: 'standalone',
distDir,
basePath: basePath,
assetPrefix: basePath,
// Disable request logging in production
logging: false,
experimental: {
proxyClientMaxBodySize: maxUploadBodySize,
},
// Set the monorepo root explicitly to avoid detecting wrong lockfiles in parent directories
turbopack: {
root: path.resolve(__dirname, '..'),
Expand Down
1 change: 1 addition & 0 deletions hindsight-docs/docs/developer/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,7 @@ The Control Plane is the web UI for managing memory banks.
| `HINDSIGHT_CP_DATAPLANE_API_URL` | URL of the API service | `http://localhost:8888` |
| `HINDSIGHT_CP_DATAPLANE_API_KEY` | Bearer token the Control Plane sends as `Authorization: Bearer <key>` on every request to the API service. Required when the API service is auth-protected; omit for a public API. | *(none — no `Authorization` header sent)* |
| `HINDSIGHT_CP_ACCESS_KEY` | Access key to protect the Control Plane UI. When set, users must enter this key to log in. | *(none — auth disabled)* |
| `HINDSIGHT_CP_MAX_UPLOAD_SIZE` | Maximum size of a single file-upload request the Control Plane accepts before truncating it. Accepts a size string (`100mb`, `1gb`) or a number of bytes. Raise this to upload files larger than the default, and keep it in line with the API's `HINDSIGHT_API_FILE_CONVERSION_MAX_BATCH_SIZE_MB`. | `100mb` |
| `NEXT_PUBLIC_BASE_PATH` | Base path for Control Plane UI when behind reverse proxy (e.g., `/hindsight`) | `""` (root) |

```bash
Expand Down
Loading