# Task inbox (`task-inbox`)

The personal worklist: filter chips over urgency-flagged items, each a drill link with title and meta.

> **Layer:** L1 surface · **Recipe:** _(unset — see docs/agent/pick-a-surface.md)_
> Curriculum: `AGENTS.md` · pick matrix: `docs/agent/pick-a-surface.md` · blast radius: `CONSUMER_MAP.md`

> **Dialect:** Partial below is **unprefixed** (gallery / standalone HM). DOM contract Python often uses the **source token** `data-dz-*` / `dz-*` (Dazzle dual-lock). Match the CSS/JS bundle you load.

> **Demo vs contract:** Live gallery behaviour may use `/mock/*` or flash toasts. Those are **offline demos only** — implement **Server exchange** + **DOM contract**, not the mock. See AGENTS.md › Gallery demos.

## Copy this

```html
<!-- icons: include the icon sheet once per page (see the Setup section, #setup) -->
<div class="hm-measure-lg">
  <div class="task-inbox-region" data-task-inbox data-region-name="inbox">
    <div class="task-inbox-chips">
      <div class="task-inbox-chip" data-chip-id="all"><span class="task-inbox-chip-count">6</span><span class="task-inbox-chip-label">All</span></div>
      <div class="task-inbox-chip" data-chip-id="overdue"><span class="task-inbox-chip-count">2</span><span class="task-inbox-chip-label">Overdue</span></div>
    </div>
    <ul class="task-inbox-items">
      <li class="task-inbox-item" data-urgency="overdue" data-item-id="t1">
        <a class="task-inbox-item-link" href="#">
          <span class="task-inbox-item-icon" aria-hidden="true"><svg class="icon" aria-hidden="true"><use href="#i-inbox"/></svg></span>
          <div class="task-inbox-item-body">
            <div class="task-inbox-item-title">Approve refund — Acme</div>
            <div class="task-inbox-item-meta">due in 2h · assigned to you</div>
          </div>
        </a>
      </li>
      <li class="task-inbox-item" data-urgency="due" data-item-id="t2">
        <a class="task-inbox-item-link" href="#">
          <span class="task-inbox-item-icon" aria-hidden="true"><svg class="icon" aria-hidden="true"><use href="#i-inbox"/></svg></span>
          <div class="task-inbox-item-body">
            <div class="task-inbox-item-title">Review KYC — Globex</div>
            <div class="task-inbox-item-meta">due tomorrow</div>
          </div>
        </a>
      </li>
    </ul>
  </div>
</div>
```

## Server exchange

This Hyperpart has **no server exchange** — presentation or client chrome only. If you put `hx-*` on a control that uses this markup, that action's exchange belongs to the action, not this part.

## Swap contract

Agent-visible HTMX topology (ADR-0054 / decision 0012). **Exchange envelope** = what the response may re-emit relative to the persistent slot (`body_only` | `outer` | `none` | `host_owned` | `document`). Dual-lock validates part markup only — not this envelope. Stem: `stems/morph-safe-hypermedia.md`.

**No host HTMX exchange** on this part — presentation or client chrome only. **Exchange envelope:** `n/a`.

If a **host** wraps this markup in `hx-*`, **that host owns the swap contract** (sole identity + envelope). Prefer `innerMorph` / `outerMorph` for stable slots; replacement for flash; body-only responses under inner swaps.

### Envelope response examples

What the **server returns** for each exchange. Match the **exchange envelope**; dual-lock still applies to interior markup.

This part has no owned exchange (envelope `n/a`). If a host adds `hx-*`, that host’s envelope applies — typically `body_only`:

```html
<!-- Prefer hx-swap=innerMorph into a stable body slot -->
<div class="dz-stack">content…</div>
```

Do **not** re-own the slot:

```html
<div id="task-inbox-root" data-dz-region>…</div>
```

## How to use it

No extended guidance authored yet — start from Copy this and the dependency chips.

### Seams

- copy the partial under Copy this; keep root class and data-* modifiers so the CSS/JS bundle matches
- no Server exchange on this part — pure presentation or client chrome
- satisfy the DOM contract tables (CI stop-ship)

## DOM contract

What emitted markup must satisfy (CI: `tests/test_contracts.py`). Do not invent attrs outside the tables. Python modules under `contracts/` are **package-internal dual-locks** (`from contracts._kit import …`) — not FastAPI business handlers. App servers implement **Server exchange** endpoints; this section constrains the HTML those endpoints return.

### `contracts/task_inbox.py`

- **Required root:** `[data-dz-task-inbox]` (part `task-inbox`)

| Node | Attr | Constraint |
|---|---|---|
| `[data-dz-task-inbox]` | `data-dz-task-inbox` | present (any value) |

#### Ingestion model `TaskInbox`

| Field | Type | Required |
|---|---|---|
| `region_name` | `string` | no |
| `body_html` | `string` | no |

#### Exemplar `render()`

```python
def render(t: TaskInbox) -> str:
    """Model → task-inbox region root."""
    rname = html.escape(t.region_name, quote=True)
    return (
        f'<div class="dz-task-inbox-region" data-dz-task-inbox '
        f'data-dz-region-name="{rname}">{t.body_html}</div>'
    )
```

## Notes

Dual-lock root is data-dz-task-inbox (contracts/task_inbox.py) on the region. Items carry data-dz-urgency="overdue|due|soon|later" (the server clamps anything else to later) + a stable data-dz-item-id; the whole row is one link, leading with its icon. Chips render count THEN label (data-dz-chip-id anchors a filter exchange in Dazzle).

## Source files

- `site/registry.py` (partial + exchanges + guidance)
- `contracts/task_inbox.py`
