Skip to content

Commit f97cabc

Browse files
authored
Merge pull request #7 from RadDad87/codex/propose-plan-for-windows-launcher-implementation-9ldchg
Z3R4H: Windows offline launcher, wrapper scaffold, geo services, UI rebrand & prompt stack
2 parents 9bd8425 + e3456d8 commit f97cabc

63 files changed

Lines changed: 5150 additions & 33 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

PROJECT_BRIEF.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Z3R4H Project Brief
2+
3+
## Product
4+
Z3R4H is a custom-branded offline survival AI interface built on Open WebUI and powered by local GGUF models through llama.cpp.
5+
6+
## Goal
7+
Create a Windows-first, fully offline survival AI product that looks polished, launches simply, and uses custom Z3R4H modes and prompts.
8+
9+
## Core Rules
10+
- Fully offline operation for v1
11+
- No cloud APIs
12+
- No OpenAI API dependency in product runtime
13+
- No telemetry
14+
- No login requirement for v1
15+
- No unnecessary frameworks or overengineering
16+
- Keep implementation simple, stable, and portable
17+
- Preserve Open WebUI where useful, but remove generic/cloud-first assumptions
18+
- Brand name must appear as Z3R4H
19+
- Interface language should emphasize:
20+
- Offline Survival AI
21+
- Local processing
22+
- Knowledge when the grid falls
23+
24+
## UI Direction
25+
- Dark tactical / premium theme
26+
- Custom Z3R4H branding
27+
- Remove generic assistant wording
28+
- Replace generic model language with Z3R4H mode language where appropriate
29+
30+
## Z3R4H Modes
31+
- General Advisor
32+
- Medical Reference
33+
- Engineering & Repair
34+
- Navigation & Terrain
35+
- Low Power Mode
36+
37+
## Prompt Architecture
38+
Each mode should eventually load:
39+
- core_system.txt
40+
- one mode-specific prompt
41+
- failure_behavior.txt
42+
43+
## Runtime Architecture
44+
User
45+
→ Z3R4H-branded Open WebUI
46+
→ local llama.cpp server
47+
→ local GGUF model
48+
49+
## Priority Order
50+
1. Reliable Windows launcher
51+
2. Open WebUI connected to local llama.cpp
52+
3. Z3R4H branding pass
53+
4. Z3R4H modes
54+
5. Prompt loading system
55+
6. Packaging and documentation
56+
57+
## Constraints
58+
- Windows-first
59+
- Offline-first
60+
- Localhost-only for inference
61+
- No unrelated refactors
62+
- Keep edits narrowly scoped to the current task

README.md

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,267 @@ If you have any questions, suggestions, or need assistance, please open an issue
237237
---
238238

239239
Created by [Timothy Jaeryang Baek](https://github.com/tjbck) - Let's make Open WebUI even more amazing together! 💪
240+
241+
## Z3R4H Windows Local Launcher (offline/localhost)
242+
243+
For Z3R4H local development on Windows (no Docker), use `launch_z3r4h.bat` at the repo root.
244+
245+
- Starts local `llama.cpp` server
246+
- Starts Open WebUI with local OpenAI-compatible backend settings
247+
- Waits for both services to become reachable
248+
- Opens Open WebUI in the default browser
249+
- Logs to `z3r4h_launcher.log`
250+
251+
The launcher enforces localhost-only endpoints and uses verified Open WebUI environment variables from this codebase:
252+
- `ENABLE_OPENAI_API=True`
253+
- `OPENAI_API_BASE_URLS=http://127.0.0.1:<LLAMA_PORT>/v1`
254+
- `OPENAI_API_KEYS=` (empty)
255+
256+
For Z3R4H offline/local startup, the launcher also applies:
257+
- `OFFLINE_MODE=True`
258+
- `WEBUI_AUTH=False`
259+
- `ENABLE_LOGIN_FORM=False`
260+
- `ENABLE_SIGNUP=False`
261+
- `ENABLE_COMMUNITY_SHARING=False`
262+
- `ENABLE_WEB_SEARCH=False`
263+
264+
This reduces cloud-first/community surfaces in the Z3R4H launcher path while preserving local chat usage.
265+
266+
Edit top variables in `launch_z3r4h.bat` before first run:
267+
- `LLAMA_SERVER_EXE`
268+
- `MODEL_PATH`
269+
- `LLAMA_HOST`
270+
- `LLAMA_PORT`
271+
- `OPEN_WEBUI_START_CMD`
272+
- `OPEN_WEBUI_URL`
273+
- `LOG_FILE`
274+
275+
### Portable Package Layout (Windows)
276+
277+
```text
278+
Z3R4H/
279+
├─ launch_z3r4h.bat
280+
├─ models/
281+
│ └─ model.gguf
282+
├─ runtime/
283+
│ └─ llama.cpp/
284+
│ └─ llama-server.exe
285+
└─ z3r4h_launcher.log (created at runtime)
286+
```
287+
288+
Launcher defaults are now relative to `%~dp0` (the launcher directory), so the package can be moved without editing absolute paths.
289+
290+
Open WebUI startup options:
291+
- **External CLI mode (default):** `open-webui serve` (requires `open-webui` in PATH)
292+
- **Bundled runtime mode (optional):** point `OPEN_WEBUI_START_CMD` to a bundled executable path under `runtime/`
293+
294+
Required at runtime:
295+
- `launch_z3r4h.bat`
296+
- `runtime/llama.cpp/llama-server.exe` (or equivalent configured path)
297+
- `models/<your-model>.gguf`
298+
- Local port availability for llama.cpp + Open WebUI
299+
- Write access for `z3r4h_launcher.log`
300+
301+
### Z3R4H Windows-Local Verification Checklist
302+
303+
1. Set launcher variables in `launch_z3r4h.bat` (`LLAMA_SERVER_EXE`, `MODEL_PATH`, ports/URL).
304+
2. Run `launch_z3r4h.bat`.
305+
3. Confirm launcher log shows:
306+
- llama.cpp started and ready
307+
- Open WebUI started and ready
308+
4. Confirm browser opens the configured local URL.
309+
5. Confirm Z3R4H Mode selector is visible in chat.
310+
6. Send one local prompt and verify a response is returned.
311+
7. Confirm offline-hardening behavior in launcher path:
312+
- no login prompt
313+
- community sharing disabled
314+
- web search disabled
315+
316+
### Troubleshooting (Windows Local)
317+
318+
- **Missing llama.cpp executable/model:** verify `LLAMA_SERVER_EXE` and `MODEL_PATH` (default package expectation: `runtime/llama.cpp/llama-server.exe` and `models/model.gguf`).
319+
- **Open WebUI startup mode issue:**
320+
- `OPEN_WEBUI_START_MODE=external` requires `open-webui` in PATH
321+
- `OPEN_WEBUI_START_MODE=bundled` requires valid `OPEN_WEBUI_BUNDLED_EXE`
322+
- **Port conflict before startup:** launcher now fails fast if `LLAMA_PORT` or WebUI port is already listening.
323+
- **Readiness probe unavailable/blocked:** verify PowerShell policy or curl availability on Windows.
324+
- **Startup timeout:** check `z3r4h_launcher.log`, then verify firewall and localhost reachability.
325+
326+
327+
### Clean-Environment Launch Review (Windows)
328+
329+
Use `Z3R4H_CLEAN_ENV_CHECKLIST.md` for a clean-machine launch/readiness pass focused on:
330+
- preflight requirements
331+
- startup validation
332+
- offline-hardening validation
333+
- hidden assumptions and launch blockers
334+
335+
### Task 11 Validation Focus (Windows Local)
336+
337+
For Task 11, treat this as a **validation-only** pass (no behavior changes by default):
338+
- run the execution-ready clean-machine flow in `Z3R4H_CLEAN_ENV_CHECKLIST.md`
339+
- rank blockers as P0/P1/P2 for launch-readiness decisions
340+
- record hidden assumptions with concrete repro evidence
341+
342+
Highest-risk items to validate first:
343+
- default external `open-webui` PATH dependency
344+
- PowerShell readiness-probe assumptions
345+
- local port conflicts (11434/8080)
346+
- packaged model path/filename mismatch
347+
348+
349+
### Task 12 Blocker-Fix Focus (Windows Local)
350+
351+
Task 12 hardens clean-machine startup by improving launcher preflight clarity and failure diagnostics only (no product/backend feature expansion):
352+
- explicit Open WebUI startup-mode branching (external vs bundled)
353+
- readiness-probe fallback diagnostics
354+
- model-path contract clarity
355+
- fail-fast local port conflict checks
356+
357+
358+
### Task 13 Release-Candidate Checklist (Windows Portable Package)
359+
360+
Use this RC gate before any installer/wrapper work:
361+
1. Scope and intent confirmed (documentation/readiness-only gate).
362+
2. Package manifest complete (launcher/runtime/model artifacts present).
363+
3. Runtime prerequisites confirmed on clean Windows machine.
364+
4. Preflight checks pass (startup mode, paths, ports, log write access).
365+
5. Cold launch validation passes (llama + Open WebUI ready).
366+
6. Operator smoke checks pass (UI opens, one local response).
367+
7. No unresolved P0/P1 blockers in checklist blocker register.
368+
8. Evidence captured and signoff recorded.
369+
370+
371+
### Task 14 Validation Execution Support (Windows Local)
372+
373+
For clean-machine RC execution, run validation in this exact order:
374+
1. Session header capture (operator/date/machine/build).
375+
2. Package manifest verification.
376+
3. Runtime prerequisite verification.
377+
4. Launcher preflight checks (mode/paths/ports/log write).
378+
5. Cold launch execution and readiness confirmation.
379+
6. Operator smoke check (UI opens + one local prompt/response).
380+
7. Blocker classification (P0/P1/P2) and disposition.
381+
8. RC signoff decision with evidence pack attached.
382+
383+
Use `Z3R4H_CLEAN_ENV_CHECKLIST.md` as the source of truth for pass/fail recording.
384+
385+
386+
### Task 15 RC Run Result Capture (Windows Local)
387+
388+
After executing validation, record outcomes using the Task 15 run-result template in `Z3R4H_CLEAN_ENV_CHECKLIST.md`:
389+
- per-step pass/fail/blocked status
390+
- evidence references per step
391+
- blocker rollup (P0/P1/P2)
392+
- final release recommendation (`GO`, `GO-WITH-RISK`, `NO-GO`)
393+
394+
395+
### Task 16 v1 Shipping Format Decision (Windows)
396+
397+
Compared options for v1:
398+
1. Portable BAT-launched package (current baseline)
399+
2. Wrapped desktop `.exe` / shell approach (intended v1 target)
400+
401+
**v1 Recommendation:** Ship with the wrapped desktop `.exe` / shell approach as the primary operator entry point.
402+
403+
Rationale for .exe-first:
404+
- improves operator-first launch experience by reducing manual launcher handling
405+
- provides a clearer product-like entry path for v1 distribution
406+
- reduces perceived complexity for first-time Windows operators
407+
408+
BAT path role during transition:
409+
- retain BAT launch flow as controlled fallback while exe-first gates are validated
410+
- do not position BAT as primary v1 operator experience
411+
412+
Exe-first gating conditions before release decision:
413+
- repeated RC runs show no unresolved P0 launch blockers in exe-first flow
414+
- failure diagnostics remain operator-visible and supportable
415+
- portability expectations are preserved for packaged runtime/model assets
416+
- support burden is acceptable versus BAT baseline in pilot validation
417+
418+
419+
### Task 17 .exe Wrapper Implementation Plan (v1 Path)
420+
421+
Task 17 defines the implementation plan only (no wrapper code yet):
422+
- wrapper technology options and recommendation
423+
- runtime startup orchestration sequence
424+
- diagnostics/logging expectations
425+
- BAT launcher fallback/support role
426+
427+
v1 intended entrypoint remains `.exe` / shell wrapper, with BAT preserved as fallback/support.
428+
429+
430+
### Task 18 Concrete .exe Wrapper Implementation Plan (Build-Ready)
431+
432+
Task 18 adds the build-ready implementation plan for the `.exe` wrapper path (planning only, no code):
433+
- recommended wrapper technology
434+
- concrete wrapper project layout
435+
- startup orchestration and readiness sequence
436+
- logging/error-handling model
437+
- BAT fallback/support path expectations
438+
439+
For v1, `.exe` remains the intended primary entrypoint; BAT remains fallback/support only.
440+
441+
442+
### Task 19 Minimal Wrapper Scaffold (Implemented)
443+
444+
Added initial native C#/.NET wrapper scaffold under `wrapper/` for `.exe`-first v1 path:
445+
- project structure and entrypoint
446+
- config/path resolution scaffold
447+
- orchestration/readiness/logging stubs
448+
- BAT fallback hook scaffold
449+
450+
No full runtime orchestration, installer, or build automation was implemented in this task.
451+
452+
453+
### Task 20 First Working Wrapper Milestone
454+
455+
The wrapper now provides a first working milestone for `.exe`-first path by delivering:
456+
- config/path validation
457+
- structured logging and error categories
458+
- structured exit codes
459+
- BAT fallback invocation path (`auto`/`always`/`never`)
460+
461+
Full runtime orchestration/readiness/browser launch remain intentionally deferred.
462+
463+
464+
### Task 21 First Live Llama Orchestration Milestone
465+
466+
Wrapper now performs first live orchestration by launching llama and validating llama readiness.
467+
This milestone still does **not** start Open WebUI or launch a browser.
468+
BAT fallback remains the support/recovery path.
469+
470+
471+
### Task 22 Open WebUI + Dual-Service Readiness Milestone
472+
473+
Wrapper now supports dual-service startup readiness:
474+
1) launch/validate llama
475+
2) launch/validate Open WebUI
476+
477+
This milestone still excludes browser launch and advanced supervision.
478+
479+
480+
### Task 23 Browser Launch on Dual-Service Readiness
481+
482+
Wrapper now opens the configured local Open WebUI URL in the default browser
483+
only after both llama and Open WebUI readiness checks pass.
484+
485+
Fallback behavior remains unchanged for earlier startup failures (`auto` / `always` / `never`).
486+
Browser-launch-only failures are returned as structured wrapper outcomes.
487+
488+
489+
### Task 24 Wrapper-First RC Validation Execution Support
490+
491+
RC validation workflow now explicitly treats the wrapper entrypoint as the
492+
primary clean-machine validation path for `.exe`-first shipping.
493+
494+
Validation guidance now records:
495+
- wrapper stage-by-stage outcomes (config, llama, webui, browser-launch)
496+
- wrapper exit code + terminal stage
497+
- BAT fallback evidence only when wrapper failure triggers support handoff
498+
499+
500+
### Task 25 Package-Root Resolution Blocker Fix
501+
502+
Wrapper default package-root detection was corrected for published RC layout so it no longer collapses to `C:\\`.
503+
Resolved runtime and fallback paths are now anchored to the detected package root and logged at startup.

0 commit comments

Comments
 (0)