Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(ui): simplify result message format and add show_duration toggle

cyh0c746e2e42e4
diff --git a/config/v2_config.py b/config/v2_config.py
index 61ef45c69..f4554e0d7 100644
--- a/config/v2_config.py
+++ b/config/v2_config.py
@@ -126,6 +126,7 @@ class V2Config:
ui: UiConfig = field(default_factory=UiConfig)
update: UpdateConfig = field(default_factory=UpdateConfig)
ack_mode: str = "reaction"
+ show_duration: bool = True # Show task duration in result messages
language: str = "en" # Global language setting (see vibe/i18n)
@classmethod
@@ -225,6 +226,10 @@ class V2Config:
if ack_mode not in {"reaction", "message"}:
raise ValueError("Config 'ack_mode' must be 'reaction' or 'message'")
+ show_duration = payload.get("show_duration", True)
+ if not isinstance(show_duration, bool):
+ show_duration = True
+
language = normalize_language(payload.get("language"), default="en")
return cls(
@@ -239,6 +244,7 @@ class V2Config:
ui=ui,
update=update,
ack_mode=ack_mode,
+ show_duration=show_duration,
language=language,
)
@@ -265,6 +271,7 @@ class V2Config:
"ui": self.ui.__dict__,
"update": self.update.__dict__,
"ack_mode": self.ack_mode,
+ "show_duration": self.show_duration,
"language": self.language,
}
path.write_text(json.dumps(payload, indent=2), encoding="utf-8")
diff --git a/modules/agents/base.py b/modules/agents/base.py
index 8e00f3b4d..4d0b3e4fb 100644
--- a/modules/agents/base.py
+++ b/modules/agents/base.py
@@ -100,7 +100,12 @@ class BaseAgent(ABC):
) -> None:
if duration_ms is None:
duration_ms = self._calculate_duration_ms(started_at)
- formatted = self.im_client.formatter.format_result_message(subtype or "", duration_ms, result_text)
+ formatted = self.im_client.formatter.format_result_message(
+ subtype or "",
+ duration_ms,
+ result_text,
+ show_duration=getattr(self.config, "show_duration", True),
+ )
if suffix:
formatted = f"{formatted}\n{suffix}"
await self.controller.emit_agent_message(context, "result", formatted, parse_mode=parse_mode)
diff --git a/modules/im/formatters/base_formatter.py b/modules/im/formatters/base_formatter.py
index 2ab40e158..2e8dfd40d 100644
--- a/modules/im/formatters/base_formatter.py
+++ b/modules/im/formatters/base_formatter.py
@@ -128,9 +128,7 @@ class BaseMarkdownFormatter(ABC):
# Default implementation - subclasses can override for platform-specific needs
return f"• {self.format_bold(label)} - {self.format_text(description)}"
- def format_definition_list(
- self, items: List[Tuple[str, str]], bold_key: bool = True
- ) -> List[str]:
+ def format_definition_list(self, items: List[Tuple[str, str]], bold_key: bool = True) -> List[str]:
"""Format a list of key-value pairs
Args:
@@ -216,9 +214,7 @@ class BaseMarkdownFormatter(ABC):
def format_error(self, error_text: str) -> str:
"""Format error message"""
- return (
- f"❌ {self.format_bold('Error')}: {self.escape_special_chars(error_text)}"
- )
+ return f"❌ {self.format_bold('Error')}: {self.escape_special_chars(error_text)}"
def format_success(self, message: str) -> str:
"""Format success message"""
@@ -244,23 +240,17 @@ class BaseMarkdownFormatter(ABC):
else:
return f"{self.format_bold(escaped_key)}:\n{escaped_value}"
- def truncate_text(
- self, text: str, max_length: int = 50, suffix: str = "..."
- ) -> str:
+ def truncate_text(self, text: str, max_length: int = 50, suffix: str = "...") -> str:
"""Truncate text to specified length"""
if len(text) <= max_length:
return text
return text[:max_length] + suffix
# Claude message formatting methods
- def format_system_message(
- self, cwd: str, subtype: str, session_id: Optional[str] = None
- ) -> str:
+ def format_system_message(self, cwd: str, subtype: str, session_id: Optional[str] = None) -> str:
"""Format system message"""
header = self.format_section_header(f"System {subtype}", "🔧")
- cwd_line = self.format_file_path(cwd, emoji="📁").replace(
- "File:", "Working directory:"
- )
+ cwd_line = self.format_file_path(cwd, emoji="📁").replace("File:", "Working directory:")
# Add session ID if available
if session_id:
@@ -338,26 +328,32 @@ class BaseMarkdownFormatter(ABC):
return "\n\n".join(parts)
def format_result_message(
- self, subtype: str, duration_ms: int, result: Optional[str] = None
+ self,
+ subtype: str,
+ duration_ms: int,
+ result: Optional[str] = None,
+ show_duration: bool = True,
) -> str:
- """Format result message"""
- # Calculate duration
- total_seconds = duration_ms / 1000
- minutes = int(total_seconds // 60)
- seconds = int(total_seconds % 60)
-
- if minutes > 0:
- duration_str = f"{minutes}m {seconds}s"
- else:
- duration_str = f"{seconds}s"
+ """Format result message.
+
+ Format: ⏱️_Success_: 2m 24s (when show_duration=True)
+ ⏱️_Success_ (when show_duration=False)
+ """
+ subtype_display = subtype.capitalize() if subtype else "Done"
+
+ if show_duration and duration_ms > 0:
+ total_seconds = duration_ms / 1000
+ minutes = int(total_seconds // 60)
+ seconds = int(total_seconds % 60)
- # Format result - don't include subtype in parentheses to avoid escaping issues
- header = self.format_section_header("Result", "📊")
- if subtype:
- header += f" {self.format_italic(subtype)}"
- duration_line = self.format_key_value("⏱️ Duration", duration_str)
+ if minutes > 0:
+ duration_str = f"{minutes}m {seconds}s"
+ else:
+ duration_str = f"{seconds}s"
- result_text = f"{header}\n{duration_line}"
+ result_text = f"⏱️{self.format_italic(subtype_display)}: {duration_str}"
+ else:
+ result_text = f"⏱️{self.format_italic(subtype_display)}"
if result:
result_text += f"\n\n{result}"
@@ -418,13 +414,9 @@ class BaseMarkdownFormatter(ABC):
return f"🔧 {self.format_code_inline(tool_name)}"
return f"🔧 {self.format_code_inline(tool_name)} {self.format_code_inline(params)}"
- def format_todo_item(
- self, status: str, priority: str, content: str, completed: bool = False
- ) -> str:
+ def format_todo_item(self, status: str, priority: str, content: str, completed: bool = False) -> str:
"""Format a todo item with status and priority"""
- status_emoji = {"pending": "⏳", "in_progress": "🔄", "completed": "✅"}.get(
- status, "⏳"
- )
+ status_emoji = {"pending": "⏳", "in_progress": "🔄", "completed": "✅"}.get(status, "⏳")
priority_emoji = {"high": "🔴", "medium": "🟡", "low": "🟢"}.get(priority, "🟡")
@@ -497,15 +489,11 @@ class BaseMarkdownFormatter(ABC):
# Description
if "description" in tool_input and tool_input["description"]:
- input_info.append(
- f"📝 Description: {self.format_code_inline(tool_input['description'])}"
- )
+ input_info.append(f"📝 Description: {self.format_code_inline(tool_input['description'])}")
# Pattern/Query
if "pattern" in tool_input and tool_input["pattern"]:
- input_info.append(
- f"🔍 Pattern: {self.format_code_inline(tool_input['pattern'])}"
- )
+ input_info.append(f"🔍 Pattern: {self.format_code_inline(tool_input['pattern'])}")
if "query" in tool_input and tool_input["query"]:
query_str = str(tool_input["query"])
@@ -514,9 +502,7 @@ class BaseMarkdownFormatter(ABC):
# URL
if "url" in tool_input and tool_input["url"]:
- input_info.append(
- f"🌐 URL: {self.format_code_inline(str(tool_input['url']))}"
- )
+ input_info.append(f"🌐 URL: {self.format_code_inline(str(tool_input['url']))}")
# Prompt
if "prompt" in tool_input and tool_input["prompt"]:
@@ -547,9 +533,7 @@ class BaseMarkdownFormatter(ABC):
# Task tool
if "subagent_type" in tool_input and tool_input["subagent_type"]:
- input_info.append(
- f"🤖 Agent: {self.format_code_inline(str(tool_input['subagent_type']))}"
- )
+ input_info.append(f"🤖 Agent: {self.format_code_inline(str(tool_input['subagent_type']))}")
if "plan" in tool_input and tool_input["plan"]:
plan_str = self.truncate_text(str(tool_input["plan"]), 100)
@@ -557,14 +541,10 @@ class BaseMarkdownFormatter(ABC):
# Notebook operations
if "cell_id" in tool_input and tool_input["cell_id"]:
- input_info.append(
- f"📊 Cell ID: {self.format_code_inline(str(tool_input['cell_id']))}"
- )
+ input_info.append(f"📊 Cell ID: {self.format_code_inline(str(tool_input['cell_id']))}")
if "cell_type" in tool_input and tool_input["cell_type"]:
- input_info.append(
- f"📝 Cell Type: {self.format_code_inline(str(tool_input['cell_type']))}"
- )
+ input_info.append(f"📝 Cell Type: {self.format_code_inline(str(tool_input['cell_type']))}")
# WebSearch
if "allowed_domains" in tool_input and tool_input["allowed_domains"]:
@@ -577,19 +557,13 @@ class BaseMarkdownFormatter(ABC):
# Grep specific
if "glob" in tool_input and tool_input["glob"]:
- input_info.append(
- f"🎯 Glob: {self.format_code_inline(str(tool_input['glob']))}"
- )
+ input_info.append(f"🎯 Glob: {self.format_code_inline(str(tool_input['glob']))}")
if "type" in tool_input and tool_input["type"]:
- input_info.append(
- f"📄 Type: {self.format_code_inline(str(tool_input['type']))}"
- )
+ input_info.append(f"📄 Type: {self.format_code_inline(str(tool_input['type']))}")
if "output_mode" in tool_input and tool_input["output_mode"]:
- input_info.append(
- f"📊 Output mode: {self.format_code_inline(str(tool_input['output_mode']))}"
- )
+ input_info.append(f"📊 Output mode: {self.format_code_inline(str(tool_input['output_mode']))}")
# Combine tool info with inputs
if input_info:
@@ -638,6 +612,4 @@ class BaseMarkdownFormatter(ABC):
"WebSearch",
"TodoWrite",
]
- return (
- tool_name not in no_json_tools and tool_input and len(str(tool_input)) < 200
- )
+ return tool_name not in no_json_tools and tool_input and len(str(tool_input)) < 200
diff --git a/ui/src/components/Dashboard.tsx b/ui/src/components/Dashboard.tsx
index e4c6d5840..e2b919257 100644
--- a/ui/src/components/Dashboard.tsx
+++ b/ui/src/components/Dashboard.tsx
@@ -375,6 +375,37 @@ export const Dashboard: React.FC = () => {
className="w-16 bg-neutral-100 border border-border rounded px-2 py-1 text-xs font-mono text-center"
/>
</div>
+ <div className="flex justify-between items-center">
+ <span className="text-muted flex items-center gap-1">
+ {t('dashboard.showDuration')}
+ <span className="relative group">
+ <Info size={12} className="text-muted/50 cursor-help" />
+ <span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 bg-text text-bg text-xs rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none">
+ {t('dashboard.showDurationHint')}
+ </span>
+ </span>
+ </span>
+ <button
+ onClick={() => {
+ setSettingsMessage(null);
+ const newConfig = {
+ ...config,
+ show_duration: !config.show_duration,
+ };
+ setConfig(newConfig);
+ autoSaveMessageConfig(newConfig);
+ }}
+ className={`px-2 py-1 rounded text-xs font-semibold border ${
+ config.show_duration !== false
+ ? 'bg-success/10 text-success border-success/20'
+ : 'bg-neutral-100 text-muted border-border'
+ }`}
+ >
+ {config.show_duration !== false
+ ? t('common.enabled')
+ : t('common.disabled')}
+ </button>
+ </div>
<div className="flex justify-between items-center">
<span className="text-muted">{t('dashboard.allowedChannels')}</span>
<Link to="/channels" className="text-xs text-accent hover:underline font-medium">{t('common.manageChannels')}</Link>
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index cccc7a7b0..9b53bbf5b 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -271,6 +271,8 @@
"ackMessage": "Message",
"errorRetryLimit": "Error Retry Limit",
"errorRetryLimitHint": "Auto-retry with 'continue' when LLM stream errors occur (0 = no retry)",
+ "showDuration": "Show Duration",
+ "showDurationHint": "Display task elapsed time in result messages",
"allowedChannels": "Allowed Channels",
"consoleServer": "Console Server",
"host": "Host",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 9ca5671a7..644d56990 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -271,6 +271,8 @@
"ackMessage": "消息回复",
"errorRetryLimit": "错误重试次数",
"errorRetryLimitHint": "当 LLM 流式响应出错时,自动发送 'continue' 重试(0 = 不重试)",
+ "showDuration": "显示耗时",
+ "showDurationHint": "在结果消息中显示任务耗时",
"allowedChannels": "允许的频道",
"consoleServer": "控制台服务器",
"host": "主机",