Repository navigation
Expand file tree
/
Copy pathnext.config.js
More file actions
114 lines (110 loc) · 5.65 KB
/
Copy pathnext.config.js
File metadata and controls
114 lines (110 loc) · 5.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/** @type {import('next').NextConfig} */
// Single source of truth for displayed version strings. Each entry derives
// from its package's authoritative manifest so a version bump never requires
// hand-editing UI copy. NEVER hardcode versions in app/ — read from these.
// SDK install copy carries no version label on purpose: SDKs republish only on
// SDK source change, so the repo manifest version routinely runs ahead of what
// npm/PyPI actually serve (marketing-site truth audit, 2026-08-06).
const { buildSecurityHeaderRules } = require('./app/lib/next-config-headers.cjs');
const nextConfig = {
// `standalone` serves the Docker/self-host path. On Vercel it must be OFF:
// Next 16.3.x skips emitting next-server.js.nft.json when an adapter is in
// play (vercel/next.js#96646, fix only in 16.4 canaries), so a standalone
// build deterministically fails Vercel's onBuildComplete with ENOENT — every
// production deploy 31c407cb..6609ac35 died this way. Vercel doesn't use the
// standalone output anyway; drop the flag only there.
output: process.env.VERCEL ? undefined : 'standalone',
productionBrowserSourceMaps: false,
// Pin the workspace root: a stray package-lock.json one directory up
// (C:\Projects) otherwise makes Next infer the wrong root and warn on every
// dev/build run.
outputFileTracingRoot: __dirname,
env: {
// Platform version — surfaced in the Sidebar build stamp.
NEXT_PUBLIC_DASHCLAW_VERSION: require('./package.json').version,
// Plugin bundle manifest version — surfaced in /downloads bundle description.
NEXT_PUBLIC_PLUGIN_MANIFEST_VERSION: require('./plugins/dashclaw/.claude-plugin/plugin.json').version,
},
images: {
remotePatterns: [
{ protocol: 'https', hostname: 'avatars.githubusercontent.com' },
{ protocol: 'https', hostname: 'lh3.googleusercontent.com' },
{ protocol: 'https', hostname: 'api.dicebear.com' },
],
},
// Security headers — see app/lib/next-config-headers.cjs for the builder
// (extracted so vitest can test the real function instead of a copy).
// LAN self-host fix: TLS-conditional CSP + HSTS. Contributed by Lief (RyanTJoy).
async headers() {
return buildSecurityHeaderRules();
},
// API Rewrites for backward compatibility with older SDKs
async rewrites() {
return [
{ source: '/api/actions/:actionId/approve', destination: '/api/approvals/:actionId' },
{ source: '/api/actions/assumptions', destination: '/api/assumptions' },
{ source: '/api/actions/assumptions/:assumptionId', destination: '/api/assumptions/:assumptionId' },
{ source: '/api/actions/signals', destination: '/api/signals' },
// Standard OIDC-style discovery path for the instance's public signing key
// (used to re-verify integrity receipts + signed compliance bundles).
{ source: '/.well-known/jwks.json', destination: '/api/integrity/jwks' },
{ source: '/.well-known/oauth-authorization-server', destination: '/api/oauth/metadata/authorization-server' },
{ source: '/.well-known/oauth-protected-resource', destination: '/api/oauth/metadata/protected-resource' },
];
},
// Permanent redirects for retired surfaces.
// The legacy Python agent-toolkit (/toolkit) has been replaced by the MCP tools
// surface documented under /docs#mcp-tools (governed-agent MCP tools — handoffs,
// secret rotation, skill safety, open loops, learning, audit retrospection).
async redirects() {
return [
// The marketing project's default *.vercel.app alias predates the custom
// domain and is still Google-indexed under the retired "AI Agent
// Observability" title. robots.txt answers Disallow: / on non-marketing
// hosts, which BLOCKS recrawl, so that stale entry can never expire on
// its own. A permanent host-level redirect (it covers /robots.txt too,
// so the alias no longer has robots of its own) lets Google follow
// through, consolidate onto the canonical host, and drop the alias.
// Exact host match only: my-dashclaw.vercel.app and hosted.dashclaw.io
// are live instances and must never redirect.
{
source: '/:path*',
has: [{ type: 'host', value: 'dash-claw.vercel.app' }],
destination: 'https://www.dashclaw.io/:path*',
permanent: true,
},
{
source: '/toolkit',
destination: '/docs#mcp-tools',
permanent: true,
},
// The retired /labs/branch-finish operator page now points at the
// decisions ledger.
{ source: '/labs/branch-finish', destination: '/decisions', permanent: true },
// The standalone /calibration page was folded into /policies as the
// "Calibration" section (Short List B4/B6).
{ source: '/calibration', destination: '/policies#calibration', permanent: true },
];
},
// Incremental TypeScript migration: resolve `.js` import specifiers to
// converted `.ts`/`.tsx` files. tsc (bundler resolution) and vitest already
// do this; the webpack production build does not by default, so converting a
// module while its importers keep their `.js` specifiers would 404 the build.
// Tries TS first, then falls back to the real JS/JSX file (existing imports
// keep working). Turbopack (dev) prefers TS via resolveExtensions order.
turbopack: {
root: __dirname,
resolveExtensions: ['.ts', '.tsx', '.mts', '.js', '.jsx', '.mjs', '.cjs', '.json'],
},
webpack(config) {
config.resolve.extensionAlias = {
...(config.resolve.extensionAlias ?? {}),
'.js': ['.ts', '.tsx', '.js', '.jsx'],
'.jsx': ['.tsx', '.jsx'],
'.mjs': ['.mts', '.mjs'],
'.cjs': ['.cts', '.cjs'],
};
return config;
},
}
module.exports = nextConfig