MCPcopy Create free account
hub / github.com/langchain-ai/deepagents / render

Method render

libs/code/deepagents_code/widgets/status.py:106–130  ·  view source on GitHub ↗

Render the model label with width-aware truncation. Returns: Text content, truncated from the left when necessary.

(self)

Source from the content-addressed store, hash-verified

104 return len(self._with_effort(full))
105
106 def render(self) -> RenderResult:
107 """Render the model label with width-aware truncation.
108
109 Returns:
110 Text content, truncated from the left when necessary.
111 """
112 width = self.content_size.width
113 if not self.model or width <= 0:
114 return ""
115 model = self._clean_model()
116 full = f"{self.provider}:{model}" if self.provider else model
117 full_with_effort = self._with_effort(full)
118 model_with_effort = self._with_effort(model)
119 if len(full_with_effort) <= width:
120 return Content(full_with_effort)
121 if len(model_with_effort) <= width:
122 return Content(model_with_effort)
123 if self.effort and width > len(self.effort) + 2:
124 model_width = width - len(self.effort) - 1
125 return Content(f"\u2026{model[-(model_width - 1) :]} {self.effort}")
126 if len(model) <= width:
127 return Content(model)
128 if width > 1:
129 return Content("\u2026" + model[-(width - 1) :])
130 return Content("\u2026")
131
132
133class StatusBar(Horizontal):

Calls 2

_clean_modelMethod · 0.95
_with_effortMethod · 0.95