Repository navigation
feat(presentation): hosted-widget launch via typed web-app actions - #108927
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7bc93d0ae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| result = await (deps.sendComponentMessage ?? sendDiscordComponentMessage)( | ||
| `channel:${channelId}`, | ||
| { ...components, text: title }, |
There was a problem hiding this comment.
Preserve forum-channel widget launches
When discord_widget runs against a target that resolves to a parent Discord forum/media channel, this new path calls sendDiscordComponentMessage, which rejects forum-like channels in extensions/discord/src/send.components.ts:306 before posting. The previous sendMessageDiscord path handled the same target by auto-creating a forum thread and carrying the button components in the starter message (extensions/discord/src/send.outbound.ts:205), so this change regresses widget launches for forum-channel targets; keep that legacy/forum path or add equivalent forum-thread creation to the component sender.
Useful? React with 👍 / 👎.
The two-member web-app union no longer accepts a distributed type: "url" | "web-app" literal or an empty receipt in typed callbacks; use explicit action casts and the Discord receipt factory.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea41fdaff9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| tableMode?: MarkdownTableMode; | ||
| chunkMode?: ChunkMode; | ||
| suppressEmbeds?: boolean; | ||
| allowedMentions?: DiscordAllowedMentions; |
There was a problem hiding this comment.
Forward allowed mentions through classic downgrades
When this new allowedMentions option is supplied on a component send that downgrades to sendMessageDiscord (mediaUrl plus only classic text/file blocks), sendDiscordComponentMessage returns before buildDiscordComponentPayload and the options passed to sendMessageDiscord omit opts.allowedMentions. That makes the caller's explicit mention suppression ineffective for media-backed classic component sends even though sendMessageDiscord supports allowedMentions, so text such as @everyone can ping in that downgrade path; pass the option through alongside the other forwarded send options.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
…penclaw#108927) * feat(presentation): support hosted widget actions * refactor(discord): route widget launches through presentation * chore: keep changelog release-owned * test(interactive): type the invalid web-app boundary case explicitly * test: type web-app action fixtures against the split union The two-member web-app union no longer accepts a distributed type: "url" | "web-app" literal or an empty receipt in typed callbacks; use explicit action casts and the Discord receipt factory.
…penclaw#108927) * feat(presentation): support hosted widget actions * refactor(discord): route widget launches through presentation * chore: keep changelog release-owned * test(interactive): type the invalid web-app boundary case explicitly * test: type web-app action fixtures against the split union The two-member web-app union no longer accepts a distributed type: "url" | "web-app" literal or an empty receipt in typed callbacks; use explicit action casts and the Discord receipt factory.
What Problem This Solves
Discord Activity launches cannot be expressed through the portable presentation-action seam:
web-appactions only carry a URL and Discord maps them to link buttons, but Activity launch needs a transport-private custom_id button answered with a LAUNCH_ACTIVITY callback. Sodiscord_widgethand-built rawButtoncomponents — the exact coupling the typed-action seam exists to prevent, and a dead end for any future cross-channel widget producer (canvasshow_widgetunification is next).Why This Change Was Made
Phase 2 of the widget/canvas unification program. Additive protocol change: the
web-appaction becomes a two-member union — URL-required orwidgetId-required — so at-least-one is enforced at the type level, mirrored in the agent-runtime types, message-tool schema, sanitizer, and normalizer. Channel mapping stays channel-owned: Discord maps a validwidgetIdto its Activity custom_id button through the one sharedbuildDiscordButtonComponentpath (raw callback data stays transport-private); URL-capable channels keep link buttons; telegram/mattermost/msteams skip widget-only buttons gracefully.discord_widgetnow posts a portable button instead of hand-built components, and gains delivered-result recovery so post-send bookkeeping failures cannot orphan or falsely delete a widget record.User Impact
Release-note summary: typed
web-apppresentation buttons can carry an OpenClaw hosted-widget ID; Discord maps valid IDs to native Activity launch buttons while URL-only channels skip hosted-widget-only buttons safely. No behavior change for existing URL-based web-app buttons.Evidence
node scripts/run-vitest.mjs src/interactive/payload.test.ts src/agents/tools/message-tool.test.ts extensions/discord/src/activities/tool.test.ts extensions/discord/src/shared-interactive.test.ts extensions/discord/src/activities/interaction.test.ts extensions/telegram/src/button-types.test.ts extensions/mattermost/src/channel.test.ts extensions/msteams/src/outbound.test.ts(Discord launch round-trip covered via the interaction handler).docs/plugins/message-presentation.mdupdated (existing page, no heading changes).