Skip to content

feat: Support Conversation API Alpha2#803

Draft
Copilot wants to merge 7 commits intomainfrom
copilot/review-dapr-building-blocks-implementation
Draft

feat: Support Conversation API Alpha2#803
Copilot wants to merge 7 commits intomainfrom
copilot/review-dapr-building-blocks-implementation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

Description

Adds first-class support for the Dapr Conversation API (Alpha2) to the JS SDK, including user-facing types, a client interface, both gRPC and HTTP implementations, comprehensive unit tests, and Testcontainers integration tests.

Changes Made

  • Types (src/types/conversation/Conversation.type.ts): Added user-facing TypeScript types for the Alpha2 Conversation API, including message roles (developer, system, user, assistant, tool), tool definitions, tool calls, and response types.
  • ConversationOptions: Optional parameters for converse() including contextId, metadata, scrubPii, temperature, tools, toolChoice, promptCacheRetention, and responseFormat.
  • Client interface (src/interfaces/Client/IClientConversation.ts): Defines converse(conversationComponentName, inputs, options?) with inputs as a required parameter and conversationComponentName as the first positional parameter for clarity.
  • gRPC implementation (src/implementation/Client/GRPCClient/conversation.ts): Maps user-facing types to proto schemas via ConnectRPC bindings and calls converseAlpha2.
  • HTTP implementation (src/implementation/Client/HTTPClient/conversation.ts): Maps to the v1.0-alpha2/conversation/{name}/converse REST endpoint, including promptCacheRetention and responseFormat in the request body.
  • DaprClient integration (src/implementation/Client/DaprClient.ts): Exposes client.conversation.converse() for both gRPC and HTTP transports.
  • Exports (src/index.ts): All new conversation types and interfaces are exported from the package index.
  • Unit tests (test/unit/protocols/http/conversation.test.ts): 37 tests for HTTPClientConversation covering all message roles, optional parameters, request body building, response mapping, tool calls, edge cases, and error propagation.
  • Unit tests (test/unit/protocols/grpc/conversation.test.ts): 31 tests for GRPCClientConversation covering all message roles, proto message building, tool building, response mapping, and edge cases.
  • Integration tests (test/e2e/common/conversation.test.ts): 14 Testcontainers-based integration tests (7 HTTP + 7 gRPC) exercising the conversation API against a real Dapr 1.16 sidecar with the conversation.echo component. Tests cover simple user messages, system messages, metadata passing, temperature option, multiple inputs, multiple content items, and error handling for non-existent components.
  • Test helper (test/e2e/helpers/containers.ts): Added buildConversationEchoComponent() helper for creating the echo conversation component used in integration tests.
  • Test script (package.json): Added test:e2e:common:conversation script and wired it into the test:e2e:common pipeline.
  • Coverage: 100% statements, 100% functions, 100% lines, ~91% branches across both implementations.

Note: The Conversation API Alpha2 requires Dapr >= 1.16.0. The integration tests use Dapr 1.16.0 images by default (overridable via DAPR_RUNTIME_VER env var).

Issue reference

N/A — this implements the Alpha2 Conversation API surface for the JS SDK.

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Copilot AI and others added 2 commits May 6, 2026 03:21
Implements the Alpha2 Conversation API in the JS SDK with support for:
- Multi-role messages (developer, system, user, assistant, tool)
- Tool calling (function tools with parameters)
- Tool choice control
- PII scrubbing
- Temperature control
- Context/session management

Adds both gRPC and HTTP client implementations.

Agent-Logs-Url: https://github.com/dapr/js-sdk/sessions/86aa791b-557e-4db5-84a3-4f1aef4e1d0d

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
This is a tracking PR for implementing the Alpha2 Conversation API in the Dapr JS SDK.

See PR description for full details.

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@WhitWaldo WhitWaldo left a comment

Choose a reason for hiding this comment

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

Please address the changes

Comment thread issues/jobs-api-support.md Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This file is not necessary and can be deleted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deleted in c5d621d.

Comment thread src/types/conversation/Conversation.type.ts Outdated
Comment thread src/types/conversation/Conversation.type.ts Outdated
Comment thread src/types/conversation/Conversation.type.ts Outdated
…ConversationOptions, extract inputs as required param, add promptCacheRetention and responseFormat, rename name to conversationComponentName, delete issues/jobs-api-support.md

Agent-Logs-Url: https://github.com/dapr/js-sdk/sessions/485d7ce7-4ca6-420b-be90-98ffa19b25db

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 9, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • buf.build
    • Triggering command: /home/REDACTED/work/js-sdk/js-sdk/node_modules/@bufbuild/buf-linux-x64/bin/buf /home/REDACTED/work/js-sdk/js-sdk/node_modules/@bufbuild/buf-linux-x64/bin/buf generate (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Proposal: Support Conversation API Alpha2 feat: Support Conversation API Alpha2 May 9, 2026
Copilot AI requested a review from WhitWaldo May 9, 2026 02:24
Copy link
Copy Markdown
Contributor

@WhitWaldo WhitWaldo left a comment

Choose a reason for hiding this comment

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

Could you please add unit and integration tests proving that this works? Please strive for at least 80% test coverage for unit tests and as many integration test paths as you can manage.

Add comprehensive tests for HTTPClientConversation and GRPCClientConversation
covering all message roles, options, request building, response mapping,
tool calls, edge cases, and error handling. 68 tests total with 100%
statement/function coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 9, 2026

Could you please add unit and integration tests proving that this works? Please strive for at least 80% test coverage for unit tests and as many integration test paths as you can manage.

Added 68 unit tests across two test files in b56e5a2:

  • test/unit/protocols/http/conversation.test.ts — 37 tests for HTTPClientConversation
  • test/unit/protocols/grpc/conversation.test.ts — 31 tests for GRPCClientConversation

Coverage: 100% statements, 100% functions, 100% lines, ~91% branches. Tests cover all 5 message roles, all optional parameters, request/response mapping, tool calls, edge cases, and error propagation.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • buf.build
    • Triggering command: /home/REDACTED/work/js-sdk/js-sdk/node_modules/@bufbuild/buf-linux-x64/bin/buf /home/REDACTED/work/js-sdk/js-sdk/node_modules/@bufbuild/buf-linux-x64/bin/buf generate (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from WhitWaldo May 9, 2026 02:42
Copy link
Copy Markdown
Contributor

@WhitWaldo WhitWaldo left a comment

Choose a reason for hiding this comment

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

Please also add integration tests utilizing Testcontainers

Copilot AI and others added 2 commits May 9, 2026 08:18
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 9, 2026

Please also add integration tests utilizing Testcontainers

Added in 23c0044. Created test/e2e/common/conversation.test.ts with 14 integration tests (7 HTTP + 7 gRPC) exercising the conversation API against a real Dapr 1.16 sidecar with the conversation.echo component. Tests cover: simple user messages, system messages, metadata passing, temperature option, multiple inputs, multiple content items, and error handling for non-existent components. Also added buildConversationEchoComponent() helper to containers.ts and test:e2e:common:conversation script to package.json.

Note: The conversation alpha2 API requires Dapr >= 1.16.0, so the test uses its own image constants defaulting to 1.16.0 instead of the shared 1.15.x constants.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 224.0.0.251
    • Triggering command: REDACTED, pid is -1 (packet block)
  • buf.build
    • Triggering command: /home/REDACTED/work/js-sdk/js-sdk/node_modules/@bufbuild/buf-linux-x64/bin/buf /home/REDACTED/work/js-sdk/js-sdk/node_modules/@bufbuild/buf-linux-x64/bin/buf generate (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from WhitWaldo May 9, 2026 08:20
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