The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): setup cards answer in the shared per-beat contract
alt-glitch6545e3bcd54c
diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx b/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsxindex 014d517c1fd..51ab4579c68 100644--- a/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx+++ b/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx@@ -10,7 +10,7 @@ import { useContributions } from '@/contrib/react/use-contributions'import { useI18n } from '@/i18n'import { connectorTitle } from '@/lib/connector-tools'import { cn } from '@/lib/utils'-import type { SetupBeatAnswer, SetupBeatToolResult } from '@/store/setup-beat'+import type { SetupBeatAnswerFields, SetupBeatToolResult } from '@/store/setup-beat'import { accentName } from '@/themes/accents'export const SETUP_BEAT_SHELL_CLASS = cn(@@ -20,7 +20,7 @@ export const SETUP_BEAT_SHELL_CLASS = cn(/** What a settled card shows: the beat's pick, or how the card closed without one. */export type SetupBeatOutcome =- | { answer: SetupBeatAnswer; beat: SetupBeat; kind: 'answer' }+ | { answer: SetupBeatAnswerFields; beat: SetupBeat; kind: 'answer' }| { beat: SetupBeat; kind: 'said'; said: string }| { beat: SetupBeat | null; kind: 'refused' | 'skipped_all' | 'timed_out' }@@ -59,7 +59,7 @@ interface AnswerNames {layout: (id: string) => stringnone: stringthemeAccent: string- tour: (answer: SetupBeatAnswer) => string+ tour: (answer: SetupBeatAnswerFields) => string}/** The tour card's label for an option id, in the app's language. */@@ -69,7 +69,7 @@ export function useTourLabel(): (id: string) => string | undefined {return id => Object.entries(t.firstRun.tours).find(([key]) => key === id)?.[1]}-function answerText(beat: SetupBeat, answer: SetupBeatAnswer, names: AnswerNames): string {+function answerText(beat: SetupBeat, answer: SetupBeatAnswerFields, names: AnswerNames): string {switch (beat) {case 'theme':return answer.accent ? accentName(answer.accent) : names.themeAccentdiff --git a/apps/desktop/src/store/setup-beat.test.ts b/apps/desktop/src/store/setup-beat.test.tsindex 3c51c414f17..dd5e135a43d 100644--- a/apps/desktop/src/store/setup-beat.test.ts+++ b/apps/desktop/src/store/setup-beat.test.ts@@ -101,6 +101,17 @@ describe('setup_beat card', () => {expect($setupBeatRequests.get()['rt-1']?.requestId).toBe('srq-4')})+ it('answers in the shared per-beat contract, never with a label alone', () => {+ const respond = parkCard('srq-5', true, 'layout')++ expect(answerSetupBeat('rt-1', { layout: 'sidebar-right' })).toBe(true)+ expect(respond).toHaveBeenCalledWith({ answer: { layout: 'sidebar-right' } })++ parkCard('srq-6')+ // @ts-expect-error every answer carries its beat's pick; the label is only what the card showed+ answerSetupBeat('rt-1', { label: 'Elite' })+ })+it('collapses every way a card can close to a receipt, and draws nothing for a card-less call', () => {expect(setupBeatOutcome({ answer: { name: 'Sid' }, beat: 'name' })).toMatchObject({ kind: 'answer' })expect(setupBeatOutcome({ beat: 'theme', said: 'make it violet' })).toMatchObject({ kind: 'said' })diff --git a/apps/desktop/src/store/setup-beat.ts b/apps/desktop/src/store/setup-beat.tsindex 5d725f29eae..ee82ca02227 100644--- a/apps/desktop/src/store/setup-beat.ts+++ b/apps/desktop/src/store/setup-beat.ts@@ -11,7 +11,17 @@*/import type { ToolCallMessagePart } from '@assistant-ui/react'-import type { SetupBeat } from '@hermes/shared'+import type {+ SetupBeat,+ SetupBeatResult,+ SetupBuildAnswer,+ SetupConnectorsAnswer,+ SetupLayoutAnswer,+ SetupNameAnswer,+ SetupPluginsAnswer,+ SetupThemeAnswer,+ SetupTourAnswer+} from '@hermes/shared'import { atom } from 'nanostores'import { recordOf } from '@/lib/connector-tools'@@ -32,22 +42,24 @@ export interface SetupBeatCard {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-}+/** The picks a card answers with: one of the shared per-beat answers (`SetupBeatResult.answer`). */+export type SetupBeatAnswer = NonNullable<SetupBeatResult['answer']>++/** An answer the receipt reads by field, whichever beat it came from. Built from the shared answers, so a+ * field the contract adds or renames reaches the receipt. */+export type SetupBeatAnswerFields = Partial<+ SetupBuildAnswer &+ SetupConnectorsAnswer &+ SetupLayoutAnswer &+ SetupNameAnswer &+ SetupPluginsAnswer &+ SetupThemeAnswer &+ SetupTourAnswer+>/** What `tools/setup_beat_tool.py` returns to the model, as the transcript's tool row carries it. */export interface SetupBeatToolResult {- answer?: SetupBeatAnswer+ answer?: SetupBeatAnswerFieldsbeat?: SetupBeatcompleted?: booleanerror?: string