@venturewild/workspace 0.6.9 → 0.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venturewild/workspace",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "description": "Claude Code Web — Replit/Lovable-style chat-first browser UI that wraps the AI agent already installed on your machine.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -3047,19 +3047,35 @@ export async function createServer(overrides = {}) {
3047
3047
  });
3048
3048
 
3049
3049
  // --- frontend bundle (built by `npm run build:web`) ---
3050
+ // Cache strategy so an AUTO-UPDATED server's new UI is picked up WITHOUT a hard
3051
+ // refresh (the whole point of "seamless like OneDrive"): the SPA shell
3052
+ // (index.html) must always be revalidated — `no-cache` — so the browser never
3053
+ // keeps loading a stale bundle reference after the server updates. Vite's
3054
+ // /assets/* files are CONTENT-HASHED (a new build = a new filename), so they're
3055
+ // safe to cache forever (`immutable`). Without this, index.html had NO cache
3056
+ // headers and browsers heuristically cached it, stranding users on the old UI.
3050
3057
  if (existsSync(config.webDir)) {
3051
3058
  app.use(
3052
3059
  '/*',
3053
3060
  serveStatic({
3054
3061
  root: path.relative(process.cwd(), config.webDir),
3062
+ onFound: (filePath, c) => {
3063
+ // Separator-agnostic (Windows serves backslash paths to onFound).
3064
+ if (/[\\/]assets[\\/]/.test(filePath)) {
3065
+ c.header('Cache-Control', 'public, max-age=31536000, immutable');
3066
+ } else {
3067
+ // index.html + any other top-level shell file → always revalidate.
3068
+ c.header('Cache-Control', 'no-cache');
3069
+ }
3070
+ },
3055
3071
  }),
3056
3072
  );
3057
- // SPA fallback
3073
+ // SPA fallback (client-side routes) — same no-cache shell rule.
3058
3074
  app.notFound((c) => {
3059
3075
  const indexHtmlPath = path.join(config.webDir, 'index.html');
3060
3076
  if (existsSync(indexHtmlPath)) {
3061
3077
  return new Response(readFileSync(indexHtmlPath), {
3062
- headers: { 'content-type': 'text/html' },
3078
+ headers: { 'content-type': 'text/html', 'cache-control': 'no-cache' },
3063
3079
  });
3064
3080
  }
3065
3081
  return c.text('wild-workspace: frontend not built; run `npm run build`', 200);