Fix Codex screenshot sharp runtime

This commit is contained in:
Catfish-75 2026-05-29 11:04:32 +03:00
parent 7d48890e9b
commit 6324160dcc
5 changed files with 20 additions and 3 deletions

View File

@ -25,6 +25,7 @@ bun build "$SRC_DIR/server.ts" \
--external playwright \ --external playwright \
--external playwright-core \ --external playwright-core \
--external diff \ --external diff \
--external sharp \
--external "bun:sqlite" \ --external "bun:sqlite" \
--external "@ngrok/ngrok" --external "@ngrok/ngrok"

View File

@ -11,6 +11,7 @@
"marked": "^18.0.2", "marked": "^18.0.2",
"playwright": "^1.58.2", "playwright": "^1.58.2",
"puppeteer-core": "^24.40.0", "puppeteer-core": "^24.40.0",
"sharp": "^0.34.5",
"socks": "^2.8.8", "socks": "^2.8.8",
}, },
"devDependencies": { "devDependencies": {

View File

@ -49,6 +49,7 @@
"marked": "^18.0.2", "marked": "^18.0.2",
"playwright": "^1.58.2", "playwright": "^1.58.2",
"puppeteer-core": "^24.40.0", "puppeteer-core": "^24.40.0",
"sharp": "^0.34.5",
"socks": "^2.8.8" "socks": "^2.8.8"
}, },
"engines": { "engines": {

11
setup
View File

@ -687,11 +687,20 @@ link_browse_runtime_assets() {
fi fi
# server-node.mjs intentionally externalizes these runtime packages. # server-node.mjs intentionally externalizes these runtime packages.
for dep in playwright playwright-core diff; do # sharp is used by screenshot size-guard and needs its platform-specific
# native @img/* sidecars present in the copied Codex runtime root.
for dep in playwright playwright-core diff sharp semver detect-libc; do
if [ -d "$gstack_dir/node_modules/$dep" ]; then if [ -d "$gstack_dir/node_modules/$dep" ]; then
_link_or_copy "$gstack_dir/node_modules/$dep" "$runtime_root/node_modules/$dep" _link_or_copy "$gstack_dir/node_modules/$dep" "$runtime_root/node_modules/$dep"
fi fi
done done
if [ -d "$gstack_dir/node_modules/@img" ]; then
mkdir -p "$runtime_root/node_modules/@img"
for scoped_dep in "$gstack_dir/node_modules/@img"/*; do
[ -e "$scoped_dep" ] || continue
_link_or_copy "$scoped_dep" "$runtime_root/node_modules/@img/$(basename "$scoped_dep")"
done
fi
if [ -d "$gstack_dir/node_modules/@ngrok" ]; then if [ -d "$gstack_dir/node_modules/@ngrok" ]; then
mkdir -p "$runtime_root/node_modules/@ngrok" mkdir -p "$runtime_root/node_modules/@ngrok"
for scoped_dep in "$gstack_dir/node_modules/@ngrok"/*; do for scoped_dep in "$gstack_dir/node_modules/@ngrok"/*; do

View File

@ -2238,6 +2238,8 @@ describe('setup script validation', () => {
const root = dep.startsWith('@') ? dep.split('/')[0] : dep; const root = dep.startsWith('@') ? dep.split('/')[0] : dep;
expect(fnBody).toContain(root); expect(fnBody).toContain(root);
} }
expect(fnBody).toContain('sharp semver detect-libc');
expect(fnBody).toContain('node_modules/@img');
expect(setupContent).toContain('link_browse_runtime_assets "$gstack_dir" "$codex_gstack"'); expect(setupContent).toContain('link_browse_runtime_assets "$gstack_dir" "$codex_gstack"');
}); });
@ -2370,9 +2372,12 @@ describe('setup script validation', () => {
const fnStart = setupContent.indexOf('create_codex_runtime_root()'); const fnStart = setupContent.indexOf('create_codex_runtime_root()');
const fnEnd = setupContent.indexOf('}', setupContent.indexOf('done', setupContent.indexOf('review/', fnStart))); const fnEnd = setupContent.indexOf('}', setupContent.indexOf('done', setupContent.indexOf('review/', fnStart)));
const fnBody = setupContent.slice(fnStart, fnEnd); const fnBody = setupContent.slice(fnStart, fnEnd);
const runtimeStart = setupContent.indexOf('link_browse_runtime_assets()');
const runtimeEnd = setupContent.indexOf('# ─── Helper: create a minimal ~/.codex/skills/gstack runtime root', runtimeStart);
const runtimeBody = setupContent.slice(runtimeStart, runtimeEnd);
expect(fnBody).toContain('gstack/SKILL.md'); expect(fnBody).toContain('gstack/SKILL.md');
expect(fnBody).toContain('browse/dist'); expect(runtimeBody).toContain('browse/dist');
expect(fnBody).toContain('browse/bin'); expect(runtimeBody).toContain('browse/bin');
expect(fnBody).toContain('gstack-upgrade/SKILL.md'); expect(fnBody).toContain('gstack-upgrade/SKILL.md');
// Review runtime assets (individual files, not the whole dir) // Review runtime assets (individual files, not the whole dir)
expect(fnBody).toContain('checklist.md'); expect(fnBody).toContain('checklist.md');