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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(models): check image generation like the other tools, total a set's cost without counting unknown as zero, and show a replay that did not verify (#2624)
Call Whitee41569c8381a
diff --git a/tests/scenarios/model_hub/catalog.yaml b/tests/scenarios/model_hub/catalog.yamlindex 926a2a4ed..cf8f2cece 100644--- a/tests/scenarios/model_hub/catalog.yaml+++ b/tests/scenarios/model_hub/catalog.yaml@@ -445,6 +445,7 @@ scenarios:- 'ui/src/components/settings/models/SourceDetailPanel.test.tsx::MH-HOSTED-UI-003: says a re-check''s cost is unknown when no estimate is known'- 'ui/src/components/settings/models/hostedTools.test.ts::MH-HOSTED-UI-003: totals a check only from what the server estimates, and never counts unknown as zero'- 'ui/src/components/settings/models/format.test.ts::MH-HOSTED-UI-003: keeps the first significant digits of a per-call price, and never shows a nonzero price as zero'+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-003: lets the locale compose a set''s cost with its unpriced checks'- id: MH-HOSTED-UI-004name: The Tools tab says how many checks an engine upgrade made stale, and nothing when none didstatus: covered@@ -499,7 +500,7 @@ scenarios:- 'ui/src/components/settings/models/SourceDetailPanel.test.tsx::MH-HOSTED-UI-013: checks a tool again from its chip, with the cost on the action, and answers there when the check is not evidence'- 'ui/src/components/settings/models/useHostedTools.test.tsx::MH-HOSTED-UI-013: reads the record before calling a probe unanswered when its answer was lost'- 'ui/src/components/settings/models/useHostedTools.test.tsx::MH-HOSTED-UI-013: reads a verdict the status does not carry as not verified, with why'- - 'ui/src/components/settings/models/hostedTools.test.ts::MH-HOSTED-UI-013: offers to check every pair with no current answer, and never an image'+ - 'ui/src/components/settings/models/hostedTools.test.ts::MH-HOSTED-UI-013: offers to check every pair with no current answer, images included'- id: MH-HOSTED-UI-016name: A hosted-tool check is a real call on exactly one Source, so the Models page reads its Sources again after one, and a Source the probe verified shows as verifiedstatus: covered@@ -509,7 +510,7 @@ scenarios:- 'ui/src/components/settings/models/SettingsModelsPage.render.test.tsx::MH-HOSTED-UI-016: reads the hosted-tools report again after a committed Source change, since its models decide which pairs could run a tool'- 'ui/src/components/settings/models/SettingsModelsPage.render.test.tsx::MH-HOSTED-UI-016: reads the Sources again after a check, since a probe can verify its Source'- id: MH-HOSTED-UI-018- name: The Tools tab never enables a tool that cannot run. It stays off until the server binds an executor, says whether a check or an executor pick is missing or checks are not available yet, and an enabled tool with nothing verified says its calls fail+ name: The Tools tab never enables a tool that cannot run. It stays off until the server binds an executor, says whether a check or an executor pick is missing, and an enabled tool with nothing verified says its calls failstatus: coveredkind: contractlayer: unit@@ -517,7 +518,7 @@ scenarios:- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-018: cannot turn a tool on until a pair is verified to run it, but can always turn it off'- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-018: keeps a tool off while the server binds no executor for it, and says to choose one when a verified pair exists'- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-018: claims routing only while the tool is on, and shows an off tool''s executor as a saved preference'- - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-018: says plainly when a tool cannot be checked yet, instead of asking for a check it cannot run'+ - 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-018: keeps an image tool off until a check verifies one of its pairs, and offers that check'- 'ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-018: says an enabled tool with nothing verified fails its calls, instead of naming a proxy'- id: MH-HOSTED-UI-017name: A Source's capability chip is usable without a mouse. Its spoken name is the locale's composition of the label, explanation and facts, it announces the detail it opens, and Enter moves focus to the detail's paid re-check@@ -527,6 +528,12 @@ scenarios:test:- 'ui/src/components/settings/models/SourceDetailPanel.test.tsx::MH-HOSTED-UI-017: names the record time, how it was learned, the reason, and until when it holds'- 'ui/src/components/settings/models/SourceDetailPanel.test.tsx::MH-HOSTED-UI-017: moves keyboard focus into the detail on Enter, so its paid re-check can be reached'+ - id: MH-HOSTED-UI-019+ name: A check's replay step reads as its own result. A replay that ran and did not verify asks for another try (or says the Source does not support it), and no replay says nothing; neither reads as the call failing+ status: covered+ kind: observation+ layer: unit+ test: ui/src/components/settings/models/ToolsTab.test.tsx::MH-HOSTED-UI-019- id: MH-VIBEY-007name: Vibey starts once with the user's Sources and built-in Agent models, seeded when its first Source existsstatus: covereddiff --git a/ui/src/components/settings/models/HostedCapabilityChips.tsx b/ui/src/components/settings/models/HostedCapabilityChips.tsxindex b3155738f..fdb77e920 100644--- a/ui/src/components/settings/models/HostedCapabilityChips.tsx+++ b/ui/src/components/settings/models/HostedCapabilityChips.tsx@@ -14,7 +14,7 @@ import { Button } from '@/components/ui/button';import { Popover, PopoverAnchor, PopoverContent } from '@/components/ui/popover';import { cn } from '@/lib/utils';import { formatDayTime, formatMonthDay, formatSentences } from './format';-import { probeableTool, probeKey, type ModelCapability, type ProbeTarget } from './hostedTools';+import { probeKey, type ModelCapability, type ProbeTarget } from './hostedTools';import type { HostedToolName, HostedToolProbeResult, RefusedEffort } from './types';import { ProbeAnswerNote } from './HostedProbeDialog';import { useEstimateLabel } from './useEstimateLabel';@@ -221,7 +221,7 @@ const CapabilityChip: React.FC<{tool,toolInline: t(`settings.models.tools.tool.${capability.tool}.inline`),}) as string;- const action = onProbe && probeableTool(capability.tool)+ const action = onProbe? (<span className="flex flex-col items-end gap-1">{last !== undefined && <ProbeAnswerNote result={last} />}diff --git a/ui/src/components/settings/models/HostedProbeDialog.tsx b/ui/src/components/settings/models/HostedProbeDialog.tsxindex 87c9f163f..f9aae17d2 100644--- a/ui/src/components/settings/models/HostedProbeDialog.tsx+++ b/ui/src/components/settings/models/HostedProbeDialog.tsx@@ -11,10 +11,10 @@ import { AlertCircle, AtSign, Check, Globe, Image as ImageIcon, Loader2, RotateCimport { Button } from '@/components/ui/button';import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@/components/ui/dialog';import { cn } from '@/lib/utils';-import { probeKey, probeTotal, probeUnanswered, type ProbeTarget } from './hostedTools';+import { probeCostSummary, probeKey, probeUnanswered, type ProbeTarget } from './hostedTools';import { serverText } from './serverCopy';import type { HostedToolName, HostedToolProbeResult, Source } from './types';-import { useEstimateLabel } from './useEstimateLabel';+import { useCostSummaryLabel, useEstimateLabel } from './useEstimateLabel';const TOOL_ICON: Record<HostedToolName, React.ComponentType<{ className?: string }>> = {web_search: Globe,@@ -70,7 +70,7 @@ const OutcomeChip: React.FC<{ outcome: Outcome }> = ({ outcome }) => {*/export const ProbeAnswerNote: React.FC<{ result: HostedToolProbeResult | null }> = ({ result }) => {const { t } = useTranslation();- if (!probeUnanswered(result)) return null;+ if (!probeUnanswered(result)) return result ? <ReplayNote replay={result.replay} /> : null;const failure = serverText(t, result?.call.error);return (<span className="model-hub-tool-cost-note flex items-center gap-1 model-hub-ink-gold" role="status">@@ -84,6 +84,22 @@ export const ProbeAnswerNote: React.FC<{ result: HostedToolProbeResult | null }>);};+/**+ * The replay step a verified call is followed by, when it ran and did not verify.+ * Null (no replay ran) and a verified replay say nothing; a replay that got no+ * answer asks for another try, never reads as a failure.+ */+const ReplayNote: React.FC<{ replay: HostedToolProbeResult['replay'] }> = ({ replay }) => {+ const { t } = useTranslation();+ if (!replay || replay.outcome === 'verified') return null;+ return (+ <span className="model-hub-tool-cost-note flex items-center gap-1 model-hub-ink-gold" role="status">+ <AlertCircle className="size-3 shrink-0" aria-hidden />+ {t(replay.outcome === 'unsupported' ? 'settings.models.tools.probe.replay.unsupported' : 'settings.models.tools.probe.replay.unverified')}+ </span>+ );+};+/** Mounted for one check: the set it shows is the one it was opened with. */export const HostedProbeDialog: React.FC<{targets: readonly ProbeTarget[];@@ -93,6 +109,7 @@ export const HostedProbeDialog: React.FC<{}> = ({ targets, sources, onRun, onClose }) => {const { t } = useTranslation();const estimateLabel = useEstimateLabel();+ const costSummaryLabel = useCostSummaryLabel();// The set is fixed when the dialog opens: the read refreshes under it as probes land.const [planned, setPlanned] = React.useState<readonly ProbeTarget[]>(targets);const [phase, setPhase] = React.useState<'confirm' | 'running' | 'result'>('confirm');@@ -107,13 +124,12 @@ export const HostedProbeDialog: React.FC<{setPhase('result');};- const total = probeTotal(planned);- const totalLabel = estimateLabel(total);+ const totalLabel = costSummaryLabel(probeCostSummary(planned));const outcomes = planned.map((target) => outcomeOf(results.get(probeKey(target)) ?? null));const unverified = planned.filter((target) => results.has(probeKey(target)) && probeUnanswered(results.get(probeKey(target)) ?? null));const count = (wanted: (outcome: Outcome) => boolean) => outcomes.filter(wanted).length;// A retry is as paid as the first run, so it says its cost the same way.- const retryLabel = estimateLabel(probeTotal(unverified));+ const retryLabel = costSummaryLabel(probeCostSummary(unverified));const done = results.size;return (@@ -144,7 +160,7 @@ export const HostedProbeDialog: React.FC<{<span className="font-semibold text-foreground">{t('settings.models.tools.dialog.total')}</span><span className="text-muted">{t('settings.models.tools.dialog.totalNote')}</span></span>- <span className="font-bold text-foreground">{totalLabel ?? t('settings.models.tools.probe.unknown')}</span>+ <span className="font-bold text-foreground">{totalLabel}</span></div></>)}@@ -181,6 +197,7 @@ export const HostedProbeDialog: React.FC<{: <Loader2 className="size-3.5 animate-spin text-muted" aria-label={t('settings.models.tools.probe.running') as string} />}/>{results.has(key) && reason && <p className="model-hub-probe-reason">{reason}</p>}+ {results.has(key) && !reason && result && <ReplayNote replay={result.replay} />}</React.Fragment>);})}@@ -194,7 +211,7 @@ export const HostedProbeDialog: React.FC<{<><Button variant="outline" size="sm" onClick={onClose}>{t('settings.models.tools.dialog.cancel')}</Button><Button size="sm" disabled={planned.length === 0} onClick={() => void run(planned)}>- {totalLabel ? t('settings.models.tools.dialog.startCost', { cost: totalLabel }) : t('settings.models.tools.dialog.start')}+ {t('settings.models.tools.dialog.startCost', { cost: totalLabel })}</Button></>)}@@ -207,7 +224,7 @@ export const HostedProbeDialog: React.FC<{void run(unverified);}}><RotateCw className="size-3.5" aria-hidden />- {t('settings.models.tools.result.retryCost', { count: unverified.length, cost: retryLabel ?? t('settings.models.tools.probe.unknown') })}+ {t('settings.models.tools.result.retryCost', { count: unverified.length, cost: retryLabel })}</Button>)}<Button size="sm" onClick={onClose}>{t('settings.models.tools.result.done')}</Button>diff --git a/ui/src/components/settings/models/ToolsTab.test.tsx b/ui/src/components/settings/models/ToolsTab.test.tsxindex a9b5bcc2f..6297ad271 100644--- a/ui/src/components/settings/models/ToolsTab.test.tsx+++ b/ui/src/components/settings/models/ToolsTab.test.tsx@@ -365,36 +365,61 @@ describe('ToolsTab checks', () => {within(card('Web search').querySelector('[data-candidate="src_grok0001:grok-4.6"]') as HTMLElement).getByRole('button', { name: 'Check again · about $0.01' });within(card('Web search').querySelector('[data-candidate="src_chatgpt1:gpt-6.1-sol"]') as HTMLElement).getByRole('button', { name: 'Check · included in subscription' });- // Images cannot be checked yet, so their rows offer nothing to run.- expect(within(card('Image generation')).queryByRole('button', { name: /Check/ })).toBeNull();+ // An image check has no list price: it says so, and never shows $0.+ within(card('Image generation').querySelector('[data-candidate="src_relay001:gpt-6.1-sol"]') as HTMLElement)+ .getByRole('button', { name: 'Check · cost unknown' });});it('MH-HOSTED-UI-013: runs the header check only after the dialog shows what it sends and costs', async () => {- const onProbe = vi.fn<RunProbe>(async (target) => target.candidate.source_id === RELAY.id+ const onProbe = vi.fn<RunProbe>(async (target) => target.tool === 'web_search' && target.candidate.source_id === RELAY.id? result('verified', target.candidate.source_id, target.candidate.model_id): { ...result('transient', target.candidate.source_id, target.candidate.model_id), call: { outcome: 'transient', error: 'models.source.cooldown.rate_limited' } });renderTab(searchable(), { onProbe });- // Two unchecked pairs (the verified one and the image are not offered); the subscription adds nothing.- screen.getByText('2 pairs to check · about $0.02 in total');+ // Three unchecked pairs (the verified one is not offered): the priced one is summed,+ // the included and the unpriced image are counted, and nothing is added as $0.+ screen.getByText('3 pairs to check · about $0.02 + 1 included + 1 without a price in total');await userEvent.click(screen.getByRole('button', { name: 'Check available tools' }));const dialog = await screen.findByRole('dialog');- within(dialog).getByText('This sends 2 real requests to the Sources below to confirm they can run these tools natively.');+ within(dialog).getByText('This sends 3 real requests to the Sources below to confirm they can run these tools natively.');expect(onProbe).not.toHaveBeenCalled();- await userEvent.click(within(dialog).getByRole('button', { name: 'Start check · about $0.02' }));+ await userEvent.click(within(dialog).getByRole('button', { name: 'Start check · about $0.02 + 1 included + 1 without a price' }));await within(dialog).findByText('Check finished');- expect(onProbe).toHaveBeenCalledTimes(2);+ expect(onProbe).toHaveBeenCalledTimes(3);within(dialog).getByText('1 runs natively');- within(dialog).getByText('1 not verified');+ within(dialog).getByText('2 not verified');// The reason sits where the locale puts it in the sentence.- within(dialog).getByText('Couldn\'t verify this time (Rate limited). Try again; this is not recorded as unsupported.');+ expect(within(dialog).getAllByText('Couldn\'t verify this time (Rate limited). Try again; this is not recorded as unsupported.')).toHaveLength(2);- // Retrying runs only the pair that got no answer.- await userEvent.click(within(dialog).getByRole('button', { name: 'Retry 1 · included in subscription' }));+ // Retrying runs only the pairs that got no answer, with their cost said the same way.+ await userEvent.click(within(dialog).getByRole('button', { name: 'Retry 2 · included in subscription + 1 without a price' }));await within(dialog).findByText('Check finished');- expect(onProbe).toHaveBeenCalledTimes(3);- expect(onProbe.mock.calls[2][0]).toMatchObject({ candidate: { source_id: SUBSCRIPTION.id } });+ expect(onProbe).toHaveBeenCalledTimes(5);+ expect(onProbe.mock.calls.slice(3).map(([target]) => target.candidate.source_id).sort()).toEqual([RELAY.id, SUBSCRIPTION.id].sort());+ });++ it('MH-HOSTED-UI-003: lets the locale compose a set\'s cost with its unpriced checks', () => {+ renderTab(searchable(), { lng: 'zh' });+ screen.getByText('3 项可检测 · 共约 $0.02,另 1 项订阅内含,另 1 项暂无单价');+ });++ it('MH-HOSTED-UI-019: shows a replay that did not verify as its own result, and nothing when no replay ran', async () => {+ const replayed = (replay: HostedToolProbeResult['replay']): HostedToolProbeResult => ({ ...result('verified', RELAY.id, 'gpt-6-astra'), replay });+ const onProbe = vi.fn<RunProbe>()+ .mockResolvedValueOnce(replayed({ outcome: 'transient', error: null }))+ .mockResolvedValueOnce(replayed(null));+ renderTab(searchable(), { onProbe });+ const row = card('Web search').querySelector('[data-candidate="src_relay001:gpt-6-astra"]') as HTMLElement;++ // The call verified; the replay after it ran out of time. That asks for another try, never reads as a failure.+ await userEvent.click(within(row).getByRole('button', { name: 'Check · about $0.02' }));+ within(row).getByText('Replay not verified · try again');+ expect(row.textContent).not.toMatch(/Not verified|Couldn't verify/);++ // No replay ran: nothing more to say.+ await userEvent.click(within(row).getByRole('button', { name: /^Check/ }));+ expect(within(row).queryByText(/Replay/)).toBeNull();});it('MH-HOSTED-UI-013: says why a failed check failed, and never shows the server\'s key as text', async () => {@@ -413,12 +438,12 @@ describe('ToolsTab checks', () => {expect(row.textContent).not.toContain('models.source');});- it('MH-HOSTED-UI-018: says plainly when a tool cannot be checked yet, instead of asking for a check it cannot run', () => {+ it('MH-HOSTED-UI-018: keeps an image tool off until a check verifies one of its pairs, and offers that check', () => {renderTab(status([tool('image_generation', { candidates: [{ source_id: RELAY.id, model_id: 'gpt-6.1-sol', call: unknown, replay: null }] })]));const image = card('Image generation');- within(image).getByText('Off · checks for this tool come in a later update');+ within(image).getByText('Off · check a Source first');expect((within(image).getByRole('switch') as HTMLButtonElement).disabled).toBe(true);- expect(within(image).queryByRole('button', { name: /Check/ })).toBeNull();+ within(image).getByRole('button', { name: 'Check · cost unknown' });});it('MH-HOSTED-UI-003: says a check\'s cost is unknown before it runs, when no estimate is known', () => {diff --git a/ui/src/components/settings/models/ToolsTab.tsx b/ui/src/components/settings/models/ToolsTab.tsxindex f7098b090..af7e9496e 100644--- a/ui/src/components/settings/models/ToolsTab.tsx+++ b/ui/src/components/settings/models/ToolsTab.tsx@@ -19,9 +19,8 @@ import { HostedProbeDialog, ProbeAnswerNote } from './HostedProbeDialog';import {evidenceChip,pendingChecks,- probeableTool,probeKey,- probeTotal,+ probeCostSummary,probeUnanswered,sameExecutor,verifiedCandidates,@@ -40,7 +39,7 @@ import type {HostedToolStatus,Source,} from './types';-import { useEstimateLabel } from './useEstimateLabel';+import { useCostSummaryLabel, useEstimateLabel } from './useEstimateLabel';type RunProbe = (target: ProbeTarget) => Promise<HostedToolProbeResult | null>;@@ -232,7 +231,7 @@ const ToolCard: React.FC<{? 'settings.models.tools.state.off': pickable? 'settings.models.tools.state.needsExecutor'- : probeableTool(tool.name) ? 'settings.models.tools.state.needsCheck' : 'settings.models.tools.state.checkUnavailable')}</span>+ : 'settings.models.tools.state.needsCheck')}</span><ToggleSwitchenabled={tool.enabled}disabled={pending || locked}@@ -260,9 +259,7 @@ const ToolCard: React.FC<{candidate={candidate}source={sources.get(candidate.source_id)}executor={tool.enabled && sameExecutor(candidate, bound)}- probe={probeableTool(tool.name)- ? { running: probing.has(key), last: lastProbes.get(key), run: onProbe, disabled: probing.size > 0 && !probing.has(key) }- : null}+ probe={{ running: probing.has(key), last: lastProbes.get(key), run: onProbe, disabled: probing.size > 0 && !probing.has(key) }}/>);})}@@ -331,7 +328,7 @@ export const ToolsTab: React.FC<{onRetry: () => void;}> = ({ read, sources, pending, probing, onChange, onProbe, onRetry }) => {const { t } = useTranslation();- const estimateLabel = useEstimateLabel();+ const costSummaryLabel = useCostSummaryLabel();// A row's last answer that did not become evidence (inconclusive, transient, a// failed request) shows where it was asked, until that row is checked again.const [lastProbes, setLastProbes] = React.useState<ReadonlyMap<string, HostedToolProbeResult | null>>(() => new Map());@@ -352,13 +349,13 @@ export const ToolsTab: React.FC<{const reverify = status?.reverify;const toCheck = status ? pendingChecks(status) : [];// 「全部已检测」 holds only where there is something a check could run on.- const checkable = status?.tools.some((tool) => probeableTool(tool.name) && tool.candidates.length > 0) ?? false;- const toCheckTotal = probeTotal(toCheck);- const toCheckCost = toCheckTotal === null+ const checkable = status?.tools.some((tool) => tool.candidates.length > 0) ?? false;+ const toCheckSummary = probeCostSummary(toCheck);+ const toCheckCost = toCheckSummary.priced === 0 && toCheckSummary.included === 0? t('settings.models.tools.header.totalUnknown')- : toCheckTotal.basis === 'included'+ : toCheckSummary.priced === 0 && toCheckSummary.unpriced === 0? t('settings.models.tools.header.totalIncluded')- : t('settings.models.tools.header.total', { cost: estimateLabel(toCheckTotal) });+ : t('settings.models.tools.header.total', { cost: costSummaryLabel(toCheckSummary) });return (<section className="model-hub-tools flex flex-col" aria-label={t('settings.models.tools.title') as string}><div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between">diff --git a/ui/src/components/settings/models/hostedTools.test.ts b/ui/src/components/settings/models/hostedTools.test.tsindex b240da2ee..4e9cbc585 100644--- a/ui/src/components/settings/models/hostedTools.test.ts+++ b/ui/src/components/settings/models/hostedTools.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest';-import { evidenceChip, modelCapabilities, pendingChecks, probeTotal, type ProbeTarget } from './hostedTools';+import { evidenceChip, modelCapabilities, pendingChecks, probeCostSummary, type ProbeTarget } from './hostedTools';import type { HostedEvidence, HostedToolCandidate } from './types';const evidence = (overrides: Partial<HostedEvidence>): HostedEvidence => ({@@ -51,15 +51,14 @@ describe('hosted-tool evidence projection', () => {candidate: { ...candidate('src_relay001', 'gpt-6-astra', evidence({})), probe_estimate: estimate },});- expect(probeTotal([at({ basis: 'list', usd: 0.02 }), at({ basis: 'included' }), at({ basis: 'list', usd: 0.03 })]))- .toEqual({ basis: 'list', usd: 0.05 });- // One unknown estimate makes the whole set's cost unknown.- expect(probeTotal([at({ basis: 'list', usd: 0.02 }), at(null)])).toBeNull();- // A check run only on subscriptions adds no charge.- expect(probeTotal([at({ basis: 'included' })])).toEqual({ basis: 'included' });+ expect(probeCostSummary([at({ basis: 'list', usd: 0.02 }), at({ basis: 'included' }), at({ basis: 'list', usd: 0.03 })]))+ .toEqual({ usd: 0.05, priced: 2, included: 1, unpriced: 0 });+ // An unknown estimate is counted, never added as zero.+ expect(probeCostSummary([at({ basis: 'list', usd: 0.02 }), at(null)])).toEqual({ usd: 0.02, priced: 1, included: 0, unpriced: 1 });+ expect(probeCostSummary([at({ basis: 'included' })])).toEqual({ usd: 0, priced: 0, included: 1, unpriced: 0 });});- it('MH-HOSTED-UI-013: offers to check every pair with no current answer, and never an image', () => {+ it('MH-HOSTED-UI-013: offers to check every pair with no current answer, images included', () => {const verified = evidence({ status: 'verified', basis: 'probe', observed_at: AT });const status = {tools: [@@ -75,7 +74,7 @@ describe('hosted-tool evidence projection', () => {};expect(pendingChecks(status).map(({ tool, candidate: c }) => `${tool}:${c.model_id}`))- .toEqual(['web_search:gpt-6-astra', 'web_search:gpt-6-luna', 'web_search:gpt-6-terra']);+ .toEqual(['web_search:gpt-6-astra', 'web_search:gpt-6-luna', 'web_search:gpt-6-terra', 'image_generation:gpt-6.1-sol']);});it('MH-HOSTED-UI-006: gives a Source model one capability per tool with evidence, in catalog order', () => {diff --git a/ui/src/components/settings/models/hostedTools.ts b/ui/src/components/settings/models/hostedTools.tsindex 4011ef8e5..e1d3856f4 100644--- a/ui/src/components/settings/models/hostedTools.ts+++ b/ui/src/components/settings/models/hostedTools.ts@@ -3,7 +3,6 @@// (`hosted-tools-status.schema.json`): the server has already folded staleness// into `status`, so nothing here re-derives routing.import type {- HostedCostEstimate,HostedEvidence,HostedToolCandidate,HostedToolExecutor,@@ -70,43 +69,34 @@ export const modelCapabilities = (status: HostedToolsStatus, sourceId: string, m: [];});-/** Tools a user can check. An image probe waits until Vibey parses image results, so the server refuses it. */-export const probeableTool = (tool: HostedToolName): boolean => tool !== 'image_generation';-export type ProbeTarget = { tool: HostedToolName; candidate: HostedToolCandidate };export const probeKey = ({ tool, candidate }: ProbeTarget): string => `${tool}:${candidate.source_id}:${candidate.model_id}`;/**- * What the header check offers to run: every checkable pair with no current- * answer, i.e. no record, or one an engine upgrade or age made stale.+ * What the header check offers to run: every pair with no current answer, i.e.+ * no record, or one an engine upgrade or age made stale.*/export const pendingChecks = (status: HostedToolsStatus): ProbeTarget[] =>- status.tools.flatMap((tool) => (probeableTool(tool.name)- ? tool.candidates- .filter((candidate) => candidate.call.status === 'unknown' || candidate.call.stale !== null)- .map((candidate) => ({ tool: tool.name, candidate }))- : []));+ status.tools.flatMap((tool) => tool.candidates+ .filter((candidate) => candidate.call.status === 'unknown' || candidate.call.stale !== null)+ .map((candidate) => ({ tool: tool.name, candidate })));-/**- * The cost of running these probes, as the server estimates each one. Unknown is- * never zero: one unknown estimate makes the total unknown. A set run entirely on- * subscriptions is included.- *//** Whether a probe's answer became no evidence: inconclusive, transient, or a request that failed (null). */export const probeUnanswered = (result: HostedToolProbeResult | null): boolean =>result === null || result.call.outcome === 'inconclusive' || result.call.outcome === 'transient';-export const probeTotal = (targets: readonly ProbeTarget[]): HostedCostEstimate | null => {- let usd = 0;- let listed = false;- for (const { candidate } of targets) {+/**+ * What running these probes costs, as the server estimates each one: the sum of+ * the priced ones, and how many are included in a subscription or have no price+ * (an image, say). Unknown is never added as zero; it is counted.+ */+export type ProbeCostSummary = { usd: number; priced: number; included: number; unpriced: number };++export const probeCostSummary = (targets: readonly ProbeTarget[]): ProbeCostSummary =>+ targets.reduce<ProbeCostSummary>((summary, { candidate }) => {const estimate = candidate.probe_estimate;- if (!estimate) return null;- if (estimate.basis === 'list') {- usd += estimate.usd;- listed = true;- }- }- return listed ? { basis: 'list', usd } : { basis: 'included' };-};+ if (!estimate) return { ...summary, unpriced: summary.unpriced + 1 };+ if (estimate.basis === 'included') return { ...summary, included: summary.included + 1 };+ return { ...summary, usd: summary.usd + estimate.usd, priced: summary.priced + 1 };+ }, { usd: 0, priced: 0, included: 0, unpriced: 0 });diff --git a/ui/src/components/settings/models/useEstimateLabel.ts b/ui/src/components/settings/models/useEstimateLabel.tsindex 66146a9bf..f8031d552 100644--- a/ui/src/components/settings/models/useEstimateLabel.ts+++ b/ui/src/components/settings/models/useEstimateLabel.ts@@ -1,6 +1,7 @@import { useTranslation } from 'react-i18next';-import { formatSmallUsd } from './format';+import { formatSentences, formatSmallUsd } from './format';+import type { ProbeCostSummary } from './hostedTools';import type { HostedCostEstimate } from './types';/** 「约 $0.02」, 「订阅内含」, or nothing when the estimate is unknown. */@@ -13,3 +14,25 @@ export const useEstimateLabel = () => {: t('settings.models.tools.probe.about', { usd: formatSmallUsd(estimate.usd) }) as string;};};++/**+ * A set of probes' cost in one phrase: the priced sum, then how many are included+ * or have no price, e.g. 「约 $0.04,另 2 项暂无单价」. Only included reads as+ * included; nothing priced at all reads as unknown. The locale composes it.+ */+export const useCostSummaryLabel = () => {+ const { t, i18n } = useTranslation();+ const estimateLabel = useEstimateLabel();+ return ({ usd, priced, included, unpriced }: ProbeCostSummary): string => {+ if (priced === 0 && included === 0) return t('settings.models.tools.probe.unknown') as string;+ const base = priced > 0+ ? estimateLabel({ basis: 'list', usd }) as string+ : t('settings.models.tools.probe.included') as string;+ const extras = [+ ...(priced > 0 && included > 0 ? [t('settings.models.tools.probe.plusIncluded', { count: included }) as string] : []),+ ...(unpriced > 0 ? [t('settings.models.tools.probe.plusUnpriced', { count: unpriced }) as string] : []),+ ];+ return extras.length === 0 ? base : formatSentences([base, ...extras], i18n.language);+ };+};+diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex 5ccc6d921..a2dc5ab38 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -2379,8 +2379,7 @@"on": "On","off": "Off","needsCheck": "Off · check a Source first",- "needsExecutor": "Off · choose an executor first",- "checkUnavailable": "Off · checks for this tool come in a later update"+ "needsExecutor": "Off · choose an executor first"},"toggle": {"turnOn": "Turn on {{name}}",@@ -2448,6 +2447,14 @@"included": "included in subscription","unknown": "cost unknown","notRecorded": "the result couldn't be recorded",+ "plusIncluded_one": "+ {{count}} included",+ "plusIncluded_other": "+ {{count}} included",+ "plusUnpriced_one": "+ {{count}} without a price",+ "plusUnpriced_other": "+ {{count}} without a price",+ "replay": {+ "unverified": "Replay not verified · try again",+ "unsupported": "Replay not supported on this Source"+ },"outcome": {"inconclusive": "Not verified · the model didn't use the tool; try again","transient": "Couldn't verify · try again",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 1981b427b..724e0a08c 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -2379,8 +2379,7 @@"on": "已开启","off": "已关闭","needsCheck": "已关闭 · 需先检测",- "needsExecutor": "已关闭 · 需先选择代理执行者",- "checkUnavailable": "已关闭 · 此工具的检测将在后续更新中提供"+ "needsExecutor": "已关闭 · 需先选择代理执行者"},"toggle": {"turnOn": "开启{{name}}",@@ -2448,6 +2447,14 @@"included": "订阅内含","unknown": "费用未知","notRecorded": "结果未能记录",+ "plusIncluded_one": ",另 {{count}} 项订阅内含",+ "plusIncluded_other": ",另 {{count}} 项订阅内含",+ "plusUnpriced_one": ",另 {{count}} 项暂无单价",+ "plusUnpriced_other": ",另 {{count}} 项暂无单价",+ "replay": {+ "unverified": "回放未验证 · 请重试",+ "unsupported": "此供应商不支持回放"+ },"outcome": {"inconclusive": "未能检测 · 模型没有调用工具,请重试","transient": "未能检测 · 请重试",