{{template "shellTop" "ecosystem"}}
<h1>Ecosystem</h1>
<p class=hint>The sibling services Maven coordinates — read-only. Identity, attention, capabilities. Enabling &amp; execution live on the authed surfaces, never here.</p>

<section class=card id=eco-nexus>
<div class=section-header>
<h2>Nexus <span class=card-sub>identity</span></h2>
</div>
{{with .Nexus}}
{{if .Err}}<div class=empty>nexus — {{.Err}}</div>
{{else if not .Rows}}<div class=empty>no entities yet.</div>
{{else}}<div class=scroll><table class=mono><tr><th>id<th>type<th>name<th>state<th>updated</tr>
{{range .Rows}}<tr><td class=key>{{.ID}}<td><span class=badge>{{.Type}}</span><td class=en>{{.DisplayName}}<td>{{.State}}<td>{{ago .UpdatedAt}}</tr>{{end}}
</table></div>{{end}}
{{end}}
</section>

<section class=card id=eco-praxis>
<div class=section-header>
<h2>Praxis <span class=card-sub>attention</span></h2>
</div>
{{with .Praxis}}
{{if .Err}}<div class=empty>praxis — {{.Err}}</div>
{{else if not .Rows}}<div class=empty>nothing needs attention.</div>
{{else}}<div class=scroll><table class=mono><tr><th>imp<th>kind<th>title<th>state<th>last seen</tr>
{{range .Rows}}<tr><td>{{.Importance}}<td><span class=badge>{{.Kind}}</span><td class=en>{{.Title}}<td>{{.State}}<td>{{ago .LastSeenAt}}</tr>{{end}}
</table></div>{{end}}
{{end}}
</section>

<section class=card id=eco-hexis>
<div class=section-header>
<h2>Hexis <span class=card-sub>capabilities</span></h2>
</div>
{{with .Hexis}}
{{if .Err}}<div class=empty>hexis — {{.Err}}</div>
{{else if not .Rows}}<div class=empty>no capabilities registered.</div>
{{else}}<div class=scroll><table class=mono><tr><th>id<th>name<th>provider<th>operation<th>risk<th>access</tr>
{{range .Rows}}<tr><td class=key>{{.ID}}<td class=en>{{.Name}}<td><span class=badge>{{.Provider}}</span><td>{{.Operation}}<td>{{.Risk}}<td>{{if .ReadOnly}}<span class="badge badge-ok">read-only</span>{{else}}<span class="badge badge-warn">mutating</span>{{end}}</tr>{{end}}
</table></div>{{end}}
{{end}}
</section>

<section class=card id=eco-calls>
<div class=section-header>
<h2>Calls <span class=card-sub>what Maven asked them</span></h2>
</div>
{{with .Calls}}
{{if .Err}}<div class=empty>calls — {{.Err}}</div>
{{else if not .Rows}}<div class=empty>no ecosystem calls yet.</div>
{{else}}<div class=scroll><table class=mono><tr><th>when<th>service<th>operation<th>status<th>ms<th>http<th>correlation</tr>
{{range .Rows}}<tr><td>{{ago .Ts}}<td><span class=badge>{{.Service}}</span><td class=en>{{.Operation}}<td>{{if eq .Status "ok"}}<span class="badge badge-ok">ok</span>{{else}}<span class="badge badge-warn">{{.Status}}</span>{{end}}<td>{{.DurationMs}}<td>{{if .HTTPStatus}}{{.HTTPStatus}}{{else}}—{{end}}<td class=key>{{.CorrelationID}}</tr>{{end}}
</table></div>{{end}}
{{end}}
</section>

{{template "shellBottom"}}
<script>
setInterval(() => fetch('/ecosystem').then(r => r.text()).then(html => {
  const d = new DOMParser().parseFromString(html, 'text/html');
  for (const id of ['eco-nexus', 'eco-praxis', 'eco-hexis', 'eco-calls']) {
    const old = document.getElementById(id), nu = d.getElementById(id);
    if (old && nu) old.replaceWith(nu);
  }
}), 15000);
</script>
</html>
