pgserve 2.1.2 → 2.2.0

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 (227) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +105 -1
  3. package/bin/autopg-wrapper.cjs +16 -0
  4. package/bin/pgserve-wrapper.cjs +31 -6
  5. package/bin/postgres-server.js +80 -7
  6. package/console/README.md +131 -0
  7. package/console/api.js +173 -0
  8. package/console/app.jsx +483 -0
  9. package/console/colors_and_type.css +227 -0
  10. package/console/components.jsx +167 -0
  11. package/console/console.css +1666 -0
  12. package/console/data.jsx +350 -0
  13. package/console/index.html +31 -0
  14. package/console/screens/databases.jsx +5 -0
  15. package/console/screens/health.jsx +5 -0
  16. package/console/screens/ingress.jsx +5 -0
  17. package/console/screens/optimizer.jsx +5 -0
  18. package/console/screens/rlm-sim.jsx +5 -0
  19. package/console/screens/rlm-trace.jsx +5 -0
  20. package/console/screens/security.jsx +5 -0
  21. package/console/screens/settings.jsx +611 -0
  22. package/console/screens/sql.jsx +5 -0
  23. package/console/screens/sync.jsx +5 -0
  24. package/console/screens/tables.jsx +5 -0
  25. package/console/tweaks-panel.jsx +425 -0
  26. package/package.json +11 -1
  27. package/src/cli-config.cjs +310 -0
  28. package/src/cli-install.cjs +98 -11
  29. package/src/cli-restart.cjs +228 -0
  30. package/src/cli-ui.cjs +580 -0
  31. package/src/cluster.js +43 -38
  32. package/src/postgres.js +141 -19
  33. package/src/settings-loader.cjs +235 -0
  34. package/src/settings-migrate.cjs +212 -0
  35. package/src/settings-pg-args.cjs +146 -0
  36. package/src/settings-schema.cjs +422 -0
  37. package/src/settings-validator.cjs +416 -0
  38. package/src/settings-writer.cjs +288 -0
  39. package/.claude/context/windows-debug.md +0 -119
  40. package/.genie/AGENTS.md +0 -15
  41. package/.genie/agents/README.md +0 -110
  42. package/.genie/agents/analyze.md +0 -176
  43. package/.genie/agents/forge.md +0 -290
  44. package/.genie/agents/garbage-cleaner.md +0 -324
  45. package/.genie/agents/garbage-collector.md +0 -596
  46. package/.genie/agents/github-issue-gc.md +0 -618
  47. package/.genie/agents/review.md +0 -380
  48. package/.genie/agents/semantic-analyzer/find-duplicates.md +0 -90
  49. package/.genie/agents/semantic-analyzer/find-orphans.md +0 -99
  50. package/.genie/agents/semantic-analyzer.md +0 -101
  51. package/.genie/agents/update.md +0 -182
  52. package/.genie/agents/wish.md +0 -357
  53. package/.genie/brainstorms/pgserve-v2/DESIGN.md +0 -174
  54. package/.genie/code/AGENTS.md +0 -694
  55. package/.genie/code/agents/audit/risk.md +0 -173
  56. package/.genie/code/agents/audit/security.md +0 -189
  57. package/.genie/code/agents/audit.md +0 -145
  58. package/.genie/code/agents/challenge.md +0 -230
  59. package/.genie/code/agents/change-reviewer.md +0 -295
  60. package/.genie/code/agents/code-garbage-collector.md +0 -425
  61. package/.genie/code/agents/code-quality.md +0 -410
  62. package/.genie/code/agents/commit-suggester.md +0 -255
  63. package/.genie/code/agents/commit.md +0 -124
  64. package/.genie/code/agents/consensus.md +0 -204
  65. package/.genie/code/agents/daily-standup.md +0 -722
  66. package/.genie/code/agents/docgen.md +0 -48
  67. package/.genie/code/agents/explore.md +0 -79
  68. package/.genie/code/agents/fix.md +0 -100
  69. package/.genie/code/agents/git/commit-advisory.md +0 -219
  70. package/.genie/code/agents/git/workflows/issue.md +0 -244
  71. package/.genie/code/agents/git/workflows/pr.md +0 -179
  72. package/.genie/code/agents/git/workflows/release.md +0 -460
  73. package/.genie/code/agents/git/workflows/report.md +0 -342
  74. package/.genie/code/agents/git.md +0 -432
  75. package/.genie/code/agents/implementor.md +0 -161
  76. package/.genie/code/agents/install.md +0 -515
  77. package/.genie/code/agents/issue-creator.md +0 -344
  78. package/.genie/code/agents/polish.md +0 -116
  79. package/.genie/code/agents/qa.md +0 -653
  80. package/.genie/code/agents/refactor.md +0 -294
  81. package/.genie/code/agents/release.md +0 -1129
  82. package/.genie/code/agents/roadmap.md +0 -885
  83. package/.genie/code/agents/tests.md +0 -557
  84. package/.genie/code/agents/tracer.md +0 -50
  85. package/.genie/code/agents/update/upstream-update.md +0 -85
  86. package/.genie/code/agents/update/versions/generic-update.md +0 -305
  87. package/.genie/code/agents/vibe.md +0 -1317
  88. package/.genie/code/spells/agent-configuration.md +0 -58
  89. package/.genie/code/spells/automated-rc-publishing.md +0 -106
  90. package/.genie/code/spells/branch-tracker-guidance.md +0 -28
  91. package/.genie/code/spells/debug.md +0 -320
  92. package/.genie/code/spells/emoji-naming-convention.md +0 -303
  93. package/.genie/code/spells/evidence-storage.md +0 -26
  94. package/.genie/code/spells/file-naming-rules.md +0 -35
  95. package/.genie/code/spells/forge-code-blueprints.md +0 -195
  96. package/.genie/code/spells/genie-integration.md +0 -153
  97. package/.genie/code/spells/publishing-protocol.md +0 -61
  98. package/.genie/code/spells/team-consultation-protocol.md +0 -284
  99. package/.genie/code/spells/tool-requirements.md +0 -20
  100. package/.genie/code/spells/triad-maintenance-protocol.md +0 -154
  101. package/.genie/code/teams/tech-council/council.md +0 -328
  102. package/.genie/code/teams/tech-council/jt.md +0 -352
  103. package/.genie/code/teams/tech-council/nayr.md +0 -305
  104. package/.genie/code/teams/tech-council/oettam.md +0 -375
  105. package/.genie/neurons/README.md +0 -193
  106. package/.genie/neurons/forge.md +0 -106
  107. package/.genie/neurons/genie.md +0 -63
  108. package/.genie/neurons/review.md +0 -106
  109. package/.genie/neurons/wish.md +0 -104
  110. package/.genie/product/README.md +0 -20
  111. package/.genie/product/cli-automation.md +0 -359
  112. package/.genie/product/environment.md +0 -60
  113. package/.genie/product/mission.md +0 -60
  114. package/.genie/product/roadmap.md +0 -44
  115. package/.genie/product/tech-stack.md +0 -34
  116. package/.genie/product/templates/context-template.md +0 -218
  117. package/.genie/product/templates/qa-done-report-template.md +0 -68
  118. package/.genie/product/templates/review-report-template.md +0 -89
  119. package/.genie/product/templates/wish-template.md +0 -120
  120. package/.genie/scripts/helpers/analyze-commit.js +0 -195
  121. package/.genie/scripts/helpers/bullet-counter.js +0 -194
  122. package/.genie/scripts/helpers/bullet-find.js +0 -289
  123. package/.genie/scripts/helpers/bullet-id.js +0 -244
  124. package/.genie/scripts/helpers/check-secrets.js +0 -237
  125. package/.genie/scripts/helpers/count-tokens.js +0 -200
  126. package/.genie/scripts/helpers/create-frontmatter.js +0 -456
  127. package/.genie/scripts/helpers/detect-markers.js +0 -293
  128. package/.genie/scripts/helpers/detect-todos.js +0 -267
  129. package/.genie/scripts/helpers/detect-unlabeled-blocks.js +0 -135
  130. package/.genie/scripts/helpers/embeddings.js +0 -344
  131. package/.genie/scripts/helpers/find-empty-sections.js +0 -158
  132. package/.genie/scripts/helpers/index.js +0 -319
  133. package/.genie/scripts/helpers/validate-frontmatter.js +0 -578
  134. package/.genie/scripts/helpers/validate-links.js +0 -207
  135. package/.genie/scripts/helpers/validate-paths.js +0 -373
  136. package/.genie/spells/README.md +0 -9
  137. package/.genie/spells/ace-protocol.md +0 -118
  138. package/.genie/spells/ask-one-at-a-time.md +0 -175
  139. package/.genie/spells/backup-analyzer.md +0 -542
  140. package/.genie/spells/blocker.md +0 -12
  141. package/.genie/spells/break-things-move-fast.md +0 -56
  142. package/.genie/spells/context-candidates.md +0 -72
  143. package/.genie/spells/context-critic.md +0 -51
  144. package/.genie/spells/defer-to-expertise.md +0 -278
  145. package/.genie/spells/delegate-dont-do.md +0 -292
  146. package/.genie/spells/error-investigation-protocol.md +0 -328
  147. package/.genie/spells/evidence-based-completion.md +0 -273
  148. package/.genie/spells/experiment.md +0 -65
  149. package/.genie/spells/file-creation-protocol.md +0 -229
  150. package/.genie/spells/forge-integration.md +0 -281
  151. package/.genie/spells/forge-orchestration.md +0 -514
  152. package/.genie/spells/gather-context.md +0 -18
  153. package/.genie/spells/global-health-check.md +0 -34
  154. package/.genie/spells/global-noop-roundtrip.md +0 -25
  155. package/.genie/spells/install-genie.md +0 -1232
  156. package/.genie/spells/install.md +0 -82
  157. package/.genie/spells/investigate-before-commit.md +0 -112
  158. package/.genie/spells/know-yourself.md +0 -288
  159. package/.genie/spells/learn.md +0 -828
  160. package/.genie/spells/mcp-diagnostic-protocol.md +0 -246
  161. package/.genie/spells/mcp-first.md +0 -124
  162. package/.genie/spells/multi-step-execution.md +0 -67
  163. package/.genie/spells/orchestration-boundary-protocol.md +0 -256
  164. package/.genie/spells/orchestrator-not-implementor.md +0 -189
  165. package/.genie/spells/prompt.md +0 -746
  166. package/.genie/spells/reflect.md +0 -404
  167. package/.genie/spells/routing-decision-matrix.md +0 -368
  168. package/.genie/spells/run-in-parallel.md +0 -12
  169. package/.genie/spells/session-state-updater-example.md +0 -196
  170. package/.genie/spells/session-state-updater.md +0 -220
  171. package/.genie/spells/track-long-running-tasks.md +0 -133
  172. package/.genie/spells/troubleshoot-infrastructure.md +0 -176
  173. package/.genie/spells/upgrade-genie.md +0 -415
  174. package/.genie/spells/url-presentation-protocol.md +0 -301
  175. package/.genie/spells/wish-initiation.md +0 -158
  176. package/.genie/spells/wish-issue-linkage.md +0 -410
  177. package/.genie/spells/wish-lifecycle.md +0 -100
  178. package/.genie/state/provider-status.json +0 -3
  179. package/.genie/state/version.json +0 -16
  180. package/.genie/wishes/canonical-pgserve-pm2-supervision/WISH.md +0 -290
  181. package/.genie/wishes/pgserve-v2/BRIEF-from-genie-pgserve.md +0 -99
  182. package/.genie/wishes/pgserve-v2/WISH.md +0 -442
  183. package/.genie/wishes/release-system-genie-pattern/WISH.md +0 -268
  184. package/.genie/wishes/release-system-genie-pattern/validation.md +0 -205
  185. package/.gitguardian.yaml +0 -29
  186. package/.gitguardianignore +0 -16
  187. package/.github/workflows/ci.yml +0 -122
  188. package/.github/workflows/release.yml +0 -289
  189. package/.github/workflows/version.yml +0 -228
  190. package/.husky/pre-commit +0 -2
  191. package/AGENTS.md +0 -433
  192. package/CLAUDE.md +0 -1
  193. package/Makefile +0 -285
  194. package/assets/icon.ico +0 -0
  195. package/bun.lock +0 -435
  196. package/bunfig.toml +0 -28
  197. package/ecosystem.config.cjs +0 -23
  198. package/eslint.config.js +0 -63
  199. package/examples/multi-tenant-demo.js +0 -104
  200. package/install.sh +0 -123
  201. package/knip.json +0 -9
  202. package/scripts/test-bun-self-heal.sh +0 -163
  203. package/scripts/test-npx.sh +0 -60
  204. package/tests/audit.test.js +0 -189
  205. package/tests/backpressure.test.js +0 -167
  206. package/tests/benchmarks/runner.js +0 -1197
  207. package/tests/benchmarks/vector-generator.js +0 -368
  208. package/tests/cli-install.test.js +0 -322
  209. package/tests/control-db.test.js +0 -285
  210. package/tests/daemon-control.test.js +0 -171
  211. package/tests/daemon-fingerprint-integration.test.js +0 -111
  212. package/tests/daemon-pr24-regression.test.js +0 -198
  213. package/tests/fingerprint.test.js +0 -263
  214. package/tests/fixtures/240-orphan-seed.sql +0 -30
  215. package/tests/multi-tenant.test.js +0 -374
  216. package/tests/orphan-cleanup.test.js +0 -390
  217. package/tests/pg-version-regex.test.js +0 -129
  218. package/tests/quick-bench.js +0 -135
  219. package/tests/router-handshake-retry.test.js +0 -119
  220. package/tests/router-handshake-watchdog.test.js +0 -110
  221. package/tests/sdk.test.js +0 -71
  222. package/tests/stale-postmaster-pid.test.js +0 -85
  223. package/tests/stress-test.js +0 -439
  224. package/tests/sync-perf-test.js +0 -150
  225. package/tests/tcp-listen.test.js +0 -368
  226. package/tests/tenancy.test.js +0 -403
  227. package/tests/wrapper-supervision.test.js +0 -107
@@ -0,0 +1,227 @@
1
+ /* pgserve design system — tokens
2
+ * :root → MDR (dark, default)
3
+ * [data-theme=lumon] → Lumon (light)
4
+ * Components reference semantic vars (--surface-*, --text-*, --accent).
5
+ * Never reference --c-* scale tokens directly.
6
+ */
7
+
8
+ @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Inter+Tight:wght@400;500;600&display=swap');
9
+
10
+ /* ============================================================
11
+ * MDR — dark, CRT phosphor (default)
12
+ * ============================================================ */
13
+ :root {
14
+ /* surface ladder */
15
+ --c-bg-0: #080B0A;
16
+ --c-bg-1: #0E1311;
17
+ --c-bg-2: #161C1A;
18
+ --c-bg-3: #1F2725;
19
+ --c-line: #2A3331;
20
+ --c-line-strong: #3A4542;
21
+
22
+ /* text ladder */
23
+ --c-fg-0: #DCE8E2;
24
+ --c-fg-1: #99A8A2;
25
+ --c-fg-2: #5E6E68;
26
+ --c-fg-3: #3A4542;
27
+
28
+ /* accent — CRT phosphor */
29
+ --c-accent: #7DD3A4;
30
+ --c-accent-hover: #97DFB6;
31
+ --c-accent-press: #5FB988;
32
+
33
+ /* semantic — matches CLI thresholds */
34
+ --c-ok: #7DD3A4;
35
+ --c-warn: #E0B062;
36
+ --c-error: #E07B7B;
37
+ --c-info: #6FB8D6;
38
+
39
+ /* domain accents */
40
+ --c-vector: #B69BE0;
41
+ --c-audit: #D6A574;
42
+
43
+ /* semantic aliases */
44
+ --surface-canvas: var(--c-bg-0);
45
+ --surface-panel: var(--c-bg-1);
46
+ --surface-raised: var(--c-bg-2);
47
+ --surface-hover: var(--c-bg-3);
48
+ --surface-tint: color-mix(in oklab, var(--c-accent) 10%, transparent);
49
+
50
+ --line: var(--c-line);
51
+ --line-strong: var(--c-line-strong);
52
+
53
+ --text-primary: var(--c-fg-0);
54
+ --text-secondary: var(--c-fg-1);
55
+ --text-dim: var(--c-fg-2);
56
+ --text-disabled: var(--c-fg-3);
57
+
58
+ --accent: var(--c-accent);
59
+ --accent-hover: var(--c-accent-hover);
60
+ --accent-press: var(--c-accent-press);
61
+ --accent-tint: color-mix(in oklab, var(--c-accent) 14%, transparent);
62
+ --accent-line: color-mix(in oklab, var(--c-accent) 38%, transparent);
63
+
64
+ --status-ok: var(--c-ok);
65
+ --status-warn: var(--c-warn);
66
+ --status-error: var(--c-error);
67
+ --status-info: var(--c-info);
68
+ --status-vector: var(--c-vector);
69
+ --status-audit: var(--c-audit);
70
+
71
+ --select-bg: color-mix(in oklab, var(--c-accent) 22%, transparent);
72
+ --scanline-opacity: 0.04;
73
+
74
+ /* type families */
75
+ --font-mono: 'JetBrains Mono', 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace;
76
+ --font-sans: 'Inter Tight', -apple-system, system-ui, sans-serif;
77
+
78
+ /* type scale */
79
+ --t-xs: 11px; /* eyebrows / labels */
80
+ --t-sm: 12px; /* metadata, table headers */
81
+ --t-md: 13px; /* body */
82
+ --t-lg: 15px; /* emphasised body */
83
+ --t-xl: 18px; /* sub-headings */
84
+ --t-2xl: 22px; /* section titles */
85
+ --t-3xl: 28px; /* page titles */
86
+ --t-4xl: 40px; /* hero metrics */
87
+ --t-5xl: 64px; /* display */
88
+
89
+ /* line-heights */
90
+ --lh-tight: 1.05;
91
+ --lh-snug: 1.25;
92
+ --lh-base: 1.45;
93
+ --lh-prose: 1.6;
94
+
95
+ /* spacing — 4px grid */
96
+ --space-0: 0;
97
+ --space-1: 4px;
98
+ --space-2: 8px;
99
+ --space-3: 12px;
100
+ --space-4: 16px;
101
+ --space-5: 24px;
102
+ --space-6: 32px;
103
+ --space-7: 48px;
104
+ --space-8: 64px;
105
+
106
+ /* radius — minimal */
107
+ --radius-0: 0;
108
+ --radius-1: 2px;
109
+ --radius-2: 4px;
110
+
111
+ /* motion */
112
+ --ease: cubic-bezier(0.2, 0, 0, 1);
113
+ --dur-micro: 90ms;
114
+ --dur-std: 180ms;
115
+ --dur-panel: 320ms;
116
+
117
+ /* sizing */
118
+ --row-control: 28px;
119
+ --row-table: 32px;
120
+ --topbar-h: 44px;
121
+ --sidebar-w: 240px;
122
+ }
123
+
124
+ /* ============================================================
125
+ * Lumon — light, institutional fluorescent
126
+ * ============================================================ */
127
+ :root[data-theme="lumon"] {
128
+ --c-bg-0: #F2EEE6;
129
+ --c-bg-1: #FFFFFF;
130
+ --c-bg-2: #EBE5D8;
131
+ --c-bg-3: #DCD4C0;
132
+ --c-line: #C8BFA8;
133
+ --c-line-strong: #9B9075;
134
+
135
+ --c-fg-0: #0A0E14;
136
+ --c-fg-1: #3B4250;
137
+ --c-fg-2: #6B6F78;
138
+ --c-fg-3: #A0A199;
139
+
140
+ --c-accent: #1B5E8C;
141
+ --c-accent-hover: #2A75A8;
142
+ --c-accent-press: #154C73;
143
+
144
+ --c-ok: #2C7A4D;
145
+ --c-warn: #B8842C;
146
+ --c-error: #9B2C2C;
147
+ --c-info: #1B5E8C;
148
+
149
+ --c-vector: #6B4FA0;
150
+ --c-audit: #8C5A1A;
151
+
152
+ --select-bg: color-mix(in oklab, var(--c-accent) 16%, transparent);
153
+ --scanline-opacity: 0;
154
+ }
155
+
156
+ /* ============================================================
157
+ * Base
158
+ * ============================================================ */
159
+ html, body {
160
+ background: var(--surface-canvas);
161
+ color: var(--text-primary);
162
+ font-family: var(--font-mono);
163
+ font-size: var(--t-md);
164
+ line-height: var(--lh-base);
165
+ font-variant-numeric: tabular-nums slashed-zero;
166
+ -webkit-font-smoothing: antialiased;
167
+ -moz-osx-font-smoothing: grayscale;
168
+ }
169
+
170
+ *, *::before, *::after { box-sizing: border-box; }
171
+
172
+ ::selection { background: var(--select-bg); color: var(--text-primary); }
173
+
174
+ /* utility classes */
175
+ .mono { font-family: var(--font-mono); }
176
+ .sans { font-family: var(--font-sans); }
177
+ .eyebrow {
178
+ font-family: var(--font-mono);
179
+ font-size: var(--t-xs);
180
+ text-transform: uppercase;
181
+ letter-spacing: 0.08em;
182
+ color: var(--text-dim);
183
+ }
184
+ .bracket-eyebrow {
185
+ font-family: var(--font-mono);
186
+ font-size: var(--t-xs);
187
+ text-transform: uppercase;
188
+ letter-spacing: 0.08em;
189
+ color: var(--status-info);
190
+ }
191
+ .bracket-eyebrow::before { content: '['; color: var(--status-info); }
192
+ .bracket-eyebrow::after { content: ']'; color: var(--status-info); }
193
+
194
+ .dim { color: var(--text-dim); }
195
+ .fg-2 { color: var(--text-secondary); }
196
+ .fg-1 { color: var(--text-primary); }
197
+
198
+ .cursor-blink::after {
199
+ content: '▌';
200
+ display: inline-block;
201
+ margin-left: 2px;
202
+ color: var(--accent);
203
+ animation: pgsv-blink 1s steps(2) infinite;
204
+ }
205
+ @keyframes pgsv-blink { 50% { opacity: 0; } }
206
+
207
+ /* scanline overlay (MDR only) */
208
+ .scanlines {
209
+ position: relative;
210
+ isolation: isolate;
211
+ }
212
+ .scanlines::after {
213
+ content: '';
214
+ position: absolute;
215
+ inset: 0;
216
+ pointer-events: none;
217
+ background-image: repeating-linear-gradient(
218
+ to bottom,
219
+ transparent 0,
220
+ transparent 2px,
221
+ rgba(125, 211, 164, 0.5) 2px,
222
+ rgba(125, 211, 164, 0.5) 3px
223
+ );
224
+ opacity: var(--scanline-opacity);
225
+ mix-blend-mode: screen;
226
+ z-index: 1;
227
+ }
@@ -0,0 +1,167 @@
1
+ /* pgserve · atoms */
2
+ const { useState, useEffect, useRef, useMemo } = React;
3
+
4
+ const cx = (...c) => c.filter(Boolean).join(' ');
5
+
6
+ function Btn({ kind = 'default', size, children, onClick, title }) {
7
+ return (
8
+ <button
9
+ className={cx('btn', kind !== 'default' && kind, size === 'sm' && 'sm')}
10
+ onClick={onClick}
11
+ title={title}
12
+ >
13
+ {children}
14
+ </button>
15
+ );
16
+ }
17
+
18
+ function Tag({ kind, children }) {
19
+ return <span className={cx('tag', kind)}>{children}</span>;
20
+ }
21
+
22
+ function Dot({ color = 'var(--accent)' }) {
23
+ return <span style={{ width: 6, height: 6, borderRadius: '50%', background: color, display: 'inline-block' }} />;
24
+ }
25
+
26
+ function BracketH({ children, hint }) {
27
+ return (
28
+ <h3 className="bracket-h">
29
+ [ {children} ]{hint && <span className="dim">{hint}</span>}
30
+ </h3>
31
+ );
32
+ }
33
+
34
+ function Stat({ label, value, sub, accent = false, status }) {
35
+ return (
36
+ <div className="stat">
37
+ <div className="lbl">{label}</div>
38
+ <div className="val">
39
+ {accent ? <span className="accent">{value}</span> : value}
40
+ </div>
41
+ {sub && <div className="sub"><span className={status}>{sub}</span></div>}
42
+ </div>
43
+ );
44
+ }
45
+
46
+ /* CLI block-bar meter */
47
+ function MiniBar({ value, max = 100, width = 20, kind = 'ok' }) {
48
+ const filled = Math.round((value / max) * width);
49
+ const empty = Math.max(0, width - filled);
50
+ return (
51
+ <span className="mbar">
52
+ <span className={cx('blk', kind !== 'ok' && kind)}>{'█'.repeat(filled)}</span>
53
+ <span className="empty">{'░'.repeat(empty)}</span>
54
+ </span>
55
+ );
56
+ }
57
+
58
+ function Threshold({ label, value, max = 100, suffix = '%', kind = 'ok' }) {
59
+ const pct = Math.min(100, (value / max) * 100);
60
+ return (
61
+ <div className="threshold">
62
+ <span className="lbl">{label}</span>
63
+ <span className="track">
64
+ <span className={cx('fill', kind !== 'ok' && kind)} style={{ width: `${pct}%` }} />
65
+ </span>
66
+ <span className="v">{value}{suffix}</span>
67
+ </div>
68
+ );
69
+ }
70
+
71
+ /* live-tailing log line */
72
+ function LogLine({ ts, lvl = 'info', evt, msg }) {
73
+ return (
74
+ <div className="log-line">
75
+ <span className="ts">{ts}</span>
76
+ <span className={cx('lvl', lvl)}>{evt}</span>
77
+ <span className="msg">{msg}</span>
78
+ </div>
79
+ );
80
+ }
81
+
82
+ /* SVG sparkline */
83
+ function Sparkline({ data, w = 120, h = 28, color = 'var(--accent)' }) {
84
+ const max = Math.max(...data), min = Math.min(...data);
85
+ const range = max - min || 1;
86
+ const step = w / (data.length - 1);
87
+ const pts = data.map((d, i) => `${(i * step).toFixed(1)},${(h - ((d - min) / range) * (h - 4) - 2).toFixed(1)}`).join(' ');
88
+ const areaPts = `0,${h} ${pts} ${w},${h}`;
89
+ return (
90
+ <svg className="spark" width={w} height={h} viewBox={`0 0 ${w} ${h}`}>
91
+ <polygon points={areaPts} fill={color} opacity="0.12" />
92
+ <polyline points={pts} fill="none" stroke={color} strokeWidth="1.2" />
93
+ </svg>
94
+ );
95
+ }
96
+
97
+ /* fingerprint hex emphasis */
98
+ function FP({ hex }) {
99
+ return <span style={{ color: 'var(--accent)' }}>{hex}</span>;
100
+ }
101
+
102
+ /* segmented control */
103
+ function Seg({ options, value, onChange }) {
104
+ return (
105
+ <div className="seg">
106
+ {options.map(o => (
107
+ <button key={o.value} className={value === o.value ? 'on' : ''} onClick={() => onChange(o.value)}>
108
+ {o.label}
109
+ </button>
110
+ ))}
111
+ </div>
112
+ );
113
+ }
114
+
115
+ /* alert banner */
116
+ function Alert({ kind = 'warn', label, children, actions }) {
117
+ return (
118
+ <div className={cx('alert', kind)}>
119
+ <span className="lbl">{label}</span>
120
+ <span className="msg">{children}</span>
121
+ {actions && <span className="actions">{actions}</span>}
122
+ </div>
123
+ );
124
+ }
125
+
126
+ /* score chip 0..100 */
127
+ function Score({ value, max = 100 }) {
128
+ const kind = value >= 80 ? 'ok' : value >= 60 ? 'warn' : 'err';
129
+ return (
130
+ <span className={cx('score', kind)}>
131
+ <span className="v">{value}</span>
132
+ <span className="max">/{max}</span>
133
+ </span>
134
+ );
135
+ }
136
+
137
+ /* bracket-eyebrow */
138
+ function Eyebrow({ children, info = true }) {
139
+ return <span className={info ? 'bracket-eyebrow' : 'eyebrow'}>{children}</span>;
140
+ }
141
+
142
+ /* placeholder for screens not yet implemented in v1; renders inside the
143
+ * standard <page> shell so navigation chrome stays consistent and the
144
+ * sidebar reads "[ coming soon ]" rather than blowing the React tree up. */
145
+ function ComingSoon({ title, crumb }) {
146
+ return (
147
+ <div className="page">
148
+ <div className="page-head">
149
+ <h1>{title}</h1>
150
+ {crumb && <span className="crumb">{crumb}</span>}
151
+ </div>
152
+ <div className="panel" style={{ padding: 32, textAlign: 'center' }}>
153
+ <div style={{ fontSize: 14, letterSpacing: '0.08em', textTransform: 'uppercase', color: 'var(--text-dim)' }}>
154
+ [ coming soon ]
155
+ </div>
156
+ <div style={{ marginTop: 12, fontSize: 12, color: 'var(--text-dim)' }}>
157
+ this screen scaffolds the autopg-console-settings wish; a future wish ships its content.
158
+ </div>
159
+ </div>
160
+ </div>
161
+ );
162
+ }
163
+
164
+ Object.assign(window, {
165
+ cx, Btn, Tag, Dot, BracketH, Stat, MiniBar, Threshold, LogLine,
166
+ Sparkline, FP, Seg, Alert, Score, Eyebrow, ComingSoon,
167
+ });