jsgui3-server 0.0.149 → 0.0.151

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.
Files changed (106) hide show
  1. package/.github/agents/Mobile Developer.agent.md +89 -0
  2. package/.github/instructions/copilot.instructions.md +1 -0
  3. package/AGENTS.md +6 -0
  4. package/README.md +185 -0
  5. package/admin-ui/client.js +73 -43
  6. package/admin-ui/v1/admin_auth_service.js +197 -0
  7. package/admin-ui/v1/admin_user_store.js +71 -0
  8. package/admin-ui/v1/client.js +17 -0
  9. package/admin-ui/v1/controls/admin_shell.js +1399 -0
  10. package/admin-ui/v1/controls/group_box.js +84 -0
  11. package/admin-ui/v1/controls/stat_card.js +125 -0
  12. package/admin-ui/v1/server.js +658 -0
  13. package/admin-ui/v1/utils/formatters.js +68 -0
  14. package/docs/admin-extension-guide.md +345 -0
  15. package/docs/api-reference.md +383 -303
  16. package/docs/books/adaptive-control-improvements/01-control-candidate-matrix.md +122 -0
  17. package/docs/books/adaptive-control-improvements/02-tier-1-layout-playbooks.md +207 -0
  18. package/docs/books/adaptive-control-improvements/03-tier-2-navigation-form-overlay.md +140 -0
  19. package/docs/books/adaptive-control-improvements/04-cross-cutting-platform-functionality.md +141 -0
  20. package/docs/books/adaptive-control-improvements/05-styling-theming-density-upgrades.md +114 -0
  21. package/docs/books/adaptive-control-improvements/06-testing-quality-gates.md +97 -0
  22. package/docs/books/adaptive-control-improvements/07-delivery-roadmap-and-ownership.md +137 -0
  23. package/docs/books/adaptive-control-improvements/08-appendix-tier1-acceptance-and-pr-templates.md +261 -0
  24. package/docs/books/adaptive-control-improvements/README.md +66 -0
  25. package/docs/books/admin-ui-authentication/01-threat-model-and-goals.md +124 -0
  26. package/docs/books/admin-ui-authentication/02-session-model-and-token-model.md +75 -0
  27. package/docs/books/admin-ui-authentication/03-auth-middleware-patterns.md +77 -0
  28. package/docs/books/admin-ui-authentication/README.md +25 -0
  29. package/docs/books/creating-a-new-admin-ui/01-introduction-and-vision.md +130 -0
  30. package/docs/books/creating-a-new-admin-ui/02-architecture-and-data-flow.md +298 -0
  31. package/docs/books/creating-a-new-admin-ui/03-server-introspection.md +381 -0
  32. package/docs/books/creating-a-new-admin-ui/04-admin-module-adapter-layer.md +592 -0
  33. package/docs/books/creating-a-new-admin-ui/05-domain-controls-stat-cards-and-gauges.md +513 -0
  34. package/docs/books/creating-a-new-admin-ui/06-domain-controls-process-manager.md +544 -0
  35. package/docs/books/creating-a-new-admin-ui/07-domain-controls-resource-pool-inspector.md +493 -0
  36. package/docs/books/creating-a-new-admin-ui/08-domain-controls-route-table-and-api-explorer.md +586 -0
  37. package/docs/books/creating-a-new-admin-ui/09-domain-controls-log-viewer-and-activity-feed.md +490 -0
  38. package/docs/books/creating-a-new-admin-ui/10-domain-controls-build-status-and-bundle-inspector.md +526 -0
  39. package/docs/books/creating-a-new-admin-ui/11-domain-controls-configuration-panel.md +808 -0
  40. package/docs/books/creating-a-new-admin-ui/12-admin-shell-layout-sidebar-navigation.md +210 -0
  41. package/docs/books/creating-a-new-admin-ui/13-telemetry-integration.md +556 -0
  42. package/docs/books/creating-a-new-admin-ui/14-realtime-sse-observable-integration.md +485 -0
  43. package/docs/books/creating-a-new-admin-ui/15-styling-theming-aero-design-system.md +521 -0
  44. package/docs/books/creating-a-new-admin-ui/16-testing-and-quality-assurance.md +147 -0
  45. package/docs/books/creating-a-new-admin-ui/17-next-steps-process-resource-roadmap.md +356 -0
  46. package/docs/books/creating-a-new-admin-ui/README.md +68 -0
  47. package/docs/books/device-adaptive-composition/01-platform-feature-audit.md +177 -0
  48. package/docs/books/device-adaptive-composition/02-responsive-composition-model.md +187 -0
  49. package/docs/books/device-adaptive-composition/03-data-model-vs-view-model.md +231 -0
  50. package/docs/books/device-adaptive-composition/04-styling-theme-breakpoints.md +234 -0
  51. package/docs/books/device-adaptive-composition/05-showcase-app-multi-device-assessment.md +193 -0
  52. package/docs/books/device-adaptive-composition/06-implementation-patterns-and-apis.md +346 -0
  53. package/docs/books/device-adaptive-composition/07-testing-harness-and-quality-gates.md +265 -0
  54. package/docs/books/device-adaptive-composition/08-roadmap-and-adoption-plan.md +250 -0
  55. package/docs/books/device-adaptive-composition/README.md +47 -0
  56. package/docs/comparison-report-express-plex-cpanel.md +549 -0
  57. package/docs/comprehensive-documentation.md +220 -220
  58. package/docs/configuration-reference.md +227 -204
  59. package/docs/designs/server-admin-interface-aero.svg +611 -0
  60. package/docs/middleware-guide.md +236 -0
  61. package/docs/system-architecture.md +24 -18
  62. package/docs/troubleshooting.md +84 -53
  63. package/middleware/compression.js +217 -0
  64. package/middleware/index.js +15 -0
  65. package/module.js +19 -11
  66. package/package.json +1 -1
  67. package/serve-factory.js +29 -0
  68. package/server.js +280 -20
  69. package/tests/README.md +5 -0
  70. package/tests/admin-ui-jsgui-controls.test.js +581 -0
  71. package/tests/test-runner.js +1 -0
  72. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-071799b982906680f5fd699d.js +0 -40
  73. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-07352945ad5c92654fcb8b65.js +0 -39
  74. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-138a601fadb6191ea314c6fd.js +0 -39
  75. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-171f6c381c2cadf2e9fa7087.js +0 -39
  76. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-1d973388156b84a04373fac9.js +0 -39
  77. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-20e117bc8a10d2cd16234bbe.js +0 -40
  78. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-2b028a82b0e5efddba42425f.js +0 -39
  79. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-4518556cd5c7e059e82b22b8.js +0 -40
  80. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-5bac1aa0f213902f718ed74f.js +0 -40
  81. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-5f9996ac7822caf777d92f56.js +0 -39
  82. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-60a92c702e65fd9cf748e3ec.js +0 -39
  83. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-6164c1f8f738995c541895d2.js +0 -44
  84. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-6718a85eb9e5aa782dd47a05.js +0 -45
  85. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-69e280f14e37aee76a1d4675.js +0 -39
  86. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7570d1b030d44b111ed59c4c.js +0 -39
  87. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7798c9bbd55e510d5039f936.js +0 -42
  88. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-78cd511ea1ef18ecb03d1be5.js +0 -40
  89. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7d482e0b95bcb5e3c543118b.js +0 -43
  90. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-80e9476d1127c55b40fdb36f.js +0 -40
  91. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-810ced55d5320a3088a05b13.js +0 -40
  92. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-8423565f1a40e329afc8c6cf.js +0 -40
  93. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-900bef783b8cee36506ec282.js +0 -39
  94. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-a1a37aff6416fdad74040ddf.js +0 -39
  95. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-ad48d5e8eda40f175b4df090.js +0 -39
  96. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-aec5a2d963015528c9099462.js +0 -39
  97. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-af9d34e0f1722fab9e28c269.js +0 -39
  98. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-b818e4015e2f1fe86280b5ab.js +0 -41
  99. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-bcb2541adc70b7aba61768c5.js +0 -44
  100. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-bfe89d2c78ed44f95ed7dd73.js +0 -40
  101. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-c06f04806a1e688e1187110c.js +0 -40
  102. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-c3f3adf904f585afc544b96a.js +0 -39
  103. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-d45acb873e1d8e32d5e60f2e.js +0 -39
  104. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-db06f132533706f4a0163b8c.js +0 -39
  105. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-f660f40d78b135fc8560a862.js +0 -39
  106. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-f9dee4ec18a96e09bee06bae.js +0 -39
@@ -0,0 +1,124 @@
1
+ # Chapter 1 — Threat Model and Goals
2
+
3
+ ## Why this chapter first
4
+
5
+ Authentication design becomes expensive when started too late. The Admin UI already has telemetry endpoints and an SSE channel, so this chapter defines what we are protecting and what can wait.
6
+
7
+ ## Assets to protect
8
+
9
+ For jsgui3-server admin surfaces, primary assets are:
10
+
11
+ 1. **Control-plane actions**
12
+ - starting/stopping resources
13
+ - changing runtime config
14
+ - registering/removing routes
15
+ 2. **Sensitive observability data**
16
+ - host/process metadata
17
+ - route inventories
18
+ - internal resource names and states
19
+ 3. **Availability**
20
+ - preventing abuse of SSE streams and expensive endpoints
21
+
22
+ ## Threat model (practical)
23
+
24
+ ### External attacker
25
+ - Can probe `/admin` and `/api/admin/*` endpoints.
26
+ - Tries default credentials, weak tokens, replay, or unauthenticated access.
27
+
28
+ ### Internal but unauthorized user
29
+ - Has network access but should not have admin privileges.
30
+ - Attempts to read diagnostic state or execute write actions.
31
+
32
+ ### Session theft and browser attacks
33
+ - Cookie theft, CSRF, XSS-assisted token misuse.
34
+ - Stale sessions after role changes.
35
+
36
+ ### Operational mistakes
37
+ - Admin endpoint exposed publicly by accident.
38
+ - Weak defaults in non-production become production behavior.
39
+
40
+ ## Security goals
41
+
42
+ ### G1: Default deny for admin APIs
43
+ - Any `/api/admin/*` endpoint should require auth by default.
44
+ - Explicit allow-list only for bootstrapping/health if needed.
45
+
46
+ ### G2: Separate read and write permissions
47
+ - Read-only operators should access telemetry.
48
+ - Mutating operations require stronger roles.
49
+
50
+ ### G3: Short-lived, revocable sessions
51
+ - Session invalidation should take effect quickly.
52
+ - SSE clients must be disconnected when auth is revoked.
53
+
54
+ ### G4: Browser-safe auth transport
55
+ - Prefer secure, httpOnly cookies for web-admin sessions.
56
+ - Apply CSRF protection for state-changing endpoints.
57
+
58
+ ### G5: Deployment-safe defaults
59
+ - Clear behavior in dev vs production.
60
+ - Explicit configuration for trusted origins and cookie policy.
61
+
62
+ ## Non-goals for first implementation phase
63
+
64
+ To keep delivery realistic, v1 auth does **not** need:
65
+
66
+ - Multi-tenant federation (SAML/OIDC enterprise SSO) on day one.
67
+ - Fine-grained per-resource ACL matrices.
68
+ - Full audit analytics UI before basic enforcement exists.
69
+
70
+ ## Phased implementation plan
71
+
72
+ ### Phase A — Guard rails (immediate)
73
+ - Keep admin UI read-only while auth is incomplete.
74
+ - Avoid adding new mutation endpoints.
75
+ - Document intended privileged operations.
76
+
77
+ ### Phase B — Baseline authentication
78
+ - Add login/logout endpoint pair.
79
+ - Add session issuance + validation middleware.
80
+ - Require auth for all `/api/admin/v1/*` and `/admin/v1`.
81
+
82
+ ### Phase C — Authorization and hardening
83
+ - Introduce roles: `admin_read`, `admin_write`.
84
+ - Add CSRF for write paths.
85
+ - Add rate limiting and SSE connection caps.
86
+
87
+ ### Phase D — Operational maturity
88
+ - Session revocation, inactivity expiry, and rotation.
89
+ - Structured security/audit logs.
90
+ - Runbook for emergency lockout and credential reset.
91
+
92
+ ## Design constraints from current codebase
93
+
94
+ Given existing server patterns:
95
+
96
+ - Admin routes are registered through router adapters.
97
+ - SSE is already used for live events.
98
+ - The current v1 UI is telemetry-first and can remain read-only safely.
99
+
100
+ This means we can adopt auth incrementally without blocking current UI progress.
101
+
102
+ ## Decision points (to finalize in next chapter)
103
+
104
+ 1. Session storage model: in-memory vs Redis-backed.
105
+ 2. Credential source: static bootstrap admin vs user store resource.
106
+ 3. Cookie strategy: strict same-site policy for local-only admin vs configurable for reverse proxies.
107
+ 4. Role model shape: two-role minimal model vs extensible claims model.
108
+
109
+ ## Selected v1 decisions (current)
110
+
111
+ The following decisions are now selected for v1 implementation:
112
+
113
+ 1. **Session storage model:** in-memory sessions.
114
+ 2. **Credential source:** user resource/store (not env-bootstrap only).
115
+ 3. **Protection scope:** protect both `/admin/v1` and `/api/admin/v1/*` immediately.
116
+
117
+ These choices keep the first auth rollout simple while still enforcing an end-to-end protected admin surface.
118
+
119
+ ## Exit criteria for this chapter
120
+
121
+ Before coding auth middleware, agree on:
122
+ - which endpoints require `admin_read` vs `admin_write`,
123
+ - session lifecycle requirements,
124
+ - dev/prod default policy matrix.
@@ -0,0 +1,75 @@
1
+ # Chapter 2 — Session Model and Token Model (v1 Decision)
2
+
3
+ ## Chosen model for v1
4
+
5
+ This project uses **stateful in-memory sessions** for admin authentication in v1.
6
+
7
+ ### Why this model now
8
+
9
+ - Fastest path to safe protection of `/admin/v1` and `/api/admin/v1/*`.
10
+ - Works with existing single-process server setup.
11
+ - Easy to reason about and debug while auth surface stabilizes.
12
+
13
+ ### Trade-offs
14
+
15
+ - Sessions are lost on server restart.
16
+ - Not suitable for multi-instance horizontal scaling without shared storage.
17
+ - Requires follow-up for production HA (Phase D).
18
+
19
+ ## Session shape
20
+
21
+ A session record contains:
22
+
23
+ - `session_id`
24
+ - `user` (`username`, `roles`)
25
+ - `created_at`
26
+ - `expires_at`
27
+
28
+ Cookie name: `jsgui_admin_v1_sid`
29
+
30
+ Cookie policy (v1):
31
+
32
+ - `HttpOnly`
33
+ - `SameSite=Lax`
34
+ - `Path=/`
35
+ - `Secure` enabled in production mode
36
+
37
+ ## User credential source (v1)
38
+
39
+ Credentials are validated against an **in-process user store resource-like service**.
40
+
41
+ - Primary bootstrap path: `ADMIN_V1_USER` + `ADMIN_V1_PASSWORD`.
42
+ - Development fallback (non-production only): `admin/admin`.
43
+ - Production without explicit password keeps login disabled until configured.
44
+
45
+ ## Endpoint policy
46
+
47
+ Public endpoints:
48
+
49
+ - `POST /api/admin/v1/auth/login`
50
+ - `POST /api/admin/v1/auth/logout`
51
+ - `GET /api/admin/v1/auth/session`
52
+ - `GET /admin/v1/login`
53
+
54
+ Protected endpoints:
55
+
56
+ - `GET /admin/v1`
57
+ - `GET /api/admin/v1/status`
58
+ - `GET /api/admin/v1/resources`
59
+ - `GET /api/admin/v1/routes`
60
+ - `GET /api/admin/v1/events`
61
+
62
+ ## Request flow
63
+
64
+ 1. Browser requests `/admin/v1`.
65
+ 2. If unauthenticated, server redirects to `/admin/v1/login`.
66
+ 3. Login form posts credentials to `/api/admin/v1/auth/login`.
67
+ 4. Server validates credentials and issues session cookie.
68
+ 5. Browser returns to `/admin/v1` and can access protected APIs.
69
+
70
+ ## Planned evolution (post-v1)
71
+
72
+ - Move session store to Redis or equivalent shared backing store.
73
+ - Add idle timeout refresh strategy.
74
+ - Add session revocation events and forced SSE disconnect.
75
+ - Add CSRF protections for write endpoints before mutation APIs launch.
@@ -0,0 +1,77 @@
1
+ # Chapter 3 — Auth Middleware Patterns for jsgui3-server
2
+
3
+ ## Goal
4
+
5
+ Establish stable authorization guard patterns now, so future write endpoints can be added safely without redesign.
6
+
7
+ ## Current guard model (implemented)
8
+
9
+ Admin v1 now uses explicit guard helpers in the server adapter:
10
+
11
+ - authentication guard
12
+ - role guard
13
+ - read-role guard (`admin_read`)
14
+ - write-role guard (`admin_write`)
15
+
16
+ This keeps route registration simple and prevents ad-hoc per-endpoint checks.
17
+
18
+ ## Route policy baseline
19
+
20
+ ### Public routes
21
+
22
+ - `/admin/v1/login`
23
+ - `POST /api/admin/v1/auth/login`
24
+ - `POST /api/admin/v1/auth/logout`
25
+ - `GET /api/admin/v1/auth/session`
26
+
27
+ ### Protected read routes (`admin_read`)
28
+
29
+ - `/admin/v1`
30
+ - `GET /api/admin/v1/status`
31
+ - `GET /api/admin/v1/resources`
32
+ - `GET /api/admin/v1/routes`
33
+ - `GET /api/admin/v1/events`
34
+
35
+ ### Reserved write route class (`admin_write`)
36
+
37
+ No mutation endpoints are enabled yet, but all future write endpoints should require `admin_write` at minimum.
38
+
39
+ ## Guard usage pattern
40
+
41
+ Use the guard wrapper at route-registration time:
42
+
43
+ - read routes use read guard
44
+ - write routes use write guard
45
+
46
+ This keeps endpoint code focused on business behavior and leaves authz behavior centralized.
47
+
48
+ ## Response semantics
49
+
50
+ - `401 Unauthorized`: no valid session.
51
+ - `403 Forbidden`: valid session, insufficient role.
52
+
53
+ These semantics are stable and should remain consistent for all future admin endpoints.
54
+
55
+ ## SSE policy
56
+
57
+ SSE endpoint is protected by the same read-role guard.
58
+
59
+ Rationale:
60
+ - event streams can reveal sensitive internal state,
61
+ - role checks must be equivalent to read API checks.
62
+
63
+ ## Next step for write endpoints
64
+
65
+ When adding first mutation routes:
66
+
67
+ 1. register route under `/api/admin/v1/...`
68
+ 2. wrap with write-role guard
69
+ 3. add CSRF requirement before enabling browser write actions
70
+ 4. add audit logging for successful and failed mutation attempts
71
+
72
+ ## Minimal acceptance checklist for new admin endpoints
73
+
74
+ - Has explicit required role (`admin_read` or `admin_write`)
75
+ - Returns 401/403 correctly
76
+ - No accidental fallback to auth-only checks
77
+ - Included in endpoint inventory docs
@@ -0,0 +1,25 @@
1
+ # Admin UI Authentication for jsgui3-server
2
+
3
+ This book introduces a practical, phased approach to securing the Admin UI.
4
+
5
+ ## Status
6
+
7
+ This book is intentionally started early (before a final auth architecture decision) so implementation can proceed safely in phases.
8
+
9
+ ## Chapters
10
+
11
+ 1. [Threat model and goals](01-threat-model-and-goals.md)
12
+ 2. [Session model and token model](02-session-model-and-token-model.md)
13
+ 3. [Auth middleware patterns in jsgui3-server](03-auth-middleware-patterns.md)
14
+ 4. Login flow and logout flow (planned)
15
+ 5. Authorization and role checks (planned)
16
+ 6. CSRF, cookies, and browser hardening (planned)
17
+ 7. SSE authentication and revocation handling (planned)
18
+ 8. Operational rollout and migration plan (planned)
19
+
20
+ ## Scope for v1 Admin
21
+
22
+ Until authentication is fully implemented:
23
+ - Keep the admin UI read-only where possible.
24
+ - Avoid privileged write-actions from browser controls.
25
+ - Document all intended mutation endpoints before building them.
@@ -0,0 +1,130 @@
1
+ # Chapter 1: Introduction & Vision
2
+
3
+ ## Why an Admin UI?
4
+
5
+ Every non-trivial server benefits from introspection. When a developer starts a jsgui3-server — whether it's a single-control demo, a multi-page application, or an API-only service — there is a wealth of internal state that is invisible from the outside:
6
+
7
+ - How many resources are loaded, and are they healthy?
8
+ - What routes have been registered, and by which publishers?
9
+ - How large is the bundled JavaScript? The extracted CSS?
10
+ - Is the build system working? Are there warnings?
11
+ - Which processes are running? What is their memory consumption?
12
+ - What observables are being published? How many clients are connected?
13
+
14
+ Today, to answer any of these questions, a developer must either read console output, attach a debugger, or write custom telemetry code. The Admin UI changes this entirely.
15
+
16
+ ## Vision Statement
17
+
18
+ **Navigate to `/admin` on any running jsgui3-server instance and immediately see everything the server knows about itself — in real time, with no configuration required.**
19
+
20
+ The Admin UI is:
21
+
22
+ 1. **Built-in** — Ships with jsgui3-server. No extra `npm install`, no separate process, no configuration file.
23
+ 2. **Real-time** — Uses the server's own SSE and Observable infrastructure to push live updates to the browser.
24
+ 3. **Honest** — Shows only data that actually exists within the running system. No mocked values, no placeholder counts.
25
+ 4. **Dogfooded** — Constructed entirely from jsgui3 controls (div, span, h2, Panel, Button, etc.). The admin UI itself is validation that the control system works.
26
+ 5. **Safe** — Defaults to read-only. Destructive actions (restart, stop) require deliberate interaction and are guarded behind confirmation.
27
+
28
+ ## Audience
29
+
30
+ The primary users of the Admin UI are:
31
+
32
+ - **Developers** building applications with jsgui3-server during local development
33
+ - **DevOps engineers** monitoring deployed instances
34
+ - **Framework contributors** debugging jsgui3-server internals
35
+ - **Curious users** who want to understand what's happening inside their server
36
+
37
+ ## Design Inspiration
38
+
39
+ The visual design draws from Windows Aero-era interfaces — a distinctive aesthetic that communicates professionalism and polish:
40
+
41
+ - **Glass-effect title bars** with gradient fills and subtle transparency
42
+ - **Warm parchment content areas** (`#F0EDE6` → `#E8E4DC`) rather than pure white
43
+ - **Group boxes** with inset labels — a classic UI pattern for organizing related controls
44
+ - **Tabbed panels** for switching between related views without navigation
45
+ - **Status bar** at the bottom with segmented information panels
46
+ - **Subtle drop shadows** and rounded corners that add depth without distraction
47
+
48
+ This aesthetic was chosen deliberately — it is visually distinct from the "flat design" dashboards common today, giving jsgui3-server its own identity while still being functional and readable.
49
+
50
+ ## Scope — What the Admin UI Is and Is Not
51
+
52
+ ### What it IS:
53
+
54
+ - A dashboard showing server state, routes, processes, resources, and build output
55
+ - A log viewer with real-time streaming
56
+ - A route and API explorer
57
+ - A configuration viewer (and, where safe, editor)
58
+ - A process manager with start/stop/restart controls
59
+
60
+ ### What it is NOT:
61
+
62
+ - A replacement for a full monitoring stack (Prometheus, Grafana, etc.)
63
+ - A code editor or IDE
64
+ - A database administration tool
65
+ - A user authentication/authorization management system
66
+
67
+ The Admin UI occupies the space between "console.log" and "full observability platform." It gives developers immediate insight into their server without leaving the browser.
68
+
69
+ ## The `/admin` Route
70
+
71
+ When jsgui3-server starts, it automatically:
72
+
73
+ 1. Loads the `Admin_Module` from `admin-ui/v1/server.js`
74
+ 2. Attaches telemetry API endpoints under `/api/admin/*`
75
+ 3. Renders the admin UI control and serves it at `/admin`
76
+ 4. Sets up SSE endpoints for real-time data push
77
+
78
+ No code change is needed in the user's application. The admin UI is always available.
79
+
80
+ ```
81
+ http://localhost:8080/admin ← Full admin dashboard
82
+ http://localhost:8080/ ← User's application (unchanged)
83
+ ```
84
+
85
+ ## Versioning Strategy
86
+
87
+ The admin UI lives in `admin-ui/v1/`. This explicit versioning allows:
88
+
89
+ - **Parallel iteration** — A `v2/` can be developed while `v1/` remains stable
90
+ - **A/B comparison** — Both versions can be served simultaneously for comparison
91
+ - **Safe rollback** — If `v2/` has issues, `v1/` is always available
92
+ - **Independent release** — The admin UI can evolve at its own pace
93
+
94
+ ## What Success Looks Like
95
+
96
+ A developer creates a simple jsgui3-server application:
97
+
98
+ ```javascript
99
+ const Server = require('jsgui3-server');
100
+ Server.serve({
101
+ Ctrl: My_App,
102
+ port: 8080
103
+ });
104
+ ```
105
+
106
+ They navigate to `http://localhost:8080/admin` and see:
107
+
108
+ - **3 stat cards** showing PID, resource count, and route count
109
+ - **A process panel** with the main server process and any child processes
110
+ - **A resource table** listing every resource in the pool with health status
111
+ - **A route table** showing all registered HTTP routes with their handler types
112
+ - **A build section** with JS bundle size, CSS size, and build timing
113
+ - **A live activity log** streaming recent requests and events
114
+
115
+ All of this appears automatically, populated with real data from the running server, updating in real time as the server handles requests.
116
+
117
+ ## Relationship to Existing Admin UI
118
+
119
+ The existing `admin-ui/` directory contains a preliminary implementation with:
120
+ - A sidebar/content shell in `admin-ui/client.js`
121
+ - Basic API endpoints in `admin-ui/server.js` for resources and observables
122
+
123
+ The `v1/` implementation builds on the lessons learned from this prototype while introducing:
124
+ - Domain-specific controls (not just generic divs)
125
+ - A comprehensive telemetry adapter layer
126
+ - Real-time SSE-driven updates
127
+ - The Aero-inspired visual design
128
+ - A structured navigation system with multiple views
129
+
130
+ The existing code in `admin-ui/client.js` and `admin-ui/server.js` remains as the current implementation. The `v1/` directory is a fresh start that will eventually replace it.