Docs  /  Brainstorm: PHP Plugin Panels — Graphs + Local / Remote Control

Brainstorm: PHP Plugin Panels — Graphs + Local / Remote Control

Status: Design brainstorm (extends existing portals; not all panels shipped)
Related: PhpGraphs.md · MinecraftWebDashboard.md · ProgramStatePortal.md · IisPhpIntegration.md · DearImGuiFeatures.md · BrainstormIntegrations.md


1. Goal

Grow a plugin-panel system in PHP so operators can:

  1. See more graphs (ops, RL, Minecraft, math, discovery, network).
  2. Control local and remote _AI / Spigot safely (same command strings as typed console, with tokens + dry-run).
  3. Mirror the Dear ImGui idea of lazy plugin panels — register panels in a catalog; only load what you open.

PHP stays primarily a visualization + gated control edge. Heavy compute stays in C++ / Spigot.

┌─────────────────────────────────────────────────────────────┐
│  Browser  —  PHP Plugin Panel Host (index.php + panels/*)   │
│   Charts (Chart.js / ECharts)  ·  Control forms  ·  Layout  │
└───────────────┬─────────────────────────────┬───────────────┘
                │ read JSON                    │ POST control
                ▼                              ▼
     state.json / graphs/*.json      control.php → signed enqueue
                ▲                              │
                │ export                       ▼
     portal / graphs export          _AI CommandQueue / remote :7710
     Minecraft WebDashboard :8787    Spigot /ai … (optional bridge)

2. Panel host architecture (PHP)

2.1 Layout

program_web_portal/   (or unified ai_web_panels/)
  index.php                 # shell: nav, auth stub, panel host
  api.php                   # existing state/graphs/checkpoints
  control.php               # NEW: gated command submit (local/remote)
  config.php
  panels/
    _registry.php           # catalog of panel ids → php files + caps
    overview.php
    graphs_architecture.php
    graphs_rl.php
    graphs_discovery.php
    minecraft_vitals.php
    minecraft_gov.php
    minecraft_market.php
    control_local.php
    control_remote.php
    mathnn_access.php
    ad_policy.php
    agents_runtime.php
    …
  assets/
    panel.css
    panel_host.js           # load panel, poll, chart instances
    vendor/chart.umd.min.js

2.2 Panel contract

Each panel is a small PHP partial + optional JS init:

// panels/minecraft_vitals.php
return [
  'id' => 'minecraft_vitals',
  'title' => 'Minecraft vitals',
  'category' => 'world',
  'caps' => ['graph', 'poll'],
  'poll_ms' => 2000,
  'data' => 'minecraft_state',   // api.php?q=…
  'render' => function ($data) { /* HTML */ },
];

Registry:

Field Meaning
id Stable URL ?panel=minecraft_vitals
category ops graphs world rl math control enterprise dev
caps graph table control_local control_remote admin
poll_ms Client poll interval
data API query key(s)
enabled Feature flag / config

2.3 Same idea as ImGui plugin panels

Dear ImGui PHP panel host
Dockspace + layouts CSS grid / tabs / saved layout JSON
Lazy panels Include only active ?panel= + favorites
SubmitCommandFromGui control.php POST → command string
Thread-safe snapshots File/HTTP JSON only — never block on long C++

3. Graph plugin panels (catalog)

3.1 Already close (thin wrappers)

Panel id Chart(s) Source
graphs_architecture Force / hierarchical DAG api.php?q=graphs&which=architecture
graphs_discovery Bar + doughnut graphs discovery
graphs_rl KPI + sparklines graphs rl + portal history
minecraft_vitals Line: players, HP, food MC state.json / history
minecraft_threat Hostiles vs time MC history
portal_overview Enablement doughnut state.json overview

3.2 High-ROI new graph panels

Panel id Graph idea Data export (C++ / Spigot) Chart type
mc_gov_pipeline Pipeline phase funnel + last enacted gov_* fields + government_state slice Funnel / step
mc_gov_treasury Treasury + sales tax over time history append gov_treasury Line + gauge
mc_market_board IRON/FOOD/COMBAT quotes market quotes series Multi-line
mc_market_volume Buy/sell volume / fee sink market events Stacked bar
bridge_peers Server vs client peer count, latency bridge status JSON KPI + sparkline
dqn_reward Episode return / epsilon MinecraftDQN status + transition log summary Line
dqn_action_hist Action id histogram (bad-loop watch) telemetry / metrics export Bar
mathnn_access_map L0–L5 feature counts enabled nn access JSON export Stacked bar / treemap
mathnn_device CPU/GPU/NPU placement MathNNDevice status KPI cards
life_rl_gauges Focus / energy / sleep twins Life RL status Radial / gauge
curriculum_board Domain smoke pass/fail grid RL curriculum export Heatmap table
command_queue Queue depth, workers CommandQueue status Line + table
ethics_gate Allow/deny rates ethics gate metrics Doughnut
ad_auth Allowed vs denied commands AD policy log tail Line + table
weather_desk Multi-hazard severity WeatherHazards / disaster JSON Multi-series
cutlass_bench TF32/GEMM history cutlass bench append Bar race
discovery_timeline Posted discoveries over days discovery entries Timeline
agent_runtime Running Lua agents AgentRuntime list JSON Table + status dots
speech_bridge Talk/listen duty cycle speech bridge metrics Dual axis
email_smtp Send success/fail (no secrets) email status counters KPI
iis_pools App pool state iis status export Table
charter_rights Charter article count / roles minecraft gov charter Cards
semantic_embed_2d Cluster scatter (offline) embed export coords Scatter
thought_dag Thought session graph thought graph export vis-network
depth_occupancy Perception depth grid depth estimator matrix Heatmap canvas

3.3 Graph “plugin packs” (bundle installs)

Pack Panels Audience
Ops pack overview, command_queue, ad_auth, iis_pools, bridge_peers Admins
Minecraft pack vitals, threat, gov_pipeline, market_board, charter_rights, dqn_* Server ops
RL / MathNN pack graphs_rl, mathnn_*, life_rl, curriculum, ethics_gate Researchers
Publish pack discovery_*, architecture, wordpress status Content
Edge pack weather, email_smtp, speech_bridge Monitoring

Each pack = folder under panels/packs/{name}/ + one registry merge file.


4. Local vs remote control panels

4.1 Principles

  1. Same command strings as typed _AI / /ai where possible.
  2. Default dry-run — live mutations need checkbox + token + optional AD-aware backend.
  3. No secrets in browser — tokens only in config.php / server env.
  4. Audit log — every control POST → data/control_audit.jsonl.
  5. Capability tags — panel caps must include control_local or control_remote.

4.2 Local control panel (control_local)

Target: _AI on the same machine as PHP (or LAN).

Control group Example actions Backend
Portal portal export, graphs export File/CLI pipe or HTTP to host
Graphs refresh graphs all same
DQN minecraft dqn status, eval, eval-chat on, dry-run via bridge remote command port
Bridge minecraft bridge status, chat say @a … :8765 plane via host
MathNN nn access map, nn access factory list host
AD ad full-access, ad status (read-only) host
IIS iis doctor, iis recycle X dry-run host
Emergency disabled in PHP by default never expose shutdown without dual control

Transport options (pick one for MVP):

Mode How Security
A. File drop PHP writes control_inbox/cmd.txt; C++ watches Simple; local FS ACL
B. Loopback HTTP Host exposes POST /control with token Best for LAN
C. Existing remote PHP → http://127.0.0.1:7710 remote commands Reuse stack
D. SSH PHP exec gated script Ops only

Recommend C (remote commands) + shared token.

4.3 Remote control panel (control_remote)

Target: another host’s _AI or Spigot HTTP.

Control group Example Path
Minecraft plugin HTTP GET/POST :8787 with token $remote in config
Spigot via _AI bridge minecraft gov status on remote host remote _AI :7710
Multi-host fleet Dropdown of hosts[] in config PHP proxy
Pixel / Android remote commands to device companion optional later
// config.php sketch
$hosts = [
  'local' => ['url' => 'http://127.0.0.1:7710', 'token' => getenv('AI_REMOTE_TOKEN')],
  'mc'    => ['url' => 'http://10.0.0.153:8787', 'token' => getenv('AI_MC_WEB_TOKEN'), 'kind' => 'spigot_web'],
  'lab'   => ['url' => 'http://lab-pc:7710', 'token' => getenv('AI_LAB_TOKEN')],
];

4.4 Control panel UI patterns

Widget Use
Command palette Fuzzy search catalog; submit string
Macro buttons “Export graphs”, “MC status”, “DQN eval”, “Gov charter”
Confirm modal Required when apply / non-dry-run
Result drawer Last stdout / JSON summary
Host switcher Local vs remote targets
Capability badges Shows if panel needs admin token

4.5 Sample macros (safe defaults)

portal export
graphs export
minecraft bridge status
minecraft dqn status
minecraft gov charter
minecraft market status
nn access status
ad full-access
iis doctor

Live-risk macros (require allow_live=1 in config and POST flag):

minecraft dqn eval
minecraft bridge chat say @a Operator panel online
iis recycle DefaultAppPool apply

5. API surface (extend api.php / new control.php)

Read (graphs)

GET api.php?q=graphs&which=all|architecture|discovery|rl
GET api.php?q=state
GET api.php?q=history
GET api.php?q=minecraft          # proxy MC web or file
GET api.php?q=panels             # registry JSON
GET api.php?q=panel&id=mc_gov_pipeline

Write (control) — new

POST control.php
  Authorization: Bearer <token>   # or X-AI-Token
  {
    "host": "local",
    "command": "graphs export",
    "dry_run": true,
    "panel": "control_local",
    "client": "php_panel"
  }

→ { "ok": true, "queued": true, "id": "…", "preview": "…" }

Rules:

  • Reject if token mismatch.
  • Reject if dry_run=false and config.allow_live false.
  • Reject commands matching denylist (emergency, rm -rf, raw shell).
  • Allowlist prefixes: portal, graphs, minecraft, nn, ad status, ad full-access, iis, rl, simple nn.

6. Data export additions (C++ side, when implementing)

Small exports unlock many panels:

Export command / file Feeds panels
graphs export (existing) architecture, discovery, rl
portal export (existing) overview, many status strings
metrics export web command_queue, dqn_*, ethics
minecraft web already vitals, extend with gov_* mkt_* series in history
nn access export json mathnn_access_map
ad audit export ad_auth panel
agents export agent_runtime

Minecraft history should append:

{ "t": 123, "gov_treasury": 100000, "gov_phase": "senate", "mkt_fee_pct": 1.0, "bridge_ok": 1 }

7. Security model (local + remote)

Layer Control
Network Bind PHP to LAN; reverse proxy TLS for WAN
Token AI_PORTAL_TOKEN / web.http.token parity
AD Optional: control.php calls host that already runs IsCommandAllowed
Dry-run Default on
Denylist Block destructive verbs in PHP even if host would allow
Audit JSONL + optional email notify
Roles viewer (graphs only) vs operator (control) in config

8. ImGui ↔ PHP parity (optional later)

ImGui panel PHP twin
Ops strip portal_overview
Command palette control_local palette
Minecraft card minecraft_* pack
Math lab mathnn_* + curriculum
Architecture graphs_architecture (vis-network)

Shared panel id namespace so docs and macros stay one vocabulary.


9. Implementation phases

P0 — Host + 6 panels (1–2 days)

  1. panels/_registry.php + shell layout.
  2. Panels: overview, graphs_architecture, graphs_discovery, minecraft_vitals, control_local (dry-run only), control_remote (status GET only).
  3. GET api.php?q=panels.
  4. Poll + Chart.js reuse from existing dashboards.

P1 — Graphs pack

  1. gov_pipeline, market_board, dqn_reward, bridge_peers, mathnn_access_map.
  2. Extend MC history fields.
  3. graphs export already enough for discovery/architecture polish (vis-network).

P2 — Real control

  1. control.php + remote commands client.
  2. Macro buttons + confirm modal.
  3. Audit log + token.
  4. AD full-access status panel (read-only).

P3 — Fleet + packs

  1. Multi-host switcher.
  2. Pack zip install.
  3. Optional IIS vhost recipe in IisPhpIntegration.md.

10. Example panel wireframes (text)

Minecraft Gov pipeline

┌─ mc_gov_pipeline ─────────────────────────────┐
│ Phase: senate          Treasury: 98,420       │
│ [docket][committee][senate●][house]…[enacted] │
│ Last bill: Cap fees at 1%                     │
│ [Refresh] [Charter] [Status cmd dry-run]      │
└───────────────────────────────────────────────┘

Control local

┌─ control_local ───────────────────────────────┐
│ Host: local (127.0.0.1:7710)  ● dry-run ON    │
│ [graphs export] [portal export] [dqn status]  │
│ Command: ________________________________     │
│ [Run dry]  [Run live ⚠]                       │
│ Last: ok — wrote graphs_all.json              │
└───────────────────────────────────────────────┘

MathNN access

┌─ mathnn_access_map ───────────────────────────┐
│ L0 ███ L1 ██ L2 ████ L3 ███ L4 ██ L5 █       │
│ Factory handles: mc_bot, tutor_1              │
│ [nn access map] [factory list]                │
└───────────────────────────────────────────────┘

11. What not to put in PHP panels

  • Training loops that block PHP-FPM.
  • Raw MySQL passwords in JS.
  • Unauthenticated apply recycle / wipe.
  • Full shell.
  • Emergency shutdown (console / AD only).

12. Success metrics

Metric Target
Panel load < 200ms shell + async data
Poll 1–5s without thrashing export
Control dry-run 100% of default macros
Operator clarity One pack install → useful wall display

13. Suggested first builds (concrete files)

program_web_portal/panels/_registry.php
program_web_portal/panels/control_local.php
program_web_portal/panels/mc_gov_pipeline.php
program_web_portal/panels/mc_market_board.php
program_web_portal/panels/mathnn_access_map.php
program_web_portal/control.php
program_web_portal/assets/panel_host.js

Extend Spigot WebDashboardService history with gov_* / mkt_* for richer Minecraft packs.


14. Bottom line

  • Plugin panels in PHP = registry of graph + control modules on top of existing program_web_portal and minecraft_web_dashboard.
  • Graphs: expand beyond discovery/architecture into gov, market, DQN, MathNN access, ethics, AD audit, weather.
  • Local control: same-host command enqueue via remote-commands token, dry-run default.
  • Remote control: multi-host config to other _AI instances and Spigot :8787.
  • ImGui parity: same panel ids and macros later for a unified ops language.

When you want implementation, start with P0 host + control_local dry-run + mc_gov_pipeline + graphs_architecture polish.

Generated from the project markdown docs on 2026-07-24. This is a static, self-contained site.