jsgui3-server 0.0.148 → 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 (154) hide show
  1. package/.github/agents/Mobile Developer.agent.md +89 -0
  2. package/.github/workflows/control-scan-manifest-check.yml +31 -0
  3. package/AGENTS.md +4 -0
  4. package/README.md +215 -3
  5. package/admin-ui/client.js +81 -51
  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/dev-status.svg +139 -0
  15. package/docs/admin-extension-guide.md +345 -0
  16. package/docs/api-reference.md +301 -43
  17. package/docs/books/adaptive-control-improvements/01-control-candidate-matrix.md +122 -0
  18. package/docs/books/adaptive-control-improvements/02-tier-1-layout-playbooks.md +207 -0
  19. package/docs/books/adaptive-control-improvements/03-tier-2-navigation-form-overlay.md +140 -0
  20. package/docs/books/adaptive-control-improvements/04-cross-cutting-platform-functionality.md +141 -0
  21. package/docs/books/adaptive-control-improvements/05-styling-theming-density-upgrades.md +114 -0
  22. package/docs/books/adaptive-control-improvements/06-testing-quality-gates.md +97 -0
  23. package/docs/books/adaptive-control-improvements/07-delivery-roadmap-and-ownership.md +137 -0
  24. package/docs/books/adaptive-control-improvements/08-appendix-tier1-acceptance-and-pr-templates.md +261 -0
  25. package/docs/books/adaptive-control-improvements/README.md +66 -0
  26. package/docs/books/admin-ui-authentication/01-threat-model-and-goals.md +124 -0
  27. package/docs/books/admin-ui-authentication/02-session-model-and-token-model.md +75 -0
  28. package/docs/books/admin-ui-authentication/03-auth-middleware-patterns.md +77 -0
  29. package/docs/books/admin-ui-authentication/README.md +25 -0
  30. package/docs/books/creating-a-new-admin-ui/01-introduction-and-vision.md +130 -0
  31. package/docs/books/creating-a-new-admin-ui/02-architecture-and-data-flow.md +298 -0
  32. package/docs/books/creating-a-new-admin-ui/03-server-introspection.md +381 -0
  33. package/docs/books/creating-a-new-admin-ui/04-admin-module-adapter-layer.md +592 -0
  34. package/docs/books/creating-a-new-admin-ui/05-domain-controls-stat-cards-and-gauges.md +513 -0
  35. package/docs/books/creating-a-new-admin-ui/06-domain-controls-process-manager.md +544 -0
  36. package/docs/books/creating-a-new-admin-ui/07-domain-controls-resource-pool-inspector.md +493 -0
  37. package/docs/books/creating-a-new-admin-ui/08-domain-controls-route-table-and-api-explorer.md +586 -0
  38. package/docs/books/creating-a-new-admin-ui/09-domain-controls-log-viewer-and-activity-feed.md +490 -0
  39. package/docs/books/creating-a-new-admin-ui/10-domain-controls-build-status-and-bundle-inspector.md +526 -0
  40. package/docs/books/creating-a-new-admin-ui/11-domain-controls-configuration-panel.md +808 -0
  41. package/docs/books/creating-a-new-admin-ui/12-admin-shell-layout-sidebar-navigation.md +210 -0
  42. package/docs/books/creating-a-new-admin-ui/13-telemetry-integration.md +556 -0
  43. package/docs/books/creating-a-new-admin-ui/14-realtime-sse-observable-integration.md +485 -0
  44. package/docs/books/creating-a-new-admin-ui/15-styling-theming-aero-design-system.md +521 -0
  45. package/docs/books/creating-a-new-admin-ui/16-testing-and-quality-assurance.md +147 -0
  46. package/docs/books/creating-a-new-admin-ui/17-next-steps-process-resource-roadmap.md +356 -0
  47. package/docs/books/creating-a-new-admin-ui/README.md +68 -0
  48. package/docs/books/device-adaptive-composition/01-platform-feature-audit.md +177 -0
  49. package/docs/books/device-adaptive-composition/02-responsive-composition-model.md +187 -0
  50. package/docs/books/device-adaptive-composition/03-data-model-vs-view-model.md +231 -0
  51. package/docs/books/device-adaptive-composition/04-styling-theme-breakpoints.md +234 -0
  52. package/docs/books/device-adaptive-composition/05-showcase-app-multi-device-assessment.md +193 -0
  53. package/docs/books/device-adaptive-composition/06-implementation-patterns-and-apis.md +346 -0
  54. package/docs/books/device-adaptive-composition/07-testing-harness-and-quality-gates.md +265 -0
  55. package/docs/books/device-adaptive-composition/08-roadmap-and-adoption-plan.md +250 -0
  56. package/docs/books/device-adaptive-composition/README.md +47 -0
  57. package/docs/books/jsgui3-bundling-research-book/00-table-of-contents.md +35 -0
  58. package/docs/books/jsgui3-bundling-research-book/01-pipeline-and-runtime-semantics.md +34 -0
  59. package/docs/books/jsgui3-bundling-research-book/02-javascript-bundling-core.md +36 -0
  60. package/docs/books/jsgui3-bundling-research-book/03-style-extraction-and-css-compilation.md +35 -0
  61. package/docs/books/jsgui3-bundling-research-book/04-static-publishing-and-delivery.md +39 -0
  62. package/docs/books/jsgui3-bundling-research-book/05-current-limits-and-size-bloat-vectors.md +25 -0
  63. package/docs/books/jsgui3-bundling-research-book/06-unused-module-elimination-strategy.md +77 -0
  64. package/docs/books/jsgui3-bundling-research-book/07-jsgui3-html-control-and-mixin-pruning.md +63 -0
  65. package/docs/books/jsgui3-bundling-research-book/08-test-and-verification-methodology.md +43 -0
  66. package/docs/books/jsgui3-bundling-research-book/09-roadmap-and-rollout.md +42 -0
  67. package/docs/books/jsgui3-bundling-research-book/10-further-research-strategies-and-upgrades.md +211 -0
  68. package/docs/books/jsgui3-bundling-research-book/README.md +35 -0
  69. package/docs/bundling-system-deep-dive.md +9 -4
  70. package/docs/comparison-report-express-plex-cpanel.md +549 -0
  71. package/docs/comprehensive-documentation.md +49 -18
  72. package/docs/configuration-reference.md +152 -27
  73. package/docs/core/README.md +19 -0
  74. package/docs/core/jsgui3-server-core-book/00-table-of-contents.md +21 -0
  75. package/docs/core/jsgui3-server-core-book/01-startup-readiness-state-machine.md +41 -0
  76. package/docs/core/jsgui3-server-core-book/02-resource-abstraction-and-lifecycle.md +92 -0
  77. package/docs/core/jsgui3-server-core-book/03-resource-pool-and-event-topology.md +47 -0
  78. package/docs/core/jsgui3-server-core-book/04-sse-publisher-semantics.md +41 -0
  79. package/docs/core/jsgui3-server-core-book/05-serve-factory-resource-wiring.md +46 -0
  80. package/docs/core/jsgui3-server-core-book/06-e2e-testing-methodology.md +48 -0
  81. package/docs/core/jsgui3-server-core-book/07-defect-detection-and-hardening-loop.md +47 -0
  82. package/docs/designs/server-admin-interface-aero.svg +611 -0
  83. package/docs/publishers-guide.md +59 -4
  84. package/docs/resources-guide.md +184 -35
  85. package/docs/simple-server-api-design.md +72 -17
  86. package/docs/system-architecture.md +18 -14
  87. package/docs/troubleshooting.md +84 -53
  88. package/examples/controls/15) window, observable SSE/server.js +6 -1
  89. package/examples/controls/19) window, auto observable ui/server.js +9 -0
  90. package/examples/controls/20) window, task manager app/README.md +133 -0
  91. package/examples/controls/20) window, task manager app/client.js +797 -0
  92. package/examples/controls/20) window, task manager app/server.js +178 -0
  93. package/examples/controls/6) window, color_palette/client.js +165 -68
  94. package/examples/controls/9) window, date picker/client.js +362 -76
  95. package/examples/controls/9b) window, shared data.model mirrored date pickers/client.js +104 -83
  96. package/examples/jsgui3-html/06) theming/client.js +22 -1
  97. package/examples/jsgui3-html/10) binding-debugger/client.js +137 -1
  98. package/http/responders/static/Static_Route_HTTP_Responder.js +52 -34
  99. package/lab/experiments/capture-color-controls.js +196 -0
  100. package/lab/results/screenshots/color-controls/full_page.png +0 -0
  101. package/lab/results/screenshots/color-controls/section_1_color_grid_12x12.png +0 -0
  102. package/lab/results/screenshots/color-controls/section_2_color_grid_4x2.png +0 -0
  103. package/lab/results/screenshots/color-controls/section_3_color_palette.png +0 -0
  104. package/lab/results/screenshots/color-controls/section_4_palette_comparison.png +0 -0
  105. package/lab/results/screenshots/color-controls/section_5_raw_swatches.png +0 -0
  106. package/lab/results/screenshots/color-controls/section_6_optimized_crayola.png +0 -0
  107. package/lab/results/screenshots/color-controls/section_7_pastel_palette.png +0 -0
  108. package/lab/results/screenshots/color-controls/section_8_extended_144.png +0 -0
  109. package/lab/screenshot-utils.js +248 -0
  110. package/module.js +12 -0
  111. package/package.json +12 -2
  112. package/publishers/Publishers.js +4 -3
  113. package/publishers/helpers/assigners/static-compressed-response-buffers/Single_Control_Webpage_Server_Static_Compressed_Response_Buffers_Assigner.js +5 -5
  114. package/publishers/http-sse-publisher.js +341 -0
  115. package/resources/process-resource.js +950 -0
  116. package/resources/processors/bundlers/js/esbuild/Advanced_JS_Bundler_Using_ESBuild.js +129 -33
  117. package/resources/processors/bundlers/js/esbuild/Core_JS_Non_Minifying_Bundler_Using_ESBuild.js +18 -7
  118. package/resources/processors/bundlers/js/esbuild/JSGUI3_HTML_Control_Optimizer.js +829 -0
  119. package/resources/remote-process-resource.js +355 -0
  120. package/resources/server-resource-pool.js +354 -41
  121. package/serve-factory.js +442 -259
  122. package/server.js +288 -13
  123. package/tests/README.md +71 -4
  124. package/tests/admin-ui-jsgui-controls.test.js +581 -0
  125. package/tests/admin-ui-render.test.js +24 -0
  126. package/tests/assigners.test.js +56 -40
  127. package/tests/bundling-default-control-elimination.puppeteer.test.js +260 -0
  128. package/tests/configuration-validation.test.js +21 -18
  129. package/tests/content-analysis.test.js +7 -6
  130. package/tests/control-optimizer-cache-behavior.test.js +52 -0
  131. package/tests/control-scan-manifest-regression.test.js +144 -0
  132. package/tests/end-to-end.test.js +15 -14
  133. package/tests/error-handling.test.js +222 -179
  134. package/tests/fixtures/bundling-default-button-client.js +37 -0
  135. package/tests/fixtures/bundling-default-window-client.js +34 -0
  136. package/tests/fixtures/control_scan_manifest_expectations.json +48 -0
  137. package/tests/fixtures/resource-monitor-client.js +319 -0
  138. package/tests/helpers/puppeteer-e2e-harness.js +317 -0
  139. package/tests/http-sse-publisher.test.js +136 -0
  140. package/tests/performance.test.js +69 -65
  141. package/tests/process-resource.test.js +138 -0
  142. package/tests/publishers.test.js +7 -7
  143. package/tests/remote-process-resource.test.js +160 -0
  144. package/tests/sass-controls.e2e.test.js +7 -1
  145. package/tests/serve-resources.test.js +270 -0
  146. package/tests/serve.test.js +120 -50
  147. package/tests/server-resource-pool.test.js +106 -0
  148. package/tests/small-controls-bundle-size.test.js +252 -0
  149. package/tests/test-runner.js +14 -1
  150. package/tests/window-examples.puppeteer.test.js +204 -1
  151. package/tests/window-resource-integration.puppeteer.test.js +585 -0
  152. package/tests/temp_invalid.js +0 -7
  153. package/tests/temp_invalid_utf8.js +0 -1
  154. package/tests/temp_malformed.js +0 -10
@@ -0,0 +1,381 @@
1
+ # Chapter 3: Server Introspection — What Data Is Available
2
+
3
+ ## Purpose
4
+
5
+ Before designing any UI control, we must know precisely what data the server can provide. This chapter is an exhaustive audit of every data source within a running jsgui3-server instance, organized by category. For each data source, we document:
6
+
7
+ - **Where it lives** (which object/property)
8
+ - **What it contains** (shape and types)
9
+ - **How to access it** (read pattern)
10
+ - **Update frequency** (static vs. dynamic)
11
+ - **Admin UI control** that will display it
12
+
13
+ ---
14
+
15
+ ## 1. Main Process Information
16
+
17
+ ### Source: `process` (Node.js global)
18
+
19
+ | Data Point | Access | Shape | Frequency |
20
+ |-----------|--------|-------|-----------|
21
+ | Process ID | `process.pid` | `number` | Static |
22
+ | Memory usage | `process.memoryUsage()` | `{ rss, heapTotal, heapUsed, external, arrayBuffers }` (bytes) | Dynamic — sample on demand |
23
+ | Uptime | `process.uptime()` | `number` (seconds) | Dynamic — always changing |
24
+ | Node.js version | `process.version` | `string` (e.g., `'v20.11.0'`) | Static |
25
+ | Platform | `process.platform` | `string` (e.g., `'win32'`, `'linux'`) | Static |
26
+ | Architecture | `process.arch` | `string` (e.g., `'x64'`) | Static |
27
+ | Command-line args | `process.argv` | `string[]` | Static |
28
+ | Working directory | `process.cwd()` | `string` | Static |
29
+ | Environment (selected) | `process.env.PORT`, `process.env.JSGUI_DEBUG`, etc. | `string \| undefined` | Static |
30
+ | CPU usage | `process.cpuUsage()` | `{ user, system }` (microseconds) | Dynamic — sample on demand |
31
+
32
+ **Admin UI controls**: Stat_Card (PID, memory), Status_Bar (uptime), Version_Label
33
+
34
+ ### Source: `os` module
35
+
36
+ | Data Point | Access | Shape | Frequency |
37
+ |-----------|--------|-------|-----------|
38
+ | CPU info | `os.cpus()` | `Array<{ model, speed, times }>` | Semi-static |
39
+ | Total memory | `os.totalmem()` | `number` (bytes) | Static |
40
+ | Free memory | `os.freemem()` | `number` (bytes) | Dynamic |
41
+ | Hostname | `os.hostname()` | `string` | Static |
42
+ | Network interfaces | `os.networkInterfaces()` | `{ [name]: Array<{ address, family, ... }> }` | Semi-static |
43
+ | OS type | `os.type()` | `string` | Static |
44
+ | Uptime (OS) | `os.uptime()` | `number` (seconds) | Dynamic |
45
+
46
+ **Admin UI controls**: Config_Panel, Status_Bar
47
+
48
+ ---
49
+
50
+ ## 2. Server Instance Properties
51
+
52
+ ### Source: `server` (JSGUI_Single_Process_Server instance)
53
+
54
+ | Property | Type | Description | Available |
55
+ |----------|------|-------------|-----------|
56
+ | `server.name` | `string` | Server name (from spec) | Always |
57
+ | `server.debug` | `boolean` | Debug mode flag | Always |
58
+ | `server.Ctrl` | `function \| undefined` | Main control constructor | If single-ctrl mode |
59
+ | `server.disk_path_client_js` | `string \| undefined` | Path to client.js entry | If JS bundling active |
60
+ | `server.http_servers` | `Array<http.Server>` | Bound HTTP/HTTPS server instances | After start() |
61
+ | `server.resource_pool` | `Server_Resource_Pool` | The resource pool | Always |
62
+ | `server.server_router` | `Router` | The HTTP router | Always |
63
+ | `server.admin` | `Admin_Module` | Admin module instance | Always |
64
+ | `server.function_publishers` | `Array<HTTP_Function_Publisher>` | Published API functions | After publish() calls |
65
+ | `server.sse_publisher` | `HTTP_SSE_Publisher \| undefined` | SSE event publisher | If events configured |
66
+ | `server._ws_publisher` | `HTTP_Website_Publisher \| undefined` | Website publisher | If website mode |
67
+ | `server._started` | `boolean` | Whether start() has been called | After start() |
68
+ | `server.port` | `number` | Bound port number | After start() |
69
+ | `server.allowed_addresses` | `string[] \| undefined` | IP address filter | If host specified |
70
+ | `server.https_options` | `object \| undefined` | TLS configuration | If HTTPS enabled |
71
+
72
+ **Admin UI controls**: Stat_Card, Config_Panel, Status_Bar, Toolbar
73
+
74
+ ### Derived Data from `server.http_servers`
75
+
76
+ Each `http.Server` instance provides:
77
+
78
+ | Data Point | Access | Shape |
79
+ |-----------|--------|-------|
80
+ | Listening address | `server.address()` | `{ address, family, port }` |
81
+ | Connection count | `server.getConnections(cb)` | `number` (async) |
82
+ | Timeout setting | `server.timeout` | `number` (ms) |
83
+ | Keep-alive timeout | `server.keepAliveTimeout` | `number` (ms) |
84
+
85
+ **Admin UI controls**: Stat_Card (connections), Config_Panel (timeouts)
86
+
87
+ ---
88
+
89
+ ## 3. Resource Pool
90
+
91
+ ### Source: `server.resource_pool` (Server_Resource_Pool)
92
+
93
+ #### Pool-Level Data
94
+
95
+ | Property/Method | Return Type | Description |
96
+ |----------------|-------------|-------------|
97
+ | `pool.summary` | `{ total, running, stopped, crashed, unreachable, byType }` | Aggregate statistics |
98
+ | `pool.resource_names` | `string[]` (inherited) | List of registered resource names |
99
+ | `pool.get_resource(name)` | `Resource \| undefined` | Get specific resource |
100
+ | `pool.get_resources_by_type(type)` | `Resource[]` | Filter by constructor/type |
101
+
102
+ #### Per-Resource Data
103
+
104
+ Every resource in the pool provides:
105
+
106
+ | Property | Type | Description |
107
+ |----------|------|-------------|
108
+ | `resource.name` | `string` | Resource name |
109
+ | `resource.constructor.name` | `string` | Class name (e.g., `'Router'`, `'Website_Resource'`) |
110
+ | `resource.__type_name` | `string \| undefined` | Type name override |
111
+ | `resource.state` | `string` | Current state |
112
+ | `resource.status` | `object` | Status object (varies by type) |
113
+
114
+ **Typical resources in a running server:**
115
+
116
+ | Name | Constructor | Notes |
117
+ |------|-------------|-------|
118
+ | `'Local Server Info'` | `Local_Server_Info` | OS info provider |
119
+ | `'Server Router'` | `Router` | HTTP routing |
120
+ | `'Admin_Publisher'` | `HTTP_Webpage_Publisher` | Admin UI publisher |
121
+ | `'Website_Resource - Single Webpage'` | `Website_Resource` | User's page |
122
+ | Any published function | `HTTP_Function_Publisher` | API endpoint |
123
+ | Custom resources | Varies | User-configured resources |
124
+
125
+ #### Pool Events
126
+
127
+ | Event | Payload | Trigger |
128
+ |-------|---------|---------|
129
+ | `'resource_state_change'` | `{ resourceName, from, to, timestamp }` | Resource state transition |
130
+ | `'crashed'` | `{ resourceName, code?, signal?, ... }` | Resource crash |
131
+ | `'unhealthy'` | `{ resourceName, consecutiveFailures, ... }` | Health check failures |
132
+ | `'unreachable'` | `{ resourceName, consecutiveFailures, error }` | Remote resource unreachable |
133
+ | `'recovered'` | `{ resourceName, status }` | Resource recovery |
134
+ | `'removed'` | `{ resourceName, timestamp }` | Resource removed from pool |
135
+
136
+ **Admin UI controls**: Resource_Table, Health_Badge, Activity_Log
137
+
138
+ ---
139
+
140
+ ## 4. Router & Routes
141
+
142
+ ### Source: `server.server_router` (Router)
143
+
144
+ The Router stores routes internally. To enumerate them for the admin UI, we need an adapter method since the Router doesn't natively expose a `list_routes()` API.
145
+
146
+ #### What we know from `set_route` calls:
147
+
148
+ Each route registration contains:
149
+ - **Path** — e.g., `/`, `/admin`, `/api/admin/resources`, `/js/js.js`
150
+ - **Responder object** — The publisher or handler instance
151
+ - **Handler function** — The `handle_http` method reference
152
+
153
+ #### Route categories (by responder type):
154
+
155
+ | Category | Responder Type | Examples |
156
+ |----------|---------------|----------|
157
+ | Auto (webpage) | `Static_Route_HTTP_Responder` | `/`, `/js/js.js`, `/css/css.css` |
158
+ | API | `HTTP_Function_Publisher` | `/api/validateUser`, `/api/register` |
159
+ | Observable | `HTTP_Observable_Publisher` | `/api/metrics` |
160
+ | SSE | `HTTP_SSE_Publisher` | `/events`, `/api/admin/events` |
161
+ | Admin | Various | `/admin`, `/api/admin/*` |
162
+ | Static | `Static_Route_HTTP_Responder` | `/static/*` |
163
+ | Website | `HTTP_Website_Publisher` | `/*` (catch-all for multi-page) |
164
+
165
+ **Adapter needed**: The `Admin_Module` will need to track routes as they are registered (by instrumenting `set_route`) or by reading the router's internal data structure.
166
+
167
+ **Admin UI controls**: Route_Table, Method_Badge, Stat_Card (route count)
168
+
169
+ ---
170
+
171
+ ## 5. Publishers
172
+
173
+ ### Function Publishers
174
+
175
+ Source: `server.function_publishers` (Array)
176
+
177
+ Each `HTTP_Function_Publisher` provides:
178
+ | Property | Type | Description |
179
+ |----------|------|-------------|
180
+ | `publisher.name` | `string` | Function name |
181
+ | `publisher.fn` | `function` | The actual function |
182
+
183
+ **Admin UI controls**: Route_Table (API rows), API Explorer
184
+
185
+ ### Observable Publishers
186
+
187
+ Each `HTTP_Observable_Publisher` provides:
188
+ | Property/Method | Type | Description |
189
+ |----------------|------|-------------|
190
+ | `publisher.obs` | `object` | Source observable |
191
+ | `publisher.schema` | `object \| undefined` | Observable schema |
192
+ | `publisher.is_paused` | `boolean` | Pause state |
193
+ | `publisher.active_sse_connections` | `Set` | Connected clients |
194
+ | `publisher.pause()` | method | Pause streaming |
195
+ | `publisher.resume()` | method | Resume streaming |
196
+ | `publisher.stop()` | method | Disconnect all clients |
197
+
198
+ **Admin UI controls**: Observable inspector, connection count badges
199
+
200
+ ### SSE Publishers
201
+
202
+ Each `HTTP_SSE_Publisher` provides:
203
+ | Property/Method | Type | Description |
204
+ |----------------|------|-------------|
205
+ | `publisher.clients` | `Map` | Connected clients with metadata |
206
+ | `publisher.event_history` | `Array` | Recent event log |
207
+ | `publisher.next_event_id` | `number` | Event ID counter |
208
+ | `publisher.broadcast(event, data)` | method | Send to all clients |
209
+ | `publisher.send(clientId, event, data)` | method | Send to one client |
210
+
211
+ **Admin UI controls**: SSE inspector, event history viewer
212
+
213
+ ---
214
+
215
+ ## 6. Build & Bundle Information
216
+
217
+ ### Source: `HTTP_Webpage_Publisher` (ready event)
218
+
219
+ When the publisher emits `'ready'`, it provides a bundle array:
220
+
221
+ ```javascript
222
+ bundle._arr = [
223
+ {
224
+ type: 'js',
225
+ extension: '.js',
226
+ route: '/js/js.js',
227
+ text: '...bundled JavaScript...',
228
+ response_buffers: { identity: Buffer, gzip?: Buffer, br?: Buffer },
229
+ response_headers: { identity: {}, gzip?: {}, br?: {} }
230
+ },
231
+ {
232
+ type: 'css',
233
+ extension: '.css',
234
+ route: '/css/css.css',
235
+ text: '...extracted CSS...',
236
+ response_buffers: { identity: Buffer, gzip?: Buffer, br?: Buffer },
237
+ response_headers: { identity: {}, gzip?: {}, br?: {} }
238
+ },
239
+ {
240
+ type: 'html',
241
+ extension: '.html',
242
+ route: '/',
243
+ text: '<!DOCTYPE html>...',
244
+ response_buffers: { identity: Buffer },
245
+ response_headers: { identity: {} }
246
+ }
247
+ ]
248
+ ```
249
+
250
+ From each bundle item, we can derive:
251
+
252
+ | Data Point | Derivation | Description |
253
+ |-----------|------------|-------------|
254
+ | Bundle size (identity) | `response_buffers.identity.length` | Uncompressed size |
255
+ | Bundle size (gzip) | `response_buffers.gzip?.length` | Gzip-compressed size |
256
+ | Bundle size (brotli) | `response_buffers.br?.length` | Brotli-compressed size |
257
+ | Route path | `item.route` | Where the bundle is served |
258
+ | Source text length | `item.text.length` | Raw text size |
259
+
260
+ **Current limitation**: Build timing is not tracked. The `Admin_Module` adapter will need to record the timestamp when the `'ready'` event fires to calculate build duration.
261
+
262
+ **Admin UI controls**: Build_Status, Stat_Card (bundle sizes)
263
+
264
+ ---
265
+
266
+ ## 7. Request Telemetry
267
+
268
+ ### Current State: Not Available
269
+
270
+ The server currently does **not** track request counts, response times, or status code distributions. The `process_request` function in `server.start()` handles requests synchronously and does not emit events.
271
+
272
+ ### Adapter Needed
273
+
274
+ To provide request telemetry to the admin UI, the `Admin_Module` will need to:
275
+
276
+ 1. **Instrument the request handler** — Wrap `process_request` to record:
277
+ - Request timestamp
278
+ - Method and URL
279
+ - Response status code
280
+ - Response time (ms)
281
+
282
+ 2. **Maintain a rolling window** — Keep the last N requests (e.g., 1000) in a circular buffer
283
+
284
+ 3. **Calculate aggregates** — Requests/minute, average response time, error rate
285
+
286
+ This is a lightweight adapter — **not** a new platform feature. It wraps existing functionality without modifying the core request flow.
287
+
288
+ **Admin UI controls**: Stat_Card (requests/min), Activity_Log, Metrics view
289
+
290
+ ---
291
+
292
+ ## 8. Process Resources (Child Processes)
293
+
294
+ ### Source: Resources of type `Process_Resource` in the pool
295
+
296
+ Each `Process_Resource` provides rich telemetry:
297
+
298
+ | Property | Type | Update Frequency |
299
+ |----------|------|-----------------|
300
+ | `state` | `'stopped' \| 'starting' \| 'running' \| 'stopping' \| 'restarting' \| 'crashed'` | On state change |
301
+ | `pid` | `number \| null` | On start/stop |
302
+ | `memory_usage` | `{ rssBytes, cpuPercent?, source, timestamp }` | On demand |
303
+ | `restart_count` | `number` | On restart |
304
+ | `last_health_check` | `object` | Periodic |
305
+ | `status` | Full status object | On demand |
306
+ | `child_process` | Node `ChildProcess` | While running |
307
+
308
+ Events from `Process_Resource`:
309
+ - `'state_change'` — `{ from, to, timestamp }`
310
+ - `'stdout'` — `{ line, pid, timestamp }`
311
+ - `'stderr'` — `{ line, pid, timestamp }`
312
+ - `'exit'` — `{ code, signal, timestamp }`
313
+ - `'health_check'` — `{ healthy, latencyMs, timestamp }`
314
+ - `'unhealthy'` — `{ consecutiveFailures, timestamp }`
315
+ - `'crashed'` — `{ code, signal, restartCount, timestamp }`
316
+
317
+ **Admin UI controls**: Process_Panel, Health_Badge, Activity_Log
318
+
319
+ ---
320
+
321
+ ## 9. Remote Process Resources
322
+
323
+ ### Source: Resources of type `Remote_Process_Resource` in the pool
324
+
325
+ | Property | Type | Update Frequency |
326
+ |----------|------|-----------------|
327
+ | `state` | `'stopped' \| 'running' \| 'unreachable'` | On poll |
328
+ | `host`, `port`, `protocol` | `string`, `number`, `string` | Static |
329
+ | `last_polled_status` | `object` | On poll |
330
+ | `last_polled_at` | `number` (timestamp) | On poll |
331
+ | `consecutive_failures` | `number` | On poll |
332
+ | `history` | `Array<{ timestamp, status, state, reachable, error? }>` | On poll |
333
+
334
+ **Admin UI controls**: Resource_Table, Health_Badge
335
+
336
+ ---
337
+
338
+ ## 10. Configuration Data
339
+
340
+ ### Directly Available
341
+
342
+ | Config Key | Source | Editable? |
343
+ |-----------|--------|-----------|
344
+ | Port | `server.port` | No (requires restart) |
345
+ | Debug mode | `server.debug` | Potentially (togglable at runtime) |
346
+ | Server name | `server.name` | No |
347
+ | Client JS path | `server.disk_path_client_js` | No |
348
+ | HTTPS enabled | `!!server.https_options` | No |
349
+ | Allowed addresses | `server.allowed_addresses` | No |
350
+
351
+ ### From `Server.serve()` Options (if used)
352
+
353
+ | Config Key | Source | Notes |
354
+ |-----------|--------|-------|
355
+ | Style config | `spec.style` | Passed to publisher |
356
+ | Bundler config | `spec.bundler` | Compression, minification settings |
357
+ | Auto-port | Derived | Whether port was auto-selected |
358
+
359
+ **Admin UI controls**: Config_Panel
360
+
361
+ ---
362
+
363
+ ## 11. Data Availability Summary
364
+
365
+ | Category | Available Now | Adapter Needed | Notes |
366
+ |----------|:------------:|:--------------:|-------|
367
+ | Main process info | ✅ | — | Node.js `process` + `os` |
368
+ | Server properties | ✅ | — | Direct property access |
369
+ | Resource pool listing | ✅ | Minor | Pool `summary` + per-resource iteration |
370
+ | Resource health events | ✅ | — | Pool events already fire |
371
+ | Route listing | ⚠️ | Yes | Router doesn't expose route list natively |
372
+ | Function publishers | ✅ | Minor | `server.function_publishers` array |
373
+ | Observable publishers | ⚠️ | Yes | Not tracked in a central registry |
374
+ | SSE publisher state | ✅ | Minor | Direct property access |
375
+ | Build/bundle info | ⚠️ | Yes | Need to capture `ready` event data |
376
+ | Request telemetry | ❌ | Yes | Request handler instrumentation needed |
377
+ | Process resources | ✅ | — | Full status API on Process_Resource |
378
+ | Remote process resources | ✅ | — | Full status API on Remote_Process_Resource |
379
+ | Configuration | ✅ | Minor | Direct property access |
380
+
381
+ The next chapter details exactly what adapter code the `Admin_Module` needs to bridge these gaps.