143
- Remove the local `planSidebarOpen` state (`:688`).
144
- Replace `setPlanSidebarOpen(true)` callsites with `rightPanelStore.open(activeThreadRef, "plan")`.
145
- Replace `closePlanSidebar` with `rightPanelStore.close(activeThreadRef)`.
146
-- Existing `planSidebarDismissedForTurnRef`/`planSidebarOpenOnNextThreadRef` logic stays local — it only governs whether to *call* `open()`/`close()` on turn change.
146
+- Existing `planSidebarDismissedForTurnRef`/`planSidebarOpenOnNextThreadRef` logic stays local — it only governs whether to _call_ `open()`/`close()` on turn change.
147
148
### Render arbitration
149
176
177
### NEW files
178
179
-| File | Purpose |
180
-|---|---|
181
-| `packages/contracts/src/preview.ts` | Effect/Schema schemas: inputs, snapshot, events, errors |
182
-| `packages/contracts/src/preview.test.ts` | Schema round‑trip tests |
183
-| `apps/server/src/preview/Services/Manager.ts` | `PreviewManager` Service tag + interface |
184
-| `apps/server/src/preview/Layers/Manager.ts` | Implementation: in‑memory map + event subject |
185
-| `apps/server/src/preview/Layers/Manager.test.ts` | Lifecycle, snapshot, event ordering |
186
-| `apps/desktop/src/preview-view-manager.ts` | Plain‑Node Electron port of ami's BrowserManager (subset) |
187
-| `apps/desktop/src/preview-preload.ts` | Webview preload (no‑op v1) |
188
-| `apps/web/src/previewStateStore.ts` | Per‑thread zustand store (mirrors `terminalStateStore.ts`) |
189
-| `apps/web/src/previewStateStore.test.ts` | Reducer tests |
190
-| `apps/web/src/rightPanelStore.ts` | Right‑panel arbiter |
191
-| `apps/web/src/rightPanelStore.test.ts` | Arbiter tests |
192
-| `apps/web/src/components/preview/PreviewPanel.tsx` | Right‑panel entry (wraps `PreviewPanelShell`) |
193
-| `apps/web/src/components/preview/PreviewPanelShell.tsx` | Shell mirroring `DiffPanelShell` (`mode: "inline"\|"sheet"\|"sidebar"`) |
194
-| `apps/web/src/components/preview/PreviewView.tsx` | Chrome bar (URL/back/fwd/refresh) + `<PreviewWebview>` |
195
-| `apps/web/src/components/preview/PreviewWebview.tsx` | Electron `<webview>` host; null on web build |
196
-| `apps/web/src/components/preview/PreviewEmptyState.tsx` | Pre‑URL empty state |
197
-| `apps/web/src/components/preview/PreviewUnsupportedToast.ts` | `"Preview is only available in the desktop app"` toast |
179
+| File | Purpose |
180
+| ------------------------------------------------------------ | ----------------------------------------------------------------------- |
181
+| `packages/contracts/src/preview.ts` | Effect/Schema schemas: inputs, snapshot, events, errors |
182
+| `packages/contracts/src/preview.test.ts` | Schema round‑trip tests |
183
+| `apps/server/src/preview/Services/Manager.ts` | `PreviewManager` Service tag + interface |
184
+| `apps/server/src/preview/Layers/Manager.ts` | Implementation: in‑memory map + event subject |
185
+| `apps/server/src/preview/Layers/Manager.test.ts` | Lifecycle, snapshot, event ordering |
186
+| `apps/desktop/src/preview-view-manager.ts` | Plain‑Node Electron port of ami's BrowserManager (subset) |
187
+| `apps/desktop/src/preview-preload.ts` | Webview preload (no‑op v1) |
188
+| `apps/web/src/previewStateStore.ts` | Per‑thread zustand store (mirrors `terminalStateStore.ts`) |
189
+| `apps/web/src/previewStateStore.test.ts` | Reducer tests |
190
+| `apps/web/src/rightPanelStore.ts` | Right‑panel arbiter |
191
+| `apps/web/src/rightPanelStore.test.ts` | Arbiter tests |
192
+| `apps/web/src/components/preview/PreviewPanel.tsx` | Right‑panel entry (wraps `PreviewPanelShell`) |
193
+| `apps/web/src/components/preview/PreviewPanelShell.tsx` | Shell mirroring `DiffPanelShell` (`mode: "inline"\|"sheet"\|"sidebar"`) |
194
+| `apps/web/src/components/preview/PreviewView.tsx` | Chrome bar (URL/back/fwd/refresh) + `<PreviewWebview>` |
195
+| `apps/web/src/components/preview/PreviewWebview.tsx` | Electron `<webview>` host; null on web build |
196
+| `apps/web/src/components/preview/PreviewEmptyState.tsx` | Pre‑URL empty state |
197
+| `apps/web/src/components/preview/PreviewUnsupportedToast.ts` | `"Preview is only available in the desktop app"` toast |
198
199
### MODIFIED files
200
201
-| File | Change |
202
-|---|---|
203
-| `packages/contracts/src/keybindings.ts` | Add `preview.toggle`, `preview.refresh`, `preview.focusUrl` to `STATIC_KEYBINDING_COMMANDS`; add `previewFocus`, `previewOpen` to context keys |
204
-| `packages/contracts/src/project.ts` | Add `previewUrl?: string` and `autoOpenPreview?: boolean` to `ProjectScript` schema |
205
-| `packages/contracts/src/server.ts` | Extend `EnvironmentApi` with `preview` namespace |
206
-| `packages/contracts/src/index.ts` | Re‑export new types |
207
-| `apps/server/src/keybindings.ts` | Add defaults: `mod+shift+j` → `preview.toggle`, `mod+shift+r` → `preview.refresh` (when `previewFocus`) |
208
-| `apps/server/src/ws.ts` | Route `preview.open`, `preview.navigate`, `preview.refresh`, `preview.close`, `preview.list`, `preview.onEvent` |
209
-| `apps/server/src/orchestration/runtimeLayer.ts` (or equivalent) | Provide `PreviewManager.Default` |
210
-| `apps/web/src/environmentApi.ts` | Wire `preview` slot in `createEnvironmentApi` |
211
-| `apps/web/src/keybindings.ts` | Add `isPreviewToggleShortcut`, `isPreviewRefreshShortcut` helpers |
212
-| `apps/web/src/routes/_chat.tsx` | Handle `preview.toggle` in global shortcut handler |
213
-| `apps/web/src/components/ChatView.tsx` | Replace local `planSidebarOpen` with `rightPanelStore`; render `PreviewPanel` |
214
-| `apps/web/src/components/ThreadTerminalDrawer.tsx` | At terminal link activation, when `match.kind === "url"` and link looks like a dev URL, show context menu with "Open in preview" / "Open in browser"; pass through to `localApi.preview.openTab(...)` when chosen |
215
-| `apps/web/src/components/ProjectScriptsControl.tsx` | Add `previewUrl` + `autoOpenPreview` form fields in the Add/Edit dialog |
216
-| `apps/web/src/projectScripts.ts` | Carry the new fields through `commandForProjectScript` / serialization |
217
-| `apps/web/src/types.ts` | Add `PreviewSession` mirror types (or re‑export from contracts) |
218
-| `apps/web/src/lib/desktopBridge.d.ts` (or wherever bridge types live) | Add `preview` namespace shape |
219
-| `apps/desktop/src/main.ts` | Register `preview:*` IPC handlers; instantiate `previewViewManager`; wire `mainWindow` injection |
220
-| `apps/desktop/src/preload.ts` | Expose `desktopBridge.preview.*` |
221
-| `KEYBINDINGS.md` | Document new commands and `previewFocus`/`previewOpen` `when` keys |
201
+| File | Change |
202
+| --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
203
+| `packages/contracts/src/keybindings.ts` | Add `preview.toggle`, `preview.refresh`, `preview.focusUrl` to `STATIC_KEYBINDING_COMMANDS`; add `previewFocus`, `previewOpen` to context keys |
204
+| `packages/contracts/src/project.ts` | Add `previewUrl?: string` and `autoOpenPreview?: boolean` to `ProjectScript` schema |
205
+| `packages/contracts/src/server.ts` | Extend `EnvironmentApi` with `preview` namespace |
206
+| `packages/contracts/src/index.ts` | Re‑export new types |
207
+| `apps/server/src/keybindings.ts` | Add defaults: `mod+shift+j` → `preview.toggle`, `mod+shift+r` → `preview.refresh` (when `previewFocus`) |
208
+| `apps/server/src/ws.ts` | Route `preview.open`, `preview.navigate`, `preview.refresh`, `preview.close`, `preview.list`, `preview.onEvent` |
209
+| `apps/server/src/orchestration/runtimeLayer.ts` (or equivalent) | Provide `PreviewManager.Default` |
210
+| `apps/web/src/environmentApi.ts` | Wire `preview` slot in `createEnvironmentApi` |
211
+| `apps/web/src/keybindings.ts` | Add `isPreviewToggleShortcut`, `isPreviewRefreshShortcut` helpers |
212
+| `apps/web/src/routes/_chat.tsx` | Handle `preview.toggle` in global shortcut handler |
213
+| `apps/web/src/components/ChatView.tsx` | Replace local `planSidebarOpen` with `rightPanelStore`; render `PreviewPanel` |
214
+| `apps/web/src/components/ThreadTerminalDrawer.tsx` | At terminal link activation, when `match.kind === "url"` and link looks like a dev URL, show context menu with "Open in preview" / "Open in browser"; pass through to `localApi.preview.openTab(...)` when chosen |
215
+| `apps/web/src/components/ProjectScriptsControl.tsx` | Add `previewUrl` + `autoOpenPreview` form fields in the Add/Edit dialog |
216
+| `apps/web/src/projectScripts.ts` | Carry the new fields through `commandForProjectScript` / serialization |
217
+| `apps/web/src/types.ts` | Add `PreviewSession` mirror types (or re‑export from contracts) |
218
+| `apps/web/src/lib/desktopBridge.d.ts` (or wherever bridge types live) | Add `preview` namespace shape |
219
+| `apps/desktop/src/main.ts` | Register `preview:*` IPC handlers; instantiate `previewViewManager`; wire `mainWindow` injection |
220
+| `apps/desktop/src/preload.ts` | Expose `desktopBridge.preview.*` |
221
+| `KEYBINDINGS.md` | Document new commands and `previewFocus`/`previewOpen` `when` keys |
222
223
### NOT changed
224
335
}
336
}
337
338
-export const PreviewError = Schema.Union([
339
- PreviewSessionLookupError,
340
- PreviewInvalidUrlError,
341
-]);
338
+export const PreviewError = Schema.Union([PreviewSessionLookupError, PreviewInvalidUrlError]);
339
export type PreviewError = typeof PreviewError.Type;
340
```
341
357
"terminal.new",
358
"terminal.close",
359
"diff.toggle",
363
- "preview.toggle", // NEW
364
- "preview.refresh", // NEW
365
- "preview.focusUrl", // NEW
360
+ "preview.toggle", // NEW
361
+ "preview.refresh", // NEW
362
+ "preview.focusUrl", // NEW
363
"commandPalette.toggle",
364
"chat.new",
365
"chat.newLocal",
396
} from "@t3tools/contracts";
397
398
export interface PreviewManagerShape {
402
- readonly open: (
403
- input: PreviewOpenInput,
404
- ) => Effect.Effect<PreviewSessionSnapshot, PreviewError>;
399
+ readonly open: (input: PreviewOpenInput) => Effect.Effect<PreviewSessionSnapshot, PreviewError>;
400
readonly navigate: (
401
input: PreviewNavigateInput,
402
) => Effect.Effect<PreviewSessionSnapshot, PreviewError>;
408
- readonly refresh: (
409
- input: PreviewRefreshInput,
410
- ) => Effect.Effect<void, PreviewError>;
403
+ readonly refresh: (input: PreviewRefreshInput) => Effect.Effect<void, PreviewError>;
404
readonly close: (input: PreviewCloseInput) => Effect.Effect<void, PreviewError>;
412
- readonly list: (
413
- threadId: string,
414
- ) => Effect.Effect<ReadonlyArray<PreviewSessionSnapshot>>;
405
+ readonly list: (threadId: string) => Effect.Effect<ReadonlyArray<PreviewSessionSnapshot>>;
406
readonly subscribe: (
407
listener: (event: PreviewEvent) => Effect.Effect<void>,
408
) => Effect.Effect<() => void>;
409
}
410
420
-export class PreviewManager extends Context.Service<
421
- PreviewManager,
422
- PreviewManagerShape
423
->()("t3/preview/Services/Manager/PreviewManager") {}
411
+export class PreviewManager extends Context.Service<PreviewManager, PreviewManagerShape>()(
412
+ "t3/preview/Services/Manager/PreviewManager",
413
+) {}
414
```
415
416
### `apps/server/src/preview/Layers/Manager.ts`
425
const trimmed = input.trim();
426
if (!trimmed) throw new Error("empty");
427
// localhost stays http unless explicitly https
438
- const useHttp =
439
- /^(localhost|127\.0\.0\.1|0\.0\.0\.0)(:|\/|$)/.test(trimmed);
428
+ const useHttp = /^(localhost|127\.0\.0\.1|0\.0\.0\.0)(:|\/|$)/.test(trimmed);
429
const parsed = urlParseLax(trimmed, { https: !useHttp });
430
if (!parsed?.href) throw new Error("unparseable");
431
return parsed.href;
432
}).pipe(
444
- Effect.catchAll((cause) =>
445
- Effect.fail(new PreviewInvalidUrlError({ rawUrl: input, cause })),
446
- ),
433
+ Effect.catchAll((cause) => Effect.fail(new PreviewInvalidUrlError({ rawUrl: input, cause }))),
434
);
435
```
436
500
this.mainWindow = window;
501
}
502
516
- getPreloadPath(): string { return this.preloadPath; }
517
- getBrowserPartition(): string { return PREVIEW_PARTITION; }
503
+ getPreloadPath(): string {
504
+ return this.preloadPath;
505
+ }
506
+ getBrowserPartition(): string {
507
+ return PREVIEW_PARTITION;
508
+ }
509
510
getBrowserSession(): Session {
511
if (this.browserSession) return this.browserSession;
512
const sess = session.fromPartition(PREVIEW_PARTITION);
513
// strip electron/t3code from UA so dev preview doesn't trip bot detection
523
- const ua = sess.getUserAgent()
514
+ const ua = sess
515
+ .getUserAgent()
516
.replace(/Electron\/[\d.]+ /, "")
517
.replace(/\s*t3code\/[\d.]+/, "");
518
sess.setUserAgent(ua);
585
await wc.loadURL(url);
586
}
587
596
- goBack(tabId: string): void { this.requireWebContents(tabId).navigationHistory.goBack(); }
597
- goForward(tabId: string): void { this.requireWebContents(tabId).navigationHistory.goForward(); }
598
- refresh(tabId: string): void { this.requireWebContents(tabId).reload(); }
588
+ goBack(tabId: string): void {
589
+ this.requireWebContents(tabId).navigationHistory.goBack();
590
+ }
591
+ goForward(tabId: string): void {
592
+ this.requireWebContents(tabId).navigationHistory.goForward();
593
+ }
594
+ refresh(tabId: string): void {
595
+ this.requireWebContents(tabId).reload();
596
+ }
597
598
onStateChange(listener: Listener): () => void {
599
this.listeners.add(listener);
654
if (input.type !== "keyDown") return false;
655
// Mirror the t3code keybinding defaults that should always reach the main window.
656
const SHORTCUTS = [
659
- { key: "j", meta: true, shift: true }, // preview.toggle
660
- { key: "k", meta: true, shift: false }, // commandPalette.toggle
661
- { key: ",", meta: true, shift: false }, // settings
662
- { key: "w", meta: true, shift: false }, // close
657
+ { key: "j", meta: true, shift: true }, // preview.toggle
658
+ { key: "k", meta: true, shift: false }, // commandPalette.toggle
659
+ { key: ",", meta: true, shift: false }, // settings
660
+ { key: "w", meta: true, shift: false }, // close
661
// future: terminal.* if user wants them while preview focused
662
];
665
- return SHORTCUTS.some((s) =>
666
- s.key.toLowerCase() === input.key.toLowerCase()
667
- && s.meta === input.meta
668
- && s.shift === input.shift,
663
+ return SHORTCUTS.some(
664
+ (s) =>
665
+ s.key.toLowerCase() === input.key.toLowerCase() &&
666
+ s.meta === input.meta &&
667
+ s.shift === input.shift,
668
);
669
}
670
703
const trimmed = input.trim();
704
if (!trimmed) throw new PreviewInvalidUrlError(input);
705
const useHttp = /^(localhost|127\.0\.0\.1|0\.0\.0\.0)(:|\/|$)/.test(trimmed);
707
- const parsed = new URL(trimmed.includes("://")
708
- ? trimmed
709
- : `${useHttp ? "http" : "https"}://${trimmed}`);
706
+ const parsed = new URL(
707
+ trimmed.includes("://") ? trimmed : `${useHttp ? "http" : "https"}://${trimmed}`,
708
+ );
709
return parsed.href;
710
}
711
}
715
super(`Preview tab not found: ${tabId}`);
716
}
717
}
719
-export class PreviewWebContentsNotFoundError extends Error { /* … */ }
720
-export class PreviewWebviewNotInitializedError extends Error { /* … */ }
721
-export class PreviewInvalidUrlError extends Error { /* … */ }
718
+export class PreviewWebContentsNotFoundError extends Error {
719
+ /* … */
720
+}
721
+export class PreviewWebviewNotInitializedError extends Error {
722
+ /* … */
723
+}
724
+export class PreviewInvalidUrlError extends Error {
725
+ /* … */
726
+}
727
728
export const previewViewManager = new PreviewViewManager();
729
```
739
Register IPC handlers (in `registerIpcHandlers()`):
740
741
```ts
737
-ipcMain.handle("preview:createTab", (_e, tabId: string) =>
738
- previewViewManager.createTab(tabId));
739
-ipcMain.handle("preview:closeTab", (_e, tabId: string) =>
740
- previewViewManager.closeTab(tabId));
742
+ipcMain.handle("preview:createTab", (_e, tabId: string) => previewViewManager.createTab(tabId));
743
+ipcMain.handle("preview:closeTab", (_e, tabId: string) => previewViewManager.closeTab(tabId));
744
ipcMain.handle("preview:setVisibility", (_e, tabId: string, visible: boolean) =>
742
- previewViewManager.setVisibility(tabId, visible));
745
+ previewViewManager.setVisibility(tabId, visible),
746
+);
747
ipcMain.handle("preview:registerWebview", (_e, tabId: string, wcId: number) =>
744
- previewViewManager.registerWebview(tabId, wcId));
748
+ previewViewManager.registerWebview(tabId, wcId),
749
+);
750
ipcMain.handle("preview:unregisterWebview", (_e, tabId: string) =>
746
- previewViewManager.unregisterWebview(tabId));
751
+ previewViewManager.unregisterWebview(tabId),
752
+);
753
ipcMain.handle("preview:navigate", (_e, tabId: string, url: string) =>
748
- previewViewManager.navigate(tabId, url));
754
+ previewViewManager.navigate(tabId, url),
755
+);
756
ipcMain.handle("preview:goBack", (_e, tabId: string) => previewViewManager.goBack(tabId));
757
ipcMain.handle("preview:goForward", (_e, tabId: string) => previewViewManager.goForward(tabId));
758
ipcMain.handle("preview:refresh", (_e, tabId: string) => previewViewManager.refresh(tabId));
783
ipcRenderer.invoke("preview:setVisibility", tabId, visible),
784
registerWebview: (tabId: string, wcId: number) =>
785
ipcRenderer.invoke("preview:registerWebview", tabId, wcId),
779
- unregisterWebview: (tabId: string) =>
780
- ipcRenderer.invoke("preview:unregisterWebview", tabId),
781
- navigate: (tabId: string, url: string) =>
782
- ipcRenderer.invoke("preview:navigate", tabId, url),
786
+ unregisterWebview: (tabId: string) => ipcRenderer.invoke("preview:unregisterWebview", tabId),
787
+ navigate: (tabId: string, url: string) => ipcRenderer.invoke("preview:navigate", tabId, url),
788
goBack: (tabId: string) => ipcRenderer.invoke("preview:goBack", tabId),
789
goForward: (tabId: string) => ipcRenderer.invoke("preview:goForward", tabId),
790
refresh: (tabId: string) => ipcRenderer.invoke("preview:refresh", tabId),
791
getPreloadPath: (): Promise<string> => ipcRenderer.invoke("preview:getPreloadPath"),
787
- getBrowserPartition: (): Promise<string> =>
788
- ipcRenderer.invoke("preview:getBrowserPartition"),
792
+ getBrowserPartition: (): Promise<string> => ipcRenderer.invoke("preview:getBrowserPartition"),
793
onStateChange: (cb: (tabId: string, state: DesktopPreviewTabState) => void) => {
794
const listener = (_e: unknown, tabId: string, state: DesktopPreviewTabState) =>
795
cb(tabId, state);
1100
1101
Following t3code's vitest patterns (`bun run test`, never `bun test`):
1102
1099
-| Test file | What it covers |
1100
-|---|---|
1101
-| `packages/contracts/src/preview.test.ts` | Schema encode/decode round-trips for inputs, snapshot, events; URL trimming; error tagged unions |
1102
-| `apps/server/src/preview/Layers/Manager.test.ts` | `open` creates session and emits `opened`; `navigate` updates and emits `navigated`; `close` removes and emits `closed`; subscribers receive monotonic events; `list` returns sorted snapshots |
1103
-| `apps/web/src/previewStateStore.test.ts` | `applyServerEvent` reducer correctness; ring buffer cap; `closed` removes entry; `desktopOverlay` is independent of snapshot fields |
1104
-| `apps/web/src/rightPanelStore.test.ts` | `open` / `close` / `toggle` semantics; per-thread isolation; `?diff=1` sync compatibility |
1105
-| `apps/web/src/components/preview/PreviewView.test.ts` (logic-only via `PreviewView.logic.ts` extraction) | URL bar input → navigation; navigation button enabled-state derivation; visibility toggle on panel hide |
1106
-| Existing `ThreadTerminalDrawer.test.ts` | Add a case: link activation with `kind: "url"` and `previewable: true` shows the context menu (mock `localApi.contextMenu.show`) |
1103
+| Test file | What it covers |
1104
+| -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1105
+| `packages/contracts/src/preview.test.ts` | Schema encode/decode round-trips for inputs, snapshot, events; URL trimming; error tagged unions |
1106
+| `apps/server/src/preview/Layers/Manager.test.ts` | `open` creates session and emits `opened`; `navigate` updates and emits `navigated`; `close` removes and emits `closed`; subscribers receive monotonic events; `list` returns sorted snapshots |
1107
+| `apps/web/src/previewStateStore.test.ts` | `applyServerEvent` reducer correctness; ring buffer cap; `closed` removes entry; `desktopOverlay` is independent of snapshot fields |
1108
+| `apps/web/src/rightPanelStore.test.ts` | `open` / `close` / `toggle` semantics; per-thread isolation; `?diff=1` sync compatibility |
1109
+| `apps/web/src/components/preview/PreviewView.test.ts` (logic-only via `PreviewView.logic.ts` extraction) | URL bar input → navigation; navigation button enabled-state derivation; visibility toggle on panel hide |
1110
+| Existing `ThreadTerminalDrawer.test.ts` | Add a case: link activation with `kind: "url"` and `previewable: true` shows the context menu (mock `localApi.contextMenu.show`) |
1111
1112
Manual smoke checklist (drop in `apps/desktop/test/smoke/`):
1113
1124
1125
## 12. Risks and resolutions
1126
1123
-| Risk | Resolution |
1124
-|---|---|
1125
-| Hidden `<webview>` GPU cost when keeping multiple threads' previews mounted | v1 only mounts the active thread's preview. v2 can adopt the `PersistentThreadTerminalDrawer` pattern + `setVisibility` |
1126
-| `<webview>` keyboard capture eats `mod+shift+j` etc. | `before-input-event` forwarder in `PreviewViewManager` (mirror of ami's pattern, smaller shortcut list) |
1127
-| URL with `X-Frame-Options: DENY` works fine in `<webview>` (good — that's why we picked `<webview>` over iframe) | n/a |
1128
-| Server restart while desktop is alive: `<webview>` is still loaded but server has no record | On WS reconnect, web side sends a `preview.list(threadId)` and if empty, sends a `preview.open(...)` to re‑register the current URL. Add a small `useReconciliation` effect in `PreviewView.tsx` |
1129
-| Renderer process renders something into `<webview>` but never registered → orphaned tab in `PreviewViewManager` | `closeTab` is idempotent; on `<webview>` unmount, `unregisterWebview` is called; if that didn't fire (crash), the next `createTab` for the same `tabId` reuses the record |
1130
-| `autoOpenPreview` racing with terminal output (URL might not be in stdout yet by the time the script "starts") | Two‑phase: if `script.previewUrl` is set, open eagerly with that URL. If not set but `autoOpenPreview === true`, watch terminal output via existing `terminal-links` extraction and open the first `previewable` URL within a 60s window |
1131
-| Multiple windows of the desktop both rendering the same `<webview>` for the same thread | `<webview>` is per‑renderer; each window creates its own. The shared `persist:t3code-preview` partition keeps cookies in sync. Server records the last navigation URL but doesn't enforce single‑renderer |
1127
+| Risk | Resolution |
1128
+| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1129
+| Hidden `<webview>` GPU cost when keeping multiple threads' previews mounted | v1 only mounts the active thread's preview. v2 can adopt the `PersistentThreadTerminalDrawer` pattern + `setVisibility` |
1130
+| `<webview>` keyboard capture eats `mod+shift+j` etc. | `before-input-event` forwarder in `PreviewViewManager` (mirror of ami's pattern, smaller shortcut list) |
1131
+| URL with `X-Frame-Options: DENY` works fine in `<webview>` (good — that's why we picked `<webview>` over iframe) | n/a |
1132
+| Server restart while desktop is alive: `<webview>` is still loaded but server has no record | On WS reconnect, web side sends a `preview.list(threadId)` and if empty, sends a `preview.open(...)` to re‑register the current URL. Add a small `useReconciliation` effect in `PreviewView.tsx` |
1133
+| Renderer process renders something into `<webview>` but never registered → orphaned tab in `PreviewViewManager` | `closeTab` is idempotent; on `<webview>` unmount, `unregisterWebview` is called; if that didn't fire (crash), the next `createTab` for the same `tabId` reuses the record |
1134
+| `autoOpenPreview` racing with terminal output (URL might not be in stdout yet by the time the script "starts") | Two‑phase: if `script.previewUrl` is set, open eagerly with that URL. If not set but `autoOpenPreview === true`, watch terminal output via existing `terminal-links` extraction and open the first `previewable` URL within a 60s window |
1135
+| Multiple windows of the desktop both rendering the same `<webview>` for the same thread | `<webview>` is per‑renderer; each window creates its own. The shared `persist:t3code-preview` partition keeps cookies in sync. Server records the last navigation URL but doesn't enforce single‑renderer |
1136
1137
---
1138
1159
1160
Every visible element below is built on existing components. No new design primitives are introduced. References below are to the `apps/web/src/components/ui/` directory.
1161
1158
-| Need | Primitive | File ref | Notes |
1159
-|---|---|---|---|
1160
-| Theme colors / radii | CSS vars `--background`, `--card`, `--muted`, `--muted-foreground`, `--border`, `--input`, `--ring`, `--success`, etc. | `apps/web/src/index.css:86` | Light + `@variant dark` blocks. Always reference vars via tailwind utilities (`bg-card`, `text-muted-foreground`) — never hard‑code hex |
1161
-| `cn` class merger | `cn(...inputs)` from `~/lib/utils` | `apps/web/src/lib/utils.ts:8` | Wraps `cx` + `tailwind-merge` |
1162
-| Buttons (chrome bar back/fwd/refresh) | `Button` `variant="ghost"` `size="icon-xs"` | `apps/web/src/components/ui/button.tsx` | `icon-xs` is `size-7 rounded-md sm:size-6` — exactly the density in the screenshot |
1163
-| Buttons (URL field submit) | `Button` `variant="outline"` `size="sm"` | same | Matches the "ProjectScript primary action" density already in `BranchToolbar` |
1164
-| Button group (back / fwd / refresh as a unit) | `Group` + implicit segmenting (no `GroupSeparator`) | `apps/web/src/components/ui/group.tsx` | Group automatically removes outer borders between adjacent `[data-slot]` children |
1165
-| URL input (chrome bar editable) | `InputGroup` + `InputGroupInput` + `InputGroupAddon align="inline-start"` (globe icon) | `apps/web/src/components/ui/input-group.tsx` | Click‑anywhere‑to‑focus already wired in `InputGroupAddon`'s `onMouseDown` |
1166
-| URL input (chrome bar disabled / read‑only) | Same `InputGroup` with `disabled` on the input | same | Yields the muted look in the screenshot via `has-[input:disabled]:opacity-64` |
1167
-| Tab strip cells | Plain `<button>` + `cn` — **not** `Tabs` (base‑ui Tabs is over‑featured for browser tabs); `Group` semantics differ | new file `PreviewTabStrip.tsx` | Same hover/active treatment as the sidebar's `ChatPreview` rows |
1168
-| "Local" recommendation card | `Card` (no `CardHeader`/`CardPanel` — flat) | `apps/web/src/components/ui/card.tsx` | `Card` already gives `rounded-2xl border bg-card text-card-foreground shadow-xs/5` plus the inset stroke via `before:` |
1169
-| Status pulse dot (running) | `<span>` with `bg-success` and `animate-pulse` | tailwind built‑in | Theme‑aware via `--success` |
1170
-| Tooltips (back/fwd/refresh hover) | `Tooltip` + `TooltipTrigger` + `TooltipPopup` | `apps/web/src/components/ui/tooltip.tsx` | Sub‑200ms hover already configured |
1171
-| Empty state title + description | `Empty`, `EmptyHeader`, `EmptyTitle`, `EmptyDescription`, `EmptyContent`, `EmptyMedia` | `apps/web/src/components/ui/empty.tsx` | `EmptyMedia variant="icon"` gives the stacked‑cards icon with side rotation we want for "no preview yet" |
1172
-| Loading bar (top of webview while navigating) | Plain `<div>` with `bg-primary` + `transition-all` | n/a | Mirrors ami's loading bar (`browser-view.tsx:434`) — single‑pixel‑height div animating `width` |
1173
-| Spinner (inline in URL field while loading) | `Spinner` | `apps/web/src/components/ui/spinner.tsx` | Wraps `Loader2Icon` from lucide |
1174
-| Context menu (terminal link "Open in preview") | `localApi.contextMenu.show(...)` (already exists) | `apps/web/src/localApi.ts:58` | Native menu on desktop, fallback in `contextMenuFallback.ts` on web |
1175
-| Keybinding shortcut label in tooltips | `shortcutLabelForCommand(keybindings, "preview.toggle")` | `apps/web/src/keybindings.ts` | Renders `⌘⇧J` etc. |
1176
-| Right‑panel shell sizing | Match `DiffPanelShell` exactly: `w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border` | `apps/web/src/components/DiffPanelShell.tsx:32` | Single class string, do not reinvent |
1162
+| Need | Primitive | File ref | Notes |
1163
+| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
1164
+| Theme colors / radii | CSS vars `--background`, `--card`, `--muted`, `--muted-foreground`, `--border`, `--input`, `--ring`, `--success`, etc. | `apps/web/src/index.css:86` | Light + `@variant dark` blocks. Always reference vars via tailwind utilities (`bg-card`, `text-muted-foreground`) — never hard‑code hex |
1165
+| `cn` class merger | `cn(...inputs)` from `~/lib/utils` | `apps/web/src/lib/utils.ts:8` | Wraps `cx` + `tailwind-merge` |
1166
+| Buttons (chrome bar back/fwd/refresh) | `Button` `variant="ghost"` `size="icon-xs"` | `apps/web/src/components/ui/button.tsx` | `icon-xs` is `size-7 rounded-md sm:size-6` — exactly the density in the screenshot |
1167
+| Buttons (URL field submit) | `Button` `variant="outline"` `size="sm"` | same | Matches the "ProjectScript primary action" density already in `BranchToolbar` |
1168
+| Button group (back / fwd / refresh as a unit) | `Group` + implicit segmenting (no `GroupSeparator`) | `apps/web/src/components/ui/group.tsx` | Group automatically removes outer borders between adjacent `[data-slot]` children |
1169
+| URL input (chrome bar editable) | `InputGroup` + `InputGroupInput` + `InputGroupAddon align="inline-start"` (globe icon) | `apps/web/src/components/ui/input-group.tsx` | Click‑anywhere‑to‑focus already wired in `InputGroupAddon`'s `onMouseDown` |
1170
+| URL input (chrome bar disabled / read‑only) | Same `InputGroup` with `disabled` on the input | same | Yields the muted look in the screenshot via `has-[input:disabled]:opacity-64` |
1171
+| Tab strip cells | Plain `<button>` + `cn` — **not** `Tabs` (base‑ui Tabs is over‑featured for browser tabs); `Group` semantics differ | new file `PreviewTabStrip.tsx` | Same hover/active treatment as the sidebar's `ChatPreview` rows |
1172
+| "Local" recommendation card | `Card` (no `CardHeader`/`CardPanel` — flat) | `apps/web/src/components/ui/card.tsx` | `Card` already gives `rounded-2xl border bg-card text-card-foreground shadow-xs/5` plus the inset stroke via `before:` |
1173
+| Status pulse dot (running) | `<span>` with `bg-success` and `animate-pulse` | tailwind built‑in | Theme‑aware via `--success` |
1174
+| Tooltips (back/fwd/refresh hover) | `Tooltip` + `TooltipTrigger` + `TooltipPopup` | `apps/web/src/components/ui/tooltip.tsx` | Sub‑200ms hover already configured |
1175
+| Empty state title + description | `Empty`, `EmptyHeader`, `EmptyTitle`, `EmptyDescription`, `EmptyContent`, `EmptyMedia` | `apps/web/src/components/ui/empty.tsx` | `EmptyMedia variant="icon"` gives the stacked‑cards icon with side rotation we want for "no preview yet" |
1176
+| Loading bar (top of webview while navigating) | Plain `<div>` with `bg-primary` + `transition-all` | n/a | Mirrors ami's loading bar (`browser-view.tsx:434`) — single‑pixel‑height div animating `width` |
1177
+| Spinner (inline in URL field while loading) | `Spinner` | `apps/web/src/components/ui/spinner.tsx` | Wraps `Loader2Icon` from lucide |
1178
+| Context menu (terminal link "Open in preview") | `localApi.contextMenu.show(...)` (already exists) | `apps/web/src/localApi.ts:58` | Native menu on desktop, fallback in `contextMenuFallback.ts` on web |
1179
+| Keybinding shortcut label in tooltips | `shortcutLabelForCommand(keybindings, "preview.toggle")` | `apps/web/src/keybindings.ts` | Renders `⌘⇧J` etc. |
1180
+| Right‑panel shell sizing | Match `DiffPanelShell` exactly: `w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border` | `apps/web/src/components/DiffPanelShell.tsx:32` | Single class string, do not reinvent |
1181
1182
**Icons.** Use `lucide-react` everywhere (already in `package.json`). The exact icons we need:
1183
1184
```ts
1185
import {
1182
- ArrowLeft, ArrowRight, // back / forward
1183
- RotateCw, Loader2, // refresh / spinning
1184
- Globe, // favicon fallback
1185
- X, // close tab
1186
- Plus, // new tab
1187
- Copy, ExternalLink, // open in browser, copy URL
1188
- Sidebar, Columns2, // right‑side toggles in tab strip (matches screenshot 2)
1189
- PanelRightOpen, PanelRightClose, // alt for above
1186
+ ArrowLeft,
1187
+ ArrowRight, // back / forward
1188
+ RotateCw,
1189
+ Loader2, // refresh / spinning
1190
+ Globe, // favicon fallback
1191
+ X, // close tab
1192
+ Plus, // new tab
1193
+ Copy,
1194
+ ExternalLink, // open in browser, copy URL
1195
+ Sidebar,
1196
+ Columns2, // right‑side toggles in tab strip (matches screenshot 2)
1197
+ PanelRightOpen,
1198
+ PanelRightClose, // alt for above
1199
} from "lucide-react";
1200
```
1201
1209
1210
Three states render inside `PreviewView.tsx` based on the `PreviewSession` for the active thread:
1211
1203
-| Session state | Component rendered |
1204
-|---|---|
1205
-| no tab open | `<PreviewEmptyState />` — disabled chrome row + "Local" recommendations |
1206
-| tab loading / loaded | `<PreviewWebview />` + chrome row + tab strip |
1207
-| tab navigation failed | `<PreviewUnreachable />` overlay above the webview |
1212
+| Session state | Component rendered |
1213
+| --------------------- | ----------------------------------------------------------------------- |
1214
+| no tab open | `<PreviewEmptyState />` — disabled chrome row + "Local" recommendations |
1215
+| tab loading / loaded | `<PreviewWebview />` + chrome row + tab strip |
1216
+| tab navigation failed | `<PreviewUnreachable />` overlay above the webview |
1217
1218
### 15.1 Empty state (`PreviewEmptyState.tsx`) — matches screenshot 1
1219
1268
return (
1269
<div className="flex h-full min-h-0 flex-col">
1270
<div className="px-6 pt-10 pb-4">
1262
- <h2 className="text-xs font-medium uppercase tracking-wide text-muted-foreground">
1263
- Local
1264
- </h2>
1271
+ <h2 className="text-xs font-medium uppercase tracking-wide text-muted-foreground">Local</h2>
1272
</div>
1273
1274
{servers.length === 0 ? (
1315
{server.processName ?? `${server.host}:${server.port}`}
1316
</span>
1317
</div>
1311
- <span
1312
- className="size-2 shrink-0 rounded-full bg-success"
1313
- aria-label="Listening"
1314
- >
1318
+ <span className="size-2 shrink-0 rounded-full bg-success" aria-label="Listening">
1319
<span className="block size-2 rounded-full bg-success animate-ping opacity-60" />
1320
</span>
1321
</Card>
1366
onForward={NOOP}
1367
onRefresh={NOOP}
1368
onSubmitUrl={(url) => api.preview.open({ threadId, url })}
1365
- inputDisabled={false} // we still want to allow paste-to-open
1366
- buttonsDisabled // back/fwd/refresh are visually disabled
1369
+ inputDisabled={false} // we still want to allow paste-to-open
1370
+ buttonsDisabled // back/fwd/refresh are visually disabled
1371
/>
1372
```
1373
1572
1573
Color mapping (Chromium → t3code theme):
1574
1571
-| Chromium | Tailwind/t3code |
1572
-|---|---|
1573
-| `--background-color: #fff` / `--google-gray-900` (dark) | `bg-background` |
1574
-| `--text-color: --google-gray-700` / `--google-gray-500` (dark) | `text-muted-foreground` |
1575
-| `--heading-color: --google-gray-900` / `--google-gray-500` (dark) | `text-foreground` |
1576
-| `--error-code-color: --google-gray-700` / `--google-gray-500` (dark) | `text-muted-foreground/70` |
1577
-| `--quiet-background-color: rgb(247,247,247)` / `--background` (dark) | `bg-muted/40` |
1578
-| `--primary-button-fill-color: --google-blue-600` / `--google-blue-300` (dark) | `bg-primary text-primary-foreground` (theme primary is `oklch(0.488 0.217 264)` light / `oklch(0.588 0.217 264)` dark — a very close blue) |
1579
-| `--secondary-button-*` | `Button variant="outline"` |
1580
-| `--link-color: rgb(88,88,88)` / `--google-blue-300` (dark) | `text-primary underline-offset-4 hover:underline` |
1581
-| Body font `system-ui, sans-serif; font-size: 75%` | We keep DM Sans (already in `apps/web/src/index.css:148`) and `text-sm` — the Chromium font tweak just compensates for their `html { font-size: 125% }` — we don't replicate that |
1575
+| Chromium | Tailwind/t3code |
1576
+| ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1577
+| `--background-color: #fff` / `--google-gray-900` (dark) | `bg-background` |
1578
+| `--text-color: --google-gray-700` / `--google-gray-500` (dark) | `text-muted-foreground` |
1579
+| `--heading-color: --google-gray-900` / `--google-gray-500` (dark) | `text-foreground` |
1580
+| `--error-code-color: --google-gray-700` / `--google-gray-500` (dark) | `text-muted-foreground/70` |
1581
+| `--quiet-background-color: rgb(247,247,247)` / `--background` (dark) | `bg-muted/40` |
1582
+| `--primary-button-fill-color: --google-blue-600` / `--google-blue-300` (dark) | `bg-primary text-primary-foreground` (theme primary is `oklch(0.488 0.217 264)` light / `oklch(0.588 0.217 264)` dark — a very close blue) |
1583
+| `--secondary-button-*` | `Button variant="outline"` |
1584
+| `--link-color: rgb(88,88,88)` / `--google-blue-300` (dark) | `text-primary underline-offset-4 hover:underline` |
1585
+| Body font `system-ui, sans-serif; font-size: 75%` | We keep DM Sans (already in `apps/web/src/index.css:148`) and `text-sm` — the Chromium font tweak just compensates for their `html { font-size: 125% }` — we don't replicate that |
1586
1587
Skeleton:
1588
1596
1597
interface Props {
1598
url: string;
1595
- errorCode: string; // e.g. "ERR_NAME_NOT_RESOLVED", "ERR_CONNECTION_REFUSED"
1599
+ errorCode: string; // e.g. "ERR_NAME_NOT_RESOLVED", "ERR_CONNECTION_REFUSED"
1600
description: string;
1601
onReload: () => void;
1602
}
1605
// Replace with an inline SVG that matches the Chromium "icon-generic"
1606
// (a stylized broken page). For v1 a Lucide MapPinOff is a fine stand-in —
1607
// we want a visual that reads "destination unreachable".
1604
- <svg viewBox="0 0 64 64" className="size-10 text-muted-foreground/70" fill="none" stroke="currentColor" strokeWidth="2.5">
1608
+ <svg
1609
+ viewBox="0 0 64 64"
1610
+ className="size-10 text-muted-foreground/70"
1611
+ fill="none"
1612
+ stroke="currentColor"
1613
+ strokeWidth="2.5"
1614
+ >
1615
<path d="M16 12 L48 12 L48 52 L16 52 Z" />
1616
<path d="M22 22 L42 22 M22 30 L36 30 M22 38 L40 38" strokeLinecap="round" />
1617
<path d="M52 8 L12 56" strokeLinecap="round" />
1636
{/* Summary — uses dangerouslySetInnerHTML only for the bold host treatment */}
1637
<p className="text-sm leading-relaxed text-muted-foreground">
1638
<strong className="font-semibold text-foreground">{host}</strong>
1629
- ’s server <abbr title="Domain Name System" className="cursor-help underline decoration-dotted underline-offset-2">DNS address</abbr>{" "}
1639
+ ’s server{" "}
1640
+ <abbr
1641
+ title="Domain Name System"
1642
+ className="cursor-help underline decoration-dotted underline-offset-2"
1643
+ >
1644
+ DNS address
1645
+ </abbr>{" "}
1646
could not be found.
1647
</p>
1648
1684
}
1685
1686
function safeHost(url: string): string | null {
1671
- try { return new URL(url).host; } catch { return null; }
1687
+ try {
1688
+ return new URL(url).host;
1689
+ } catch {
1690
+ return null;
1691
+ }
1692
}
1693
```
1694
1695
The component intentionally:
1696
+
1697
- Uses theme tokens only — looks correct in light + dark with no extra wiring.
1698
- Drops Chromium's "Diagnose connection" / "Portal sign-in" buttons (irrelevant in our shell).
1699
- Drops the dinosaur game (RIP).
1704
A 1.5px primary-colored bar that fills as the page loads, anchored to the bottom of the chrome row. Direct port of ami's pattern (`browser-view.tsx:434`):
1705
1706
```tsx
1686
-{loadProgress > 0 && (
1687
- <div
1688
- className="pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 rounded-full bg-primary transition-all duration-150 ease-out"
1689
- style={{
1690
- width: `${loadProgress}%`,
1691
- boxShadow: "0 0 6px 1px var(--ring)",
1692
- }}
1693
- />
1694
-)}
1707
+{
1708
+ loadProgress > 0 && (
1709
+ <div
1710
+ className="pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 rounded-full bg-primary transition-all duration-150 ease-out"
1711
+ style={{
1712
+ width: `${loadProgress}%`,
1713
+ boxShadow: "0 0 6px 1px var(--ring)",
1714
+ }}
1715
+ />
1716
+ );
1717
+}
1718
```
1719
1720
Progress is computed locally with `useLoadingProgress(isLoading)` — same hook signature as ami's, ~30 lines.
1731
import { Context, Effect } from "effect";
1732
1733
export interface DiscoveredLocalServer {
1711
- host: string; // "localhost"
1712
- port: number; // 5175
1713
- url: string; // "http://localhost:5175"
1734
+ host: string; // "localhost"
1735
+ port: number; // 5175
1736
+ url: string; // "http://localhost:5175"
1737
processName: string | null; // "node", "vite", "next-server"
1738
pid: number | null;
1739
}
1763
2. **Fallback — TCP connect probe**: iterate a curated list of common dev ports `[3000, 3001, 3333, 4173, 4200, 4321, 5000, 5173, 5174, 5175, 5500, 8000, 8080, 8081, 8888, 9000]` against `127.0.0.1`, mark any that accepts a connection. Used on Windows and as the safety net if `lsof` is missing.
1764
1765
Polling cadence:
1766
+
1767
- When `retain()` count is 0 → not polling.
1768
- When ≥1 → poll every 3s. Diff against last result; only emit `subscribe` callbacks when the set differs.
1769
- `retain()` returns a release fn that decrements the counter; goes idle automatically when the empty state is hidden.
1786
1787
Append these to the file list:
1788
1765
-| File | Purpose |
1766
-|---|---|
1767
-| `apps/server/src/preview/Services/PortScanner.ts` | Service tag + interface |
1768
-| `apps/server/src/preview/Layers/PortScanner.ts` | `lsof` strategy + TCP probe fallback + polling |
1769
-| `apps/server/src/preview/Layers/PortScanner.test.ts` | Parser tests for `lsof -F pcn` output |
1770
-| `apps/web/src/lib/favicon.ts` | `faviconUrlForOrigin(url, size)` helper |
1771
-| `apps/web/src/components/preview/PreviewTabStrip.tsx` | Tab strip (screenshot 2) |
1772
-| `apps/web/src/components/preview/TabFavicon.tsx` | Favicon `<img>` w/ `<Globe>` fallback |
1773
-| `apps/web/src/components/preview/BrowserMockup.tsx` | Tiny tailwind browser thumbnail icon |
1774
-| `apps/web/src/components/preview/PreviewLocalServerCard.tsx` | Card row for a discovered server |
1775
-| `apps/web/src/components/preview/PreviewUnreachable.tsx` | 404.html rewritten in tailwind |
1789
+| File | Purpose |
1790
+| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
1791
+| `apps/server/src/preview/Services/PortScanner.ts` | Service tag + interface |
1792
+| `apps/server/src/preview/Layers/PortScanner.ts` | `lsof` strategy + TCP probe fallback + polling |
1793
+| `apps/server/src/preview/Layers/PortScanner.test.ts` | Parser tests for `lsof -F pcn` output |
1794
+| `apps/web/src/lib/favicon.ts` | `faviconUrlForOrigin(url, size)` helper |
1795
+| `apps/web/src/components/preview/PreviewTabStrip.tsx` | Tab strip (screenshot 2) |
1796
+| `apps/web/src/components/preview/TabFavicon.tsx` | Favicon `<img>` w/ `<Globe>` fallback |
1797
+| `apps/web/src/components/preview/BrowserMockup.tsx` | Tiny tailwind browser thumbnail icon |
1798
+| `apps/web/src/components/preview/PreviewLocalServerCard.tsx` | Card row for a discovered server |
1799
+| `apps/web/src/components/preview/PreviewUnreachable.tsx` | 404.html rewritten in tailwind |
1800
| `apps/web/src/components/preview/useDiscoveredLocalServers.ts` | Hook subscribing to `EnvironmentApi.preview.subscribePorts` + merging in `recentUrlsFromTerminal` and `ProjectScript.previewUrl` |
1777
-| `apps/web/src/components/preview/useLoadingProgress.ts` | 30-line progress simulator (port of ami's) |
1778
-| `apps/web/src/components/preview/errorCodeMessages.ts` | `ERR_*` → human-readable description map |
1801
+| `apps/web/src/components/preview/useLoadingProgress.ts` | 30-line progress simulator (port of ami's) |
1802
+| `apps/web/src/components/preview/errorCodeMessages.ts` | `ERR_*` → human-readable description map |
1803
1804
Update the contract additions in §4 to add:
1805