Skip to content

The agent that grows with you

feat(desktop): drop the "This could run on your computer" strip above the composer

Teknium24051d9084bb
diff --git a/apps/desktop/src/app/chat/built-in-tour.ts b/apps/desktop/src/app/chat/built-in-tour.ts
index 2ecdfa345fe..bd99c84fc2c 100644
--- a/apps/desktop/src/app/chat/built-in-tour.ts
+++ b/apps/desktop/src/app/chat/built-in-tour.ts
@@ -61,7 +61,7 @@ function onScreen(selector: string): boolean {
}
/** Whether the model stop says this computer can run a local model: the
- * local-setup offer's answer (the backend's catalog `fits` check, on a local
+ * local-setup eligibility answer (the backend's catalog `fits` check, on a local
* connection with Local Models on, with nothing set up yet). */
async function canRunLocalModel(): Promise<boolean> {
const read = readLocalSetupEligibility().then(
diff --git a/apps/desktop/src/app/chat/composer/index.tsx b/apps/desktop/src/app/chat/composer/index.tsx
index 35a59d4cfb2..aa77990f202 100644
--- a/apps/desktop/src/app/chat/composer/index.tsx
+++ b/apps/desktop/src/app/chat/composer/index.tsx
@@ -82,7 +82,6 @@ import { useSlashCompletions } from './hooks/use-slash-completions'
import { useStatusDrawer } from './hooks/use-status-drawer'
import { useSessionStatusPresence } from './hooks/use-status-presence'
import { shouldConvertPasteToAttachment } from './large-paste'
-import { LocalSetupCard } from './local-setup-card'
import { ActionBadges } from './micro-actions'
import { chipTypedPathOnSpace, pathifyRefs } from './path-refs'
import { QueuePanel } from './queue-panel'
@@ -1496,7 +1495,6 @@ export function ChatBar({
onUndone={clearDraft}
readLiveText={syncDraftFromEditor}
/>
- <LocalSetupCard busy={busy} guidedChat={guidedChat} />
<VoiceActivity state={voiceActivityState} />
<VoicePlaybackActivity />
{queueEdit && editingQueuedPrompt && (
diff --git a/apps/desktop/src/app/chat/composer/local-setup-card.test.tsx b/apps/desktop/src/app/chat/composer/local-setup-card.test.tsx
deleted file mode 100644
index 8b6512e2dd4..00000000000
--- a/apps/desktop/src/app/chat/composer/local-setup-card.test.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { render } from '@testing-library/react'
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-
-vi.mock('@/app/chat/session-view', () => ({ useSessionView: () => ({ kind: 'primary' }) }))
-vi.mock('./scope', () => ({ useComposerScope: () => ({ target: 'main' }) }))
-
-describe('LocalSetupCard', () => {
- beforeEach(() => {
- vi.resetModules()
- // A relaunch: the card was shown last run, and the backend connection is not there yet.
- localStorage.setItem('hermes.desktop.offers.local-setup.v1', JSON.stringify({ state: 'shown' }))
- })
-
- it('settles on one answer while there is no connection instead of re-reading in a loop', async () => {
- const { $localModelsEnabled } = await import('@/store/local-models-flag')
- const { $localSetupEligibility } = await import('@/store/local-setup-offer')
- const { LocalSetupCard } = await import('./local-setup-card')
- $localModelsEnabled.set(true)
-
- expect(() => render(<LocalSetupCard busy={false} guidedChat={false} />)).not.toThrow()
- expect($localSetupEligibility.get()?.reason).toBe('connection not established yet')
- })
-})
diff --git a/apps/desktop/src/app/chat/composer/local-setup-card.tsx b/apps/desktop/src/app/chat/composer/local-setup-card.tsx
deleted file mode 100644
index 505f3959ae7..00000000000
--- a/apps/desktop/src/app/chat/composer/local-setup-card.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-import { useStore } from '@nanostores/react'
-import { useEffect } from 'react'
-
-import { useSessionView } from '@/app/chat/session-view'
-import { Button } from '@/components/ui/button'
-import { Codicon } from '@/components/ui/codicon'
-import { useI18n } from '@/i18n'
-import {
- $localSetupEligibility,
- $localSetupOffer,
- dismissLocalSetupOffer,
- readLocalSetupEligibility,
- requestLocalSetupMenu
-} from '@/store/local-setup-offer'
-import { isHudWindow } from '@/store/windows'
-
-import { useComposerScope } from './scope'
-
-const ELIGIBILITY_RETRY_MS = 30_000
-
-interface LocalSetupCardProps {
- busy: boolean
- guidedChat: boolean
-}
-
-/**
- * "This could run on your computer" strip above the input, after the first
- * finished turn once onboarding is over (store/local-setup-offer.ts). The offer
- * is about the machine, not the chat, so it sits in the main window's primary
- * composer (not tiles, not the HUD) and survives a relaunch until x or Show me.
- * Only while that session is idle: an automatic follow-up turn hides it, the
- * next idle brings it back. Offers, never hijacks: "Show me" opens this
- * composer's model menu on click, nothing moves by itself.
- */
-export function LocalSetupCard({ busy, guidedChat }: LocalSetupCardProps) {
- const primary = useSessionView().kind === 'primary'
- const { target } = useComposerScope()
- const offer = useStore($localSetupOffer)
- const eligibility = useStore($localSetupEligibility)
- const fit = eligibility?.fit
- const { t } = useI18n()
- const copy = t.composer.localSetup
-
- // No answer yet (relaunch, or the backend just changed): ask. A failed answer is asked again after a pause, so a
- // backend that recovers brings the card back without a read on every render.
- useEffect(() => {
- if (offer.state !== 'shown') {
- return
- }
-
- if (!eligibility) {
- void readLocalSetupEligibility()
-
- return
- }
-
- if (eligibility.transient) {
- const retry = window.setTimeout(() => void readLocalSetupEligibility(), ELIGIBILITY_RETRY_MS)
-
- return () => window.clearTimeout(retry)
- }
- }, [offer.state, eligibility])
-
- if (offer.state !== 'shown' || !fit || !primary || busy || guidedChat || isHudWindow()) {
- return null
- }
-
- return (
- <div
- className="flex items-center justify-between gap-2 rounded-lg border border-[color-mix(in_srgb,var(--dt-composer-ring)_32%,transparent)] bg-accent/18 px-2 py-1.5"
- data-slot="composer-local-setup"
- role="status"
- >
- <div className="flex min-w-0 items-center gap-2">
- <Codicon className="shrink-0 text-(--ui-accent)" name="chip" size="0.85rem" />
- <div className="min-w-0 text-[0.72rem] leading-snug">
- <div className="font-medium text-foreground">{copy.title}</div>
- <div className="truncate text-muted-foreground/88">{copy.text(fit.model.display_name)}</div>
- </div>
- </div>
- <div className="flex shrink-0 items-center gap-1">
- <Button onClick={() => requestLocalSetupMenu(target)} size="xs" type="button" variant="secondary">
- {copy.action}
- </Button>
- <Button
- aria-label={t.common.close}
- onClick={dismissLocalSetupOffer}
- size="icon-xs"
- type="button"
- variant="ghost"
- >
- <Codicon name="close" size="0.7rem" />
- </Button>
- </div>
- </div>
- )
-}
diff --git a/apps/desktop/src/app/chat/composer/model-pill.tsx b/apps/desktop/src/app/chat/composer/model-pill.tsx
index c1a08c31af8..ab93fb8dff2 100644
--- a/apps/desktop/src/app/chat/composer/model-pill.tsx
+++ b/apps/desktop/src/app/chat/composer/model-pill.tsx
@@ -15,7 +15,6 @@ import { useI18n } from '@/i18n'
import { ChevronDown } from '@/lib/icons'
import { formatModelPillLabel, providerDisplayName } from '@/lib/model-status-label'
import { cn } from '@/lib/utils'
-import { $localSetupMenuRequest, acceptLocalSetupOffer } from '@/store/local-setup-offer'
import { $currentModelSource, setModelPickerOpen } from '@/store/session'
import { useComposerModelPillLabel } from './contrib'
@@ -122,22 +121,6 @@ export function ModelPill({
[scope.target, disabled, hasLiveMenu]
)
- // The local-setup card's "Show me": open THIS composer's menu (the card names
- // its own composer), where the offer row sits on top. The offer is accepted
- // only once a menu actually opened. A click fired it, never a background event.
- useEffect(
- () =>
- $localSetupMenuRequest.listen(request => {
- if (!request || request.target !== scope.target || disabled || !hasLiveMenu) {
- return
- }
-
- acceptLocalSetupOffer()
- setOpen(true)
- }),
- [scope.target, disabled, hasLiveMenu]
- )
-
// The composer pick is sticky: a manual selection is pinned and every NEW
// chat uses it instead of the Settings → Model default — silently, which has
// cost users real money on a forgotten paid-model pick (#62055). Surface the
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/message-stream.ts b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/message-stream.ts
index 4e3ba0dff2d..a03b4706b14 100644
--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/message-stream.ts
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/message-stream.ts
@@ -1,7 +1,6 @@
import type { BillingBlock } from '@hermes/shared'
import { burstVibeHearts } from '@/components/chat/vibe-hearts'
-import { $chatOnboardingThreadIds } from '@/components/onboarding-chat/assembly'
import { translateNow } from '@/i18n'
import type { GatewayEventPayload } from '@/lib/chat-messages'
import { coerceGatewayText, coerceThinkingText } from '@/lib/chat-runtime'
@@ -12,14 +11,12 @@ import { billingCtaLabel, clearBillingBlock, runBillingRecovery, setBillingBlock
import { clearSettledClarifyRequest } from '@/store/clarify'
import { setSessionCompacting } from '@/store/compaction'
import { noteFreeTierTurnComplete } from '@/store/free-tier-sign-in'
-import { reportLocalSetupTurnComplete } from '@/store/local-setup-offer'
import { notify } from '@/store/notifications'
import { flashPetActivity, markPetUnread, setPetActivity } from '@/store/pet'
import { clearAllPrompts } from '@/store/prompts'
import { providerWaitText, setSessionProviderWait } from '@/store/provider-wait'
import { setCurrentUsage, setTurnStartedAt } from '@/store/session'
import { refreshSupportedSessionControlAfterTurn } from '@/store/session-control'
-import { storedSessionIdForRuntimeId } from '@/store/session-states'
import { pruneFinishedSessionSubagents } from '@/store/subagents'
import { clearActiveSessionTodos } from '@/store/todos'
@@ -85,23 +82,6 @@ function turnFailure(payload: GatewayEventPayload | undefined, finalText: string
}
}
-function reportOnboardingTurnComplete(ctx: GatewayEventContext, sessionId: string): void {
- // The whole agent loop has returned: the end of a task, not a step in one.
- // Only the session on screen counts, which drops subagent mirrors (child ids).
- if (!ctx.isActiveEvent) {
- return
- }
-
- const setupThreads = $chatOnboardingThreadIds.get()
- const storedId = storedSessionIdForRuntimeId(sessionId)
-
- reportLocalSetupTurnComplete({
- failed: ctx.payload?.status !== 'complete',
- sessionId,
- setupChat: setupThreads.includes(sessionId) || (storedId !== null && setupThreads.includes(storedId))
- })
-}
-
function appendMoaReference(ctx: GatewayEventContext, sessionId: string): void {
const { deps, payload, occurredAt } = ctx
const label = coerceGatewayText(payload?.label) || 'reference'
@@ -408,8 +388,6 @@ export function handleMessageStreamEvent(ctx: GatewayEventContext): boolean {
payload?.response_reused === true
)
- reportOnboardingTurnComplete(ctx, sessionId)
-
if (payload?.status === 'complete') {
noteFreeTierTurnComplete()
}
diff --git a/apps/desktop/src/app/shell/local-setup-menu-row.tsx b/apps/desktop/src/app/shell/local-setup-menu-row.tsx
index c827ad55cc1..3e0c904abb4 100644
--- a/apps/desktop/src/app/shell/local-setup-menu-row.tsx
+++ b/apps/desktop/src/app/shell/local-setup-menu-row.tsx
@@ -6,14 +6,12 @@ import { Codicon } from '@/components/ui/codicon'
import { DropdownMenuItem, dropdownMenuRow, DropdownMenuSeparator } from '@/components/ui/dropdown-menu'
import { useI18n } from '@/i18n'
import { cn } from '@/lib/utils'
-import { $localSetupRowFit, acceptLocalSetupOffer, refreshLocalSetupEligibility } from '@/store/local-setup-offer'
+import { $localSetupRowFit, refreshLocalSetupEligibility } from '@/store/local-setup-offer'
import { requestRoute } from '@/store/recovery-requests'
/**
* "Run locally" at the top of the composer's model menu, for as long as this
- * machine qualifies and nothing is set up. The permanent home of the
- * local-setup offer: the card can be dismissed, this row stays until setup
- * completes. Every menu open re-reads eligibility (a user action, not a poll),
+ * machine qualifies and nothing is set up. Every menu open re-reads eligibility (a user action, not a poll),
* so finishing setup retires the row. A menu item, so the keyboard reaches it.
*/
export function LocalSetupMenuRow() {
@@ -33,10 +31,7 @@ export function LocalSetupMenuRow() {
<DropdownMenuItem
className={cn(dropdownMenuRow, 'items-start gap-2 py-1.5')}
data-slot="model-menu-local-setup"
- onSelect={() => {
- acceptLocalSetupOffer()
- requestRoute(`${SETTINGS_ROUTE}?tab=providers&pview=local`)
- }}
+ onSelect={() => requestRoute(`${SETTINGS_ROUTE}?tab=providers&pview=local`)}
>
<Codicon className="mt-0.5 shrink-0 text-(--ui-accent)" name="chip" size="0.8rem" />
<span className="min-w-0 flex-1 leading-snug">
diff --git a/apps/desktop/src/components/tips/use-tip-rotation.ts b/apps/desktop/src/components/tips/use-tip-rotation.ts
index 0c3ba761879..2cba843488c 100644
--- a/apps/desktop/src/components/tips/use-tip-rotation.ts
+++ b/apps/desktop/src/components/tips/use-tip-rotation.ts
@@ -120,8 +120,7 @@ export function useTipRotation(copy: Translations['tips']) {
// The engine-update campaign outranks the walk: it says something about
// THIS machine. It shares the cooldown, so taking the moment still costs
- // it the usual hours. (The local-setup offer left the rotation: it runs on
- // events in store/local-setup-offer.ts, not on this clock.)
+ // it the usual hours.
if (offerUpdate()) {
return
}
diff --git a/apps/desktop/src/i18n/ar_chat.ts b/apps/desktop/src/i18n/ar_chat.ts
index e48f1a033db..49c99c4e5cc 100644
--- a/apps/desktop/src/i18n/ar_chat.ts
+++ b/apps/desktop/src/i18n/ar_chat.ts
@@ -133,11 +133,6 @@ export const arChat = {
editingQueuedInComposer: 'جار تحرير رسالة في الطابور',
restoredDraftNotice: 'تمت استعادة رسالتك غير المُرسلة',
restoredDraftUndo: 'تراجع',
- localSetup: {
- title: 'يمكن تشغيل هذا على جهازك',
- text: (model: string) => `${model} يناسب هذا الجهاز. مجاني، وتبقى المحادثات على جهازك.`,
- action: 'أرني'
- },
queueEdit: 'تحرير الرسالة المجدولة',
queueExpand: 'توسيع',
queueCollapse: 'طي',
diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.ts
index 4ecf64de3f7..21066d8e8e1 100644
--- a/apps/desktop/src/i18n/de.ts
+++ b/apps/desktop/src/i18n/de.ts
@@ -3999,11 +3999,6 @@ export const deOverrides = {
editingQueuedInComposer: 'Bearbeitet eingereihten Turn im Composer',
restoredDraftNotice: 'Ihre nicht gesendete Nachricht wurde wiederhergestellt',
restoredDraftUndo: 'Rückgängig',
- localSetup: {
- title: 'Das könnte auf Ihrem Computer laufen',
- text: (model: string) => `${model} passt auf diesen Rechner. Kostenlos, und Chats bleiben auf Ihrem Computer.`,
- action: 'Zeigen'
- },
queueEdit: 'Bearbeiten',
queueExpand: 'Ausklappen',
queueCollapse: 'Einklappen',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 21ce7a2a501..7e6ed980c36 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -3559,11 +3559,6 @@ export const en: Translations = {
editingQueuedInComposer: 'Editing queued turn in composer',
restoredDraftNotice: 'Restored your unsent message',
restoredDraftUndo: 'Undo',
- localSetup: {
- title: 'This could run on your computer',
- text: (model: string) => `${model} fits this machine. Free, and chats stay on your computer.`,
- action: 'Show me'
- },
queueEdit: 'Edit',
queueExpand: 'Expand',
queueCollapse: 'Collapse',
diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.ts
index 26a338ee134..4e4f1a20852 100644
--- a/apps/desktop/src/i18n/es.ts
+++ b/apps/desktop/src/i18n/es.ts
@@ -3994,11 +3994,6 @@ export const esOverrides = {
editingQueuedInComposer: 'Editando turno en cola en el compositor',
restoredDraftNotice: 'Se restauró tu mensaje sin enviar',
restoredDraftUndo: 'Deshacer',
- localSetup: {
- title: 'Esto podría ejecutarse en este equipo',
- text: (model: string) => `${model} cabe en este equipo. Gratis, y los chats se quedan en este equipo.`,
- action: 'Muéstrame'
- },
queueEdit: 'Editar',
queueExpand: 'Expandir',
queueCollapse: 'Contraer',
diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.ts
index c3df6153dc8..6d1f7719b21 100644
--- a/apps/desktop/src/i18n/fr.ts
+++ b/apps/desktop/src/i18n/fr.ts
@@ -4009,12 +4009,6 @@ export const frOverrides = {
editingQueuedInComposer: "Modification du tour en file d'attente dans le compositeur",
restoredDraftNotice: 'Votre message non envoyé a été restauré',
restoredDraftUndo: 'Annuler',
- localSetup: {
- title: 'Ceci pourrait tourner sur votre ordinateur',
- text: (model: string) =>
- `${model} tient sur cette machine. Gratuit, et les conversations restent sur votre ordinateur.`,
- action: 'Montrez-moi'
- },
queueEdit: 'Modifier',
queueExpand: 'Déplier',
queueCollapse: 'Replier',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 13123c2f9de..94e182431af 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -2591,11 +2591,6 @@ export const jaOverrides = {
editingQueuedInComposer: 'コンポーザーでキュー済みターンを編集中',
restoredDraftNotice: '未送信のメッセージを復元しました',
restoredDraftUndo: '元に戻す',
- localSetup: {
- title: 'このコンピューターで実行できます',
- text: (model: string) => `${model} はこのマシンで動きます。無料で、チャットはこのコンピューターから出ません。`,
- action: '見てみる'
- },
queueEdit: '編集',
queueExpand: '展開',
queueCollapse: '折りたたむ',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index 2585081ecf6..75c96b3cabc 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -2855,12 +2855,6 @@ export const ruOverrides = {
editingQueuedInComposer: 'Редактирование хода в очереди в композере',
restoredDraftNotice: 'Восстановлено ваше неотправленное сообщение',
restoredDraftUndo: 'Отменить',
- localSetup: {
- title: 'Это может работать на вашем компьютере',
- text: (model: string) =>
- `${model} подходит для этого компьютера. Бесплатно, а чаты остаются на вашем компьютере.`,
- action: 'Показать'
- },
queueEdit: 'Изменить',
queueExpand: 'Раскрыть',
queueCollapse: 'Свернуть',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index adb6b35436e..bbce444d5fa 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -3047,7 +3047,6 @@ export interface Translations extends NoticeTranslations {
restoredDraftNotice: string
restoredDraftUndo: string
/** The local-setup offer above the input after the first finished task. */
- localSetup: { title: string; text: (model: string) => string; action: string }
queueEdit: string
queueExpand: string
queueCollapse: string
diff --git a/apps/desktop/src/i18n/zh-hant_chat.ts b/apps/desktop/src/i18n/zh-hant_chat.ts
index 0eccad237eb..a61e1f0fefe 100644
--- a/apps/desktop/src/i18n/zh-hant_chat.ts
+++ b/apps/desktop/src/i18n/zh-hant_chat.ts
@@ -155,11 +155,6 @@ export const zhHantChat = {
editingQueuedInComposer: '在輸入框中編輯排隊回合',
restoredDraftNotice: '已還原你未送出的訊息',
restoredDraftUndo: '復原',
- localSetup: {
- title: '這可以在你的電腦上執行',
- text: (model: string) => `${model} 適合這台電腦。免費,對話留在你的電腦上。`,
- action: '帶我看看'
- },
queueEdit: '編輯',
queueExpand: '展開',
queueCollapse: '收起',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 09b5b18b117..447a34f8609 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -3471,11 +3471,6 @@ export const zhOverrides = {
editingQueuedInComposer: '正在输入框中编辑排队回合',
restoredDraftNotice: '已恢复你未发送的消息',
restoredDraftUndo: '撤销',
- localSetup: {
- title: '这可以在你的电脑上运行',
- text: (model: string) => `${model} 适合这台电脑。免费,对话留在你的电脑上。`,
- action: '带我看看'
- },
queueEdit: '编辑',
queueExpand: '展开',
queueCollapse: '收起',
diff --git a/apps/desktop/src/lib/tips/local-cta.ts b/apps/desktop/src/lib/tips/local-cta.ts
index 8025b64fd77..256d8bff36f 100644
--- a/apps/desktop/src/lib/tips/local-cta.ts
+++ b/apps/desktop/src/lib/tips/local-cta.ts
@@ -2,9 +2,6 @@
* Reshow clock for the local-models campaign tips in the rotation (today: the
* engine update). A tip ignored (timed out) may return, but on a much longer
* clock than the rotation's: it is the same message twice, not a tour moving on.
- *
- * The local-setup offer used to live here too; it moved out of the rotation to
- * store/local-setup-offer.ts, which runs on events instead of this clock.
*/
export const LOCAL_TIP_RESHOW_MS = 7 * 24 * 60 * 60_000
diff --git a/apps/desktop/src/store/local-setup-offer.ts b/apps/desktop/src/store/local-setup-offer.ts
index 7b7f994c1e1..64f15ed92a9 100644
--- a/apps/desktop/src/store/local-setup-offer.ts
+++ b/apps/desktop/src/store/local-setup-offer.ts
@@ -1,93 +1,19 @@
/**
- * The local-setup offer: "this machine can run a model locally" for every
- * machine that qualifies, delivered by state transitions, never by a timer.
+ * Local-setup eligibility: whether this machine can run a model locally, read
+ * once per backend connection from the local-models status + catalog.
*
- * Three surfaces read this one record:
- *
- * - The handoff tour ends on the model pill (`signpost.ts`) when the machine
- * qualifies. Every guided user who reaches the handoff sees it.
- * - A card above the primary composer after the first finished turn once
- * onboarding is over (handoff or skip). It renders only while that session
- * is idle, so an automatic follow-up turn hides it and the next idle shows it.
- * - A "Run locally" row at the top of the model menu, until setup is done.
- *
- * States move only on events: `armed` when onboarding ends, `shown` on the
- * first eligible `message.complete`, `dismissed` on ✕, `accepted` on the card's
- * button. Local setup completing ends it by eligibility: a machine with a
- * runtime and a staged model no longer qualifies, so every surface hides.
- *
- * The predecessor was a tip in the rotation: 5-10 min settle, a six-hour
- * cooldown shared with every tip, a quiet check, a 22 s linger, and a 7-day
- * reshow. It fired on rtxspark and vespyr with nobody watching and recorded
- * itself as shown, which hid it for a week.
+ * Two surfaces read it: the "Run locally" row at the top of the model menu
+ * (until setup is done) and the handoff tour's model-pill step. A machine with
+ * a runtime and a staged model no longer qualifies, so both hide.
*/
import { atom, computed } from 'nanostores'
import { getLocalCatalog, getLocalModelsStatus } from '@/hermes'
-import { isOnboardingEnabled } from '@/lib/onboarding-enabled'
-import { Codecs, persistentAtom } from '@/lib/persisted'
-import { readKey } from '@/lib/storage'
import type { LocalCatalogModel, LocalModelsStatus } from '@/types/hermes'
import { $localModelsEnabled } from './local-models-flag'
-import { $desktopOnboarding } from './onboarding'
-import { $onboardingGate, $onboardingStateRead, type OnboardingPhase } from './onboarding-gate'
import { $connection } from './session'
-import { $retiredTips } from './tips'
-
-type LocalSetupOfferState = 'accepted' | 'armed' | 'dismissed' | 'shown' | 'unarmed'
-
-interface OfferRecord {
- armedBy: null | string
- /** ISO time of the last transition, for `state()` readouts. */
- at: null | string
- /** Runtime id of the session whose finished turn showed the card (diagnostics only). */
- sessionId: null | string
- state: LocalSetupOfferState
-}
-
-const OFFER_STATES: readonly LocalSetupOfferState[] = ['accepted', 'armed', 'dismissed', 'shown', 'unarmed']
-const EMPTY: OfferRecord = { armedBy: null, at: null, sessionId: null, state: 'unarmed' }
-
-/** Persisted as a flat string record so `Codecs.stringRecord` does the parsing at the storage boundary. */
-function toRecord(stored: Record<string, string>): OfferRecord {
- const state = OFFER_STATES.find(candidate => candidate === stored.state)
-
- return state
- ? { armedBy: stored.armedBy ?? null, at: stored.at ?? null, sessionId: stored.sessionId ?? null, state }
- : EMPTY
-}
-
-function toStored(record: OfferRecord): Record<string, string> {
- return Object.fromEntries(Object.entries(record).filter((entry): entry is [string, string] => entry[1] !== null))
-}
-
-const STORAGE_KEY = 'hermes.desktop.offers.local-setup.v1'
-
-/** Desktop-global like the tip ledgers: the offer is about this machine, not a profile. */
-const $stored = persistentAtom<Record<string, string>>(STORAGE_KEY, {}, Codecs.stringRecord)
-
-export const $localSetupOffer = computed($stored, toRecord)
-
-/** The stored record as another window may have left it. */
-function readStoredRecord(): OfferRecord {
- const raw = readKey(STORAGE_KEY)
-
- return raw === null ? EMPTY : toRecord(Codecs.stringRecord.decode(raw))
-}
-
-function setRecord(record: OfferRecord): void {
- $stored.set(toStored(record))
-}
-
-// Another window moved the offer (dismissed it, say): adopt that, so this window
-// neither keeps showing a card the user closed nor writes an older state over it.
-window.addEventListener('storage', event => {
- if (event.key === STORAGE_KEY) {
- $stored.set(event.newValue === null ? {} : Codecs.stringRecord.decode(event.newValue))
- }
-})
/** The recommended catalog row that fits, when this machine qualifies. */
interface LocalSetupFit {
@@ -217,149 +143,23 @@ $connection.listen(() => {
}
})
-const FINAL_STATES: readonly LocalSetupOfferState[] = ['accepted', 'dismissed']
-
-function transition(state: LocalSetupOfferState, patch: Partial<OfferRecord>): void {
- // Another window may have closed the offer since this one last read it; a final state stays final.
- const stored = readStoredRecord()
-
- if (FINAL_STATES.includes(stored.state)) {
- $stored.set(toStored(stored))
-
- return
- }
-
- setRecord({ ...$localSetupOffer.get(), ...patch, at: new Date().toISOString(), state })
-}
-
-/** The guide will not run for this identity: `onboarding.state` answered without starting it, or "choose a provider later". */
-function guideWillNotStart(): boolean {
- return $onboardingStateRead.get() || $desktopOnboarding.get().firstRunSkipped
-}
-
-/**
- * Guided onboarding ending (either way) arms the offer, and so does an install
- * where the guide never runs (flag off, or `idle` with the guide ruled out).
- * `cinematic`/`guided`/`handoff`, and an `idle` the guide may still leave, wait:
- * the card must not land on top of the guide.
- */
-function armFromPhase(phase: OnboardingPhase): void {
- if ($localSetupOffer.get().state !== 'unarmed') {
- return
- }
-
- // Someone who closed the old local-setup tip already answered this offer.
- if ($retiredTips.get().includes('local-setup')) {
- transition('dismissed', { armedBy: 'retired-tip' })
- } else if (phase === 'done' || phase === 'skipped') {
- transition('armed', { armedBy: `onboarding:${phase}` })
- } else if (!isOnboardingEnabled()) {
- transition('armed', { armedBy: 'no-guided-onboarding' })
- } else if (phase === 'idle' && guideWillNotStart()) {
- transition('armed', { armedBy: 'guide-will-not-start' })
- }
-}
-
-$onboardingGate.subscribe(gate => armFromPhase(gate.phase))
-$desktopOnboarding.listen(() => armFromPhase($onboardingGate.get().phase))
-$onboardingStateRead.listen(() => armFromPhase($onboardingGate.get().phase))
-
-interface TurnCompleteSignal {
- /** Anything but a completed turn: errored, interrupted, cancelled. */
- failed: boolean
- sessionId: null | string
- /** A turn of the setup chat itself (its closing words after `start_chat`). */
- setupChat: boolean
-}
-
-/**
- * `message.complete` for the session the user is looking at. The whole agent
- * loop has returned at this point (tool calls and interim messages come before
- * it), so this is the end of a task, not a step in one. Turns that did not
- * complete do not count; the caller only reports the session on screen.
- */
-export function reportLocalSetupTurnComplete({ failed, sessionId, setupChat }: TurnCompleteSignal): void {
- const offer = $localSetupOffer.get()
-
- if (failed || !sessionId || setupChat || offer.state !== 'armed') {
- return
- }
-
- // The task chat that setup hands off to speaks first: its opening turn asks which direction to take.
- // That question is not a finished task, so the card waits for the next completed turn.
- if (offer.armedBy === 'onboarding:done' && offer.sessionId === null) {
- transition('armed', { sessionId })
-
- return
- }
-
- void readLocalSetupEligibility().then(({ fit }) => {
- if (fit && $localSetupOffer.get().state === 'armed') {
- transition('shown', { sessionId })
- }
- })
-}
-
-export function dismissLocalSetupOffer(): void {
- transition('dismissed', {})
-}
-
-export function acceptLocalSetupOffer(): void {
- transition('accepted', {})
-}
-
-/** The model-menu row stays until setup completes, whatever happened to the card. */
+/** The model-menu row stays until setup completes. */
export const $localSetupRowFit = computed($localSetupEligibility, eligibility => eligibility?.fit ?? null)
-/** Asks the pill of one composer (by scope target) to open its menu, where the row sits on top. */
-export const $localSetupMenuRequest = atom<null | { seq: number; target: string }>(null)
-
-export function requestLocalSetupMenu(target: string): void {
- $localSetupMenuRequest.set({ seq: ($localSetupMenuRequest.get()?.seq ?? 0) + 1, target })
-}
-
// ── Debug handle ────────────────────────────────────────────────────────────
// Ships in packaged builds on purpose: rtxspark/vespyr run MSIX bundles we
// drive over CDP, and `state()` is how a run that showed nothing explains itself.
-interface LocalSetupOfferDebug {
- force: () => Promise<Eligibility>
- reset: () => void
- state: () => {
- eligibility: Eligibility | null
- localModelsEnabled: boolean
- offer: OfferRecord
- onboardingPhase: OnboardingPhase
- }
+interface LocalSetupDebug {
+ state: () => { eligibility: Eligibility | null; localModelsEnabled: boolean }
}
declare global {
interface Window {
- __hermesTips?: LocalSetupOfferDebug
+ __hermesTips?: LocalSetupDebug
}
}
window.__hermesTips = {
- /** Skip onboarding and waiting: mark the card shown now, if the machine qualifies. */
- force: async () => {
- invalidateLocalSetupEligibility()
- const result = await readLocalSetupEligibility()
-
- if (result.fit) {
- transition('shown', { armedBy: 'debug:force', sessionId: 'debug' })
- }
-
- return result
- },
- reset: () => {
- $stored.set({})
- invalidateLocalSetupEligibility()
- armFromPhase($onboardingGate.get().phase)
- },
- state: () => ({
- eligibility: $localSetupEligibility.get(),
- localModelsEnabled: $localModelsEnabled.get(),
- offer: $localSetupOffer.get(),
- onboardingPhase: $onboardingGate.get().phase
- })
+ state: () => ({ eligibility: $localSetupEligibility.get(), localModelsEnabled: $localModelsEnabled.get() })
}
diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.json
index 9a2c4cc0ebe..d28cbc0277c 100644
--- a/locales/_keys.desktop.json
+++ b/locales/_keys.desktop.json
@@ -906,9 +906,6 @@
"composer.hotkeys",
"composer.images",
"composer.listening",
- "composer.localSetup.action",
- "composer.localSetup.text",
- "composer.localSetup.title",
"composer.lookupLoading",
"composer.lookupNoMatches",
"composer.lookupOr",