Skip to content

Commit de4b9aa

Browse files
committed
feat(debug): add debug server launcher script for Windows
1 parent bb9a058 commit de4b9aa

3 files changed

Lines changed: 144 additions & 6 deletions

File tree

scripts/build-sidecar.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ const binDir = resolve(root, 'src-tauri', 'bin')
2121
const targets = {
2222
'bun-darwin-arm64': 'youclaw-server-aarch64-apple-darwin',
2323
'bun-darwin-x64': 'youclaw-server-x86_64-apple-darwin',
24-
'bun-linux-x64': 'youclaw-server-x86_64-unknown-linux-gnu',
25-
'bun-windows-x64': 'youclaw-server-x86_64-pc-windows-msvc.exe',
24+
'bun-linux-x64-baseline': 'youclaw-server-x86_64-unknown-linux-gnu',
25+
'bun-windows-x64-baseline': 'youclaw-server-x86_64-pc-windows-msvc.exe',
2626
}
2727

2828
// Detect current platform target
2929
function getCurrentTarget() {
3030
const arch = process.arch === 'arm64' ? 'arm64' : 'x64'
3131
const os = process.platform === 'win32' ? 'windows' : process.platform
32-
return `bun-${os}-${arch}`
32+
const key = `bun-${os}-${arch}`
33+
// Prefer baseline variant for broader CPU compatibility (no AVX requirement)
34+
const baselineKey = `${key}-baseline`
35+
if (targets[baselineKey]) return baselineKey
36+
return key
3337
}
3438

3539
// Generate build-constants.ts from env vars, compiled into sidecar

scripts/debug-server.bat

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
@echo off
2+
chcp 65001 >nul 2>&1
3+
title YouClaw Server Debug
4+
5+
echo ============================================
6+
echo YouClaw Server Debug Launcher
7+
echo ============================================
8+
echo.
9+
10+
:: ---- System Info ----
11+
echo [System Info]
12+
echo OS:
13+
ver
14+
echo Architecture: %PROCESSOR_ARCHITECTURE%
15+
echo Username: %USERNAME%
16+
echo.
17+
18+
:: ---- Check VC++ Runtime ----
19+
echo [VC++ Runtime Check]
20+
if exist "%SystemRoot%\System32\vcruntime140.dll" (
21+
echo vcruntime140.dll: OK
22+
) else (
23+
echo vcruntime140.dll: MISSING !!!
24+
)
25+
if exist "%SystemRoot%\System32\msvcp140.dll" (
26+
echo msvcp140.dll: OK
27+
) else (
28+
echo msvcp140.dll: MISSING !!!
29+
)
30+
echo.
31+
32+
:: ---- Locate server exe ----
33+
set "SERVER_EXE="
34+
35+
:: Support drag-and-drop: user drags youclaw-server.exe onto this bat
36+
if not "%~1"=="" (
37+
if exist "%~1" (
38+
set "SERVER_EXE=%~1"
39+
goto :found
40+
)
41+
)
42+
43+
:: Same directory as this script
44+
if exist "%~dp0youclaw-server.exe" (
45+
set "SERVER_EXE=%~dp0youclaw-server.exe"
46+
goto :found
47+
)
48+
49+
:: Common install paths
50+
for %%D in (
51+
"%LOCALAPPDATA%\YouClaw"
52+
"%LOCALAPPDATA%\Programs\YouClaw"
53+
"%ProgramFiles%\YouClaw"
54+
) do (
55+
if exist "%%~D\youclaw-server.exe" (
56+
set "SERVER_EXE=%%~D\youclaw-server.exe"
57+
goto :found
58+
)
59+
)
60+
61+
:: Search all drives for YouClaw folder
62+
for %%X in (C D E F G) do (
63+
if exist "%%X:\YouClaw\youclaw-server.exe" (
64+
set "SERVER_EXE=%%X:\YouClaw\youclaw-server.exe"
65+
goto :found
66+
)
67+
)
68+
69+
echo [ERROR] youclaw-server.exe not found.
70+
echo.
71+
echo Usage:
72+
echo 1. Copy this script next to youclaw-server.exe, then double-click
73+
echo 2. Or drag youclaw-server.exe onto this script
74+
echo.
75+
goto :end
76+
77+
:found
78+
echo [Server Location]
79+
echo %SERVER_EXE%
80+
echo.
81+
82+
:: ---- Check exe architecture ----
83+
echo [Binary Check]
84+
if exist "%SERVER_EXE%" (
85+
for %%F in ("%SERVER_EXE%") do echo File size: %%~zF bytes
86+
)
87+
echo.
88+
89+
:: ---- Set environment variables ----
90+
set "PORT=62601"
91+
set "HOME=%USERPROFILE%"
92+
set "BUN_TMPDIR=%TEMP%"
93+
set "LOG_LEVEL=debug"
94+
95+
echo [Environment]
96+
echo PORT=%PORT%
97+
echo HOME=%HOME%
98+
echo USERPROFILE=%USERPROFILE%
99+
echo TEMP=%TEMP%
100+
echo BUN_TMPDIR=%BUN_TMPDIR%
101+
echo LOG_LEVEL=%LOG_LEVEL%
102+
echo.
103+
104+
echo ============================================
105+
echo Starting server... (errors will show below)
106+
echo ============================================
107+
echo.
108+
109+
"%SERVER_EXE%" 2>&1
110+
111+
echo.
112+
echo ============================================
113+
set "EXIT_CODE=%ERRORLEVEL%"
114+
echo Server exited with code: %EXIT_CODE%
115+
116+
:: Decode common Windows error codes
117+
if "%EXIT_CODE%"=="-1073741795" echo = 0xC000001D: Illegal Instruction (CPU not supported?)
118+
if "%EXIT_CODE%"=="-1073741795" echo Bun requires a CPU with AVX support. Check if your CPU supports AVX.
119+
if "%EXIT_CODE%"=="-1073741819" echo = 0xC0000005: Access Violation (memory error)
120+
if "%EXIT_CODE%"=="-1073741515" echo = 0xC0000135: DLL Not Found (missing vcruntime140.dll?)
121+
if "%EXIT_CODE%"=="-1073740791" echo = 0xC0000409: Stack Buffer Overrun
122+
if "%EXIT_CODE%"=="-1073740940" echo = 0xC0000374: Heap Corruption
123+
echo ============================================
124+
125+
:end
126+
echo.
127+
echo Press any key to close...
128+
pause >nul

web/src/components/ai-elements/link-safety-modal.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,23 @@ export const LinkSafetyModal = ({ url, onClose }: { url: string; onClose: () =>
1313

1414
return (
1515
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50" onClick={onClose}>
16-
<div className="bg-background rounded-lg shadow-lg p-6 max-w-md w-full mx-4" onClick={(e) => e.stopPropagation()}>
16+
<div className="bg-background text-foreground rounded-lg shadow-lg p-6 max-w-md w-full mx-4" onClick={(e) => e.stopPropagation()}>
1717
<div className="flex items-center justify-between mb-2">
1818
<h3 className="text-lg font-semibold">Open external link?</h3>
1919
<button onClick={onClose} className="text-muted-foreground hover:text-foreground"></button>
2020
</div>
2121
<p className="text-sm text-muted-foreground mb-3">You're about to visit an external website.</p>
22-
<div className="bg-muted rounded p-3 mb-4 break-all text-sm font-mono">{url}</div>
22+
<div className="bg-muted text-foreground rounded p-3 mb-4 break-all text-sm font-mono">{url}</div>
2323
<div className="flex gap-3 justify-end">
24+
<button
25+
onClick={onClose}
26+
className="inline-flex items-center gap-1.5 px-4 py-2 rounded border border-border text-foreground hover:bg-muted text-sm"
27+
>
28+
Cancel
29+
</button>
2430
<button
2531
onClick={handleCopy}
26-
className="inline-flex items-center gap-1.5 px-4 py-2 rounded border border-border hover:bg-muted text-sm"
32+
className="inline-flex items-center gap-1.5 px-4 py-2 rounded border border-border text-foreground hover:bg-muted text-sm"
2733
>
2834
{copied ? <CheckIcon className="size-4 text-green-500" /> : <CopyIcon className="size-4" />}
2935
{copied ? "Copied!" : "Copy link"}

0 commit comments

Comments
 (0)