Skip to content

feat(messaging): surface Plan/Review artifacts via Markdown attachment + inline preview #193

@huntharo

Description

@huntharo

Summary

PwrAgent's messaging integration has no plan/review surface delivery today. When a turn completes with a plan artifact (Codex turn/plan/updated), nothing routes it to the bound Telegram or Discord channel. The status card hardcodes the literal string "Plan mode: unavailable". Review mode has no representation at all.

The outboundAttachments capability fields on MessagingCapabilityProfile were declared in PR #180 as scaffolding for this work but are not yet read by any producer.

Goal

Match the proven openclaw-app-server pattern: surface the plan artifact as a Markdown file attachment with a truncated inline preview when the provider supports file uploads, and fall back to a longer inline-only preview otherwise.

What's missing

  • ❌ No producer ever emits a MessagingFilePart. The type and adapter delivery infrastructure (uploadableFileParts, sendDocument, Discord attachment routes) exist but have no caller.
  • ❌ The messaging controller doesn't subscribe to turn/plan/updated events. Even though the protocol carries the plan, nothing routes it to messaging.
  • ❌ The status card hardcodes "Plan mode: unavailable" (apps/desktop/src/main/messaging/core/messaging-status-card.ts:106).
  • ❌ Review mode has no protocol/UI representation in PwrAgent today.

What's already in place

  • MessagingFilePart type defined in the messaging interface
  • ✅ Discord and Telegram adapters can deliver files end-to-end
  • outboundAttachments capability profile declared on both providers (with size limits, file/image/URL support flags)
  • ✅ Protocol notifications recognized: turn/plan/updated, item/plan/delta, TurnPlanStep
  • ✅ Capability framework (PR feat(messaging): capability discovery and adaptive rendering (Phases 1-4) #180) — producers thread capabilityProfile and apply applyActionCapabilityLimits. The same plumbing will carry attachment-capability decisions.

Plan document

Detailed implementation plan: `docs/plans/2026-05-05-002-feat-messaging-plan-review-attachment-delivery-plan.md` (filed on the PR #180 branch — will land on `main` when that PR merges).

The plan covers:

  • buildPlanArtifactIntent producer signature
  • Three rendering modes (inline-only / attachment+summary / inline-fallback) selected by capability + size
  • Controller subscription to turn/plan/updated
  • Status card integration replacing the "Plan mode: unavailable" stub
  • Review-mode generalization (buildArtifactDeliveryIntent({ kind: "plan" | "review", … }))
  • Open questions: Grok-backend parity (does it emit equivalent events?), state lifecycle for re-presenting plans, message-edit semantics for multi-part delivery
  • Five concrete integration test scenarios

Capability framework reference

Established in PR #180 (#180): `MessagingCapabilityProfile` with `outboundAttachments` reserved for this work. Annotation in `packages/messaging/interface/src/index.ts` explicitly points consumers at this plan.

Out of scope

  • Implementing Signal / Slack / Mattermost / Feishu adapters (they would benefit from this work, but providers are tracked separately).
  • Desktop UI plan rendering — the renderer thread view is presumably already wired since turn/plan/updated is a known protocol event; this issue is messaging-side only.

Suggested next step

/ce:work docs/plans/2026-05-05-002-feat-messaging-plan-review-attachment-delivery-plan.md once PR #180 merges and the plan doc reaches main.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions