Skip to content

Add support for subChannels being stored in entities#697

Merged
benbrown merged 11 commits intomainfrom
users/benbro/533
Oct 20, 2025
Merged

Add support for subChannels being stored in entities#697
benbrown merged 11 commits intomainfrom
users/benbro/533

Conversation

@benbrown
Copy link
Copy Markdown
Contributor

@benbrown benbrown commented Oct 17, 2025

This PR adds support for the ProductInfo entity, and adds some helper functions around the use of the channelId field.

Resolves #533

New:

  • channelId will now be a combination of primary channel (legacy channelId) + the subchannel id from the entity.
  • channelIdChannel will return on the primary channel
  • channelIdSubChannel will return the subchannel id

activity.channelId = 'foo:bar' works
activity.channelIdChannel = 'foo' works
activity.channelIdSubChannel = 'bar' works

How this works:
Under the hood, we have getter/setter functions for channelId and the other sub-fields.
The "legacy" value of channelId from the wire is stored in _channelId.
The entity is stored as transmitted.
Deserialization works as expected with no change.

During serialization, we move the value from _channelId to channelId. This happens in both toJsonString and in the noramalizeOutgoingActivity method.

GOTCHAS:
If a user does JSON.stringify(activity) they will end up with _channelId instead of channelId

Copilot AI review requested due to automatic review settings October 17, 2025 19:57
@benbrown
Copy link
Copy Markdown
Contributor Author

benbrown commented Oct 17, 2025

TO DO:

  • Add jsdoc comments
  • Address copilot comments
  • Find places where we are already doing activity.channelId == and update to channelIdChannel

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for representing subchannels via a ProductInfo entity and introduces getters/setters to combine primary channel and subchannel into a composite channelId while normalizing serialization to keep only the primary channel in wire payloads.

  • Introduces ProductInfo entity and helper for adding it to activities.
  • Replaces direct channelId storage with internal _channelId plus computed accessors (channelId, channelIdChannel, channelIdSubChannel).
  • Normalizes outgoing activities to replace _channelId with channelId and updates serialization logic.

Reviewed Changes

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

File Description
packages/agents-hosting/src/activityWireCompat.ts Normalizes outgoing payload by moving _channelId to channelId.
packages/agents-activity/src/activity.ts Adds internal _channelId plus composite channelId accessors and updated serialization logic.
packages/agents-activity/src/entity/productInfo.ts Defines ProductInfo entity and helper for attaching it to an Activity.
packages/agents-activity/test/activity/activity.subChannels.test.ts Adds tests covering composite channelId behavior and serialization.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread packages/agents-activity/src/activity.ts
Comment thread packages/agents-activity/src/activity.ts
Comment thread packages/agents-hosting/src/activityWireCompat.ts
Comment thread packages/agents-activity/src/activity.ts Outdated
Comment thread packages/agents-activity/src/activity.ts Outdated
Comment thread packages/agents-activity/src/activity.ts Outdated
Comment thread packages/agents-activity/src/activity.ts Outdated
Copy link
Copy Markdown
Member

@tracyboehrer tracyboehrer left a comment

Choose a reason for hiding this comment

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

Passing Activity.channelId to the various UserTokenClient operation could cause an issue. Unclear if ABS will handle the full channelId. DotNet will use just the "channel" portion for those calls.

@benbrown benbrown self-assigned this Oct 20, 2025
@benbrown benbrown merged commit 744b50b into main Oct 20, 2025
7 checks passed
@benbrown benbrown deleted the users/benbro/533 branch October 20, 2025 20:24
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.

Implement internal channel / product info

3 participants