Skip to content

feat(platform): serve Chat from a JS host as an optional capability - #400

Open
filvecchiato wants to merge 6 commits into
mainfrom
feat/chat-platform-js-host
Open

feat(platform): serve Chat from a JS host as an optional capability#400
filvecchiato wants to merge 6 commits into
mainfrom
feat/chat-platform-js-host

Conversation

@filvecchiato

Copy link
Copy Markdown
Collaborator

Closes #383.

  • New OptionalPlatform super-trait in truapi-platform lists capabilities a host may omit. Codegen reads it and emits chat?: ChatPlatform on HostCallbacks, optional RawCallbacks members, and get_optional_function bindings — so omitting chat keeps chat_platform: None and the existing Unsupported answer.
  • The worker init message now carries which optional capabilities the main-thread host serves, so the core sees the same set either side of the boundary.
  • ChatPlatform methods renamed to create_chat_room / post_chat_message / subscribe_chat_rooms: the callback namespace is flat, and postMessage was ambiguous. subscribe_chat_rooms now yields a Result like every other platform stream.

@filvecchiato
filvecchiato requested a review from a team August 14, 2026 13:17
Comment thread js/packages/truapi-host/README.md
Comment thread rust/crates/truapi-server/src/runtime.rs Outdated
Comment thread rust/crates/truapi-server/src/wasm.rs Outdated
Comment thread rust/crates/truapi-platform/src/lib.rs Outdated
Comment thread js/packages/truapi-host/src/web/worker-provider.test.ts
Comment thread rust/crates/truapi-codegen/src/ts/host_callbacks.rs Outdated
Also applies review fixes: CSP-safe stubs, logged stream errors, JSDoc in
codegen, worker-gate tests, outbound-only chat note.
@filvecchiato
filvecchiato requested a review from Imod7 August 16, 2026 16:06
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.

A JS host cannot serve chat: executionKind: "Chat" is accepted, but every chat call returns Unsupported

2 participants