feat(ai): optional local AI via the codex CLI (plan import + repaint) - #11
Merged
Conversation
…hotoreal repaint - dev-server middleware (scripts/ai-api.mjs): /api/ai/status + /understand + /render, all as codex exec child processes with a shared single-flight slot, process-group kill, client-disconnect abort and cancel endpoints; the script reads no credentials (codex auth stays codex-managed) - render asks codex for exactly one image_gen call and decodes the PNG from the session rollout (both v0.140/v0.144 record shapes), deleting the rollout afterwards; aspect is one of 1:1 / 3:2 / 2:3 - UI: AI render modal (prompt, presets, swipe compare, history in IndexedDB), Home-tab plan import with queue/cancel states, plan-image corner minimap - Demo degradation: on static hosts (no /api/ai/*) the modal + import row show a local-only notice instead of breaking - Framing fidelity: screenshots are flattened onto the paper color and the editor's -10% view bias is cleared while capturing, so renders align 1:1 - Tooling: npm run doctor (Node/codex/login/port preflight, --json), npm run scan:public + CI workflow (build + smoke + scan), INSTALL.md agent runbook, README one-sentence setup prompt (bilingual) - audit:ui gains S8-ai-modal + import-row queued-stub states (14 total) Verified locally: build + build:pages clean; smoke 205 OK; smoke:ui (default, open-ai, loading-veil, new-room) 0 errors; audit:ui clean; doctor ready; scan:public clean; live e2e — plan-synthetic.png imported as 5 rooms / 9 openings / 38 furniture with the minimap, AI render completed in 75.5 s with the layout locked; Pages-like static host serves the demo with the local-only badges and zero page errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The closing PR of the multi-room + AI series — both AI capabilities, unified on the local codex CLI (ChatGPT login; no API keys, nothing leaves the user's machine except the codex call itself):
scripts/ai-api.mjs(dev-server middleware, new):/api/ai/status·/understand(floor-plan recognition viacodex exec --output-schema, strict JSON, 180 s, ephemeral) ·/render(oneimage_gencall, PNG decoded from the session rollout — both v0.140/v0.144 record shapes — then rollout cleanup). Shared single-flight slot, process-group SIGKILL, client-disconnect abort, cancel endpoints. The script reads no credential files./api/ai/*) the AI entries show a local-only badge instead of failing — the Pages demo's 'no backend' promise stays true.--paperand the editor's view bias is cleared while capturing — renders align with the 3D view to within ~1%.npm run doctor(Node ≥ 20 · codex CLI ·codex login status;--json),npm run scan:public+ a CI workflow (build + smoke + scan on push/PR),INSTALL.mdagent runbook, README one-sentence setup prompt (EN + 中文), CHANGELOG started (0.2.0), version bump.Verification (local, branch
feat/codex-ai)npm run build+build:pagesclean;smoke205 OK;smoke:ui(default / open-ai / loading-veil / new-room) 0 console errors;audit:ui14 states × 2 viewports clean;doctorready;scan:publiccleanNote:
vite previewdoes not serve static assets under the configuredbase(vite preview quirk) — Pages itself serves the file tree correctly; verified with a plain static server.