# `PhoenixKitAgent.Web.Dock.Panel`
[🔗](https://github.com/BeamLabEU/phoenix_kit_agent/blob/v0.1.0/lib/phoenix_kit_agent/web/dock/panel.ex#L1)

The markup of the chat panel (`PhoenixKitAgent.Web.Dock`) and its browser
hooks: the button with the list of chats, and the panel with the feed, the
indicator and the composer. The LiveView holds the state and the events;
this module only draws them.

The hooks are runtime colocated hooks (the host bundles nothing for them),
and live here because a colocated hook is named after the module that
renders the element using it. They run from inline `<script>` elements, so
under a Content-Security-Policy the page must allow `script-src
'unsafe-inline'`; the scripts carry no nonce. Without them the panel shows,
but forgets its state, does not resize, and Enter does not send:

  * `.DockState` — keeps the panel open or closed, the chosen chat and the
    width in `localStorage`, and tells the LiveView on mount and when it
    joins again after a lost connection (`restore`): a re-join mounts the
    LiveView afresh, while the hook's element stays and gets no `mounted`;
  * `.Feed` — keeps the feed scrolled to its end while the user is there;
  * `.Composer` — Enter sends, the page's path goes with the form, the text
    is cleared once the turn started (`pk-agent:sent`). The textarea is
    `phx-update="ignore"`: the browser owns the draft, so a re-render (a
    file uploading, a message arriving) never wipes it;
  * `.Waiting` — the indicator gives up after the deadline of a turn and
    its grace period, counted again for each turn (`data-turn`) and after a
    lost connection is found again (`reconnected`).

# `dock`

The button, the list of chats and the panel.
## Attributes

* `user_uuid` (`:string`) (required)
* `chats` (`:list`) (required)
* `next_cursor` (`:any`) (required)
* `renaming` (`:string`) - Defaults to `nil`.
* `conversation` (`:any`) (required)
* `messages` (`:any`) (required) - the `:messages` stream.
* `pinned` (`:list`) - the waiting cards of the chat older than the page in the feed. Defaults to `[]`.
* `earlier?` (`:boolean`) (required)
* `activity` (`:any`) (required)
* `timeout_ms` (`:integer`) (required)
* `turn_ref` (`:string`) - Defaults to `nil`.
* `restored` (`:integer`) - how many times the browser restored the panel. Defaults to `0`.
* `error` (`:string`) - Defaults to `nil`.
* `instructions_form` (`:any`) - Defaults to `nil`.
* `unsent` (`:list`) (required)
* `upload` (`:any`) (required) - `@uploads.files`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
