Skip to content

Command progress and notifications #36

@pento

Description

@pento

Show real-time feedback in the browser as Claude processes commands — progress states in the sidebar and snackbar notifications on completion/failure.

Command Status Polling

Poll GET /wpce/v1/commands?post_id={current}&since={last_check} from the browser to track active command status changes. Polling interval:

  • Every 2s while a command is running
  • Every 10s when idle (to catch status updates from commands submitted in other tabs)
  • Stop polling when no recent commands exist

Sidebar: Command History

List of recent commands in the AI Actions sidebar panel with status indicators:

  • Pending — clock icon, "Waiting for Claude..."
  • Claimed/Running — spinner, "Claude is working..."
  • Completed — checkmark, "Done"
  • Failed — X icon, error message from the message field
  • Expired — clock icon, "Timed out"
  • Cancelled — dash icon, "Cancelled"

Running commands show a cancel button. History is scoped to the current post and current session (no need to persist across page reloads beyond what the REST API returns).

Snackbar Notifications

Use @wordpress/notices to show snackbar notifications:

  • Completed: "Claude finished proofreading your post." / "Claude finished reviewing your post." (message varies by prompt type)
  • Failed: "Claude couldn't complete the review: [message]"
  • Expired: "Command timed out — Claude may not be connected."

Notifications should not stack — if multiple commands complete in quick succession, show the most recent.

Acceptance Criteria

  • Browser polls for command status updates at appropriate intervals
  • Sidebar shows command history with correct status icons and labels
  • Running commands have a cancel button
  • Snackbar notifications on completion, failure, and expiry
  • Notification text is contextual to the prompt type
  • Polling frequency adjusts based on whether a command is active
  • Reuses the @wordpress/data store from AI Actions sidebar panel #32

Part of #28.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions