The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(desktop): type the setup_beat card, answer and result
alt-glitchc13adbb4bee8
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/server-requests.ts b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/server-requests.tsindex 879ed054393..6deb9713849 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/server-requests.ts+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/server-requests.ts@@ -38,7 +38,7 @@ import {previewScopeForRuntime,storedSessionIdForRuntimeId} from '@/store/session-states'-import { parkSetupBeat } from '@/store/setup-beat'+import { parkSetupBeat, type SetupBeatCard } from '@/store/setup-beat'import { parkThemePick } from '@/store/theme-pick'import { requestScrollToBottom } from '@/store/thread-scroll'import { $toursEnabled } from '@/store/tours'@@ -742,14 +742,13 @@ const setupBeat: Handler = ctx => {return}- const { card } = request.paramsconst question = str(request.params.question)rememberServerRequest(request)parkSetupBeat({beat,- // SAFETY: a non-array object is the contract's `card: Record<string, unknown>`.- card: typeof card === 'object' && card !== null && !Array.isArray(card) ? (card as Record<string, unknown>) : {},+ // SAFETY: tools/setup_beat_tool.py::_card builds every card from agent/onboarding_flow.py::BEATS.+ card: (request.params.card ?? {}) as SetupBeatCard,question,requestId: request.id,sessionIddiff --git a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.ts b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.tsindex a29566f64f2..9a39af57b37 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.ts+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.ts@@ -6,6 +6,7 @@ import { noteSetupBeatResult } from '@/store/onboarding-run'import { flashPetActivity, setPetActivity } from '@/store/pet'import { recordPreviewArtifact, reofferPreviewArtifact } from '@/store/preview-status'import { $sessionStates, storedSessionIdForRuntimeId } from '@/store/session-states'+import { setupBeatResult } from '@/store/setup-beat'import { isTerminalSubagentCompletion, pruneDelegateFallbackSubagents, upsertSubagent } from '@/store/subagents'import { reportMcpToolResult } from '@/store/suggestion-providers/repair'import { invalidateSkillSuggestionIndex } from '@/store/suggestion-providers/skill'@@ -107,7 +108,7 @@ export function handleToolEvent(ctx: GatewayEventContext): boolean {}if (payload?.name === 'setup_beat' && !event.replayed) {- noteSetupBeatResult(payload.result)+ noteSetupBeatResult(setupBeatResult(payload.result))}if (isActiveEvent) {diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/beat-cards.tsx b/apps/desktop/src/components/assistant-ui/setup-beat/beat-cards.tsxindex 623d44e6e5d..9cbc3c2a746 100644--- a/apps/desktop/src/components/assistant-ui/setup-beat/beat-cards.tsx+++ b/apps/desktop/src/components/assistant-ui/setup-beat/beat-cards.tsx@@ -6,26 +6,7 @@ import { Button } from '@/components/ui/button'import { Chip } from '@/components/ui/chip'import { Input } from '@/components/ui/input'import { useI18n } from '@/i18n'--export interface BeatOption {- id: string- label: string-}--/** The `options` rows of a card payload (layout, tour, build); malformed rows are left out. */-export function beatOptions(card: Record<string, unknown>): BeatOption[] {- const rows = Array.isArray(card.options) ? card.options : []-- return rows.flatMap(row => {- if (typeof row !== 'object' || row === null) {- return []- }-- const { id, label } = row as Record<string, unknown>-- return typeof id === 'string' && typeof label === 'string' ? [{ id, label }] : []- })-}+import type { BeatOption } from '@/store/setup-beat'/** A text box for the name. The OS account's full name is offered as a row and is sent only when picked. */export function NameCard({ onName, suggested }: { onName: (name: string) => void; suggested?: string }) {diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/plugins-card.tsx b/apps/desktop/src/components/assistant-ui/setup-beat/plugins-card.tsxindex 72c8d1baab3..3a4c053a567 100644--- a/apps/desktop/src/components/assistant-ui/setup-beat/plugins-card.tsx+++ b/apps/desktop/src/components/assistant-ui/setup-beat/plugins-card.tsx@@ -15,9 +15,6 @@ import type { ConnectionOwner } from '@/store/connection-request'import { requestGatewayForAgent } from '@/store/gateway'import { openCatalogPluginInstall } from '@/store/plugin-catalog-install'-const pluginNames = (card: Record<string, unknown>): string[] =>- Array.isArray(card.plugins) ? card.plugins.filter((name): name is string => typeof name === 'string') : []-async function readPresence(owner: ConnectionOwner, names: string[]): Promise<CatalogPluginPresence[]> {const result = await requestGatewayForAgent<PluginsManageResult>(owner.connectionId, owner.profile, 'plugins.manage', {action: 'presence',@@ -37,18 +34,11 @@ async function openInstall(name: string, profile: string): Promise<void> {/** The plugins this OS runs, from the card payload; Install opens the reviewed install dialog in place,* Continue answers with the ones installed. */-export function PluginsCard({- card,- onContinue-}: {- card: Record<string, unknown>- onContinue: (installed: string[]) => void-}) {+export function PluginsCard({ names, onContinue }: { names: string[]; onContinue: (installed: string[]) => void }) {const { t } = useI18n()const copy = t.firstRunconst storedId = useStore(useSessionView().$storedId)const owner = useConnectionOwner(storedId, true)- const names = pluginNames(card)const plugins = useStore($agentPlugins)const presence = useQuery({@@ -58,9 +48,7 @@ export function PluginsCard({staleTime: Infinity})- const installed = new Set(- plugins.flatMap(row => [row.catalog_name, row.name]).filter((name): name is string => Boolean(name))- )+ const installed = new Set(plugins.flatMap(row => (row.catalog_name ? [row.catalog_name, row.name] : [row.name])))const rows = presence.data ?? []diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx b/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsxindex d1fb1475e13..5a5e3a8da4a 100644--- a/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx+++ b/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx@@ -6,8 +6,8 @@ import { WIDGET_SHELL_CLASS } from '@/components/chat/widget-shell'import { LAYOUTS_AREA } from '@/components/pane-shell/tree/presets'import { useContributions } from '@/contrib/react/use-contributions'import { useI18n } from '@/i18n'-import { connectorText, recordOf } from '@/lib/connector-tools'import { cn } from '@/lib/utils'+import type { SetupBeatAnswer, SetupBeatToolResult } from '@/store/setup-beat'import { accentName } from '@/themes/accents'export const SETUP_BEAT_SHELL_CLASS = cn(@@ -17,20 +17,17 @@ export const SETUP_BEAT_SHELL_CLASS = cn(export const SETUP_BEAT_LABEL_CLASS = 'text-[0.6875rem] leading-4 text-(--ui-text-tertiary)'-const BEATS: readonly SetupBeat[] = ['name', 'theme', 'layout', 'connectors', 'plugins', 'tour', 'build']-/** What a settled card shows: the beat's pick, or how the card closed without one. */export type SetupBeatOutcome =- | { answer: Record<string, unknown>; beat: SetupBeat; kind: 'answer' }+ | { answer: SetupBeatAnswer; beat: SetupBeat; kind: 'answer' }| { beat: SetupBeat | null; kind: 'said' | 'skipped_all' | 'timed_out' }/** The receipt a setup_beat result calls for; null for a result that showed no card (a value given in* words, a skip, `done`), which draws nothing. */-export function setupBeatOutcome(result: unknown): null | SetupBeatOutcome {- const row = resultRow(result)- const beat = BEATS.find(candidate => candidate === row.beat) ?? null+export function setupBeatOutcome(result: SetupBeatToolResult): null | SetupBeatOutcome {+ const beat = result.beat ?? null- if (row.skipped_all === true) {+ if (result.skipped_all) {return { beat, kind: 'skipped_all' }}@@ -38,55 +35,47 @@ export function setupBeatOutcome(result: unknown): null | SetupBeatOutcome {return null}- if (typeof row.answer === 'object' && row.answer !== null) {- return { answer: recordOf(row.answer), beat, kind: 'answer' }+ if (result.answer) {+ return { answer: result.answer, beat, kind: 'answer' }}- if (typeof row.said === 'string') {+ if (result.said !== undefined) {return { beat, kind: 'said' }}- return row.timed_out === true ? { beat, kind: 'timed_out' } : null+ return result.timed_out ? { beat, kind: 'timed_out' } : null}-const resultRow = (result: unknown) => recordOf(typeof result === 'string' ? parseJson(result) : result)--/** A refused call (`{error}`): shown as the plain tool row so the failure stays readable. */-export const setupBeatFailed = (result: unknown): boolean => typeof resultRow(result).error === 'string'--function parseJson(text: string): unknown {- try {- return JSON.parse(text)- } catch {- return null- }+interface AnswerNames {+ layout: (id: string) => string+ none: string+ themeAccent: string}-const listOf = (value: unknown): string[] =>- Array.isArray(value) ? value.filter((item): item is string => typeof item === 'string') : []+function answerText(beat: SetupBeat, answer: SetupBeatAnswer, names: AnswerNames): string {+ switch (beat) {+ case 'theme':+ return answer.accent ? accentName(answer.accent) : names.themeAccent-function answerText(beat: SetupBeat, answer: Record<string, unknown>, names: AnswerNames): string {- if (beat === 'theme') {- return answer.accent === null ? names.themeAccent : accentName(connectorText(answer.accent) ?? '')- }+ case 'layout':+ return names.layout(answer.layout ?? '')- if (beat === 'layout') {- return names.layout(connectorText(answer.layout) ?? '')- }+ case 'connectors':+ case 'plugins': {+ const picked = (beat === 'connectors' ? answer.connected : answer.installed) ?? []- if (beat === 'connectors' || beat === 'plugins') {- const picked = listOf(beat === 'connectors' ? answer.connected : answer.installed)+ return picked.length > 0 ? picked.join(', ') : names.none+ }- return picked.length > 0 ? picked.join(', ') : names.none- }+ case 'name':+ return answer.name ?? ''- return connectorText(answer.label) ?? connectorText(answer[beat]) ?? ''-}+ case 'tour':+ return answer.label ?? answer.tour ?? ''-interface AnswerNames {- layout: (id: string) => string- none: string- themeAccent: string+ case 'build':+ return answer.label ?? answer.build ?? ''+ }}/** One line where the choice happened: the beat, then what was picked or how the card closed. */diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/setup-beat-tool.tsx b/apps/desktop/src/components/assistant-ui/setup-beat/setup-beat-tool.tsxindex 2067d16ac95..bcd196fded9 100644--- a/apps/desktop/src/components/assistant-ui/setup-beat/setup-beat-tool.tsx+++ b/apps/desktop/src/components/assistant-ui/setup-beat/setup-beat-tool.tsx@@ -11,23 +11,28 @@ import { AccentPickerCard } from '@/components/assistant-ui/theme-picker/accent-import { LayoutPickerCard } from '@/components/assistant-ui/theme-picker/layout-picker-card'import { cn } from '@/lib/utils'import { applyAppearance } from '@/store/appearance-apply'-import { $setupBeatRequests, answerSetupBeat, type SetupBeatRequest } from '@/store/setup-beat'+import {+ $setupBeatRequests,+ answerSetupBeat,+ type SetupBeatAnswer,+ type SetupBeatRequest,+ setupBeatResult+} from '@/store/setup-beat'import { ToolFallback } from '../tool/fallback'-import { beatOptions, NameCard, OptionsCard } from './beat-cards'+import { NameCard, OptionsCard } from './beat-cards'import { PluginsCard } from './plugins-card'import {SETUP_BEAT_LABEL_CLASS,SETUP_BEAT_SHELL_CLASS,- setupBeatFailed,type SetupBeatOutcome,setupBeatOutcome,SetupBeatReceipt} from './receipt'/** The card body for one beat; `answer` sends the beat's picks and settles the card. */-function BeatBody({ answer, request }: { answer: (picks: Record<string, unknown>) => void; request: SetupBeatRequest }) {+function BeatBody({ answer, request }: { answer: (picks: SetupBeatAnswer) => void; request: SetupBeatRequest }) {const { card } = requestswitch (request.beat) {@@ -35,7 +40,7 @@ function BeatBody({ answer, request }: { answer: (picks: Record<string, unknown>return (<NameCardonName={name => answer({ name })}- suggested={typeof card.suggested === 'string' ? card.suggested : undefined}+ suggested={Array.isArray(card.suggested) ? undefined : card.suggested}/>)@@ -62,7 +67,7 @@ function BeatBody({ answer, request }: { answer: (picks: Record<string, unknown>)case 'plugins':- return <PluginsCard card={card} onContinue={installed => answer({ installed })} />+ return <PluginsCard names={card.plugins ?? []} onContinue={installed => answer({ installed })} />case 'tour':@@ -79,10 +84,6 @@ function BeatBody({ answer, request }: { answer: (picks: Record<string, unknown>}}-function suggestedSlugs(card: Record<string, unknown>): string[] {- return Array.isArray(card.suggested) ? card.suggested.filter((slug): slug is string => typeof slug === 'string') : []-}-function BeatShell({ beat, children, question }: { beat: SetupBeat; children: ReactNode; question: string }) {return (<div className={cn(SETUP_BEAT_SHELL_CLASS, 'grid gap-3')} data-setup-beat={beat}>@@ -100,11 +101,13 @@ export function SetupBeatTool(props: ToolCallMessagePartProps) {const [settled, setSettled] = useState<null | SetupBeatOutcome>(null)if (props.result !== undefined) {- if (setupBeatFailed(props.result)) {+ const result = setupBeatResult(props.result)++ if (result.error !== undefined) {return <ToolFallback {...props} />}- const outcome = setupBeatOutcome(props.result)+ const outcome = setupBeatOutcome(result)return outcome ? <SetupBeatReceipt outcome={outcome} /> : null}@@ -120,7 +123,7 @@ export function SetupBeatTool(props: ToolCallMessagePartProps) {return null}- const answer = (picks: Record<string, unknown>) => {+ const answer = (picks: SetupBeatAnswer) => {if (answerSetupBeat(sessionId, picks)) {setSettled({ answer: picks, beat: request.beat, kind: 'answer' })}@@ -132,7 +135,7 @@ export function SetupBeatTool(props: ToolCallMessagePartProps) {{request.question && <span className={cn(SETUP_BEAT_LABEL_CLASS, 'px-3.5')}>{request.question}</span>}<ConnectorDirectoryCardonContinue={({ connected, newly_connected }) => answer({ connected, newly_connected })}- suggested={suggestedSlugs(request.card)}+ suggested={Array.isArray(request.card.suggested) ? request.card.suggested : []}/></div>)diff --git a/apps/desktop/src/store/onboarding-run.test.ts b/apps/desktop/src/store/onboarding-run.test.tsindex f243eff4fe7..ef49452dad0 100644--- a/apps/desktop/src/store/onboarding-run.test.ts+++ b/apps/desktop/src/store/onboarding-run.test.ts@@ -1,28 +1,28 @@import { beforeEach, describe, expect, it, vi } from 'vitest'-vi.mock('./profile', () => ({ ensureGatewayProfile: vi.fn(async () => undefined) }))-import { $onboardingPhase } from './onboarding-phase'import { $onboardingDecided, $onboardingSurfaceClear } from './onboarding-presence'import { $onboardingEnded, decideOnboarding, noteSetupBeatResult, startOnboarding } from './onboarding-run'import { $connection } from './session'-const STARTED = { resumed: false, session_id: 'rt-1', stored_session_id: 'st-1' }+const ensureProfile = async (): Promise<void> => undefinedfunction backend(state: { eligible: boolean; run: boolean }) {const calls: string[] = []+ const started = { resumed: false, session_id: 'rt-1', stored_session_id: 'st-1' }- const request = async <T>(method: string): Promise<T> => {+ const request = async <T,>(method: string): Promise<T> => {calls.push(method)- // SAFETY: the fake answers each method with its contract's result shape.- return (method === 'onboarding.state' ? state : STARTED) as T+ // SAFETY: the fake answers onboarding.state and onboarding.start with their contract result shapes.+ return (method === 'onboarding.state' ? state : started) as T}return { calls, request }}beforeEach(() => {+ // SAFETY: factsSource reads only `mode`; a local connection skips the machine comparison.$connection.set({ mode: 'local' } as never)$onboardingPhase.set('idle')$onboardingEnded.set(null)@@ -35,7 +35,7 @@ describe('onboarding run', () => {const { calls, request } = backend({ eligible: true, run: true })const resume = vi.fn(async () => undefined)- await decideOnboarding(request, resume)+ await decideOnboarding(request, resume, { ensureProfile })stop()expect(calls).toEqual(['onboarding.state', 'onboarding.start'])@@ -47,8 +47,8 @@ describe('onboarding run', () => {it('ends once on the model finishing, and frees the first-run surfaces', async () => {const { request } = backend({ eligible: true, run: true })- await startOnboarding(request, vi.fn(async () => undefined))- noteSetupBeatResult(JSON.stringify({ completed: true }))+ await startOnboarding(request, vi.fn(async () => undefined), { ensureProfile })+ noteSetupBeatResult({ completed: true })noteSetupBeatResult({ skipped_all: true })expect($onboardingPhase.get()).toBe('done')diff --git a/apps/desktop/src/store/onboarding-run.ts b/apps/desktop/src/store/onboarding-run.tsindex 508777d4314..728b4d477dc 100644--- a/apps/desktop/src/store/onboarding-run.ts+++ b/apps/desktop/src/store/onboarding-run.ts@@ -11,13 +11,15 @@ import type { MachineFactsResult, OnboardingRunStateResult, OnboardingStartResulimport { atom } from 'nanostores'import { getRuntimeI18nLocale } from '@/i18n/runtime'+import type { GatewayRequester } from '@/lib/yolo-session'import { $onboardingPhase } from './onboarding-phase'import { markOnboardingDecided, setOnboardingSurfaceActive } from './onboarding-presence'import { ensureGatewayProfile } from './profile'import { $connection } from './session'+import type { SetupBeatToolResult } from './setup-beat'-export type OnboardingRequest = <T>(method: string, params?: Record<string, unknown>) => Promise<T>+export type OnboardingRequest = GatewayRequester/** Opens a stored session on screen, replacing the route (`useSessionActions().resumeSession`). */export type OnboardingResume = (storedId: string, replaceRoute?: boolean) => Promise<void>@@ -60,17 +62,23 @@ async function factsSource(request: OnboardingRequest): Promise<'local' | 'remotreturn same ? 'local' : 'remote'}+interface StartOptions {+ /** Points the window's gateway at the profile onboarding runs in (`store/profile.ts::ensureGatewayProfile`). */+ ensureProfile?: (profile: string) => Promise<void>+ rerun?: boolean+}+/** Open the onboarding chat (a new one for a rerun, else the run in progress or a new one). */export async function startOnboarding(request: OnboardingRequest,resume: OnboardingResume,- { rerun = false }: { rerun?: boolean } = {}+ { ensureProfile = ensureGatewayProfile, rerun = false }: StartOptions = {}): Promise<boolean> {$onboardingPhase.set('shown')$onboardingEnded.set(null)try {- await ensureGatewayProfile(ONBOARDING_PROFILE)+ await ensureProfile(ONBOARDING_PROFILE)const started = await request<OnboardingStartResult>('onboarding.start', {facts_source: await factsSource(request),@@ -98,19 +106,23 @@ let decision: null | Promise<void> = null* this install and the free tier can drive it. First-run surfaces wait until this has answered; the* presence surface is set before the answer is published, so they never see a clear moment in between.*/-export function decideOnboarding(request: OnboardingRequest, resume: OnboardingResume): Promise<void> {- decision ??= readAndStart(request, resume)+export function decideOnboarding(+ request: OnboardingRequest,+ resume: OnboardingResume,+ options?: StartOptions+): Promise<void> {+ decision ??= readAndStart(request, resume, options)return decision}-async function readAndStart(request: OnboardingRequest, resume: OnboardingResume): Promise<void> {+async function readAndStart(request: OnboardingRequest, resume: OnboardingResume, options?: StartOptions): Promise<void> {try {const state = await request<OnboardingRunStateResult>('onboarding.state')if (state.run && state.eligible) {- await startOnboarding(request, resume)+ await startOnboarding(request, resume, options)}} catch (error) {console.warn('[onboarding] state could not be read', error)@@ -142,24 +154,10 @@ export async function skipOnboarding(request: OnboardingRequest, runtimeId: stri}/** A `setup_beat` result that ends the run: `completed` (the model said done) or `skipped_all`. */-export function noteSetupBeatResult(result: unknown): void {- const value = typeof result === 'string' ? parseJson(result) : result-- if (typeof value !== 'object' || value === null) {- return- }-- if ('completed' in value && value.completed === true) {+export function noteSetupBeatResult(result: SetupBeatToolResult): void {+ if (result.completed) {endOnboarding('done')- } else if ('skipped_all' in value && value.skipped_all === true) {+ } else if (result.skipped_all) {endOnboarding('skipped')}}--function parseJson(text: string): unknown {- try {- return JSON.parse(text)- } catch {- return null- }-}diff --git a/apps/desktop/src/store/setup-beat.ts b/apps/desktop/src/store/setup-beat.tsindex 9a5f09358fa..25f8d90928b 100644--- a/apps/desktop/src/store/setup-beat.ts+++ b/apps/desktop/src/store/setup-beat.ts@@ -7,16 +7,61 @@* id, so a late cancel never erases a newer card the same session raised.*/+import type { ToolCallMessagePart } from '@assistant-ui/react'import type { SetupBeat } from '@hermes/shared'import { atom } from 'nanostores'+import { recordOf } from '@/lib/connector-tools'+import { registerParkedCardAnswer } from './parked-card-answers'import { respondToServerRequest } from './server-requests'+export interface BeatOption {+ id: string+ label: string+}++/** A beat's card data (`agent/onboarding_flow.py::BEATS`, `tools/setup_beat_tool.py::_card`): name `{suggested?}`+ * (the account's full name), layout/tour/build `{options}`, connectors `{suggested}` (slugs), plugins `{plugins}`. */+export interface SetupBeatCard {+ options?: BeatOption[]+ plugins?: string[]+ suggested?: string | string[]+}++/** The picks a card answers with, per beat (`SetupBeatResult.answer`). Tour and build add the option's label. */+export interface SetupBeatAnswer {+ accent?: null | string+ build?: string+ connected?: string[]+ installed?: string[]+ label?: string+ layout?: string+ name?: string+ newly_connected?: string[]+ tour?: string+}++/** What `tools/setup_beat_tool.py` returns to the model, as the transcript's tool row carries it. */+export interface SetupBeatToolResult {+ answer?: SetupBeatAnswer+ beat?: SetupBeat+ completed?: boolean+ error?: string+ said?: string+ skipped_all?: boolean+ timed_out?: boolean+}++/** A setup_beat tool row's result: the object a live row carries, or the JSON text of a reloaded one. */+export function setupBeatResult(result: ToolCallMessagePart['result']): SetupBeatToolResult {+ // SAFETY: tools/setup_beat_tool.py::_result builds every result from an agent/onboarding_flow.py step.+ return recordOf(result) as SetupBeatToolResult+}+export interface SetupBeatRequest {beat: SetupBeat- /** The beat's data from `agent/onboarding_flow.py::BEATS` (options, suggested slugs, plugin names). */- card: Record<string, unknown>+ card: SetupBeatCardquestion: stringrequestId: stringsessionId: string@@ -41,7 +86,7 @@ export function clearSetupBeat(requestId: string, sessionId: string): boolean {return true}-function respond(sessionId: string, result: { answer: Record<string, unknown> } | { said: string }): boolean {+function respond(sessionId: string, result: { answer: SetupBeatAnswer } | { said: string }): boolean {const request = $setupBeatRequests.get()[sessionId]if (!request) {@@ -50,11 +95,11 @@ function respond(sessionId: string, result: { answer: Record<string, unknown> }clearSetupBeat(request.requestId, sessionId)- return respondToServerRequest(request.requestId, result)+ return respondToServerRequest(request.requestId, { ...result })}/** Answer the session's card with the beat's picks. False when no card waits. */-export function answerSetupBeat(sessionId: string, answer: Record<string, unknown>): boolean {+export function answerSetupBeat(sessionId: string, answer: SetupBeatAnswer): boolean {return respond(sessionId, { answer })}