jsgui3-server 0.0.149 → 0.0.150

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 (98) hide show
  1. package/.github/agents/Mobile Developer.agent.md +89 -0
  2. package/AGENTS.md +4 -0
  3. package/README.md +130 -0
  4. package/admin-ui/client.js +73 -43
  5. package/admin-ui/v1/admin_auth_service.js +197 -0
  6. package/admin-ui/v1/admin_user_store.js +71 -0
  7. package/admin-ui/v1/client.js +17 -0
  8. package/admin-ui/v1/controls/admin_shell.js +1399 -0
  9. package/admin-ui/v1/controls/group_box.js +84 -0
  10. package/admin-ui/v1/controls/stat_card.js +125 -0
  11. package/admin-ui/v1/server.js +658 -0
  12. package/admin-ui/v1/utils/formatters.js +68 -0
  13. package/docs/admin-extension-guide.md +345 -0
  14. package/docs/books/adaptive-control-improvements/01-control-candidate-matrix.md +122 -0
  15. package/docs/books/adaptive-control-improvements/02-tier-1-layout-playbooks.md +207 -0
  16. package/docs/books/adaptive-control-improvements/03-tier-2-navigation-form-overlay.md +140 -0
  17. package/docs/books/adaptive-control-improvements/04-cross-cutting-platform-functionality.md +141 -0
  18. package/docs/books/adaptive-control-improvements/05-styling-theming-density-upgrades.md +114 -0
  19. package/docs/books/adaptive-control-improvements/06-testing-quality-gates.md +97 -0
  20. package/docs/books/adaptive-control-improvements/07-delivery-roadmap-and-ownership.md +137 -0
  21. package/docs/books/adaptive-control-improvements/08-appendix-tier1-acceptance-and-pr-templates.md +261 -0
  22. package/docs/books/adaptive-control-improvements/README.md +66 -0
  23. package/docs/books/admin-ui-authentication/01-threat-model-and-goals.md +124 -0
  24. package/docs/books/admin-ui-authentication/02-session-model-and-token-model.md +75 -0
  25. package/docs/books/admin-ui-authentication/03-auth-middleware-patterns.md +77 -0
  26. package/docs/books/admin-ui-authentication/README.md +25 -0
  27. package/docs/books/creating-a-new-admin-ui/01-introduction-and-vision.md +130 -0
  28. package/docs/books/creating-a-new-admin-ui/02-architecture-and-data-flow.md +298 -0
  29. package/docs/books/creating-a-new-admin-ui/03-server-introspection.md +381 -0
  30. package/docs/books/creating-a-new-admin-ui/04-admin-module-adapter-layer.md +592 -0
  31. package/docs/books/creating-a-new-admin-ui/05-domain-controls-stat-cards-and-gauges.md +513 -0
  32. package/docs/books/creating-a-new-admin-ui/06-domain-controls-process-manager.md +544 -0
  33. package/docs/books/creating-a-new-admin-ui/07-domain-controls-resource-pool-inspector.md +493 -0
  34. package/docs/books/creating-a-new-admin-ui/08-domain-controls-route-table-and-api-explorer.md +586 -0
  35. package/docs/books/creating-a-new-admin-ui/09-domain-controls-log-viewer-and-activity-feed.md +490 -0
  36. package/docs/books/creating-a-new-admin-ui/10-domain-controls-build-status-and-bundle-inspector.md +526 -0
  37. package/docs/books/creating-a-new-admin-ui/11-domain-controls-configuration-panel.md +808 -0
  38. package/docs/books/creating-a-new-admin-ui/12-admin-shell-layout-sidebar-navigation.md +210 -0
  39. package/docs/books/creating-a-new-admin-ui/13-telemetry-integration.md +556 -0
  40. package/docs/books/creating-a-new-admin-ui/14-realtime-sse-observable-integration.md +485 -0
  41. package/docs/books/creating-a-new-admin-ui/15-styling-theming-aero-design-system.md +521 -0
  42. package/docs/books/creating-a-new-admin-ui/16-testing-and-quality-assurance.md +147 -0
  43. package/docs/books/creating-a-new-admin-ui/17-next-steps-process-resource-roadmap.md +356 -0
  44. package/docs/books/creating-a-new-admin-ui/README.md +68 -0
  45. package/docs/books/device-adaptive-composition/01-platform-feature-audit.md +177 -0
  46. package/docs/books/device-adaptive-composition/02-responsive-composition-model.md +187 -0
  47. package/docs/books/device-adaptive-composition/03-data-model-vs-view-model.md +231 -0
  48. package/docs/books/device-adaptive-composition/04-styling-theme-breakpoints.md +234 -0
  49. package/docs/books/device-adaptive-composition/05-showcase-app-multi-device-assessment.md +193 -0
  50. package/docs/books/device-adaptive-composition/06-implementation-patterns-and-apis.md +346 -0
  51. package/docs/books/device-adaptive-composition/07-testing-harness-and-quality-gates.md +265 -0
  52. package/docs/books/device-adaptive-composition/08-roadmap-and-adoption-plan.md +250 -0
  53. package/docs/books/device-adaptive-composition/README.md +47 -0
  54. package/docs/comparison-report-express-plex-cpanel.md +549 -0
  55. package/docs/designs/server-admin-interface-aero.svg +611 -0
  56. package/docs/troubleshooting.md +84 -53
  57. package/module.js +16 -11
  58. package/package.json +1 -1
  59. package/serve-factory.js +1 -0
  60. package/server.js +199 -0
  61. package/tests/README.md +5 -0
  62. package/tests/admin-ui-jsgui-controls.test.js +581 -0
  63. package/tests/test-runner.js +1 -0
  64. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-071799b982906680f5fd699d.js +0 -40
  65. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-07352945ad5c92654fcb8b65.js +0 -39
  66. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-138a601fadb6191ea314c6fd.js +0 -39
  67. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-171f6c381c2cadf2e9fa7087.js +0 -39
  68. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-1d973388156b84a04373fac9.js +0 -39
  69. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-20e117bc8a10d2cd16234bbe.js +0 -40
  70. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-2b028a82b0e5efddba42425f.js +0 -39
  71. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-4518556cd5c7e059e82b22b8.js +0 -40
  72. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-5bac1aa0f213902f718ed74f.js +0 -40
  73. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-5f9996ac7822caf777d92f56.js +0 -39
  74. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-60a92c702e65fd9cf748e3ec.js +0 -39
  75. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-6164c1f8f738995c541895d2.js +0 -44
  76. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-6718a85eb9e5aa782dd47a05.js +0 -45
  77. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-69e280f14e37aee76a1d4675.js +0 -39
  78. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7570d1b030d44b111ed59c4c.js +0 -39
  79. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7798c9bbd55e510d5039f936.js +0 -42
  80. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-78cd511ea1ef18ecb03d1be5.js +0 -40
  81. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7d482e0b95bcb5e3c543118b.js +0 -43
  82. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-80e9476d1127c55b40fdb36f.js +0 -40
  83. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-810ced55d5320a3088a05b13.js +0 -40
  84. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-8423565f1a40e329afc8c6cf.js +0 -40
  85. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-900bef783b8cee36506ec282.js +0 -39
  86. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-a1a37aff6416fdad74040ddf.js +0 -39
  87. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-ad48d5e8eda40f175b4df090.js +0 -39
  88. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-aec5a2d963015528c9099462.js +0 -39
  89. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-af9d34e0f1722fab9e28c269.js +0 -39
  90. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-b818e4015e2f1fe86280b5ab.js +0 -41
  91. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-bcb2541adc70b7aba61768c5.js +0 -44
  92. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-bfe89d2c78ed44f95ed7dd73.js +0 -40
  93. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-c06f04806a1e688e1187110c.js +0 -40
  94. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-c3f3adf904f585afc544b96a.js +0 -39
  95. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-d45acb873e1d8e32d5e60f2e.js +0 -39
  96. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-db06f132533706f4a0163b8c.js +0 -39
  97. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-f660f40d78b135fc8560a862.js +0 -39
  98. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-f9dee4ec18a96e09bee06bae.js +0 -39
@@ -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.
@@ -0,0 +1,298 @@
1
+ # Chapter 2: Architecture & Data Flow
2
+
3
+ ## Overview
4
+
5
+ The Admin UI follows a classic client-server architecture that leverages jsgui3's isomorphic rendering pipeline. The server renders the initial HTML, the client activates controls and begins fetching live data through a set of JSON API endpoints and SSE streams.
6
+
7
+ ```
8
+ ┌──────────────────────────────────────────────────────────┐
9
+ │ Browser (Client) │
10
+ │ │
11
+ │ ┌─────────────┐ ┌──────────────┐ ┌────────────────┐ │
12
+ │ │ Admin Shell │ │ Domain Ctrls │ │ SSE Client │ │
13
+ │ │ (sidebar, │──│ (stat cards, │──│ (EventSource │ │
14
+ │ │ toolbar, │ │ tables, │ │ for live │ │
15
+ │ │ status bar) │ │ panels) │ │ updates) │ │
16
+ │ └──────┬───────┘ └──────┬───────┘ └───────┬────────┘ │
17
+ │ │ │ │ │
18
+ │─────────┼─────────────────┼───────────────────┼───────────│
19
+ │ fetch('/api/admin/*') │ EventSource('/api/admin/ │
20
+ │ │ │ events') │ │
21
+ └─────────┼─────────────────┼───────────────────┼───────────┘
22
+ │ │ │
23
+ ▼ ▼ ▼
24
+ ┌──────────────────────────────────────────────────────────┐
25
+ │ jsgui3-server (Node.js) │
26
+ │ │
27
+ │ ┌──────────────────────────────────────────────────┐ │
28
+ │ │ Admin Module (v1/server.js) │ │
29
+ │ │ │ │
30
+ │ │ ┌───────────┐ ┌───────────┐ ┌──────────────┐ │ │
31
+ │ │ │ Telemetry │ │ Snapshot │ │ SSE Broadcast│ │ │
32
+ │ │ │ Collector │ │ Endpoints │ │ Channel │ │ │
33
+ │ │ └─────┬─────┘ └─────┬─────┘ └──────┬───────┘ │ │
34
+ │ └────────┼───────────────┼───────────────┼──────────┘ │
35
+ │ │ │ │ │
36
+ │ ┌────────▼───────────────▼───────────────▼──────────┐ │
37
+ │ │ Server Internals │ │
38
+ │ │ │ │
39
+ │ │ resource_pool server_router http_servers │ │
40
+ │ │ function_pubs sse_publisher process.memoryUsage │ │
41
+ │ └────────────────────────────────────────────────────┘ │
42
+ └──────────────────────────────────────────────────────────┘
43
+ ```
44
+
45
+ ## Component Hierarchy
46
+
47
+ The admin UI is composed of nested jsgui3 controls that follow the standard lifecycle pattern. The hierarchy is:
48
+
49
+ ```
50
+ Admin_Page (extends Active_HTML_Document)
51
+ ├── Admin_Toolbar
52
+ │ ├── Button (Refresh)
53
+ │ ├── Button (Stop)
54
+ │ ├── Separator
55
+ │ ├── Button (Restart)
56
+ │ ├── Separator
57
+ │ ├── Button (Logs)
58
+ │ ├── Status_Indicator (Server Online)
59
+ │ └── Version_Label
60
+ ├── Admin_Sidebar
61
+ │ ├── Server_Identity_Card
62
+ │ ├── Nav_Section ("OVERVIEW")
63
+ │ │ ├── Nav_Item (Dashboard) [active]
64
+ │ │ ├── Nav_Item (Processes)
65
+ │ │ └── Nav_Item (Resources)
66
+ │ ├── Nav_Section ("SERVER")
67
+ │ │ ├── Nav_Item (Routes)
68
+ │ │ ├── Nav_Item (Bundles)
69
+ │ │ └── Nav_Item (API)
70
+ │ ├── Nav_Section ("DIAGNOSTICS")
71
+ │ │ ├── Nav_Item (Metrics)
72
+ │ │ ├── Nav_Item (Logs)
73
+ │ │ └── Nav_Item (Inspector)
74
+ │ ├── Health_Summary
75
+ │ └── Boot_Status
76
+ ├── Admin_Content_Area
77
+ │ ├── [Dashboard View]
78
+ │ │ ├── Stat_Card (Main Process)
79
+ │ │ ├── Stat_Card (Child Processes)
80
+ │ │ ├── Stat_Card (Resource Pool)
81
+ │ │ ├── Stat_Card (Routes)
82
+ │ │ ├── Stat_Card (Requests/Min)
83
+ │ │ ├── Process_Panel (group box)
84
+ │ │ ├── Resource_Table (group box)
85
+ │ │ ├── Tabbed_Panel (Routes & API | Build | Config | Logs)
86
+ │ │ ├── Server_Lifecycle_Diagram
87
+ │ │ ├── Config_Panel (group box)
88
+ │ │ └── Activity_Log (group box)
89
+ │ ├── [Processes View]
90
+ │ ├── [Resources View]
91
+ │ ├── [Routes View]
92
+ │ ├── [Logs View]
93
+ │ └── ...
94
+ └── Admin_Status_Bar
95
+ ├── Status_Segment (Ready status)
96
+ ├── Status_Segment (Memory)
97
+ ├── Status_Segment (Uptime)
98
+ └── Status_Segment (Requests/min)
99
+ ```
100
+
101
+ ## Data Flow Patterns
102
+
103
+ ### Pattern 1: Snapshot Polling
104
+
105
+ For data that changes infrequently (configuration, route table, resource list), the client fetches a JSON snapshot on demand:
106
+
107
+ ```
108
+ Client Server
109
+ │ │
110
+ │── GET /api/admin/snapshot ───▶│
111
+ │ │── Collects data from:
112
+ │ │ resource_pool.summary
113
+ │ │ server_router routes
114
+ │ │ process.memoryUsage()
115
+ │ │ os.cpus(), os.networkInterfaces()
116
+ │◀── 200 { snapshot } ─────────│
117
+ │ │
118
+ │── Renders controls ──────────│
119
+ ```
120
+
121
+ ### Pattern 2: SSE Real-Time Stream
122
+
123
+ For data that changes frequently (request counts, log entries, process health), the client opens an SSE connection:
124
+
125
+ ```
126
+ Client Server
127
+ │ │
128
+ │── GET /api/admin/events ────▶│
129
+ │ Accept: text/event-stream │
130
+ │ │── Opens SSE channel
131
+ │◀── event: connected ─────────│
132
+ │ │
133
+ │◀── event: request_log ───────│ (on each HTTP request)
134
+ │◀── event: resource_change ───│ (on pool state change)
135
+ │◀── event: build_complete ────│ (on bundle rebuild)
136
+ │◀── event: heartbeat ─────────│ (every 15s keep-alive)
137
+ │ │
138
+ ```
139
+
140
+ ### Pattern 3: Command Dispatch
141
+
142
+ For admin actions (restart server, rebuild bundle), the client sends POST requests:
143
+
144
+ ```
145
+ Client Server
146
+ │ │
147
+ │── POST /api/admin/action ───▶│
148
+ │ { "action": "restart" } │
149
+ │ │── Validates action
150
+ │ │── Executes action
151
+ │◀── 200 { result } ───────────│
152
+ │ │
153
+ │◀── event: server_restarting ──│ (via SSE)
154
+ │◀── event: server_ready ──────│ (via SSE)
155
+ ```
156
+
157
+ ## Isomorphic Rendering Pipeline
158
+
159
+ The admin UI follows the standard jsgui3 isomorphic pattern:
160
+
161
+ ### Server-Side (Initial Load)
162
+
163
+ 1. User navigates to `/admin`
164
+ 2. `HTTP_Webpage_Publisher` creates a `Server_Static_Page_Context`
165
+ 3. `Admin_Page` constructor runs → `compose()` builds the DOM tree server-side
166
+ 4. `ctrl.active()` is called to finalize the tree
167
+ 5. HTML is rendered to string and sent to the browser
168
+ 6. JS bundle (`/admin/js/js.js`) and CSS bundle (`/admin/css/css.css`) are included via `<script>` and `<link>` tags
169
+
170
+ ### Client-Side (Activation)
171
+
172
+ 1. Browser parses HTML — the admin UI is immediately visible (server-rendered)
173
+ 2. JS bundle loads and executes
174
+ 3. `Admin_Page.activate()` fires:
175
+ - Binds event listeners to sidebar navigation
176
+ - Opens SSE connection to `/api/admin/events`
177
+ - Fetches initial snapshot from `/api/admin/snapshot`
178
+ - Populates controls with live data
179
+
180
+ This means the admin UI has **zero time-to-first-paint** for the structural layout, with data populating as the JS bundle activates.
181
+
182
+ ## Module Boundary
183
+
184
+ The admin UI maintains a clean module boundary with the host server:
185
+
186
+ ```
187
+ Host Server (server.js) Admin Module (admin-ui/v1/server.js)
188
+ ┌────────────────────────┐ ┌────────────────────────────┐
189
+ │ │ │ │
190
+ │ resource_pool ───────▶│─────────────│▶ get_resources_tree() │
191
+ │ server_router ───────▶│─────────────│▶ get_routes_list() │
192
+ │ http_servers ───────▶│─────────────│▶ get_server_status() │
193
+ │ function_pubs ───────▶│─────────────│▶ get_publishers_list() │
194
+ │ process ───────▶│─────────────│▶ get_process_info() │
195
+ │ │ │ │
196
+ │ NO modifications to │ │ Read-only access to │
197
+ │ core server behavior │ │ server properties │
198
+ │ │ │ │
199
+ └────────────────────────┘ └────────────────────────────┘
200
+ ```
201
+
202
+ The Admin Module:
203
+ - **Reads** from `server.resource_pool`, `server.server_router`, `server.http_servers`
204
+ - **Subscribes** to events on `resource_pool` for state changes
205
+ - **Collects** Node.js `process.memoryUsage()`, `os.cpus()`, `os.uptime()`
206
+ - **Does NOT** modify how the server handles user routes or processes requests
207
+
208
+ The only write operations the admin module provides are:
209
+ - Restarting child processes (via `Process_Resource.restart()`)
210
+ - Stopping/starting resources (via `Resource_Pool.start/stop`)
211
+
212
+ These use the existing resource API surface — no new capabilities are added to the server itself.
213
+
214
+ ## File Organization
215
+
216
+ ```
217
+ admin-ui/
218
+ └── v1/
219
+ ├── client.js # Client entry — exports Admin_Page control
220
+ ├── server.js # Admin_Module class — telemetry adapter
221
+ ├── controls/
222
+ │ ├── admin_shell.js # Root shell: toolbar + sidebar + content + status bar
223
+ │ ├── stat_card.js # Reusable stat card control
224
+ │ ├── process_panel.js # Process tree with fork visualization
225
+ │ ├── resource_table.js # Resource pool table
226
+ │ ├── route_table.js # Route listing with method badges
227
+ │ ├── log_viewer.js # Scrolling log output
228
+ │ ├── build_status.js # Bundle size and build info
229
+ │ ├── config_panel.js # Configuration display/editor
230
+ │ ├── sidebar.js # Sidebar with navigation sections
231
+ │ ├── toolbar.js # Top toolbar with action buttons
232
+ │ ├── status_bar.js # Bottom status bar
233
+ │ ├── nav_item.js # Individual navigation item
234
+ │ ├── group_box.js # Classic group box with inset label
235
+ │ ├── tab_panel.js # Tabbed content switcher
236
+ │ ├── health_badge.js # Colored health indicator
237
+ │ ├── method_badge.js # HTTP method badge (GET, POST, etc.)
238
+ │ └── data_table.js # Generic sortable data table
239
+ └── css/
240
+ └── admin-tokens.css # Design tokens for the Aero theme
241
+ ```
242
+
243
+ ## Dependency Graph
244
+
245
+ ```
246
+ client.js
247
+ └── Admin_Page (extends Active_HTML_Document)
248
+ ├── Admin_Toolbar
249
+ │ └── jsgui3 controls: div, span, Button
250
+ ├── Admin_Sidebar
251
+ │ ├── Nav_Item
252
+ │ └── Health_Badge
253
+ ├── Admin_Content_Area
254
+ │ ├── Stat_Card
255
+ │ ├── Process_Panel
256
+ │ │ └── Health_Badge
257
+ │ ├── Resource_Table
258
+ │ │ ├── Data_Table
259
+ │ │ └── Health_Badge
260
+ │ ├── Route_Table
261
+ │ │ ├── Data_Table
262
+ │ │ └── Method_Badge
263
+ │ ├── Tab_Panel
264
+ │ ├── Group_Box
265
+ │ ├── Log_Viewer
266
+ │ ├── Build_Status
267
+ │ └── Config_Panel
268
+ └── Admin_Status_Bar
269
+
270
+ server.js
271
+ └── Admin_Module
272
+ ├── Reads: server.resource_pool
273
+ ├── Reads: server.server_router
274
+ ├── Reads: server.http_servers
275
+ ├── Reads: server.function_publishers
276
+ ├── Uses: HTTP_SSE_Publisher (for /api/admin/events)
277
+ └── Uses: process, os modules
278
+ ```
279
+
280
+ ## Request Routing
281
+
282
+ All admin routes live under the `/admin` and `/api/admin/` prefixes:
283
+
284
+ | Route | Method | Purpose |
285
+ |-------|--------|---------|
286
+ | `/admin` | GET | Serve the admin UI HTML page |
287
+ | `/admin/js/js.js` | GET | Client JavaScript bundle |
288
+ | `/admin/css/css.css` | GET | Extracted CSS bundle |
289
+ | `/api/admin/snapshot` | GET | Full server state snapshot |
290
+ | `/api/admin/resources` | GET | Resource pool listing |
291
+ | `/api/admin/routes` | GET | Route table |
292
+ | `/api/admin/processes` | GET | Process information |
293
+ | `/api/admin/config` | GET | Server configuration |
294
+ | `/api/admin/build` | GET | Build/bundle status |
295
+ | `/api/admin/events` | GET | SSE stream for real-time updates |
296
+ | `/api/admin/action` | POST | Execute admin action (restart, etc.) |
297
+
298
+ All endpoints are registered by the `Admin_Module.attach_to_router()` method, which receives the `server_router` from the host server.