Adds a desktop-only browser preview that lives in the right panel slot alongside plan/diff. Lets the user point an Electron <webview> at any URL — typed into a chrome-style URL bar, clicked from the empty-state list of detected localhost dev servers, or auto-opened by a project script with `previewUrl` set. Single-tab per thread. Server (Effect/Layers): - PreviewManager: per-(thread, tab) session metadata via SynchronizedRef + PubSub<PreviewEvent>; survives WS reconnect via `list`/replay. - PreviewPortScanner: lsof on macOS/Linux, TCP probe fallback on Windows; reference-counted polling so we only scan when subscribed. - WS RPC + streams (`preview.open|navigate|refresh|close|list|reportStatus`, `subscribePreviewEvents`, `subscribeDiscoveredLocalServers`). Desktop: - PreviewViewManager owns Chromium WebContents per tab, mediates navigation/zoom/devtools/clear-storage. registerWebview gates by webContents.getType() === "webview" and host-window match. - IPC channels for create/close/register/navigate/back/forward/refresh/ zoom/hardReload/openDevTools/clearCookies/clearCache/getBrowserPartition. - Forwards app-level shortcuts (mod+shift+J, mod+K, mod+,, mod+W) from the webview back to the main window. - Persisted browser session partition (cookies, cache). Web: - PreviewPanel/PreviewView/PreviewWebview render the surface; chrome row with back/forward/refresh + URL input + Open-in-browser + 3-dot menu (Hard reload, DevTools, Zoom −/+/reset, Clear cookies/cache). - usePreviewSession subscribes to server events; usePreviewBridge mirrors desktop state into the store and forwards Loading→Success/ LoadFailed back to the server. - previewStateStore: per-thread snapshot + desktopOverlay + recently- seen URLs (Zustand). - rightPanelStore arbitrates plan vs. preview vs. diff; ChatView's toggles strip the `?diff=1` URL hint when switching to preview and vice versa so the panels are mutually exclusive. - Top-nav Globe toggle in ChatHeader (desktop builds only) and a `mod+shift+J` keybinding routed via a typed previewActionBus. - PreviewEmptyState lists detected localhost servers (scanner + configured project URLs + recently-seen) with live "listening" pulse. - PreviewUnreachable: theme-aware port of Chromium's "site can't be reached" page. - Resizable inline panel (RightPanelResizeHandle + useResizableWidth); width persists to localStorage on drag-end. - Terminal link "Open in preview" context-menu integration for loopback URLs. Contracts: - preview.ts schemas (PreviewSessionSnapshot, PreviewNavStatus, PreviewEvent, RPC inputs/results, DiscoveredLocalServer). - ProjectScript schema gains optional `previewUrl` + `autoOpenPreview`. - New keybinding commands: preview.toggle/refresh/focusUrl/zoomIn/Out/ resetZoom; new `when:` contexts `previewFocus` / `previewOpen`. Shared: - @t3tools/shared/preview: normalizePreviewUrl, isPreviewableUrl, isLoopbackHost, newPreviewTabId, LSOF_LOCAL_HOST_TOKENS. Tests: - contracts: schema decode tests for all preview events/snapshots/inputs. - shared: URL normalization coverage. - server: PreviewManager (open/navigate/reportStatus/refresh/close, multi-subscriber isolation, idempotency); PortScanner (lsof parsing including IPv6, TCP probe, reference-counted polling). - web: previewStateStore (per-tab event application, dedupe, reconnect recovery); rightPanelStore arbitration.
178 lines
4.4 KiB
JSON
178 lines
4.4 KiB
JSON
{
|
|
"name": "@t3tools/shared",
|
|
"private": true,
|
|
"type": "module",
|
|
"exports": {
|
|
"./model": {
|
|
"types": "./src/model.ts",
|
|
"import": "./src/model.ts"
|
|
},
|
|
"./advertisedEndpoint": {
|
|
"types": "./src/advertisedEndpoint.ts",
|
|
"import": "./src/advertisedEndpoint.ts"
|
|
},
|
|
"./agentAwareness": {
|
|
"types": "./src/agentAwareness.ts",
|
|
"import": "./src/agentAwareness.ts"
|
|
},
|
|
"./git": {
|
|
"types": "./src/git.ts",
|
|
"import": "./src/git.ts"
|
|
},
|
|
"./sourceControl": {
|
|
"types": "./src/sourceControl.ts",
|
|
"import": "./src/sourceControl.ts"
|
|
},
|
|
"./logging": {
|
|
"types": "./src/logging.ts",
|
|
"import": "./src/logging.ts"
|
|
},
|
|
"./observability": {
|
|
"types": "./src/observability.ts",
|
|
"import": "./src/observability.ts"
|
|
},
|
|
"./httpObservability": {
|
|
"types": "./src/httpObservability.ts",
|
|
"import": "./src/httpObservability.ts"
|
|
},
|
|
"./shell": {
|
|
"types": "./src/shell.ts",
|
|
"import": "./src/shell.ts"
|
|
},
|
|
"./semver": {
|
|
"types": "./src/semver.ts",
|
|
"import": "./src/semver.ts"
|
|
},
|
|
"./Net": {
|
|
"types": "./src/Net.ts",
|
|
"import": "./src/Net.ts"
|
|
},
|
|
"./DrainableWorker": {
|
|
"types": "./src/DrainableWorker.ts",
|
|
"import": "./src/DrainableWorker.ts"
|
|
},
|
|
"./KeyedCoalescingWorker": {
|
|
"types": "./src/KeyedCoalescingWorker.ts",
|
|
"import": "./src/KeyedCoalescingWorker.ts"
|
|
},
|
|
"./schemaJson": {
|
|
"types": "./src/schemaJson.ts",
|
|
"import": "./src/schemaJson.ts"
|
|
},
|
|
"./schemaYaml": {
|
|
"types": "./src/schemaYaml.ts",
|
|
"import": "./src/schemaYaml.ts"
|
|
},
|
|
"./toolActivity": {
|
|
"types": "./src/toolActivity.ts",
|
|
"import": "./src/toolActivity.ts"
|
|
},
|
|
"./Struct": {
|
|
"types": "./src/Struct.ts",
|
|
"import": "./src/Struct.ts"
|
|
},
|
|
"./serverSettings": {
|
|
"types": "./src/serverSettings.ts",
|
|
"import": "./src/serverSettings.ts"
|
|
},
|
|
"./String": {
|
|
"types": "./src/String.ts",
|
|
"import": "./src/String.ts"
|
|
},
|
|
"./projectScripts": {
|
|
"types": "./src/projectScripts.ts",
|
|
"import": "./src/projectScripts.ts"
|
|
},
|
|
"./orchestrationTiming": {
|
|
"types": "./src/orchestrationTiming.ts",
|
|
"import": "./src/orchestrationTiming.ts"
|
|
},
|
|
"./remote": {
|
|
"types": "./src/remote.ts",
|
|
"import": "./src/remote.ts"
|
|
},
|
|
"./relaySigning": {
|
|
"types": "./src/relaySigning.ts",
|
|
"import": "./src/relaySigning.ts"
|
|
},
|
|
"./dpop": {
|
|
"types": "./src/dpop.ts",
|
|
"import": "./src/dpop.ts"
|
|
},
|
|
"./dpopCommon": {
|
|
"types": "./src/dpopCommon.ts",
|
|
"import": "./src/dpopCommon.ts"
|
|
},
|
|
"./relayAuth": {
|
|
"types": "./src/relayAuth.ts",
|
|
"import": "./src/relayAuth.ts"
|
|
},
|
|
"./relayUrl": {
|
|
"types": "./src/relayUrl.ts",
|
|
"import": "./src/relayUrl.ts"
|
|
},
|
|
"./relayJwt": {
|
|
"types": "./src/relayJwt.ts",
|
|
"import": "./src/relayJwt.ts"
|
|
},
|
|
"./oauthScope": {
|
|
"types": "./src/oauthScope.ts",
|
|
"import": "./src/oauthScope.ts"
|
|
},
|
|
"./searchRanking": {
|
|
"types": "./src/searchRanking.ts",
|
|
"import": "./src/searchRanking.ts"
|
|
},
|
|
"./qrCode": {
|
|
"types": "./src/qrCode.ts",
|
|
"import": "./src/qrCode.ts"
|
|
},
|
|
"./cliArgs": {
|
|
"types": "./src/cliArgs.ts",
|
|
"import": "./src/cliArgs.ts"
|
|
},
|
|
"./path": {
|
|
"types": "./src/path.ts",
|
|
"import": "./src/path.ts"
|
|
},
|
|
"./keybindings": {
|
|
"types": "./src/keybindings.ts",
|
|
"import": "./src/keybindings.ts"
|
|
},
|
|
"./composerTrigger": {
|
|
"types": "./src/composerTrigger.ts",
|
|
"import": "./src/composerTrigger.ts"
|
|
},
|
|
"./terminalLabels": {
|
|
"types": "./src/terminalLabels.ts",
|
|
"import": "./src/terminalLabels.ts"
|
|
},
|
|
"./relayClient": {
|
|
"types": "./src/relayClient.ts",
|
|
"import": "./src/relayClient.ts"
|
|
},
|
|
"./preview": {
|
|
"types": "./src/preview.ts",
|
|
"import": "./src/preview.ts"
|
|
}
|
|
},
|
|
"scripts": {
|
|
"typecheck": "tsgo --noEmit",
|
|
"test": "vp test run"
|
|
},
|
|
"dependencies": {
|
|
"@noble/curves": "catalog:",
|
|
"@noble/hashes": "catalog:",
|
|
"@t3tools/contracts": "workspace:*",
|
|
"effect": "catalog:",
|
|
"jose": "catalog:",
|
|
"yaml": "catalog:"
|
|
},
|
|
"devDependencies": {
|
|
"@effect/platform-node": "catalog:",
|
|
"@effect/vitest": "catalog:",
|
|
"@types/node": "catalog:",
|
|
"vite-plus": "catalog:"
|
|
}
|
|
}
|