Skip to content

Prompt Preview Support#536

Merged
corinagum merged 14 commits into
microsoft:mainfrom
ShanmathiMayuramKrithivasan:shmayura/prompt-preview
May 11, 2026
Merged

Prompt Preview Support#536
corinagum merged 14 commits into
microsoft:mainfrom
ShanmathiMayuramKrithivasan:shmayura/prompt-preview

Conversation

@ShanmathiMayuramKrithivasan

Copy link
Copy Markdown
Contributor

Prompt preview allows a bot to reference the original targeted message in its reply, so Teams can render a collapsible preview of the user's prompt.

When a bot replies to a targeted message (reactive scenarios), the SDK now passes the original message's messageId via a targetedMessageInfo entity in the activity's entities array.

For proactive replies, developers can attach the entity themselves with the messageId of the targeted message.

Copilot AI review requested due to automatic review settings April 21, 2026 12:32

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

Adds “prompt preview” support by attaching a targetedMessageInfo entity to outbound message activities, enabling Teams to render a collapsible preview of the original targeted prompt.

Changes:

  • Auto-inject targetedMessageInfo (with original inbound activity.id) when replying/sending in a reactive targeted-message flow.
  • Add a first-class addTargetedMessageInfo(messageId) helper on Activity for proactive/manual scenarios.
  • Extend API entity typings and add unit tests + example usage.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/apps/src/contexts/activity.ts Auto-populates targetedMessageInfo entity on outbound message sends in reactive targeted-message scenarios.
packages/apps/src/contexts/activity.test.ts Adds tests validating auto-population behavior and non-overwrite behavior.
packages/api/src/models/entity/targeted-message-info-entity.ts Introduces the TargetedMessageInfoEntity model type.
packages/api/src/models/entity/index.ts Wires the new entity into the public Entity union + exports.
packages/api/src/activities/activity.ts Adds addTargetedMessageInfo(messageId) fluent helper to attach the entity.
examples/targeted-messages/src/index.ts Demonstrates reactive/proactive prompt preview usage and updates help text.

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

Comment thread examples/targeted-messages/src/index.ts Outdated
Comment thread examples/targeted-messages/src/index.ts Outdated
@corinagum

Copy link
Copy Markdown
Collaborator

The new public API for prompt preview is missing the @experimental / Diagnostic: ExperimentalTeamsTargeted JSDoc that withRecipient(value, isTargeted) carries at packages/api/src/activities/activity.ts:292-293.

Consider adding the same annotation to:

  • addTargetedMessageInfo in packages/api/src/activities/activity.ts
  • TargetedMessageInfoEntity in packages/api/src/models/entity/targeted-message-info-entity.ts

so consumers see the preview warning consistent with the rest of the targeted-messages surface.

Comment thread packages/apps/src/contexts/activity.ts Outdated
Comment thread packages/api/src/activities/activity.ts
Comment thread examples/targeted-messages/src/index.ts Outdated
corinagum added a commit that referenced this pull request May 6, 2026
PR #482 left a stale examples/quoted-replies entry (directory was
renamed to examples/quoting), and the lockfile predated PR #536's
examples/targeted-messages workspace. npm ci enforces lockfile
against workspace globs and was failing in CI; npm install tolerated
the drift. Regenerated from scratch so both new example workspaces
are present and the stale one is gone.
@corinagum
corinagum merged commit 40133fe into microsoft:main May 11, 2026
4 checks passed
corinagum added a commit that referenced this pull request May 14, 2026
## Summary

Brings `main` into `release` for the 2.0.11 release, with quoted-replies
(PR #482) excluded.

Single squashed commit containing the diff between `release` (2.0.10)
and `main`, minus the quoted-replies feature.

## What's in this release

- All commits merged to main since 2.0.10 (the previous release),
notably:
- **Reactions GA** (PR #575) — `[Experimental]` removed;
`ReactionClient.remove()` → `delete()`
  - User-agent fix (PR #573)
  - Prompt Preview Support (PR #536)
  - Various dependency bumps and bug fixes

## What's NOT in this release

**Quoted-replies feature (PR #482) is excluded:**
- `prependQuote()`, `addQuote()` builder methods — absent
- `context.quote()` and quote-aware `reply()` behavior — reverted to
legacy `replyToId` + blockquote
- `examples/quoting` — removed
- QR-related tests — removed

**Kept intentionally:**
- `QuotedReplyEntity` type stays in the `Entity` union so inbound
activities carrying `quotedReply` entities still parse
- `addTargetedMessageInfo` runtime strip-QR logic (filters `e.type ===
'quotedReply'`) — preserves prompt-preview cleanup

## Version

`version.json`: `2.0.10` → `2.0.11`

## Test plan

- [x] `npm run lint` — 33/33 packages
- [x] `npm run build` — 35/35 packages
- [x] `npm run test` — 730/730 tests across 61 suites
- [x] `npm pack --workspaces` — all tarballs produced; verified
`quoted-reply-entity.d.ts` ships in `@microsoft/teams.api`; no
`prependQuote`/`addQuote` symbols in bundled `dist/`
- [ ] ADO Public publish pipeline (post-merge)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

## CI note

skip-test-verification — the `release` branch is out of sync with `main`
for three template/example pairs (templates: `ai`; examples: `echo`,
`graph`). This PR brings them along as part of the bulk main→release
merge but doesn't try to re-pair them, since that's an orthogonal fix
and would muddy this PR's "single squashed release diff" intent.
corinagum added a commit that referenced this pull request May 27, 2026
## Summary

Brings `origin/main` into `release` for the **2.0.12** release. **No
carve-outs this time** — Quoted Replies is included.

`version.json`: `2.0.12-preview.{height}` → `2.0.12`.

Aligns with teams.py 2.0.12 (PR #442 already on PyPI / pending publish).

## What's in this release (delta from 2.0.11)

**Features**
- Quoted Replies + new quotes features — previously held back via the
2.0.11 carve-out (#576)
- SuggestedActionSubmitActivity for `suggestedAction/submit` invoke
(#591)
- Default targeted replies for targeted inbound messages (#592)
- Filter colliding keys before `Object.assign` in `ActivityContext`
(#596)
- Prompt Preview support (#536)
- A2A sample (#584)
- AI/MCPClient (#572)
- Allow passing custom HTTP client via `AppOptions`-equivalent
- Reactions API marked GA (#575), Rename `ReactionClient.remove()` →
`delete()` (#567)

**Security & fixes**
- Security hardening: tighten cross-origin policies (#595)
- Lock JsonWebToken trust-boundary contract (#586)
- `fix(deps)`: npm audit fix — clears all high-severity advisories
(#599)
- `fix(apps)`: log inbound activities at info, warn on missing
Authorization (#568)
- `fix`: App user-agent merging (#573)
- `fix`: Add null checks in `local-memory.ts` to prevent role crash
(#438)
- `fix`: `@microsoft/teams.client` import error in webpack 5 (#566)
- Switch to named imports without subpaths (#561)

**Deprecations / package changes**
- Deprecate `DevtoolsPlugin` in favor of Microsoft 365 Agents Playground
(#593)
- Remove in-repo Teams CLI package (#580) — moved to
`teams-sdk/packages/cli`
- Deprecate AI Libraries (#588)
- Correct imports + return types in misc. packages (#589)

**Dependency bumps**
- turbo 2.8.11 → 2.9.14 (#587)
- qs 6.15.0 → 6.15.2 (#594)
- hono 4.12.14 → 4.12.16 (#562)
- npm audit fix bundle (#599): axios 1.13.5 → 1.16.1, fast-uri 3.1.0 →
3.1.2, ws 8.19.0 → 8.21.0, @azure/msal-node hoisted 5.2.2, uuid 11.1.0 →
11.1.1, @azure/identity 4.13.0 → 4.13.1, express-rate-limit, ip-address,
brace-expansion, etc.

## Quoted Replies inclusion notes

- Teams client rendering is in-sync with the wire format as of
2026-05-06.
- APX QR rollout completed: Public 2026-04-10, GCCH/DoD/Gallatin
2026-04-14.
- No SDK-side carve-outs needed; this matches the teams.py 2.0.12 (PR
#442) decision.

## Branch structure note

`prep-release/2.0.12` is reset to `origin/main` + a one-line
`version.json` bump. Diff against `release` (this PR) shows the full
delta from 2.0.11. We deliberately did not use a 2-parent merge commit —
the auto-merge tried to interleave non-overlapping hunks from main's QR
additions with release's QR carve-outs in `activity.ts`, producing a
semantically broken file. Reset-to-main + version bump is the clean way
to express "release should equal main."

## Test plan

- [x] `npm install` clean (post-audit-fix lockfile)
- [x] `npm run build` — 33/33 targets clean
- [x] `npm test` — 14/14 task targets, 279+ tests pass
- [x] E2E echo bot smoke test against `cg-test-bot-py` via canary ABS —
done on `cg/audit-deps-ts` (now merged); covers axios + msal-node code
paths
- [ ] Pipeline Build + Test stages green on `release` after merge
- [ ] Publish pipeline run with **Public** → ESRP → npm
`@microsoft/teams.*@2.0.12`
- [ ] Smoke install: `npm view @microsoft/teams[email protected]` after
publish
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