Skip to content

th-9a5794: render stream_preamble ephemeral pre-answer sentence#35

Merged
brentrager merged 2 commits into
mainfrom
th-9a5794-preamble
Jul 15, 2026
Merged

th-9a5794: render stream_preamble ephemeral pre-answer sentence#35
brentrager merged 2 commits into
mainfrom
th-9a5794-preamble

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

What

Renders the new stream_preamble frame from the operator. When the server streams a fast-model preamble ("what I'm about to do") ahead of the answer — covering the reasoning model's time-to-first-token — the widget shows it in the assistant bubble's typing slot (muted + italic, in place of the bare dots), then swaps in the real answer the instant it starts streaming. A late preamble frame (after the answer began) is ignored, matching the server guard.

⛔ Blocked on

@smooai/smooth-operator 1.22.15 (smooth-operator PR #234), which adds stream_preamble to the SDK event union. Until it publishes, the SDK client (client.js isServerEvent gate) drops the frame as unknown, and pnpm install can't resolve the bumped dep. On publish: pnpm install to refresh the lockfile → CI green → mark ready.

Verified

172/172 widget tests pass against a locally-built 1.22.15 SDK, including 2 new tests (preamble shown then replaced by the answer; late preamble ignored). Typecheck clean. The event.type === 'stream_preamble' check is written version-independently (small cast) so it compiles against the current pinned SDK too.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WEUZgsyfGVab8uqSFPbr23

When the operator streams a fast-model preamble ahead of the answer (covering
the reasoning model's time-to-first-token), show it in the assistant bubble's
typing slot — muted + italic, in place of the bare typing dots — then swap in the
real answer the instant it starts streaming. A late preamble frame (arriving
after the answer began) is ignored, matching the server-side guard.

Requires @smooai/smooth-operator >= 1.22.15 (adds stream_preamble to the event
union so the SDK client forwards the frame instead of dropping it as unknown).

Verified: 172/172 widget tests pass against a 1.22.15 SDK, including 2 new tests
(preamble shown then replaced by the answer; late preamble ignored). typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WEUZgsyfGVab8uqSFPbr23
@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b4372ec

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/chat-widget Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager brentrager marked this pull request as ready for review July 15, 2026 21:44
@brentrager brentrager merged commit c492c54 into main Jul 15, 2026
1 check passed
@brentrager brentrager deleted the th-9a5794-preamble branch July 15, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant