This repository was archived by the owner on May 26, 2026. It is now read-only.
feat(KR-P2-CAP-PANEL): capabilities inspector — live read from tool_capability_map + actor_has_capability#52
Merged
Conversation
…apability_map + actor_has_capability Operator-side view of "what Kora is permitted to invoke right now". First real-data panel in the CC#2 admin series (predecessors #26 OPS, #31 SEA, #37 CONTROL, #45 BOOT, #49 COST were all stub-then-real). No stub flag — the dependencies (KR-P2-A's TOOL_CAPABILITY_MAP + actor_has_capability) are already on main. Backend (kora_cli/web_server.py): GET /api/capabilities — reads the 64-entry TOOL_CAPABILITY_MAP and resolves each unique cap_* (17 of them) via actor_has_capability, catching KeyError → "unmapped_in_c2_mirror" verdict (the documented fail-CLOSED state per D-krp2a-st1-infra-tier-caps-missing-from-c2-mirror). Returns: groups[] sorted alphabetical by cap_name with tools[] sorted within, substrate_tier[] (the 4 kora__* tools the pre-screen short-circuits with PASS), and 3 summary counts. Read-only by design; cap policy changes are substrate-team's lane. Frontend: - CapabilitiesPage.tsx — * Summary banner: "{total_tools} tools across {total_caps} cap_* groups" + per-verdict counts + "D-krp2a-st1" attribution when anything is unmapped. * Substrate-enforced card: 4 kora__* tools with green "always PASS" badge and the substrate-side-is-authoritative explainer. * One card per cap_* group with verdict pill, per-verdict-tone border, tool chips, and an inline explainer for unmapped groups ("Closes when substrate-team KR-P2-N ships"). - api.ts — CapVerdict type alias + 2 interfaces (CapabilityGroup, CapabilitiesResponse) + getCapabilities client. - App.tsx — /capabilities route + nav entry (ShieldCheck icon) between /cost-state and /kora-control per spec §3. Tests: tests/kora_cli/test_web_server_capabilities.py — 12 tests covering all 10 §5 scenarios + 2 extra guards (tools sorted within each group, substrate_tier disjoint from TOOL_CAPABILITY_MAP). 90/90 across the full web_server admin-panel suite pass. tsc -b + vite build clean. Current main state at landing: all 17 cap_* groups surface as unmapped_in_c2_mirror (D-krp2a-st1 default). Panel renders 17 amber group cards + 4 always-PASS substrate-tier tools — operationally this gives Joshua immediate visibility into "everything except the 4 kora__* tools is fail-CLOSED until KR-P2-N closes the mirror gap." Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 21, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Operator-side view of "what Kora is permitted to invoke right now". First real-data panel in the CC#2 admin series — no `stub` flag because both dependencies (KR-P2-A's `TOOL_CAPABILITY_MAP` and the `actor_has_capability` helper) are already on main.
This is the operator-side view of the D-krp2a-st1-infra-tier-caps-missing-from-c2-mirror deviation: infra-tier cap_* names are not yet in the C2 mirror, so `actor_has_capability` raises `KeyError` on them — the endpoint catches that and surfaces an `unmapped_in_c2_mirror` verdict so the operator sees the documented fail-CLOSED state instead of a swallowed error.
Endpoint (kora_cli/web_server.py)
`GET /api/capabilities` — read-only. Returns:
Verdict resolution: `actor_has_capability(cap)` → `granted`/`denied`; `KeyError` → `unmapped_in_c2_mirror`; unexpected exception → `error` (with server-log).
Frontend (web/)
Current main state at landing
Live call against `origin/main` HEAD `036fc7b` returns:
```
total_tools: 68
total_caps: 17
unmapped_count: 17
groups by verdict: { unmapped_in_c2_mirror: 17 }
```
Every cap_* group is currently unmapped — meaning every non-substrate tool path is fail-CLOSED until KR-P2-N closes the mirror gap. The panel makes that visible at a glance rather than letting it hide as silent denial.
Test plan
Dependency notes
🤖 Generated with Claude Code