Skip to content

feat(ai): optional local AI via the codex CLI (plan import + repaint) - #11

Merged
yuyou-dev merged 1 commit into
mainfrom
feat/codex-ai
Aug 22, 2026
Merged

feat(ai): optional local AI via the codex CLI (plan import + repaint)#11
yuyou-dev merged 1 commit into
mainfrom
feat/codex-ai

Conversation

@yuyou-dev

Copy link
Copy Markdown
Owner

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 via codex exec --output-schema, strict JSON, 180 s, ephemeral) · /render (one image_gen call, 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.
  • UI: AI render modal (default prompt is photoreal — cartoon→photo contrast; cinematic/anime/cyberpunk/watercolor/claymation/cel presets; swipe compare; IndexedDB history), Home-tab plan import (queue + cancel + force-kill), plan-image corner minimap.
  • Demo degradation: on static hosts (no /api/ai/*) the AI entries show a local-only badge instead of failing — the Pages demo's 'no backend' promise stays true.
  • Framing fidelity: captures are flattened onto --paper and the editor's view bias is cleared while capturing — renders align with the 3D view to within ~1%.
  • Tooling: 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.md agent runbook, README one-sentence setup prompt (EN + 中文), CHANGELOG started (0.2.0), version bump.

Verification (local, branch feat/codex-ai)

  • npm run build + build:pages clean; smoke 205 OK; smoke:ui (default / open-ai / loading-veil / new-room) 0 console errors; audit:ui 14 states × 2 viewports clean; doctor ready; scan:public clean
  • Live e2e (real codex, UI-driven headless): plan-synthetic.png → 5 rooms / 9 openings / 38 furniture + minimap; AI render done in 75.5 s with the layout locked; zero console errors
  • Pages simulation (plain static server at /OpenHome3D/): app boots, AI modal + import show the local-only badge, render button disabled, zero page errors

Note: vite preview does not serve static assets under the configured base (vite preview quirk) — Pages itself serves the file tree correctly; verified with a plain static server.

…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.
@yuyou-dev
yuyou-dev merged commit ffed908 into main Aug 22, 2026
1 check passed
@yuyou-dev
yuyou-dev deleted the feat/codex-ai branch August 22, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants