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(models): hosted tool cards and IM lines as the approved v2 mockups show them (#2658)

Call White69384c54f521
diff --git a/core/hosted_activity.py b/core/hosted_activity.py
index eec1c00b4..8aa258dce 100644
--- a/core/hosted_activity.py
+++ b/core/hosted_activity.py
@@ -315,6 +315,28 @@ def _clip(text: str, limit: int = LINE_SUBJECT_MAX_CHARS) -> str:
return flat if len(flat) <= limit else flat[: limit - 1].rstrip() + "…"
+def _ran(activity: HostedActivity, lang: str) -> list[Optional[str]]:
+ """How a completed call ran and what it produced, as the IM line names them.
+
+ A direct image call names the image model and the image's size rather than a vendor: the model is what the call
+ picked, and the image is the result. A proxied search names its executor's model beside the vendor.
+ """
+
+ if activity.mode == "direct":
+ first = activity.images[0] if activity.images else None
+ size = f"{first.width}×{first.height}" if first is not None and first.width and first.height else None
+ more = _count(activity, lang) if len(activity.images) > 1 else None
+ return [activity.model, size, more]
+ vendor = _vendor_label(activity.provider)
+ if not vendor:
+ mode = None
+ elif activity.mode == "proxy" and activity.model:
+ mode = i18n_t("hostedTools.mode.proxyModel", lang, provider=vendor, model=activity.model)
+ else:
+ mode = i18n_t(f"hostedTools.mode.{activity.mode}", lang, provider=vendor)
+ return [mode, _count(activity, lang)]
+
+
def _count(activity: HostedActivity, lang: str) -> Optional[str]:
if activity.tool == "image_generate":
count, unit = len(activity.images), "image"
@@ -361,7 +383,8 @@ def _error_text(activity: HostedActivity, lang: str) -> str:
def hosted_line(activity: HostedActivity, lang: str, *, escape: Callable[[str], str] = lambda text: text) -> str:
"""The one-line form IM shows per hosted call.
- ``🔎 Web search "query" · native (xAI) · 6 sources · $0.01``. A call that did
+ ``🔎 Web search "query" · native (xAI) · 6 sources · $0.01``, or for an image
+ ``🖼 Image generation "prompt" · gpt-image-2 · 1536×1024 · $0.02``. A call that did
not complete says why instead of how it ran or what it found, and keeps a
known cost (``HostedActivity.completed``). ``escape`` makes the quoted
subject safe for the destination's markup.
@@ -372,10 +395,7 @@ def hosted_line(activity: HostedActivity, lang: str, *, escape: Callable[[str],
if activity.subject:
parts[0] += " " + i18n_t("hostedTools.quoted", lang, subject=escape(_clip(activity.subject)))
if activity.completed:
- vendor = _vendor_label(activity.provider)
- if vendor:
- parts.append(i18n_t(f"hostedTools.mode.{activity.mode}", lang, provider=vendor))
- parts.append(_count(activity, lang))
+ parts.extend(_ran(activity, lang))
else:
parts.append(i18n_t(f"hostedTools.status.{activity.status}", lang, error=escape(_error_text(activity, lang))))
parts.append(_cost(activity, lang))
diff --git a/tests/scenarios/model_hub/catalog.yaml b/tests/scenarios/model_hub/catalog.yaml
index a66caa0de..894ffce6a 100644
--- a/tests/scenarios/model_hub/catalog.yaml
+++ b/tests/scenarios/model_hub/catalog.yaml
@@ -243,7 +243,7 @@ scenarios:
layer: unit
test:
- 'ui/src/components/workbench/HostedToolRow.test.tsx::MH-HOSTED-UI-008: shows a native and a proxied call the same way, each with how it ran and its known cost'
- - 'ui/src/components/workbench/HostedToolRow.test.tsx::MH-HOSTED-UI-008: shows a direct image call with how it ran, its file and the prompt it rendered, and no cost when none is known'
+ - 'ui/src/components/workbench/HostedToolRow.test.tsx::MH-HOSTED-UI-008: shows a direct image call by its model and Source, with its size, file and prompt, and no cost when none is known'
- 'ui/src/components/workbench/HostedToolRow.test.tsx::MH-HOSTED-UI-008: shows a total an unpriced attempt left only as a lower bound'
- id: MH-HOSTED-UI-009
name: A hosted call's card payload is projected from the canonical C-1 records in the shape the Web renders
diff --git a/tests/test_hosted_activity.py b/tests/test_hosted_activity.py
index 9d554b57d..aa58131fa 100644
--- a/tests/test_hosted_activity.py
+++ b/tests/test_hosted_activity.py
@@ -245,12 +245,12 @@ def test_a_response_scoped_summary_is_shown_once():
"zh",
"🔎 网页搜索 “OpenAI announcements October 2026” · 原生(Anthropic) · 2 个来源 · ≈ $0.01",
),
- (proxy_x_search, "zh", "🔎 X 搜索 “from:OpenAI within_time:7d” · 由 xAI 代理 · 2 条帖子 · $0.11"),
+ (proxy_x_search, "zh", "🔎 X 搜索 “from:OpenAI within_time:7d” · 由 xAI 代理(grok-4.6) · 2 条帖子 · $0.11"),
(
direct_image,
"en",
"🖼 Image generation “A wide photo of an open laptop on a desk at night, empty da…”"
- " · direct (OpenAI) · 1 image",
+ " · gpt-image-2 · 1536×1024",
),
(proxy_failed, "zh", "🔎 X 搜索 “from:OpenAI” · 失败:no Source is verified for X search"),
],
@@ -297,7 +297,7 @@ def test_the_im_line_names_a_subscription_and_a_shared_response_cost():
),
),
)
- assert hosted_line(included, "zh") == "🔎 X 搜索 “from:xai within_time:3d” · 由 OpenAI 代理 · 1 条帖子 · 订阅内含"
+ assert hosted_line(included, "zh") == "🔎 X 搜索 “from:xai within_time:3d” · 由 OpenAI 代理(gpt-6.1-sol) · 1 条帖子 · 订阅内含"
shared = native_activities(
_message(
diff --git a/tests/test_vibey_agent.py b/tests/test_vibey_agent.py
index d1e578cf1..3c1316b56 100644
--- a/tests/test_vibey_agent.py
+++ b/tests/test_vibey_agent.py
@@ -3724,7 +3724,7 @@ async def test_a_proxied_hosted_result_shows_once_its_result_is_committed(engine
await harness.agent._on_event(run, ToolFinished("turn", 1, call.id, entry.row_id, False))
- assert harness.controller.im_client.sent[-1:] == ["🔎 X search “from:OpenAI” · via xAI proxy · 1 post · $0.11"]
+ assert harness.controller.im_client.sent[-1:] == ["🔎 X search “from:OpenAI” · via xAI proxy (grok-4.6) · 1 post · $0.11"]
def test_an_image_is_attached_unless_the_reply_already_links_it(tmp_path) -> None:
diff --git a/ui/src/components/workbench/HostedToolRow.test.tsx b/ui/src/components/workbench/HostedToolRow.test.tsx
index 1cb42b4c6..9b8d44872 100644
--- a/ui/src/components/workbench/HostedToolRow.test.tsx
+++ b/ui/src/components/workbench/HostedToolRow.test.tsx
@@ -59,7 +59,7 @@ describe('hosted tool cards', () => {
within(native).getByText('2 sources');
const proxy = row('call_x1');
- within(proxy).getByText('Via xAI proxy');
+ within(proxy).getByText('Via xAI proxy · grok-4.6');
within(proxy).getByText('$0.11');
within(proxy).getByText('2 posts');
@@ -81,14 +81,14 @@ describe('hosted tool cards', () => {
within(failed).getByText('no Source is verified for X search');
});
- it('MH-HOSTED-UI-008: shows a direct image call with how it ran, its file and the prompt it rendered, and no cost when none is known', () => {
+ it('MH-HOSTED-UI-008: shows a direct image call by its model and Source, with its size, file and prompt, and no cost when none is known', () => {
renderGroup([{
...fixture.direct_image,
images: [{ ...fixture.direct_image.images[0], media_url: '/api/media/tok_3f2a?w=1536&h=1024', bytes: 1_993_000 }],
}]);
const image = row('call_ig1');
within(image).getByText('image_generate');
- within(image).getByText('Direct · OpenAI');
+ within(image).getByText('gpt-image-2 · relay-gpt');
within(image).getByText('1 image · 1536×1024');
expect(image.textContent).not.toMatch(/\$/);
@@ -98,7 +98,10 @@ describe('hosted tool cards', () => {
expect((figure.querySelector('img') as HTMLImageElement).getAttribute('src')).toBe('/api/media/tok_3f2a?w=1536&h=1024');
within(figure).getByRole('link', { name: '3f2a.png' });
within(figure).getByText('1.9 MB');
- within(figure).getByText('Revised prompt');
+ // The image as made: model and size, then where it ran.
+ within(figure).getByText('gpt-image-2 · 1536×1024');
+ within(figure).getByText('relay-gpt');
+ within(figure).getByText('Prompt');
within(figure).getByText(fixture.direct_image.revised_prompt);
});
@@ -155,7 +158,7 @@ describe('hosted tool cards', () => {
it('reads in Chinese with the same facts', () => {
renderGroup(['proxy_x_search'], 'zh');
const proxy = row('call_x1');
- within(proxy).getByText('由 xAI 代理');
+ within(proxy).getByText('由 xAI 代理 · grok-4.6');
within(proxy).getByText('2 条帖子');
});
});
diff --git a/ui/src/components/workbench/HostedToolRow.tsx b/ui/src/components/workbench/HostedToolRow.tsx
index 59baba315..7e3e699ff 100644
--- a/ui/src/components/workbench/HostedToolRow.tsx
+++ b/ui/src/components/workbench/HostedToolRow.tsx
@@ -4,7 +4,7 @@
// sources or image it produced. Every mode draws the same card from the same record.
import * as React from 'react';
import { useTranslation } from 'react-i18next';
-import { AtSign, Check, ChevronRight, CircleSlash, Download, FileImage, Globe, Image as ImageIcon, TriangleAlert, Waypoints, WandSparkles, Zap } from 'lucide-react';
+import { AtSign, Check, ChevronRight, CircleSlash, Download, FileImage, Globe, Image as ImageIcon, TriangleAlert, Type, Waypoints } from 'lucide-react';
import clsx from 'clsx';
import { ChatImage } from '../ui/chat-image';
@@ -83,15 +83,21 @@ export const HostedModeChip: React.FC<{ card: HostedActivity }> = ({ card }) =>
);
}
const vendor = vendorLabel(card.provider);
- if (!vendor) return null;
if (card.mode === 'direct') {
+ // An image call names the model it picked and where it ran, not a vendor: the model is the choice.
+ const where = card.source_name ?? vendor;
+ const label = card.model && where
+ ? t('chat.agentActivity.hosted.mode.directModel', { model: card.model, source: where })
+ : vendor && t('chat.agentActivity.hosted.mode.direct', { provider: vendor });
+ if (!label) return null;
return (
<span className="inline-flex shrink-0 items-center gap-1 rounded-full border border-cyan/40 bg-cyan-soft px-2 py-px text-[11px] font-medium text-cyan-ink">
- <Zap className="size-3" aria-hidden="true" />
- {t('chat.agentActivity.hosted.mode.direct', { provider: vendor })}
+ <ImageIcon className="size-3" aria-hidden="true" />
+ {label}
</span>
);
}
+ if (!vendor) return null;
return card.mode === 'native' ? (
<span className="inline-flex shrink-0 items-center gap-1 rounded-full border border-mint/40 bg-mint-soft px-2 py-px text-[11px] font-medium text-mint-ink">
<Check className="size-3" aria-hidden="true" />
@@ -100,7 +106,9 @@ export const HostedModeChip: React.FC<{ card: HostedActivity }> = ({ card }) =>
) : (
<span className="inline-flex shrink-0 items-center gap-1 rounded-full border border-cyan/40 bg-cyan-soft px-2 py-px text-[11px] font-medium text-cyan-ink">
<Waypoints className="size-3" aria-hidden="true" />
- {t('chat.agentActivity.hosted.mode.proxy', { provider: vendor })}
+ {card.model
+ ? t('chat.agentActivity.hosted.mode.proxyModel', { provider: vendor, model: card.model })
+ : t('chat.agentActivity.hosted.mode.proxy', { provider: vendor })}
</span>
);
};
@@ -131,7 +139,18 @@ export const HostedImageFigure: React.FC<{ card: HostedActivity; image: HostedAc
: null}
<figcaption className="flex flex-col">
<span className="flex flex-wrap items-center gap-x-2 gap-y-1 px-3 py-2 text-[11px] text-muted">
- <HostedModeChip card={card} />
+ {card.mode === 'direct' && card.model
+ ? (
+ <>
+ {/* The image as made: the model and its size, then where it ran. */}
+ <span className="inline-flex shrink-0 items-center gap-1 rounded-full border border-cyan/40 bg-cyan-soft px-2 py-px font-medium text-cyan-ink">
+ <ImageIcon className="size-3" aria-hidden="true" />
+ {image.width && image.height ? `${card.model} · ${image.width}×${image.height}` : card.model}
+ </span>
+ {(card.source_name ?? vendorLabel(card.provider)) && <span>{card.source_name ?? vendorLabel(card.provider)}</span>}
+ </>
+ )
+ : <HostedModeChip card={card} />}
{cost && <span>{cost}</span>}
<span className="ml-auto inline-flex min-w-0 items-center gap-1.5">
<FileImage className="size-3.5 shrink-0 text-cyan-ink" aria-hidden="true" />
@@ -145,8 +164,8 @@ export const HostedImageFigure: React.FC<{ card: HostedActivity; image: HostedAc
{card.revised_prompt && (
<span className="flex flex-col gap-1 border-t border-border px-3 py-2">
<span className="inline-flex items-center gap-1.5 text-[11px] font-medium text-muted">
- <WandSparkles className="size-3" aria-hidden="true" />
- {t('chat.agentActivity.hosted.image.revisedPrompt')}
+ <Type className="size-3" aria-hidden="true" />
+ {t('chat.agentActivity.hosted.image.prompt')}
</span>
<span className="text-[12px] leading-relaxed text-foreground/90">{card.revised_prompt}</span>
</span>
@@ -173,7 +192,7 @@ const HostedDetail: React.FC<{ card: HostedActivity }> = ({ card }) => {
{completed && (card.mode === 'native'
? <Check className="size-3 shrink-0 text-mint-ink" aria-hidden="true" />
: card.mode === 'direct'
- ? <Zap className="size-3 shrink-0 text-cyan-ink" aria-hidden="true" />
+ ? <ImageIcon className="size-3 shrink-0 text-cyan-ink" aria-hidden="true" />
: <Waypoints className="size-3 shrink-0 text-cyan-ink" aria-hidden="true" />)}
<span className="min-w-0">{facts.join(' · ')}</span>
</div>
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 5eb0ba580..ffc68709b 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -4960,7 +4960,9 @@
"mode": {
"native": "Native · {{provider}}",
"proxy": "Via {{provider}} proxy",
- "direct": "Direct · {{provider}}"
+ "direct": "Direct · {{provider}}",
+ "directModel": "{{model}} · {{source}}",
+ "proxyModel": "Via {{provider}} proxy · {{model}}"
},
"status": {
"failed": "Failed",
@@ -4989,7 +4991,7 @@
"duration": "took {{seconds}} s",
"alsoSearched": "Also searched: {{queries}}",
"image": {
- "revisedPrompt": "Revised prompt",
+ "prompt": "Prompt",
"download": "Download {{name}}"
}
},
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 3d3648655..8be3f82ce 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -4960,7 +4960,9 @@
"mode": {
"native": "原生 · {{provider}}",
"proxy": "由 {{provider}} 代理",
- "direct": "{{provider}} 直连"
+ "direct": "{{provider}} 直连",
+ "directModel": "{{model}} · {{source}}",
+ "proxyModel": "由 {{provider}} 代理 · {{model}}"
},
"status": {
"failed": "失败",
@@ -4989,7 +4991,7 @@
"duration": "用时 {{seconds}} 秒",
"alsoSearched": "还搜索了:{{queries}}",
"image": {
- "revisedPrompt": "修订后的提示词",
+ "prompt": "提示词",
"download": "下载 {{name}}"
}
},
diff --git a/vibe/i18n/en.json b/vibe/i18n/en.json
index 419925ef7..19184f071 100644
--- a/vibe/i18n/en.json
+++ b/vibe/i18n/en.json
@@ -1793,6 +1793,7 @@
"mode": {
"native": "native ({provider})",
"proxy": "via {provider} proxy",
+ "proxyModel": "via {provider} proxy ({model})",
"direct": "direct ({provider})"
},
"count": {
diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.json
index eb9ceeea2..ff5ccf7dd 100644
--- a/vibe/i18n/zh.json
+++ b/vibe/i18n/zh.json
@@ -1793,6 +1793,7 @@
"mode": {
"native": "原生({provider})",
"proxy": "由 {provider} 代理",
+ "proxyModel": "由 {provider} 代理({model})",
"direct": "{provider} 直连"
},
"count": {