@omnicross/ui 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -0
- package/dist/assets/index-CvcsVuOR.js +357 -0
- package/dist/assets/index-Y6H8_Q0c.css +1 -0
- package/dist/index.html +13 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# @omnicross/ui — Control Panel frontend
|
|
2
|
+
|
|
3
|
+
The Omnicross Control Panel: a **Vite + React frontend** wired to the daemon's
|
|
4
|
+
localhost admin HTTP API (`/admin/api/*`). The package publishes only its built
|
|
5
|
+
`dist/` (static assets, zero runtime deps); the source lives right here. It has
|
|
6
|
+
no hard runtime dependency on any shell — the same build runs
|
|
7
|
+
|
|
8
|
+
1. **served by the daemon** at `http://127.0.0.1:8766/ui` (same origin as the
|
|
9
|
+
admin API — no CORS). This is what `omnicross ui` launches; `@omnicross/daemon`
|
|
10
|
+
depends on this package and resolves its `dist/` at runtime.
|
|
11
|
+
2. **inside the Tauri desktop shell** (`../../apps/desktop`) — the only
|
|
12
|
+
Tauri-aware code paths are three `isTauri()`-guarded seams (native fetch, the
|
|
13
|
+
`daemon_status` command, tray/autostart settings); in a plain browser they
|
|
14
|
+
fall back to platform `fetch` / a liveness probe / hidden rows.
|
|
15
|
+
3. **on the Vite dev server** (port 1430). The daemon deliberately sends no
|
|
16
|
+
CORS headers, so the dev server **proxies `/admin/*` to it server-side** —
|
|
17
|
+
the browser only ever talks same-origin, exactly like the production `/ui`
|
|
18
|
+
serving. Works against a real daemon or the mock, no `.env` needed.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
- Node 18+ and npm. Nothing else for `npm run dev` at the repo root (it boots
|
|
23
|
+
the daemon for you); frontend-only dev needs a daemon (or the mock) on
|
|
24
|
+
`127.0.0.1:8766` for the proxy to forward to.
|
|
25
|
+
|
|
26
|
+
## Configure (optional)
|
|
27
|
+
|
|
28
|
+
Zero config by default. `.env` (see `.env.example`) is only for unusual setups:
|
|
29
|
+
|
|
30
|
+
- `VITE_DAEMON_ADMIN_TOKEN` — when the daemon sets `admin.token`, put the same
|
|
31
|
+
value here so requests carry `Authorization: Bearer <token>`.
|
|
32
|
+
- `VITE_DAEMON_PROXY_TARGET` — where the dev proxy forwards `/admin/*`
|
|
33
|
+
(default `http://127.0.0.1:8766`).
|
|
34
|
+
- `VITE_DAEMON_BASE_URL` — overrides the client's base URL entirely. Do NOT
|
|
35
|
+
set it to an absolute URL for browser dev: that bypasses the proxy and
|
|
36
|
+
cross-origin calls fail by design (the daemon sends no CORS headers).
|
|
37
|
+
|
|
38
|
+
## Run
|
|
39
|
+
|
|
40
|
+
This is a workspace member — `npm install` at the repo root installs everything.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# One command, both halves (recommended): daemon on 8766 + Vite on 1430
|
|
44
|
+
npm run dev # at the REPO ROOT — seeds omnicross.dev.config.json on first run
|
|
45
|
+
|
|
46
|
+
# Frontend only (you provide the daemon or the mock on 8766):
|
|
47
|
+
npm run dev -w @omnicross/ui # http://localhost:1430 — /admin/* proxied to 127.0.0.1:8766
|
|
48
|
+
node scripts/mock-daemon.mjs # or: a no-key mock admin API on 8766
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For the native desktop window, use the Tauri shell project instead:
|
|
52
|
+
`cd apps/desktop && npm run dev`.
|
|
53
|
+
|
|
54
|
+
## Build / verify
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm run typecheck -w @omnicross/ui # tsc --noEmit
|
|
58
|
+
npm run build -w @omnicross/ui # vite build → dist/ (relative-asset base; servable at any mount path)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`prepack` runs the build automatically, so `npm publish` always ships a fresh
|
|
62
|
+
`dist/`. The daemon serves whatever `packages/ui/dist/` holds — rebuild after
|
|
63
|
+
frontend changes (or point `OMNICROSS_UI_DIST` elsewhere).
|
|
64
|
+
|
|
65
|
+
## Architecture
|
|
66
|
+
|
|
67
|
+
- `src/daemon/` — the typed admin HTTP client (`adminClient.ts`) + the provider
|
|
68
|
+
DTO adapter (`llmConfigAdapter.ts`) that maps the daemon's thin provider DTO
|
|
69
|
+
to the Provider page's rich `LLMProvider` shape. `httpFetch.ts` is the
|
|
70
|
+
transport seam (Tauri plugin-http inside the shell, platform `fetch` otherwise);
|
|
71
|
+
`adminClient.ts` picks the base URL by host context (loopback inside Tauri,
|
|
72
|
+
same-origin everywhere else — the daemon-served `/ui` directly, the Vite dev
|
|
73
|
+
server via its `/admin` proxy).
|
|
74
|
+
- `src/shared/` — the local seam: `agent` (daemon-pointed, no `window.native`),
|
|
75
|
+
a single-slice `settingsStore` (`useLlmProvidersData`), a `useTranslation`
|
|
76
|
+
shim, and `cn`.
|
|
77
|
+
- `src/shared-types/` — the hand-mirrored subset of the daemon/upstream
|
|
78
|
+
`llm-config` types the page consumes.
|
|
79
|
+
- `src/components/ui/` — the ported UI primitives.
|
|
80
|
+
- `src/features/` — the pages (provider settings, accounts, API service,
|
|
81
|
+
Code CLI, settings).
|
|
82
|
+
- The Tauri shell itself lives in `apps/desktop/src-tauri` (separate project).
|
|
83
|
+
|
|
84
|
+
### Disabled-when-unbacked controls
|
|
85
|
+
|
|
86
|
+
The full Provider form is rendered for visual fidelity. Controls whose
|
|
87
|
+
underlying field has no daemon backing render **disabled with a tooltip**
|
|
88
|
+
("Not yet supported by the daemon") — never hidden, never fake-success. The only
|
|
89
|
+
hard exclusion is the Electron-only encrypted-credential migration pack.
|