Class MessageListComponent

java.lang.Object
ai.mindconnect.adminui.ui.component.MessageListComponent
All Implemented Interfaces:
UiComponent

public final class MessageListComponent extends Object implements UiComponent
The main conversation list of a chat page. Renders the message history (interleaved with historic task cards rebuilt from persisted TOOL_CALL/TOOL_RESULT messages) and exposes both the navigation action buttons (Back / Memory / Traces / Todos / Workspace) and the token-usage suffix in its title.

The component is the heart of the chat page in patch terms: almost every streaming event translates into a patch against either the list's root id (msg-list-{sid}) — for full refreshes after a turn — or against individual item ids inside the list (bot-pending placeholder, task cards, thinking indicator).

Patch shapes follow the renderer contract:

  • APPEND with a single-item wrapper UiList — the renderer extracts the wrapper's items into the existing <ul> so the list header isn't duplicated.
  • REPLACE with the rendered UiList of the entire component — used when the header (token bar) needs to refresh alongside body changes.
  • REMOVE on a wrapper id — drops the surrounding <li>.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    The tool name and pretty-printed arguments out of a request's content JSON.
    static interface 
    Supplies the pre-built sub-agent cards (with their nested child-task trees) for a given parent toolCallId.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MessageListComponent(UUID sessionId, ai.mindconnect.agent.domain.AgentDefinition agent, List<ai.mindconnect.message.domain.Message> history, ai.mindconnect.agent.memory.domain.WorkingMemory memory)
     
    MessageListComponent(UUID sessionId, ai.mindconnect.agent.domain.AgentDefinition agent, List<ai.mindconnect.message.domain.Message> history, ai.mindconnect.agent.memory.domain.WorkingMemory memory, MessageListComponent.SubAgentTreeProvider subAgentTree)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Builds every tool / sub-agent card across this component's full history, in order.
    ai.mindconnect.ui.model.UiPatch.Operation
    appendApprovalCard(ai.mindconnect.ui.model.UiList.Item card)
    APPEND the live approval card — the stream-side twin of the historic render.
    ai.mindconnect.ui.model.UiPatch.Operation
    appendBotPending(String pendingId, String agentName)
    APPEND the bot-pending placeholder used as the streaming target.
    ai.mindconnect.ui.model.UiPatch.Operation
    APPEND a visible failure notice — a turn that FAILED (context overflow, backend error) must say so in the chat, not just stop the spinner.
    ai.mindconnect.ui.model.UiPatch.Operation
    APPEND a task card to the list (running / done / failed variants).
    ai.mindconnect.ui.model.UiPatch.Operation
    APPEND a task card into a nested sub-agent child list rather than the top-level message list.
    ai.mindconnect.ui.model.UiPatch.Operation
    appendThinking(String thinkingId, String agentName)
    APPEND an "AI is thinking …" placeholder shown between the user message and the first incoming token.
    ai.mindconnect.ui.model.UiPatch.Operation
    APPEND a synthetic user-message item.
    static ai.mindconnect.ui.model.UiList.Item
    approvalCard(UUID sessionId, String callId, String toolName, String argsJson, String time)
    The approval card — ONE shape for every open question (root tool or sub-agent alike): the answer is a plain dispatch identified by callId alone, the ToolApprovalStore knows the rest.
    id()
    The DOM id this component renders with.
    The final assistant CHAT text in this component's history, or null.
     
    ai.mindconnect.ui.model.UiPatch.Operation
    removeThinking(String thinkingId)
    REMOVE the thinking indicator together with its wrapping <li>.
    ai.mindconnect.ui.model.UiList
    Full render — emit the component as a UiNode.
    ai.mindconnect.ui.model.UiPatch.Operation
    REPLACE on the list root.
    ai.mindconnect.ui.model.UiPatch.Operation
    replaceBotPending(String pendingId, String cumulativeText)
    REPLACE the bot-pending markdown body with the current cumulative text.
    ai.mindconnect.ui.model.UiPatch.Operation
    REPLACE a task card in place.
    withBubbledApprovals(List<ai.mindconnect.ui.model.UiList.Item> cards)
    Cards for the OPEN sub-agent approval questions of this (root) session — the controller builds them from the ToolApprovalStore, the single truth for bubbled requests (nothing about them lives in this conversation's history).
    withParentSession(UUID parentSessionId)
    Sets the parent session id so the header shows an "↑ Parent Session" link.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MessageListComponent

      public MessageListComponent(UUID sessionId, ai.mindconnect.agent.domain.AgentDefinition agent, List<ai.mindconnect.message.domain.Message> history, ai.mindconnect.agent.memory.domain.WorkingMemory memory)
    • MessageListComponent

      public MessageListComponent(UUID sessionId, ai.mindconnect.agent.domain.AgentDefinition agent, List<ai.mindconnect.message.domain.Message> history, ai.mindconnect.agent.memory.domain.WorkingMemory memory, MessageListComponent.SubAgentTreeProvider subAgentTree)
  • Method Details

    • withParentSession

      public MessageListComponent withParentSession(UUID parentSessionId)
      Sets the parent session id so the header shows an "↑ Parent Session" link. Pass null (the default) for top-level, user-initiated sessions. Returns this for fluent chaining.
    • withBubbledApprovals

      public MessageListComponent withBubbledApprovals(List<ai.mindconnect.ui.model.UiList.Item> cards)
      Cards for the OPEN sub-agent approval questions of this (root) session — the controller builds them from the ToolApprovalStore, the single truth for bubbled requests (nothing about them lives in this conversation's history). Returns this for fluent chaining.
    • id

      public String id()
      Description copied from interface: UiComponent
      The DOM id this component renders with. Patch operations targeting this component (REPLACE / CLEAR / REMOVE) use this id, so it must match the id on the root UiNode returned by UiComponent.render().
      Specified by:
      id in interface UiComponent
    • render

      public ai.mindconnect.ui.model.UiList render()
      Description copied from interface: UiComponent
      Full render — emit the component as a UiNode. Used both inside a page's full render and as the payload of a REPLACE patch.
      Specified by:
      render in interface UiComponent
    • parseApprovalContent

      public static MessageListComponent.ApprovalCall parseApprovalContent(String content)
    • approvalCard

      public static ai.mindconnect.ui.model.UiList.Item approvalCard(UUID sessionId, String callId, String toolName, String argsJson, String time)
      The approval card — ONE shape for every open question (root tool or sub-agent alike): the answer is a plain dispatch identified by callId alone, the ToolApprovalStore knows the rest. The turn never ended, so there is no stream to start — the ORIGINAL stream carries the continuation once the parked tool task is woken.
    • appendErrorNotice

      public ai.mindconnect.ui.model.UiPatch.Operation appendErrorNotice(String message)
      APPEND a visible failure notice — a turn that FAILED (context overflow, backend error) must say so in the chat, not just stop the spinner. Not persisted: the failure lives on the task record; this is the live face of it.
    • appendApprovalCard

      public ai.mindconnect.ui.model.UiPatch.Operation appendApprovalCard(ai.mindconnect.ui.model.UiList.Item card)
      APPEND the live approval card — the stream-side twin of the historic render.
    • replaceAll

      public ai.mindconnect.ui.model.UiPatch.Operation replaceAll()
      REPLACE on the list root. Used after a turn finishes (streaming or non-streaming): rebuilds the full list from persisted history so the live bot-pending placeholder and live task cards get swapped for the final assistant message and its historic task cards. The token bar in the title refreshes at the same time.
    • appendUserMessage

      public ai.mindconnect.ui.model.UiPatch.Operation appendUserMessage(String text)
      APPEND a synthetic user-message item. The id is temporary (epoch milliseconds) and only matters until the next replaceAll() — which is fine because the streaming chat always replaces the whole list at the end of the turn.
    • appendBotPending

      public ai.mindconnect.ui.model.UiPatch.Operation appendBotPending(String pendingId, String agentName)
      APPEND the bot-pending placeholder used as the streaming target. Subsequent token deltas REPLACE the placeholder's body (via replaceBotPending(String, String)).
    • replaceBotPending

      public ai.mindconnect.ui.model.UiPatch.Operation replaceBotPending(String pendingId, String cumulativeText)
      REPLACE the bot-pending markdown body with the current cumulative text. The pendingId is the same id used by appendBotPending(String, String).
    • appendThinking

      public ai.mindconnect.ui.model.UiPatch.Operation appendThinking(String thinkingId, String agentName)
      APPEND an "AI is thinking …" placeholder shown between the user message and the first incoming token. Removed via removeThinking(String) when the stream begins.
    • removeThinking

      public ai.mindconnect.ui.model.UiPatch.Operation removeThinking(String thinkingId)
      REMOVE the thinking indicator together with its wrapping <li>. Targets the wrapper id (thinking-wrapper-{thinkingId}) so the renderer's REMOVE path drops the surrounding list item.
    • appendTaskCard

      public ai.mindconnect.ui.model.UiPatch.Operation appendTaskCard(TaskCardComponent card)
      APPEND a task card to the list (running / done / failed variants).
    • appendTaskCardInto

      public ai.mindconnect.ui.model.UiPatch.Operation appendTaskCardInto(String childListId, TaskCardComponent card)
      APPEND a task card into a nested sub-agent child list rather than the top-level message list. childListId is the id of the sub-agent card's nested <ul>-bearing list (TaskCardComponent.childListId(String)); the renderer's append-into-list path drops the card's <li> straight into that list's <ul>, so the card nests under its sub-agent.
    • replaceTaskCard

      public ai.mindconnect.ui.model.UiPatch.Operation replaceTaskCard(TaskCardComponent card)
      REPLACE a task card in place. Targets the card's own id (the <li>'s id), not the wrapper — that's the shape REPLACE needs to morph an existing list item.
    • allHistoricTaskCards

      public List<TaskCardComponent> allHistoricTaskCards()
      Builds every tool / sub-agent card across this component's full history, in order. Used to render a sub-session's activity as the nested body of its parent's sub-agent card — there's no user-turn interleaving to respect inside a sub-session, so the whole range is taken at once. Sub-agent calls recurse through this component's MessageListComponent.SubAgentTreeProvider.
    • lastAssistantText

      public String lastAssistantText()
      The final assistant CHAT text in this component's history, or null.