Skip to content

feat(presentation): hosted-widget launch via typed web-app actions - #108927

Merged
steipete merged 5 commits into
mainfrom
feat/widget-web-app-action
Jul 16, 2026
Merged

steipete merged 5 commits into
mainfrom
feat/widget-web-app-action

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Discord Activity launches cannot be expressed through the portable presentation-action seam: web-app actions 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. So discord_widget hand-built raw Button components — the exact coupling the typed-action seam exists to prevent, and a dead end for any future cross-channel widget producer (canvas show_widget unification is next).

Why This Change Was Made

Phase 2 of the widget/canvas unification program. Additive protocol change: the web-app action becomes a two-member union — URL-required or widgetId-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 valid widgetId to its Activity custom_id button through the one shared buildDiscordButtonComponent path (raw callback data stays transport-private); URL-capable channels keep link buttons; telegram/mattermost/msteams skip widget-only buttons gracefully. discord_widget now 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-app presentation 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

  • Focused tests green: 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).
  • Structured autoreview (codex/gpt-5.6-sol, branch vs origin/main): clean, no actionable findings.
  • docs/plugins/message-presentation.md updated (existing page, no heading changes).

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: telegram Channel integration: telegram agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Jul 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 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".

Comment on lines +132 to +134
result = await (deps.sendComponentMessage ?? sendDiscordComponentMessage)(
`channel:${channelId}`,
{ ...components, text: title },

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.

P2 Badge 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 👍 / 👎.

steipete added 2 commits July 16, 2026 04:15
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.
@openclaw-barnacle openclaw-barnacle Bot added the channel: feishu Channel integration: feishu label Jul 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 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;

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.

P2 Badge 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 👍 / 👎.

@steipete
steipete merged commit 990e8d2 into main Jul 16, 2026
125 of 127 checks passed
@steipete
steipete deleted the feat/widget-web-app-action branch July 16, 2026 11:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…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.
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: telegram Channel integration: telegram docs Improvements or additions to documentation maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant