Class TaskCardComponent
- All Implemented Interfaces:
UiComponent
<details> list item.
A card has three lifecycle states; this component is constructed directly in the state it should render in (no internal mutation):
- running — header shows
⏳ name — running…, body shows the input arguments, card is open by default so the user can see what's executing. - done — header shows
✓ name (duration ms), body shows input + output, card is collapsed. - failed — header shows
✗ name (duration ms), body shows input + the error message, card is collapsed.
Sub-agent cards build a real tree. Instead of indenting
nested tool calls with whitespace, a sub-agent card's body is a
UiStack that contains a nested UiList with a
stable id (childListId(String)). The sub-agent's own tool-call
cards are appended into that nested list, so the DOM hierarchy mirrors
the agent call hierarchy. A patch targeting the nested list's id appends
straight into its <ul>; a patch targeting a child card's id
morphs that <li> in place — both work regardless of nesting
depth because the SPA patch dispatcher resolves targets by element id.
Cards live as a single <li> inside their list's <ul>.
The rendered UiList wraps a single UiList.Item so the JS
append-into-list path treats it as a one-item insert.
-
Constructor Summary
ConstructorsConstructorDescriptionTaskCardComponent(String nodeId, String headerLabel, ai.mindconnect.ui.model.UiNode body, boolean open) Primary constructor — caller supplies the fully-built body node.TaskCardComponent(String nodeId, String headerLabel, ai.mindconnect.ui.model.UiNode body, boolean open, String summaryId) Full constructor —summaryIdmakes the summary text individually REPLACEable.TaskCardComponent(String nodeId, String headerLabel, String bodyMarkdown, boolean open) Convenience constructor for the common markdown-body case. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringchildListId(String subAgentTaskId) Stable id of the nested<ul>-bearing list that holds a sub-agent's child task cards.static StringdoneSubAgentHeader(String agentName, long durationMs) static ai.mindconnect.ui.model.UiTextdoneSubAgentSummary(String taskId, String agentName, long durationMs) Summary-span REPLACE node flipping the marker to "done".static TaskCardComponentCard representing a tool call that finished successfully.static StringdoneToolHeader(String toolName, long durationMs) "✓ toolName (123 ms)".static StringfailedSubAgentHeader(String agentName) static ai.mindconnect.ui.model.UiTextfailedSubAgentSummary(String taskId, String agentName) Summary-span REPLACE node flipping the marker to "failed".static TaskCardComponentfailedTool(String nodeId, String toolName, Object arguments, String error, long durationMs) Card representing a tool call that failed.static StringfailedToolHeader(String toolName, long durationMs) "✗ toolName (123 ms)".static TaskCardComponentCard rebuilt from persisted TOOL_CALL + TOOL_RESULT messages.static TaskCardComponenthistoricSubAgent(String nodeId, String agentName, String taskId, boolean running, boolean failed, long durationMs, String inputJson, String resultText, ai.mindconnect.ui.model.UiList childList, String finalTextMarkdown) Sub-agent card rebuilt from persisted state on a full page load.id()The id of the card's<li>; what REPLACE patches target.static ai.mindconnect.ui.model.UiLinkopenSessionLink(String subSessionId) A link that opens the sub-agent's own session page in a new browser tab.static StringprettyJson(Object value) Pretty-prints arguments map as JSON; falls back to toString on errors.ai.mindconnect.ui.model.UiListrender()Renders as a single-itemUiListwrapper.static TaskCardComponentrunningSubAgent(String nodeId, String agentName, String taskId, String subSessionId, String inputJson) The running sub-agent card.static StringrunningSubAgentHeader(String agentName) static TaskCardComponentrunningTool(String nodeId, String toolName, Object arguments) Card representing a tool call that has just started.static StringrunningToolHeader(String toolName) "⏳ toolName — running…".static StringStable id of a sub-agent card's body stack (append target for the final answer).static ai.mindconnect.ui.ext.markdown.UiMarkdownsubAgentAnswer(String taskId, String finalText) Markdown node holding the sub-agent's final answer — APPENDed into the body stack on done.static ai.mindconnect.ui.model.UiListsubAgentChildList(String taskId) The nested child list (subtasks-{taskId}) that child cards append into.static StringStable id of a sub-agent card's summary span (the running/done marker shown even when collapsed).static StringtaskCardBody(String inputJsonOrText, String output) Builds the markdown body of a task card: optional **Input** code block, optional **Output** code block, or a placeholder when both are null.
-
Constructor Details
-
TaskCardComponent
public TaskCardComponent(String nodeId, String headerLabel, ai.mindconnect.ui.model.UiNode body, boolean open) Primary constructor — caller supplies the fully-built body node. -
TaskCardComponent
public TaskCardComponent(String nodeId, String headerLabel, ai.mindconnect.ui.model.UiNode body, boolean open, String summaryId) Full constructor —summaryIdmakes the summary text individually REPLACEable. -
TaskCardComponent
Convenience constructor for the common markdown-body case.
-
-
Method Details
-
summaryId
Stable id of a sub-agent card's summary span (the running/done marker shown even when collapsed). -
id
The id of the card's<li>; what REPLACE patches target.- Specified by:
idin interfaceUiComponent
-
childListId
Stable id of the nested<ul>-bearing list that holds a sub-agent's child task cards. Inner tool-call events APPEND into this id so they nest under the sub-agent instead of going flat into the message list. Derived purely from the sub-agent'staskIdso the streaming handler can compute it without holding a reference to the card object. -
render
public ai.mindconnect.ui.model.UiList render()Renders as a single-itemUiListwrapper. The wrapper id differs from the item id so a REPLACE on the item (id()) morphs the<li>content without disturbing the surrounding list — but APPEND on the message list's id can also take this wrapper directly: the renderer's "append a list" path extracts itsitemsinto the existing<ul>.- Specified by:
renderin interfaceUiComponent
-
runningTool
Card representing a tool call that has just started. -
doneTool
public static TaskCardComponent doneTool(String nodeId, String toolName, Object arguments, String result, long durationMs) Card representing a tool call that finished successfully. -
failedTool
public static TaskCardComponent failedTool(String nodeId, String toolName, Object arguments, String error, long durationMs) Card representing a tool call that failed. -
stackId
Stable id of a sub-agent card's body stack (append target for the final answer). -
openSessionLink
A link that opens the sub-agent's own session page in a new browser tab.external→ target="_blank" with no SPA interception.subSessionIdis the sub-session's id (== the card's taskId). -
runningSubAgent
public static TaskCardComponent runningSubAgent(String nodeId, String agentName, String taskId, String subSessionId, String inputJson) The running sub-agent card. Built once at SubAgentStarted. The<details>summary carries the live status marker (⏳ + agent name) inside an id'd span so it can be flipped to ✓/✗ on completion without touching the nested tree — and stays visible when the card is collapsed. The body opens with a link to the sub-session and (once known) the input, then the nested child list; the final answer is appended beneath it on done.subSessionIdis the durable session id this card is keyed on (==taskIdfor live cards).inputJsonis therun_agentcall's arguments, or null when not yet known live. -
subAgentChildList
The nested child list (subtasks-{taskId}) that child cards append into. -
doneSubAgentSummary
public static ai.mindconnect.ui.model.UiText doneSubAgentSummary(String taskId, String agentName, long durationMs) Summary-span REPLACE node flipping the marker to "done". Visible while collapsed. -
failedSubAgentSummary
Summary-span REPLACE node flipping the marker to "failed". -
subAgentAnswer
public static ai.mindconnect.ui.ext.markdown.UiMarkdown subAgentAnswer(String taskId, String finalText) Markdown node holding the sub-agent's final answer — APPENDed into the body stack on done. -
historic
Card rebuilt from persisted TOOL_CALL + TOOL_RESULT messages. Caller passes a pre-computed header (already labelled done/failed) and the card body produced bytaskCardBody(String, String). -
historicSubAgent
public static TaskCardComponent historicSubAgent(String nodeId, String agentName, String taskId, boolean running, boolean failed, long durationMs, String inputJson, String resultText, ai.mindconnect.ui.model.UiList childList, String finalTextMarkdown) Sub-agent card rebuilt from persisted state on a full page load. Keyed on the sub-session id (taskId) so its ids match the ones the live stream uses — a reload mid-run produces the identical nodes and the run's continuing live patches (summary flip, answer append) still land.childListholds the recursively-built child cards; passfinalTextMarkdown == nullwhile the sub-agent is still running so no answer block is shown yet.The body reads like a normal tool card plus the tree: a link to open the sub-session in a new tab, the call's **Input** (and **Output** when it differs from the rendered answer), the nested child tree, then the sub-agent's final answer as a chat bubble.
- Parameters:
running- when true the summary shows the ⏳ marker and the card starts open; the summary id lets a later done patch flip it.inputJson- therun_agentcall's pretty-printed arguments, or null.resultText- the persisted tool-result text (≈ the answer), or null while running.
-
runningToolHeader
"⏳ toolName — running…". -
doneToolHeader
"✓ toolName (123 ms)". -
failedToolHeader
"✗ toolName (123 ms)". -
runningSubAgentHeader
-
doneSubAgentHeader
-
failedSubAgentHeader
-
taskCardBody
Builds the markdown body of a task card: optional **Input** code block, optional **Output** code block, or a placeholder when both are null. -
prettyJson
Pretty-prints arguments map as JSON; falls back to toString on errors.
-