The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): in-app tips
Brooklyn Nicholsonbaaf3049926a
diff --git a/apps/desktop/src/app/contrib/wiring.tsx b/apps/desktop/src/app/contrib/wiring.tsxindex 723fabe8995..1da332aca62 100644--- a/apps/desktop/src/app/contrib/wiring.tsx+++ b/apps/desktop/src/app/contrib/wiring.tsx@@ -32,6 +32,7 @@ import {import { FloatingPet } from '@/components/pet/floating-pet'import { RemoteDisplayBanner } from '@/components/remote-display-banner'import { SendDiagnosticsHost } from '@/components/send-diagnostics-dialog'+import { TipHost } from '@/components/tips'import { emitGatewayEvent } from '@/contrib/events'import { getLatestSessionMessages } from '@/hermes'import { type ChatMessage, chatMessageText, preserveLocalAssistantErrors, toChatMessages } from '@/lib/chat-messages'@@ -1253,6 +1254,11 @@ export function ContribWiring({ children }: { children: ReactNode }) {Never in the HUD: that window is the chat bar and nothing else. */}{!isHudWindow() && !isBrowserWindow() && <FloatingPet />}+ {/* In-app tips. Renders nothing until the app is quiet and has something+ to point at, and nothing at all once they're off or all retired. The+ HUD and browser windows have none of the surfaces a tip talks about. */}+ {!isHudWindow() && !isBrowserWindow() && <TipHost />}+{/* Single persistent xterm host chasing the terminal pane's slot rect.The HUD has no terminal pane, so it has nothing to chase. */}{!isHudWindow() && !isBrowserWindow() && (diff --git a/apps/desktop/src/app/settings/appearance-settings.tsx b/apps/desktop/src/app/settings/appearance-settings.tsxindex 238978fb9b5..4090bf8915e 100644--- a/apps/desktop/src/app/settings/appearance-settings.tsx+++ b/apps/desktop/src/app/settings/appearance-settings.tsx@@ -22,6 +22,7 @@ import { $reactionsEnabled, setReactionsEnabled } from '@/store/reactions-enableimport { $reasoningCollapsedByDefault, setReasoningCollapsedByDefault } from '@/store/reasoning-disclosure'import { $sessionListDensity, type SessionListDensity, setSessionListDensity } from '@/store/session-list-density'import { $tabStripDefault, setTabStripDefault, type TabStripDefault } from '@/store/tabstrip-prefs'+import { $retiredTips, $tipsEnabled, resetTips, setTipsEnabled } from '@/store/tips'import { $toolViewMode, setToolViewMode } from '@/store/tool-view'import {$translucency,@@ -355,6 +356,8 @@ export function AppearanceSettings() {const translucency = useStore($translucency)const glassMode = translucency.mode === 'glass' && GLASS_SUPPORTEDconst reactionsEnabled = useStore($reactionsEnabled)+ const tipsEnabled = useStore($tipsEnabled)+ const retiredTips = useStore($retiredTips)const vibeHeartsEnabled = useStore($vibeHeartsEnabled)const backdrop = useStore($backdrop)const introSplash = useStore($introSplash)@@ -755,6 +758,40 @@ export function AppearanceSettings() {title={a.reactionsTitle}/>+ <ListRow+ action={+ <div className="flex flex-col items-end gap-1.5">+ <SegmentedControl+ onChange={id => {+ triggerHaptic('selection')+ setTipsEnabled(id === 'on')+ }}+ options={[+ { id: 'off', label: t.common.off },+ { id: 'on', label: t.common.on }+ ]}+ value={tipsEnabled ? 'on' : 'off'}+ />+ {/* The ✕ on a tip is permanent, so this is the only way back.+ It appears once there is something to bring back. */}+ {retiredTips.length > 0 && (+ <Button+ onClick={() => {+ triggerHaptic('selection')+ resetTips()+ }}+ size="inline"+ variant="text"+ >+ {a.tipsReset(retiredTips.length)}+ </Button>+ )}+ </div>+ }+ description={a.tipsDesc}+ title={a.tipsTitle}+ />+<ListRowaction={<SegmentedControldiff --git a/apps/desktop/src/components/tips/index.tsx b/apps/desktop/src/components/tips/index.tsxnew file mode 100644index 00000000000..0c95f25ff58--- /dev/null+++ b/apps/desktop/src/components/tips/index.tsx@@ -0,0 +1,109 @@+/**+ * TIP HOST — one per window, renders nothing until the app has something to+ * say.+ *+ * It owns what the bubble itself must not: keeping the anchor honest, marking+ * it while the arrow is on it, and knowing when a tip has had its moment.+ *+ * The anchor is re-resolved on a slow poll rather than captured once. A tip+ * outlives several React renders, and the element it points at can be replaced+ * (a re-render swaps the node) or leave entirely (a pane closes, a route+ * changes). Re-resolving handles the first and closes the tip on the second,+ * which is the difference between an arrow that follows its subject and one+ * left pointing at empty screen.+ */++import './tips.css'++import { useStore } from '@nanostores/react'+import { useEffect, useState } from 'react'++import { useI18n } from '@/i18n'+import { resolveTipAnchor } from '@/lib/tips/anchor'+import { $activeTip, dismissTip, retireActiveTip } from '@/store/tips'++import { TipBubble } from './tip-bubble'+import { useTipRotation } from './use-tip-rotation'++/** How long a tip stays before it steps aside for the rotation. */+const LINGER_MS = 22_000+const ANCHOR_POLL_MS = 1_000++export function TipHost() {+ const { t } = useI18n()+ const tip = useStore($activeTip)+ const [anchor, setAnchor] = useState<HTMLElement | null>(null)++ useTipRotation(t.tips)++ useEffect(() => {+ if (!tip) {+ setAnchor(null)++ return+ }++ const sync = () => {+ const found = resolveTipAnchor(document, tip.targets)++ if (found) {+ setAnchor(previous => (previous === found ? previous : found))+ } else {+ // Whatever it was about is gone; so is the reason to point at it.+ dismissTip()+ }+ }++ sync()++ const poll = window.setInterval(sync, ANCHOR_POLL_MS)+ const linger = window.setTimeout(dismissTip, LINGER_MS)++ return () => {+ window.clearInterval(poll)+ window.clearTimeout(linger)+ }+ }, [tip])++ // Mark the subject for as long as the arrow is on it.+ //+ // Almost always the subject IS the anchor. The exception is an anchor that+ // exists only to place the arrow — a nav row's label span, which is anchored+ // so the arrow lands at the end of the word instead of out at the sidebar's+ // edge, and which would otherwise get an outline around one word. Those say+ // so with `data-tip-arrow-only` and hand the outline to their region.+ //+ // Opt-in rather than "walk up to the nearest region", because every anchor+ // has a region above it somewhere: the model pill sits inside the composer,+ // and a walk marks the composer for a tip about the pill.+ //+ // An attribute and not a class, so React — which owns these elements'+ // className — has nothing to clobber, and so a target the tip system has+ // never heard of still gets marked.+ useEffect(() => {+ if (!anchor) {+ return+ }++ const marked = anchor.hasAttribute('data-tip-arrow-only') ? (anchor.closest('[data-tip-region]') ?? anchor) : anchor++ marked.setAttribute('data-tip-target', '')++ return () => marked.removeAttribute('data-tip-target')+ }, [anchor])++ if (!tip || !anchor) {+ return null+ }++ return (+ <TipBubble+ anchor={anchor}+ keybind={tip.keybind}+ onClose={retireActiveTip}+ side={tip.side}+ text={tip.text}+ title={tip.title}+ />+ )+}diff --git a/apps/desktop/src/components/tips/tip-bubble.tsx b/apps/desktop/src/components/tips/tip-bubble.tsxnew file mode 100644index 00000000000..103e39a45e0--- /dev/null+++ b/apps/desktop/src/components/tips/tip-bubble.tsx@@ -0,0 +1,97 @@+/**+ * THE TIP BUBBLE — a pointer, not an overlay.+ *+ * The app's popover, in its accent variant: same box, same arrow, same+ * placement engine, filled instead of glassed. Nothing here re-implements the+ * surface — a tip that drifted from the popover's shape would read as a+ * different app talking.+ *+ * What it does own is behaviour, and a coachmark's is the opposite of a menu's+ * at every point: it never takes focus, clicking the app does not dismiss it,+ * and it does not own Esc. The composer already answers Esc, and a dismissable+ * layer in front of it would make one cancel gesture do two things (DESIGN.md).+ * A tip blocks nothing and closes itself, so it never needs to compete.+ */++import { useEffect, useRef } from 'react'++import { KbdCombo } from '@/components/ui/kbd'+import { Popover, PopoverAnchor, PopoverContent } from '@/components/ui/popover'+import { useI18n } from '@/i18n'+import { iconSize, X } from '@/lib/icons'+import { useKeybindHint } from '@/lib/keybinds/use-keybind-hint'+import type { TipSide } from '@/lib/tips/catalog'++export interface TipBubbleProps {+ /** The element the arrow points at. */+ anchor: HTMLElement+ /** Keybind action id; its live combo prints under the text. */+ keybind?: string+ /** Hard close — this tip never comes back. */+ onClose: () => void+ side: TipSide+ text: string+ title?: string+}++export function TipBubble({ anchor, keybind, onClose, side, text, title }: TipBubbleProps) {+ const { t } = useI18n()+ const combo = useKeybindHint(keybind ?? '')+ const anchorRef = useRef<HTMLElement | null>(anchor)++ // Radix reads `virtualRef.current` on every render of the anchor, so keeping+ // the ref current is what lets a tip follow an element that got re-created+ // (a re-render swaps the node, not the selector).+ anchorRef.current = anchor++ // Nothing in here is a focus trap, but a tip arriving under an open native+ // menu would still float above it. Scroll it into agreement instead of+ // guessing: the popover re-measures whenever its anchor moves.+ useEffect(() => {+ anchor.scrollIntoView?.({ block: 'nearest', inline: 'nearest' })+ }, [anchor])++ return (+ <Popover open>+ <PopoverAnchor virtualRef={anchorRef} />+ <PopoverContent+ aria-live="polite"+ className="p-2.5"+ collisionPadding={12}+ data-slot="tip-bubble"+ // Ambient chrome: it must not take the caret out of the composer, and+ // touching the app is not a dismissal gesture — the ✕ and the timer+ // are. See the header note on Esc.+ onCloseAutoFocus={event => event.preventDefault()}+ onEscapeKeyDown={event => event.preventDefault()}+ onFocusOutside={event => event.preventDefault()}+ onInteractOutside={event => event.preventDefault()}+ onOpenAutoFocus={event => event.preventDefault()}+ role="status"+ side={side}+ variant="accent"+ >+ <div className="flex items-start gap-2">+ <div className="min-w-0 flex-1">+ {title && <p className="text-[length:var(--conversation-caption-font-size)] font-semibold">{title}</p>}+ {/* Held off full strength so the title still leads. Everything here+ is currentColor-relative, so it follows whatever the accent's+ foreground is rather than pinning a grey that only works on glass. */}+ <p className="mt-0.5 text-[length:var(--conversation-caption-font-size)] leading-(--conversation-caption-line-height) text-current/85">+ {text}+ </p>+ {combo && <KbdCombo className="mt-2" combo={combo} size="sm" variant="inverted" />}+ </div>+ <button+ aria-label={t.tips.close}+ className="-mr-0.5 -mt-0.5 shrink-0 cursor-pointer rounded-[3px] p-0.5 text-current/70 transition-colors hover:bg-current/15 hover:text-current"+ onClick={onClose}+ type="button"+ >+ <X className={iconSize.sm} />+ </button>+ </div>+ </PopoverContent>+ </Popover>+ )+}diff --git a/apps/desktop/src/components/tips/tips.css b/apps/desktop/src/components/tips/tips.cssnew file mode 100644index 00000000000..f0f8b4bbeb0--- /dev/null+++ b/apps/desktop/src/components/tips/tips.css@@ -0,0 +1,42 @@+/* THE POINTED-AT THING.++ A tip has no scrim and no spotlight — the arrow is the whole mechanism — so+ the subject gets marked rather than the rest of the app getting dimmed. The+ host hangs `data-tip-target` on the subject — the arrow's anchor, or the+ region that anchor defers to — and takes it off when the tip goes. Nothing+ here knows what that element is.++ `outline` and not a border, ring or glow: it draws outside the box without+ taking part in layout, so nothing shifts when a tip lands, and it inherits+ whatever `border-radius` the target already has instead of imposing one.+ A glow was the first attempt and read as noise at every intensity — the+ targets sit on busy surfaces, and a soft accent haze looks like more of the+ same. A hard line does not. */++[data-tip-target] {+ outline: 2px solid var(--dt-primary);+ outline-offset: 3px;+ animation: hermes-tip-outline-pulse 1.8s ease-in-out infinite;+}++/* A region is a whole area — a nav row, the sidebar, the composer — and those+ are the elements sitting flush against a scroller or an `overflow-hidden`+ parent, where an outline drawn 3px OUTSIDE the box is the outline you can't+ see. Inset it and it always lands on its own surface. Applies whether the+ region was deferred to or anchored directly. */+[data-tip-target][data-tip-region] {+ outline-offset: -2px;+}++@keyframes hermes-tip-outline-pulse {+ 50% {+ outline-color: color-mix(in srgb, var(--dt-primary) 45%, transparent);+ }+}++/* Marked, not breathing. The outline is the signal; the pulse is only flavour. */+@media (prefers-reduced-motion: reduce) {+ [data-tip-target] {+ animation: none;+ }+}diff --git a/apps/desktop/src/components/tips/use-tip-rotation.ts b/apps/desktop/src/components/tips/use-tip-rotation.tsnew file mode 100644index 00000000000..de8a0285a17--- /dev/null+++ b/apps/desktop/src/components/tips/use-tip-rotation.ts@@ -0,0 +1,106 @@+/**+ * The rotation's clock: when the app is quiet, offer a tip.+ *+ * "Quiet" is doing the work here. A tip is the app talking unprompted, so it+ * waits for a moment that is genuinely idle — nothing streaming, no dialog,+ * menu or tour on screen, the window focused, and a few seconds since the last+ * keystroke. Fail any of those and the tick simply passes; a tip is never+ * queued up to ambush the user the instant they stop typing.+ */++import { useEffect } from 'react'++import type { Translations } from '@/i18n/types'+import { resolveTipAnchor } from '@/lib/tips/anchor'+import { TIP_CATALOG } from '@/lib/tips/catalog'+import { nextTip } from '@/lib/tips/rotation'+import { $awaitingResponse, $busy } from '@/store/session'+import { $activeTip, $lastTipId, $retiredTips, showTip } from '@/store/tips'++const TICK_MS = 5_000+/** Long enough that the first tip lands after you've settled in, not on boot. */+const FIRST_TIP_MS = 45_000+/** And rare enough afterwards to stay a nicety rather than a nag. */+const BETWEEN_TIPS_MS = 6 * 60_000+/** Typing is the clearest "I'm busy" signal the renderer gets for free. */+const TYPING_GRACE_MS = 5_000++/** Anything on screen a tip would be talking over. `.driver-popover` is the+ * tour: two accent-lit bubbles at once is one too many. */+const BLOCKING_SURFACES =+ '[role="dialog"],[role="alertdialog"],[role="menu"],[role="listbox"],[data-overlay-surface],.driver-popover'++function appIsQuiet(lastTypedAt: number): boolean {+ if (document.visibilityState !== 'visible' || !document.hasFocus()) {+ return false+ }++ if ($busy.get() || $awaitingResponse.get()) {+ return false+ }++ if (Date.now() - lastTypedAt < TYPING_GRACE_MS) {+ return false+ }++ return !document.querySelector(BLOCKING_SURFACES)+}++/** Drive the ambient rotation for as long as the host is mounted. */+export function useTipRotation(copy: Translations['tips']) {+ useEffect(() => {+ let lastTypedAt = 0+ let dueAt = Date.now() + FIRST_TIP_MS++ const noteTyping = () => {+ lastTypedAt = Date.now()+ }++ const offer = () => {+ if ($activeTip.get()) {+ // One is up; the next comes due a good while after it goes away.+ dueAt = Date.now() + BETWEEN_TIPS_MS++ return+ }++ if (Date.now() < dueAt || !appIsQuiet(lastTypedAt)) {+ return+ }++ // Only tips with something on screen to point at are candidates, so the+ // rotation never burns a turn on a pane the user isn't showing.+ const onScreen = TIP_CATALOG.filter(tip => resolveTipAnchor(document, tip.targets))++ const chosen = nextTip(+ TIP_CATALOG.map(tip => tip.id),+ onScreen.map(tip => tip.id),+ { lastShownId: $lastTipId.get(), retired: $retiredTips.get() }+ )++ const tip = onScreen.find(candidate => candidate.id === chosen)++ if (!tip) {+ return+ }++ showTip({+ keybind: tip.keybind,+ side: tip.side,+ targets: tip.targets,+ text: copy.items[tip.id].text,+ tipId: tip.id,+ title: copy.items[tip.id].title+ })+ }++ const timer = window.setInterval(offer, TICK_MS)++ window.addEventListener('keydown', noteTyping, true)++ return () => {+ window.clearInterval(timer)+ window.removeEventListener('keydown', noteTyping, true)+ }+ }, [copy])+}diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex f658ca540cb..b8dd49dc2ee 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -469,6 +469,10 @@ export const ar = defineLocale({introSplashDesc: 'الشعار النصي والعبارة التمهيدية في محادثة فارغة.',reactionsTitle: 'تفاعلات الرسائل',reactionsDesc: 'تفاعلات إيموجي بأسلوب iMessage — تفاعل مع الرسائل، ويمكن لـ Hermes التفاعل مع رسائلك.',+ tipsTitle: 'نصائح داخل التطبيق',+ tipsDesc:+ 'إشارات عرضية إلى أجزاء من التطبيق ربما لم تكتشفها بعد. إغلاق نصيحة يزيلها نهائيًا، ويمكن لـ Hermes أيضًا أن يشير إلى واحدة عند الحاجة.',+ tipsReset: count => `استعادة ${count} نصيحة مغلقة`,composerPopoutTitle: 'محرر عائم',composerPopoutDesc: 'السماح بسحب محرر الرسائل خارج موضعه. عطّل هذا الخيار لإبقائه مثبتًا في الأسفل.',vibeHeartsTitle: 'قلوب المزاج',@@ -2836,6 +2840,51 @@ export const ar = defineLocale({reloadWindow: 'إعادة تحميل النافذة',openLogs: 'فتح السجلات'},+ tips: {+ close: 'لا تعرض هذه النصيحة مرة أخرى',+ items: {+ 'new-session': {+ title: 'ابدأ من جديد',+ text: 'كل محادثة جديدة لها سياقها وطرفيتها ومجلد عملها الخاص.'+ },+ skills: {+ title: 'علّمه مرة واحدة',+ text: 'المهارات مجلدات من التعليمات يحمّلها Hermes عندما يقتضي العمل ذلك.'+ },+ messaging: {+ title: 'Hermes بعيدًا عن مكتبك',+ text: 'اربطه بـ Telegram وDiscord وSlack وغيرها — الوكيل نفسه والذاكرة نفسها.'+ },+ artifacts: {+ title: 'كل ما صنعه Hermes',+ text: 'الصور والملفات والروابط من كل الجلسات، مفهرسة في مكان واحد.'+ },+ cron: {+ title: 'عمل يجري من تلقاء نفسه',+ text: 'جدوِل موجّهًا كل ساعة أو كل ليلة أو وفق تعبير cron.'+ },+ 'command-palette': {+ title: 'صندوق واحد لكل شيء',+ text: 'الجلسات والإعدادات والمهارات والأوامر كلها تستجيب للوحة الأوامر.'+ },+ profiles: {+ title: 'الملفات الشخصية منفصلة',+ text: 'كل واحد منها Hermes مستقل — مفاتيحه وذاكرته وجلساته الخاصة.'+ },+ 'composer-mentions': {+ title: 'المرفقات والأوامر',+ text: 'اكتب @ لإحضار ملف إلى المحادثة، و / لتشغيل أمر.'+ },+ 'model-switch': {+ title: 'بدّل النموذج أثناء المحادثة',+ text: 'اسم النموذج زر. غيّره كلما تغيّرت طبيعة العمل.'+ },+ 'right-pane': {+ title: 'لوحة العمل',+ text: 'الملفات والطرفية والمراجعة والمتصفح المدمج تتشارك اللوحة الجانبية.'+ }+ }+ },ui: {search: {clear: 'مسح البحث'diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex a3c7fb1ce0a..a255e8e17f4 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -588,6 +588,10 @@ export const en: Translations = {introSplashDesc: 'The wordmark and prompt shown on an empty chat.',reactionsTitle: 'Message Reactions',reactionsDesc: 'iMessage-style emoji tapbacks — react to messages, and Hermes can react to yours.',+ tipsTitle: 'In-App Tips',+ tipsDesc:+ 'Occasional pointers at parts of the app you may not have found yet. Closing one retires it for good; Hermes can also point one out when it helps.',+ tipsReset: (count: number) => `Bring back ${count} closed ${count === 1 ? 'tip' : 'tips'}`,composerPopoutTitle: 'Floating Composer',composerPopoutDesc: 'Allow dragging the composer out of its dock. Turn this off to keep it locked at the bottom.',vibeHeartsTitle: 'Vibe Hearts',@@ -3459,6 +3463,52 @@ export const en: Translations = {}},+ tips: {+ close: "Don't show this tip again",+ items: {+ 'new-session': {+ title: 'Start fresh',+ text: 'A new chat gets its own context, terminal and working directory.'+ },+ skills: {+ title: 'Teach it once',+ text: 'Skills are folders of instructions Hermes loads when the work calls for them.'+ },+ messaging: {+ title: 'Hermes away from your desk',+ text: 'Connect Telegram, Discord, Slack and more — same agent, same memory.'+ },+ artifacts: {+ title: 'Everything Hermes made',+ text: 'Images, files and links from every session, indexed in one place.'+ },+ cron: {+ title: 'Work that runs itself',+ text: 'Schedule a prompt hourly, nightly, or on a cron expression.'+ },+ 'command-palette': {+ title: 'One box for everything',+ text: 'Sessions, settings, skills and commands all answer to the palette.'+ },+ profiles: {+ title: 'Profiles are separate',+ text: 'Each one is its own Hermes — own keys, own memory, own sessions.'+ },+ 'composer-mentions': {+ title: 'Attach and command',+ text: 'Type @ to bring a file into the conversation, / to run a command.'+ },+ 'model-switch': {+ title: 'Switch models mid-thread',+ text: 'The model name is a button. Change it whenever the work changes shape.'+ },+ 'right-pane': {+ title: 'The working pane',+ text: 'Files, terminal, review and the in-app browser share the right side.'+ }+ }+ },+errors: {genericFailure: 'Something went wrong',boundaryTitle: 'Something broke in the interface',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex d4131559edf..57ff7cf1149 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -411,6 +411,10 @@ export const ja = defineLocale({reactionsTitle: 'メッセージリアクション',reactionsDesc:'iMessage風の絵文字タップバック — メッセージにリアクションでき、Hermesもあなたのメッセージにリアクションします。',+ tipsTitle: 'アプリ内ヒント',+ tipsDesc:+ 'まだ見つけていない機能をときどき案内します。閉じたヒントは二度と表示されません。役に立つときは Hermes からも案内できます。',+ tipsReset: (count: number) => `閉じた${count}件のヒントを元に戻す`,composerPopoutTitle: 'フローティング入力欄',composerPopoutDesc: '入力欄をドックからドラッグして外せるようにします。オフにすると画面下部に固定されます。',vibeHeartsTitle: 'バイブハート',@@ -3082,6 +3086,52 @@ export const ja = defineLocale({}},+ tips: {+ close: 'このヒントを今後表示しない',+ items: {+ 'new-session': {+ title: '新しく始める',+ text: '新しいチャットは、専用のコンテキスト・ターミナル・作業ディレクトリを持ちます。'+ },+ skills: {+ title: '一度教えれば覚えます',+ text: 'スキルは手順書のフォルダで、必要な場面で Hermes が自分で読み込みます。'+ },+ messaging: {+ title: 'デスクを離れても Hermes',+ text: 'Telegram、Discord、Slack などに接続。同じエージェント、同じ記憶のままです。'+ },+ artifacts: {+ title: 'Hermes が作ったものすべて',+ text: '全セッションの画像・ファイル・リンクを一箇所にまとめています。'+ },+ cron: {+ title: '自動で動く仕事',+ text: 'プロンプトを毎時・毎晩、または cron 式で実行できます。'+ },+ 'command-palette': {+ title: 'すべてはこの一箇所から',+ text: 'セッション、設定、スキル、コマンドはすべてパレットから呼び出せます。'+ },+ profiles: {+ title: 'プロファイルは独立しています',+ text: 'それぞれが独自のキー・メモリ・セッションを持つ、別の Hermes です。'+ },+ 'composer-mentions': {+ title: 'ファイルとコマンド',+ text: '@ でファイルを会話に取り込み、/ でコマンドを実行できます。'+ },+ 'model-switch': {+ title: '会話の途中でモデルを変更',+ text: 'モデル名はボタンです。作業の性質が変わったら切り替えてください。'+ },+ 'right-pane': {+ title: '作業用ペイン',+ text: 'ファイル、ターミナル、レビュー、アプリ内ブラウザはサイドペインにまとまっています。'+ }+ }+ },+errors: {genericFailure: '問題が発生しました',boundaryTitle: 'インターフェイスで問題が発生しました',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 4c2df317408..bf216445123 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -5,6 +5,8 @@// partial locales should use `defineLocale()` so missing desktop-only strings// fall back to English while new keys remain type-checked.+import type { TipId } from '@/lib/tips/catalog'+export type Locale = 'en' | 'zh' | 'zh-hant' | 'ja' | 'ar'export type ToolTitleKey =@@ -478,6 +480,9 @@ export interface Translations {introSplashDesc: stringreactionsTitle: stringreactionsDesc: string+ tipsTitle: string+ tipsDesc: string+ tipsReset: (count: number) => stringcomposerPopoutTitle: stringcomposerPopoutDesc: stringvibeHeartsTitle: string@@ -2977,6 +2982,12 @@ export interface Translations {}}+ tips: {+ close: string+ /** Keyed by `TipId`, so a new tip without copy is a type error. */+ items: Record<TipId, { title: string; text: string }>+ }+errors: {genericFailure: stringboundaryTitle: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex f155f4050cf..15253340c22 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -400,6 +400,9 @@ export const zhHant = defineLocale({introSplashDesc: '空白對話中顯示的字標和提示語。',reactionsTitle: '訊息回應',reactionsDesc: 'iMessage 風格的表情回應 — 你可以對訊息做出回應,Hermes 也能回應你的訊息。',+ tipsTitle: '應用程式內提示',+ tipsDesc: '偶爾指出你可能還沒發現的功能。關掉一則就不再出現;需要時 Hermes 也能指給你看。',+ tipsReset: (count: number) => `復原 ${count} 則已關閉的提示`,composerPopoutTitle: '懸浮輸入框',composerPopoutDesc: '允許將輸入框拖出底部停靠區。關閉後,輸入框會鎖定在底部。',vibeHeartsTitle: '心情愛心',@@ -2963,6 +2966,52 @@ export const zhHant = defineLocale({openLogs: '開啟記錄'},+ tips: {+ close: '不再顯示這則提示',+ items: {+ 'new-session': {+ title: '從頭開始',+ text: '新對話擁有獨立的上下文、終端機與工作目錄。'+ },+ skills: {+ title: '教一次就夠',+ text: '技能是一組說明檔,Hermes 會在需要時自行載入。'+ },+ messaging: {+ title: '離開電腦也能用',+ text: '接上 Telegram、Discord、Slack 等 — 同一個代理,同一份記憶。'+ },+ artifacts: {+ title: 'Hermes 做過的一切',+ text: '所有工作階段的圖片、檔案與連結,都彙整在這裡。'+ },+ cron: {+ title: '會自己執行的工作',+ text: '讓一則提示按小時、按夜間,或依 cron 運算式定時執行。'+ },+ 'command-palette': {+ title: '一個輸入框搞定一切',+ text: '工作階段、設定、技能與指令都能從命令選單找到。'+ },+ profiles: {+ title: '設定檔彼此獨立',+ text: '每個都是獨立的 Hermes — 自己的金鑰、記憶與工作階段。'+ },+ 'composer-mentions': {+ title: '附件與指令',+ text: '輸入 @ 把檔案帶入對話,輸入 / 執行指令。'+ },+ 'model-switch': {+ title: '對話中隨時換模型',+ text: '模型名稱就是按鈕。工作性質變了就換一個。'+ },+ 'right-pane': {+ title: '工作面板',+ text: '檔案、終端機、審閱與內建瀏覽器都在側邊面板裡。'+ }+ }+ },+ui: {search: {clear: '清除搜尋'diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex e5326688699..2928974c40c 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -574,6 +574,9 @@ export const zh: Translations = {introSplashDesc: '空白对话中显示的字标和提示语。',reactionsTitle: '消息回应',reactionsDesc: 'iMessage 风格的表情回应 — 你可以给消息添加回应,Hermes 也能回应你的消息。',+ tipsTitle: '应用内提示',+ tipsDesc: '偶尔指出你可能还没发现的功能。关掉一条就不再出现;需要时 Hermes 也能指给你看。',+ tipsReset: (count: number) => `恢复 ${count} 条已关闭的提示`,composerPopoutTitle: '悬浮输入框',composerPopoutDesc: '允许将输入框拖出底部停靠区。关闭后,输入框会锁定在底部。',vibeHeartsTitle: '心情爱心',@@ -3603,6 +3606,52 @@ export const zh: Translations = {}},+ tips: {+ close: '不再显示这条提示',+ items: {+ 'new-session': {+ title: '从头开始',+ text: '新对话拥有独立的上下文、终端和工作目录。'+ },+ skills: {+ title: '教一次就够',+ text: '技能是一组说明文件,Hermes 会在需要时自行加载。'+ },+ messaging: {+ title: '离开电脑也能用',+ text: '接入 Telegram、Discord、Slack 等 — 同一个智能体,同一份记忆。'+ },+ artifacts: {+ title: 'Hermes 做过的一切',+ text: '所有会话里的图片、文件和链接,都汇总在这里。'+ },+ cron: {+ title: '会自己运行的任务',+ text: '让一条提示按小时、按夜间,或按 cron 表达式定时执行。'+ },+ 'command-palette': {+ title: '一个输入框搞定一切',+ text: '会话、设置、技能和命令都能从命令面板找到。'+ },+ profiles: {+ title: '配置文件彼此独立',+ text: '每个都是独立的 Hermes — 自己的密钥、记忆和会话。'+ },+ 'composer-mentions': {+ title: '附件与命令',+ text: '输入 @ 把文件带入对话,输入 / 运行命令。'+ },+ 'model-switch': {+ title: '对话中随时换模型',+ text: '模型名称就是按钮。工作性质变了就换一个。'+ },+ 'right-pane': {+ title: '工作面板',+ text: '文件、终端、审阅和内置浏览器都在侧边面板里。'+ }+ }+ },+errors: {genericFailure: '发生错误',boundaryTitle: '界面出错了',diff --git a/apps/desktop/src/lib/tips/anchor.ts b/apps/desktop/src/lib/tips/anchor.tsnew file mode 100644index 00000000000..9ce67e2d7d7--- /dev/null+++ b/apps/desktop/src/lib/tips/anchor.ts@@ -0,0 +1,46 @@+/**+ * Where a tip can actually point right now.+ *+ * A tip has no spotlight and no scrim, so a bubble anchored to something the+ * user cannot see is not a dimmed step — it is an arrow into empty space. The+ * anchor is therefore re-resolved from the DOM every time, and a tip whose+ * handles are all missing is simply skipped this round.+ *+ * The `data-pane-hidden` guard is the same one the tour collector owes: an+ * inactive tab in a keep-alive stack stays MOUNTED under `visibility: hidden`+ * so its scroll position survives, which means it keeps its layout box and its+ * rect is identical to the live tab's. No geometry test separates them.+ */++/** The first target that resolves to a visible, on-screen element. */+export function resolveTipAnchor(doc: Document, targets: readonly string[]): HTMLElement | null {+ for (const selector of targets) {+ const element = doc.querySelector<HTMLElement>(selector)++ if (element && isTipAnchorVisible(element)) {+ return element+ }+ }++ return null+}++function isTipAnchorVisible(element: HTMLElement): boolean {+ if (element.closest('[data-pane-hidden]')) {+ return false+ }++ const rect = element.getBoundingClientRect()++ if (rect.width < 8 || rect.height < 8) {+ return false+ }++ const view = element.ownerDocument.defaultView++ if (!view) {+ return true+ }++ return rect.bottom > 0 && rect.top < view.innerHeight && rect.right > 0 && rect.left < view.innerWidth+}diff --git a/apps/desktop/src/lib/tips/catalog.ts b/apps/desktop/src/lib/tips/catalog.tsnew file mode 100644index 00000000000..69d3f434ec9--- /dev/null+++ b/apps/desktop/src/lib/tips/catalog.ts@@ -0,0 +1,58 @@+/**+ * THE TIP CATALOG — what the app tells you about itself when it's quiet.+ *+ * Data only. A tip is an id, somewhere to point, and (optionally) the keybind+ * whose CURRENT combo the bubble prints. The words live in i18n under+ * `tips.items[id]`, keyed by the same id, so `TipId` is what makes a missing+ * translation a type error rather than an empty bubble.+ *+ * `targets` is a preference list, not a selector: the first one that resolves+ * to a visible element wins, and a tip whose anchors are all absent simply+ * isn't a candidate this time round (see `resolveTipAnchor`). That is why a+ * tip about the profile rail costs nothing on a layout that has no rail.+ *+ * Handles are `data-tour`, the same vocabulary the tour engine's collector+ * treats as identity — one set of durable handles, two consumers. Never point+ * a tip at a positional selector or a translated aria-label.+ */++export type TipSide = 'bottom' | 'left' | 'right' | 'top'++export interface TipDef {+ /** Persistence key for a hard close. Stable forever — renaming forgets it. */+ id: TipId+ /** Keybind action id; the bubble renders its live combo. Never hardcode one. */+ keybind?: string+ /** Preferred side of the anchor. Flips at a viewport edge like any popover. */+ side: TipSide+ /** Candidate anchors, best first. */+ targets: readonly string[]+}++export type TipId =+ | 'artifacts'+ | 'command-palette'+ | 'composer-mentions'+ | 'cron'+ | 'messaging'+ | 'model-switch'+ | 'new-session'+ | 'profiles'+ | 'right-pane'+ | 'skills'++// Between them these introduce the app: the rail down the left, the composer,+// and the pane on the right. Nothing here is a step in a sequence — any one has+// to stand alone, because that is how they arrive.+export const TIP_CATALOG: readonly TipDef[] = [+ { id: 'new-session', keybind: 'session.new', side: 'right', targets: ['[data-tour="sidebar-nav-new-session"]'] },+ { id: 'skills', keybind: 'nav.skills', side: 'right', targets: ['[data-tour="sidebar-nav-skills"]'] },+ { id: 'messaging', keybind: 'nav.messaging', side: 'right', targets: ['[data-tour="sidebar-nav-messaging"]'] },+ { id: 'artifacts', keybind: 'nav.artifacts', side: 'right', targets: ['[data-tour="sidebar-nav-artifacts"]'] },+ { id: 'cron', keybind: 'nav.cron', side: 'right', targets: ['[data-tour="sidebar-nav-cron"]'] },+ { id: 'command-palette', keybind: 'nav.commandPalette', side: 'right', targets: ['[data-tour="sessions-sidebar"]'] },+ { id: 'profiles', keybind: 'profile.next', side: 'right', targets: ['[data-tour="profile-rail"]'] },+ { id: 'composer-mentions', side: 'top', targets: ['[data-tour="composer"]'] },+ { id: 'model-switch', keybind: 'composer.modelPicker', side: 'top', targets: ['[data-tour="model-pill"]'] },+ { id: 'right-pane', keybind: 'view.toggleRightSidebar', side: 'bottom', targets: ['[data-tour="right-pane-toggle"]'] }+]diff --git a/apps/desktop/src/lib/tips/rotation.ts b/apps/desktop/src/lib/tips/rotation.tsnew file mode 100644index 00000000000..5c8c17cc629--- /dev/null+++ b/apps/desktop/src/lib/tips/rotation.ts@@ -0,0 +1,54 @@+/**+ * Which tip comes next.+ *+ * The catalog is a ring and the rotation walks it in order, resuming from+ * whichever tip was last shown. Order and not shuffle: the catalog reads as a+ * tour of the app — the rail down the left, then the composer, then the pane on+ * the right — and walking it that way means a user who sees three tips over a+ * week sees three neighbouring parts of the app, not three unrelated ones.+ *+ * Two rules on top of the walk:+ *+ * 1. A hard close RETIRES a tip. It is gone for good — the only way back is+ * Settings → Reset. Retiring every tip is a legitimate end state: the+ * rotation runs dry and the app stops talking, which is what a user who+ * closed all of them was asking for.+ * 2. A tip is skipped, not waited for, when it has nothing on screen to point+ * at. `available` is the subset that resolves right now, and the walk steps+ * over the rest — but it counts position against the FULL catalog, so which+ * panes happen to be open changes what you see and never the order you see+ * it in.+ */++export interface TipRotationState {+ /** The tip shown most recently, retired or not. Where the next walk starts. */+ lastShownId: null | string+ /** Hard-closed tip ids. */+ retired: readonly string[]+}++/**+ * The first tip after `lastShownId` that is live and on screen, wrapping at the+ * end of the catalog. Null when the rotation is spent.+ *+ * @param order Every tip id, in catalog order — the ring being walked.+ * @param available The subset with something on screen to point at.+ */+export function nextTip(+ order: readonly string[],+ available: readonly string[],+ state: TipRotationState+): null | string {+ // An unknown or absent last tip starts the walk at the top of the catalog.+ const start = state.lastShownId == null ? -1 : order.indexOf(state.lastShownId)++ for (let step = 1; step <= order.length; step += 1) {+ const id = order[(start + step + order.length) % order.length]++ if (available.includes(id) && !state.retired.includes(id)) {+ return id+ }+ }++ return null+}diff --git a/apps/desktop/src/store/tips.ts b/apps/desktop/src/store/tips.tsnew file mode 100644index 00000000000..6e023b42e93--- /dev/null+++ b/apps/desktop/src/store/tips.ts@@ -0,0 +1,104 @@+/**+ * In-app tips — on by default, closable for good.+ *+ * Three pieces of state, three different lifetimes:+ *+ * - `$tipsEnabled` is the opt-OUT. Persisted, and mirrored into+ * `display.in_app_tips` on the CONNECTED gateway so the agent's `tip` tool+ * answers to the same switch the user flipped — one lever, not two.+ * - `$retiredTips` is the hard-close ledger. A tip the user ✕'d never comes+ * back on its own; Settings → Reset is the only way, and that is the whole+ * contract behind the ✕ being a heavier gesture than closing the bubble.+ * - `$activeTip` is what is on screen. Ephemeral by design: a tip is a nicety,+ * and one that survives a reload has overstayed.+ *+ * `$lastTipId` is the rotation's cursor — where the next walk through the+ * catalog resumes from. Persisted, because the alternative is that every+ * relaunch reopens the tour at tip one.+ */++import { atom } from 'nanostores'++import { Codecs, persistentAtom } from '@/lib/persisted'+import type { TipSide } from '@/lib/tips/catalog'+import { activeGateway } from '@/store/gateway'++/** A tip as the bubble needs it: resolved copy, resolved anchor. */+export interface ActiveTip {+ /** Keybind action id whose live combo the bubble prints. */+ keybind?: string+ side: TipSide+ /** Candidate anchors, best first — re-resolved while the bubble is up, so a+ * tip follows an element that re-renders and leaves when it goes away. */+ targets: readonly string[]+ text: string+ /** Catalog id. Absent for an agent-authored tip, which has nothing to retire. */+ tipId?: string+ title?: string+}++// Opt-out: absent storage means on.+export const $tipsEnabled = persistentAtom('hermes.desktop.tips.v1', true, Codecs.bool)+export const $retiredTips = persistentAtom<string[]>('hermes.desktop.tips.retired.v1', [], Codecs.stringArray)+export const $lastTipId = persistentAtom<null | string>('hermes.desktop.tips.last.v1', null, Codecs.nullableText)+export const $activeTip = atom<ActiveTip | null>(null)++export function setTipsEnabled(enabled: boolean): void {+ if (!enabled) {+ $activeTip.set(null)+ }++ $tipsEnabled.set(enabled)+}++/** Un-retire everything. The rotation starts over from a full deck. */+export function resetTips(): void {+ $retiredTips.set([])+}++/** Put a tip on screen. A no-op while tips are off — every caller, agent+ * included, goes through here so the opt-out has exactly one enforcement+ * point. */+export function showTip(tip: ActiveTip): boolean {+ if (!$tipsEnabled.get()) {+ return false+ }++ if (tip.tipId) {+ $lastTipId.set(tip.tipId)+ }++ $activeTip.set(tip)++ return true+}++/** Soft close: this one has had its moment, the rotation carries on. */+export function dismissTip(): void {+ $activeTip.set(null)+}++/** Hard close (the ✕): retire the catalog tip behind the bubble for good. An+ * agent tip has no catalog entry, so it just closes. */+export function retireActiveTip(): void {+ const tipId = $activeTip.get()?.tipId++ if (tipId && !$retiredTips.get().includes(tipId)) {+ $retiredTips.set([...$retiredTips.get(), tipId])+ }++ $activeTip.set(null)+}++// The agent's `tip` tool gates on this key, and reading it off the CONNECTED+// gateway is what makes the toggle work the same whether that gateway is local,+// SSH, URL, or cloud. listen(), not subscribe(): boot must not write back the+// value it just read.+$tipsEnabled.listen(enabled => {+ void activeGateway()+ ?.request('config.set', { key: 'display.in_app_tips', value: String(enabled) })+ .catch(() => {+ // Not connected yet — the next toggle still lands, and absent config+ // reads as on, which matches the renderer's own default.+ })+})