Skip to content

The agent that grows with you

First-run intro no longer plays hearts; usage-stats bar waits out the tour (#129636)

Siddharth Balyan08f3a7209f03
diff --git a/agent/turn_context.py b/agent/turn_context.py
index ac00c87229b..8729fcad35b 100644
--- a/agent/turn_context.py
+++ b/agent/turn_context.py
@@ -727,14 +727,19 @@ def _tick_memory_nudge(agent: Any) -> bool:
return False
-def _emit_reaction(agent: Any, original_user_message: Any) -> None:
+def _emit_reaction(agent: Any, original_user_message: Any, display_kind: Optional[str] = None) -> None:
"""Cosmetic side-signal: detect an affection reaction so the host can play hearts.
- Token-free, never touches the conversation, never fatal."""
+ Token-free, never touches the conversation, never fatal. Only words the user typed
+ count: a hidden prompt or an expanded skill body is app/skill text, not affection."""
reaction_callback = getattr(agent, "reaction_callback", None)
- if reaction_callback is None:
+ if reaction_callback is None or display_kind == "hidden":
return
with suppress(Exception):
from agent.reactions import detect_reaction
+ from agent.skill_commands import describe_skill_invocation
+
+ if describe_skill_invocation(original_user_message) is not None:
+ return
kind = detect_reaction(original_user_message)
if kind:
@@ -1083,7 +1088,7 @@ def build_turn_context(
# Preserve the original user message (no nudge injection).
original_user_message = persist_user_message if persist_user_message is not None else user_message
should_review_memory = _tick_memory_nudge(agent)
- _emit_reaction(agent, original_user_message)
+ _emit_reaction(agent, original_user_message, persist_user_display_kind)
if not agent.quiet_mode:
agent._safe_print(
diff --git a/apps/desktop/src/components/shared-metrics/consent-dialog.tsx b/apps/desktop/src/components/shared-metrics/consent-dialog.tsx
index 9772db41c8c..51f5bd0b085 100644
--- a/apps/desktop/src/components/shared-metrics/consent-dialog.tsx
+++ b/apps/desktop/src/components/shared-metrics/consent-dialog.tsx
@@ -13,6 +13,7 @@ import {
} from '@/components/ui/dialog'
import { useI18n } from '@/i18n'
import { ChevronDown } from '@/lib/icons'
+import { $tourActive } from '@/lib/tour/tour-active'
import { cn } from '@/lib/utils'
import { notifyError } from '@/store/notifications'
import { $desktopOnboarding } from '@/store/onboarding'
@@ -57,6 +58,7 @@ export function SharedMetricsConsentDialog({ enabled, profile, requestGateway }:
const onboarding = useStore($desktopOnboarding)
const surfaces = useStore($onboardingSurfaces)
const guidedSettled = useStore($guidedOnboardingSettled)
+ const tourActive = useStore($tourActive)
const setupProfile = useStore($setupProfileName)
const detailsId = useId()
const consent = useStore($sharedMetricsConsent)
@@ -64,14 +66,15 @@ export function SharedMetricsConsentDialog({ enabled, profile, requestGateway }:
const [expanded, setExpanded] = useState(false)
const [saving, setSaving] = useState(false)
- // Never over the provider picker, the free-tier welcome or the guided chat:
+ // Never over the provider picker, the free-tier welcome or the guided chat, or a tour on screen:
// the question belongs to the moment after setup.
const onboardingSettled =
(onboarding.configured === true || onboarding.firstRunSkipped) &&
!onboarding.manual &&
!onboarding.freeTierReady &&
surfaces.size === 0 &&
- guidedSettled
+ guidedSettled &&
+ !tourActive
// The setup profile only hosts the welcome chat; its answer would count for nobody.
const inSetupProfile = setupProfile !== null && normalizeProfileKey(setupProfile) === normalizeProfileKey(profile)
diff --git a/apps/desktop/src/lib/tour/engine.ts b/apps/desktop/src/lib/tour/engine.ts
index 42892e89992..47a2987358a 100644
--- a/apps/desktop/src/lib/tour/engine.ts
+++ b/apps/desktop/src/lib/tour/engine.ts
@@ -77,6 +77,8 @@ export interface TourHost {
navigate?: (to: string) => void
/** Reveal a desktop pane by name. */
revealPane?: (pane: string) => void
+ /** The tour ended, however it ended (Esc, the ✕, an overlay click, the last step). */
+ onEnd?: () => void
}
/** A normalized action. `kind` is the verb; the rest is per-verb payload. */
@@ -290,7 +292,17 @@ export function runTourEngine(
if (!holder.driver) {
clearOrphans()
- holder.driver = factory(base)
+ // Esc, the X and an overlay click end a highlight too; without this
+ // hook the tour-active flag would stay set for the rest of the session.
+ holder.driver = factory({
+ ...base,
+ onDestroyed: () => {
+ holder.driver = undefined
+ holder.release?.()
+ holder.release = undefined
+ host?.onEnd?.()
+ }
+ })
}
// A one-off highlight is its own arrival, so it uses the settle-down enter.
@@ -328,6 +340,7 @@ export function runTourEngine(
holder.driver = undefined
holder.release?.()
holder.release = undefined
+ host?.onEnd?.()
if (origin !== undefined && host?.navigate && host.currentRoute?.() !== origin) {
host.navigate(origin)
diff --git a/apps/desktop/src/lib/tour/run-tour.ts b/apps/desktop/src/lib/tour/run-tour.ts
index 88df01d9ab4..08a47295f56 100644
--- a/apps/desktop/src/lib/tour/run-tour.ts
+++ b/apps/desktop/src/lib/tour/run-tour.ts
@@ -30,6 +30,7 @@ import {
type TourStyle
} from './engine'
import { type Stage, stopSpotlightBlur, syncSpotlightBlur } from './spotlight-blur'
+import { $tourActive } from './tour-active'
/** Which document a tour runs against. */
export type TourSurface = 'app' | 'preview'
@@ -43,7 +44,8 @@ const APP_HOST: TourHost = {
navigate: to => {
window.location.hash = to
},
- revealPane: pane => void revealDesktopPane(pane)
+ revealPane: pane => void revealDesktopPane(pane),
+ onEnd: () => $tourActive.set(false)
}
/** The app's own overlay treatment: a softly rounded cutout and a transition
@@ -78,6 +80,8 @@ export async function runTour(action: TourAction, surface: TourSurface = 'app'):
// Mirror driver.js's cutout onto a blur layer for as long as the tour is
// up, and drop the whole thing once it isn't. The layer reads driver's own
// per-frame stage rect, so it eases between steps exactly like the cutout.
+ $tourActive.set(isTourActive())
+
if (isTourActive()) {
syncSpotlightBlur(() => (appHolder.driver?.getState?.('__activeStagePosition') as null | Stage) ?? null)
} else {
diff --git a/apps/desktop/src/lib/tour/tour-active.ts b/apps/desktop/src/lib/tour/tour-active.ts
new file mode 100644
index 00000000000..36f603a07e7
--- /dev/null
+++ b/apps/desktop/src/lib/tour/tour-active.ts
@@ -0,0 +1,5 @@
+import { atom } from 'nanostores'
+
+/** Reactive twin of `isTourActive` for UI that must wait out a tour. Lives apart from
+ * run-tour.ts, which is dynamic-imported to keep driver.js off the boot path. */
+export const $tourActive = atom(false)