The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(onboarding): a name typed in the composer shows as the user's bubble
alt-glitch8ee227e68792
diff --git a/agent/onboarding_flow.py b/agent/onboarding_flow.pyindex d6d3a875a89..689e99ce41f 100644--- a/agent/onboarding_flow.py+++ b/agent/onboarding_flow.py@@ -65,8 +65,12 @@ class Shown:@dataclass(frozen=True)class Answered:+ """``said``: the answer came as words in the composer (the name card), so the chat shows them as+ the user's bubble."""+beat: stranswer: Mapping[str, Any]+ said: str = ""# ``present`` on the events below: the beat's picks as this machine has them now (the apps connected,@@ -279,7 +283,8 @@ def _answered(record: dict, event: Answered, facts: Facts, now: float) -> Step:return Step(record, {"beat": event.beat, "error": "The card sent an answer this beat does not accept. "f'Bring it back with setup_beat(beat="{event.beat}").'})_settle(record, event.beat, event.answer)- return Step(record, {"beat": event.beat, "answer": dict(event.answer), "next": _next_field(record)},+ said = {"said": event.said} if event.said else {}+ return Step(record, {"beat": event.beat, "answer": dict(event.answer), **said, "next": _next_field(record)},BEAT_BY_ID[event.beat].after(record["picks"]))diff --git a/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx b/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsxindex b376329f937..fc938840921 100644--- a/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx+++ b/apps/desktop/src/components/assistant-ui/setup-beat/receipt.tsx@@ -42,14 +42,15 @@ export function setupBeatOutcome(result: SetupBeatToolResult): null | SetupBeatOreturn { beat, kind: 'refused' }}- if (result.answer) {- return { answer: result.answer, beat, kind: 'answer' }- }-+ // Words typed in the composer show as the user's bubble, also when they answered the card (the name).if (result.said?.trim()) {return { beat, kind: 'said', said: result.said.trim() }}+ if (result.answer) {+ return { answer: result.answer, beat, kind: 'answer' }+ }+return result.timed_out ? { beat, kind: 'timed_out' } : null}diff --git a/apps/desktop/src/store/setup-beat.test.ts b/apps/desktop/src/store/setup-beat.test.tsindex de6336a19e3..e27a7093b3e 100644--- a/apps/desktop/src/store/setup-beat.test.ts+++ b/apps/desktop/src/store/setup-beat.test.ts@@ -83,6 +83,7 @@ describe('setup_beat card', () => {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' })+ expect(setupBeatOutcome({ answer: { name: 'Ada' }, beat: 'name', said: 'Ada' })).toMatchObject({ kind: 'said' })expect(setupBeatOutcome({ beat: 'layout', timed_out: true })).toMatchObject({ kind: 'timed_out' })expect(setupBeatOutcome({ skipped_all: true })).toMatchObject({ kind: 'skipped_all' })expect(setupBeatOutcome({ beat: 'build', error: 'not accepted' })).toMatchObject({ kind: 'refused' })diff --git a/tests/tools/test_setup_beat_tool.py b/tests/tools/test_setup_beat_tool.pyindex ff51f2968b4..deabcc05dcd 100644--- a/tests/tools/test_setup_beat_tool.py+++ b/tests/tools/test_setup_beat_tool.py@@ -77,6 +77,7 @@ def test_next_shows_the_first_open_beat_and_the_name_card_offers_the_account_namassert desktop.shown[0]["beat"] == "name" and desktop.shown[0]["card"] == {"suggested": "Ada Lovelace"}# Words typed while the name card waits are the name; the account name reaches the model only if picked.assert result["answer"] == {"name": "Ada"} and "Ada Lovelace" not in json.dumps(result)+ assert result["said"] == "Ada" # drawn as the user's bubble, not a receiptdef test_no_answer_closes_the_card_and_typed_words_come_back_as_said(db, desktop):diff --git a/tools/setup_beat_tool.py b/tools/setup_beat_tool.pyindex 963e81952e3..f7d9d2b2144 100644--- a/tools/setup_beat_tool.py+++ b/tools/setup_beat_tool.py@@ -66,7 +66,7 @@ def _reply_event(beat: str, reply: Mapping[str, Any] | None) -> flow.Event:said = reply.get("said")if isinstance(said, str) and said.strip():# Words typed while the name card waits are the name, like its own text box.- return (flow.Answered(beat, {"name": said.strip()}) if beat == "name"+ return (flow.Answered(beat, {"name": said.strip()}, said.strip()) if beat == "name"else flow.Said(beat, said.strip(), _present(beat)))answer = reply.get("answer")return flow.Answered(beat, answer) if isinstance(answer, dict) and answer else flow.TimedOut(beat, _present(beat))