Skip to content

Split up Outbound and Inbound Activities#639

Merged
heyitsaamir merged 9 commits into
microsoft:mainfrom
heyitsaamir:heyitsaamir-outbound-activity-split
Jul 15, 2026
Merged

Split up Outbound and Inbound Activities#639
heyitsaamir merged 9 commits into
microsoft:mainfrom
heyitsaamir:heyitsaamir-outbound-activity-split

Conversation

@heyitsaamir

@heyitsaamir heyitsaamir commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Currently, MessageActivity / TypingActivity are used to represent both outbound AND inbound activities. These classes model the full activity shape, including fields that have no meaning on an outbound call. (from, conversation, channelId, serviceUrl, timestamp, etc.).

That creates confusing devex: callers can set fields that are ignored or overwritten by the send path, and it blurs the distinction between activities the app receives and activities the app sends.

In practice, apps only send two outbound activity types:

  1. Message
  2. Typing

This PR prototypes an outbound input model for those sendable activities:

  • ActivityInput as the outbound base class
  • MessageActivityInput
  • TypingActivityInput
  • ActivityParams = IMessageActivityInput | ITypingActivityInput

The inbound activity/router model stays unchanged, but app-facing send/create surfaces are now centered around outbound activity inputs.

Backward compatibility

Now, existing code often does:

ctx.send(new MessageActivity().withText("hi"))

To keep that working, this PR keeps accepting MessageActivity and TypingActivity on send surfaces through deprecated overloads. When those legacy builders are passed to send, they are converted into MessageActivityInput / TypingActivityInput before sending.

That gives users migration guidance without breaking existing code:

So now, this is the more correct code:

ctx.send(new MessageActivityInput().withText("hi"))

But this continues to work:
image

The conversion intentionally drops server-populated fields like from, conversation, channelId, and serviceUrl so the wire payload matches what the app is actually allowed to send.

Non-sendable activity cleanup

ActivityParams remains the outbound input union. Non-sendable activity types such as messageUpdate, messageDelete, messageReaction, and invoke feedback are not accepted by activity create/send APIs, so we removed those.

Call sites that previously tried to create those activity types were updated to use the appropriate APIs instead, such as update, delete, and reaction endpoints.

heyitsaamir and others added 4 commits July 12, 2026 08:19
Deprecate legacy activity builders on send surfaces while converting them to outbound activity inputs before sending. Update examples to use MessageActivityInput and keep raw conversation-client payloads available for devtools emulator traffic.

Co-authored-by: Copilot App <[email protected]>
Remove the raw activity escape hatch from conversation activity APIs so ActivityParams remains the message/typing input union. Update deprecated devtools paths to use update, delete, and reaction endpoints instead of creating non-sendable activity types.

Co-authored-by: Copilot App <[email protected]>
Comment thread packages/api/src/activities/activity.ts
Comment thread packages/api/src/activities/typing.ts
Comment thread packages/apps/src/activity-sender.ts
Comment thread packages/apps/src/http/http-stream.ts
Comment thread packages/devtools/src/components/Feedback/Feedback.tsx
Deprecate outbound-only helpers on full Activity and clarify that typing input text is used for streaming updates.

Co-authored-by: Copilot App <[email protected]>
Comment thread packages/api/src/activities/activity.ts
heyitsaamir and others added 3 commits July 13, 2026 23:19
Add JSDoc for the new public outbound activity input APIs and record the public API documentation requirement in CONTRIBUTING.MD.

Co-authored-by: Copilot App <[email protected]>
Add the public API JSDoc rule to .github/copilot-instructions.md instead of CONTRIBUTING.MD.

Co-authored-by: Copilot App <[email protected]>
Use root AGENTS.md for the public API JSDoc instruction instead of Copilot-specific instructions.

Co-authored-by: Copilot App <[email protected]>
@heyitsaamir
heyitsaamir marked this pull request as ready for review July 14, 2026 21:04
Copilot AI review requested due to automatic review settings July 14, 2026 21:04

Copilot AI left a comment

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.

Pull request overview

This PR prototypes a dedicated outbound activity input model (message/typing only) so app-facing send/create APIs stop accepting full inbound activity shapes, while keeping backwards compatibility by converting legacy MessageActivity/TypingActivity builders into outbound inputs.

Changes:

  • Introduces ActivityInput, MessageActivityInput, and TypingActivityInput (plus updated ActivityParams) to represent outbound-sendable activities only.
  • Updates apps + API send/create/update surfaces to accept outbound inputs, while preserving legacy builder support via deprecated overloads and toActivityParams() conversion.
  • Updates DevTools and examples to use the new outbound inputs and to use dedicated update/delete/reaction APIs instead of creating non-sendable activity types.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/devtools/src/utils/create-feedback.ts Removes legacy invoke-based feedback activity creation helper.
packages/devtools/src/screens/ChatScreen/ChatScreen.tsx Switches edit/delete/reaction flows to update/delete/reaction endpoints and message input builder.
packages/devtools/src/components/Feedback/Feedback.tsx Changes feedback submission to reactions; removes dependency on ActivityStore + invoke activity creation.
packages/apps/src/types/plugin/sender.ts Adds deprecated overload for legacy builder activity input.
packages/apps/src/types/plugin/plugin.ts Adds deprecated overload signature for legacy builder send inputs.
packages/apps/src/http/http-stream.ts Normalizes outbound payload via toActivityParams() before merging ref fields.
packages/apps/src/contexts/function.ts Adds deprecated overloads for legacy builder activities on send().
packages/apps/src/contexts/activity.ts Adds deprecated overloads; routes outbound sends through toActivityParams(); drops server-filled fields from sign-in fallback payload.
packages/apps/src/contexts/activity.test.ts Updates expectations to match outbound input payload shape (e.g., removed inputHint).
packages/apps/src/app.ts Adds deprecated overloads so App.send/reply still accept legacy builders.
packages/apps/src/app.process.ts Expands wrapped context.send type to include legacy builder activities.
packages/apps/src/activity-sender.ts Normalizes outbound payload via toActivityParams() before merging conversation reference fields.
packages/apps/src/activity-sender.spec.ts Adds coverage for legacy builder conversion + ref field merging behavior.
packages/api/src/models/activity-like.ts Defines DeprecatedInputActivity and narrows ActivityLike to outbound message/typing inputs (plus string/card).
packages/api/src/clients/conversation/index.ts Adds deprecated overloads for legacy builders on conversation activity operations/accessors.
packages/api/src/clients/conversation/activity.ts Narrows ActivityParams to message/typing inputs and converts legacy builders via toActivityParams() before HTTP calls.
packages/api/src/clients/conversation/activity.spec.ts Adds tests verifying legacy builder conversion drops server-populated fields.
packages/api/src/activities/utils/to-activity-params.ts Converts string/card/legacy builders into normalized outbound inputs.
packages/api/src/activities/utils/to-activity-params.spec.ts Adds tests for legacy builder conversion into MessageActivityInput/TypingActivityInput.
packages/api/src/activities/typing.ts Introduces TypingActivityInput + outbound typing input interface/builder.
packages/api/src/activities/message/message.ts Introduces MessageActivityInput + outbound message input interface/builder (quoting, streaming, mentions, etc.).
packages/api/src/activities/index.ts Re-exports ActivityInput/IActivityInput for public consumption.
packages/api/src/activities/activity.ts Introduces IActivityInput and ActivityInput base builder for outbound activities; deprecates outbound-relevant methods on legacy Activity.
examples/targeted-messages/src/index.ts Migrates sample to MessageActivityInput.
examples/suggested-action/src/index.ts Migrates sample to MessageActivityInput.
examples/stream/src/index.ts Migrates sample to MessageActivityInput streaming emit/send paths.
examples/quoting/src/index.ts Migrates sample to MessageActivityInput quoting helpers.
examples/formatted-messaging/src/index.ts Migrates sample to MessageActivityInput for rich text formats.
examples/echo/src/index.ts Migrates sample to MessageActivityInput for proactive send.
examples/dialogs/src/index.ts Migrates sample to MessageActivityInput for card sending.
examples/cards/src/index.ts Updates commented example to reference MessageActivityInput.
examples/ai-mcp/src/handlers.ts Migrates streaming markers and pending cards to MessageActivityInput.
examples/ai-mcp/src/citation-collector.ts Updates typing to accept MessageActivityInput instead of legacy MessageActivity.
AGENTS.md Adds repo guidance requiring JSDoc for all new public API surface area.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/api/src/activities/typing.ts
Comment thread packages/api/src/activities/message/message.ts Outdated
Comment thread packages/api/src/activities/message/message.ts Outdated
Comment thread packages/api/src/activities/message/message.ts Outdated
Comment thread packages/api/src/clients/conversation/index.ts
Comment thread packages/devtools/src/components/Feedback/Feedback.tsx
Comment thread packages/devtools/src/screens/ChatScreen/ChatScreen.tsx
Comment thread packages/api/src/activities/message/message.ts Outdated
Comment thread packages/api/src/activities/message/message.ts Outdated
Comment thread packages/api/src/activities/message/message.ts Outdated
Narrow outbound send and stream surfaces to message/typing input shapes while preserving deprecated MessageActivity and TypingActivity builder support.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e32e9910-5791-4ac4-9ce0-9e843e19195e
@heyitsaamir heyitsaamir changed the title Prototype outbound activity inputs Split up Outbound and Inbound Activities Jul 15, 2026
@heyitsaamir
heyitsaamir added this pull request to the merge queue Jul 15, 2026
Merged via the queue into microsoft:main with commit f534647 Jul 15, 2026
5 checks passed
@lilyydu lilyydu mentioned this pull request Jul 16, 2026
lilyydu added a commit that referenced this pull request Jul 16, 2026
## Release v2.0.14

Prepares the stable **2.0.14** release by merging `main` into `release`
and setting `version.json` to the stable version (removing the
`-preview.{height}` suffix).

- Previous release: `2.0.13` (published 2026-06-15)
- Only functional diff vs `main` is `version.json`:
`2.0.14-preview.{height}` → `2.0.14`

## What's in this release

### 🚀 Features
* Flatten client method chains to reduce call hops by @lilyydu in
#634
* Support resetting response streams and streaming error handling by
@lilyydu in #635
* Add `extendedMarkdown` text format value by @singhk97 in
#615

### 🐛 Fixes
* Set `replyToId` for all streaming activities by @lilyydu in
#646
* Use `artifactName` for pipelineArtifact inputs in publish pipeline by
@corinagum in #625

### ♻️ Refactors
* Move `apps` from file-based mixins to real classes by @heyitsaamir in
#633
* Split up Outbound and Inbound Activities by @heyitsaamir in
#639
* Remove `ExperimentalTeamsQuotedReplies` markers by @corinagum in
#621

### 🧪 Tests
* Add integration tests for Teams TypeScript SDK by @corinagum in
#622

### 📚 Docs & Examples
* Migrate examples to the flattened conversation API by @lilyydu in
#637
* Note npm CFS proxy for Microsoft-managed devices by @corinagum in
#638
* Update integration test runbook link to ADO wiki by @corinagum in
#624

### 🔧 Chores & Dependencies
* Bump version to 2.0.14-preview and fix pipeline release job by
@corinagum in #620
* Bump hono from 4.12.21 to 4.12.25 by @dependabot in
#623
* Bump react-router from 7.15.0 to 7.15.1 by @dependabot in
#619
* Bump vite from 6.4.2 to 6.4.3 by @dependabot in
#617

**Full Changelog**:
v2.0.13...prep-release/2.0.14

### After merge
1. Trigger the [release
pipeline](https://dev.azure.com/DomoreexpGithub/Github_Pipelines/_build?definitionId=52&_a=summary)
on `release` with **Public** publish type
2. Bump `main` → `2.0.15-preview.{height}`
3. Create the `v2.0.14` git tag + GitHub Release

Co-authored-by: Copilot <[email protected]>
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.

3 participants