Skip to content

feat(realtime): add unified set()#77

Merged
AdirAmsalem merged 7 commits intomainfrom
feat/set-sdk-only
Feb 9, 2026
Merged

feat(realtime): add unified set()#77
AdirAmsalem merged 7 commits intomainfrom
feat/set-sdk-only

Conversation

@AdirAmsalem
Copy link
Contributor

@AdirAmsalem AdirAmsalem commented Feb 8, 2026

Summary

Alternative to PR #76. Adds the same set() SDK method but without introducing a new wire protocol type.

  • set() sends type: "set_image" on the wire (same as setImage())
  • Server sees set_image for both calls — no server changes needed
  • No set_input / set_input_ack wire types introduced

Usage

// set() replaces the full state — prompt + image atomically in a single message
await realtimeClient.set({
  prompt: "A person wearing a superhero costume",
  enhance: true,
  image: "https://example.com/superhero-reference.png",
});

Tradeoffs vs #76

This PR (SDK-only) PR #76 (new wire type)
Wire type set_image (reused) set_input (new)
Backend changes None Yes
Server observability Can't distinguish set() vs setImage() Can distinguish
Deploy coordination SDK only SDK + API
Future flexibility Locked to set_image behavior Can diverge later

Tests

70/70 passing


Note

Medium Risk
Adds a new realtime client API that changes how prompt/image updates are sent and introduces URL fetching/base64 conversion behavior, which can affect runtime behavior and timeouts but does not change the wire protocol.

Overview
Adds a unified realtimeClient.set() method that atomically updates prompt and/or reference image via the existing set_image pathway (with input validation and a longer update timeout), and exposes the new SetInput type from the SDK entrypoint.

Refactors image handling to a shared imageToBase64 helper (supporting File/Blob, raw base64, data: URLs, and http(s) URLs via fetch) and updates the lucy-2 realtime example plus new unit tests covering set() validation and call behavior.

Written by Cursor Bugbot for commit efca18d. This will update automatically on new commits. Configure here.

…re type

set() builds and sends set_image messages on the wire, reusing existing
server handling. No new wire protocol types needed — set_input/set_input_ack
are not introduced. The server sees set_image for both setImage() and set() calls.
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 8, 2026

Open in StackBlitz

npm i https://pkg.pr.new/DecartAI/sdk/@decartai/sdk@77

commit: efca18d

@AdirAmsalem AdirAmsalem changed the title feat(realtime): add unified set() — SDK-only, no new wire type feat(realtime): add unified set() Feb 8, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Copy link
Contributor

@tomershlasky tomershlasky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pretty like it actually, looks much more clean and maintainable (and the other pros you mentioned)

@AdirAmsalem AdirAmsalem merged commit 915d493 into main Feb 9, 2026
5 checks passed
@AdirAmsalem AdirAmsalem deleted the feat/set-sdk-only branch February 9, 2026 07:29
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.

2 participants