# Identity Header Component - Implementation Spec

This document details the layout, styling, and behavior for the `identity-header` component (`ibgib-identity-header`). It is rendered inside the app shell's header and acts as a status indicator and shortcut route for the user's active identity.

## Requirements

1. **State-Driven Display**:
   - **Active Identity Mode**: If an active Domain Identity (Keystone) address exists in settings and is resolved in the local space, the component displays an identity pill showing a truncated version of the address.
   - **Inactive/Default Mode**: If no identity is resolved, the component renders a prominent "Create Identity" button.
2. **Interactive Routing**:
   - Clicking either the identity pill or the fallback "Create Identity" button calls `SpaceGibShellService.showIdentityManager()` to load the full `<ibgib-identity-manager>` component in the center view panel.
3. **Agent-Themeable Styles**:
   - The layout must be highly compact to fit inside a standard horizontal header panel.
   - All styling must prioritize valid theme CSS variables (e.g., `--button-background-color-base`, `--tab-text-color-active`) to remain dynamic and styleable by runtime agents.
4. **Shared Settings Scope**:
   - It is initialized with the virtual `ROOT_ADDR` and manually binds to the `"keystones"` index `ibgib`.
   - It initializes its coupled settings via `this.initSettings()`. Since both this component and the manager share the `"keystones"` index backing model, they automatically resolve the exact same coupled settings `ibgib` and settings timeline, reactively syncing active identity selection changes.
   - For detailed data schema, see [identity-manager IMPLEMENTATION.md](../identity-manager/IMPLEMENTATION.md).

---

## Component Structure

* **[identity-header.mts](file:///c:/Users/billm/antigravity/ibgib/apps/space-gib/src/client/components/identity-header/identity-header.mts)**: Element definition, lifecycle events, active identity resolution, shell service navigation call.
* **[identity-header.html](file:///c:/Users/billm/antigravity/ibgib/apps/space-gib/src/client/components/identity-header/identity-header.html)**: Compact HTML structures for the pill and fallback button.
* **[identity-header.css](file:///c:/Users/billm/antigravity/ibgib/apps/space-gib/src/client/components/identity-header/identity-header.css)**: Glassmorphic pill styling matching current themes.

---

## Implementation Checklist

### Phase 1: Basic Scaffolding & Setup
- [x] Scaffold `identity-header.mts`, `.html`, and `.css` files.
- [x] Register `IdentityHeaderComponentMeta` with `IbGibComponentService`.
- [x] Mount `<ibgib-identity-header>` inside the header panel in `SpaceGibShellService`.

### Phase 2: Navigation & Identity State
- [x] Wire up click handlers to trigger center-panel navigation to `ibgib-identity-manager`.
- [x] Resolve settings and check the `"keystones"` index to render the appropriate active/inactive view mode.

### Phase 3: Visual Polish & Bugs
- [ ] Ensure the header component has an initial size/button and is visible while the page is initializing.

### Testing Note
- [ ] **Manual Testing Only**: Visual integration and navigation behavior will be verified manually by the developer to limit token consumption.
