Skip to content

file transfer (dotnet): parse images/files, wire directive sink to Rust parity - #348

Merged
brentrager merged 1 commit into
mainfrom
ft-dotnet
Aug 11, 2026
Merged

file transfer (dotnet): parse images/files, wire directive sink to Rust parity#348
brentrager merged 1 commit into
mainfrom
ft-dotnet

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

The .NET (C#) smooth-operator server handled send_message as text only — no multimodal images, no file attachments, and no host-directive channel. The file-transfer contract merged to main in #342 (send_message.files[] + the send_file directive convention on eventual_response.directive); Rust already implements it. This brings the .NET server to parity.

Solution

  • Regenerate Types.cs from the updated spec via tools/Generator (adds SendMessageRequest.Files, and picks up Skill). Generated output, not hand-edited.
  • images[] — parsed fail-soft in FrameDispatcher, attached as OpenAI image_url content parts. The engine (a fixed published NuGet) builds the live user turn from a string, so it can carry no content parts; instead the images ride an image-only ChatMessage seated on the thread immediately before the text turn — the model sees them adjacent to the question, with no empty or duplicated message. data:DataContent, http(s)UriContent; the optional vision detail hint rides on AdditionalProperties. Malformed/unsupported entries are dropped.
  • files[] — parsed fail-soft and surfaced on a new per-turn TurnContext (files list + directive sink), published as an AsyncLocal around the run so a host tool the engine invokes can read them. Never sent to the model.
  • send_file directive — a host tool writes an opaque directive onto TurnContext.Current.Directive; the runner drains it after the turn onto eventual_response.directive (last-write-wins, omitted when none for back-compat). ProtocolEvents.EventualResponse grew an optional directive param.

Backward compatible: absent images/files and no host directive is byte-for-byte the previous text-only behavior.

Verification

  • dotnet build + dotnet test on the full solution in Release: all green (302 server tests incl. 8 new, plus integration/host/client/postgres projects).
  • New FileTransferTests (8): images attach as content parts (UriContent+DataContent, detail on AdditionalProperties, live text turn preserved, no empty message), malformed images fail-soft, files surfaced on TurnContext and kept off the model, tool→directive→eventual_response.directive (spec-validated), and directive omission for back-compat.

Notes

  • Publish gate: source-only. The .NET server consumes the engine as the published SmooAI.SmoothOperator.Core NuGet; this PR does not publish anything.
  • Changeset added (minor on @smooai/smooth-operator-server).

🤖 Generated with Claude Code

…st parity

Bring the C# smooth-operator server to Rust parity on the PR #342 file-transfer
contract. send_message was text-only; it now handles images[], files[], and the
send_file directive.

- Regenerate Types.cs from the updated spec (adds SendMessageRequest.Files, Skill).
- images[]: parsed fail-soft, attached as OpenAI image_url content parts. The
  engine builds the live user turn from a string, so images ride an image-only
  ChatMessage seated on the thread just before the text turn (no empty/duplicate
  message). data: -> DataContent, http(s) -> UriContent; detail on
  AdditionalProperties. Malformed/unsupported entries dropped.
- files[]: parsed fail-soft, surfaced on a new per-turn TurnContext (AsyncLocal)
  so host tools can read them; never sent to the model.
- Directive sink: a host tool writes onto TurnContext.Current.Directive; drained
  after the turn onto eventual_response.directive (last-write-wins, omitted when
  none for back-compat).
- Tests: FileTransferTests covers images-attach, malformed fail-soft, files-on-
  context, tool->directive->eventual_response, and directive omission.

Source-only; the engine stays the published NuGet (no publish).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b5438a7

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

This PR includes changesets to release 1 package
Name Type
@smooai/smooth-operator-server 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 merged commit 2d5dc0e into main Aug 11, 2026
1 check passed
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