Skip to content

feat: Adopt Plan API for plan display and editing #491

@PureWeen

Description

@PureWeen

Problem

The SDK has a full Plan API (session.Rpc.Plan.Read/Update/Delete) and plan events (SessionPlanChangedEvent, ExitPlanModeRequestedEvent) — all completely unused. When agents create plans (in plan mode), PolyPilot has no way to show them to the user or let users edit them.

PR #116 (stale, from Feb 15) attempted to add plan display in the chat area but was never merged and is now heavily conflicted.

SDK APIs Available

RPC:

  • session.Rpc.Plan.ReadAsync() — returns Exists, Content, Path
  • session.Rpc.Plan.UpdateAsync(content) — write/update plan
  • session.Rpc.Plan.DeleteAsync() — delete plan

Events:

  • SessionPlanChangedEvent — plan file updated (operation: create/update/delete)
  • ExitPlanModeRequestedEvent — agent wants to exit plan mode (includes PlanContent)
  • ExitPlanModeCompletedEvent — plan mode exit completed

Mode:

  • session.Rpc.Mode.SetAsync(SessionModeGetResultMode.Plan) — switch to plan mode
  • SessionModeChangedEvent — mode changed

What to Change

  1. Listen for SessionPlanChangedEvent to detect when agent creates/updates a plan
  2. Call Plan.ReadAsync() to get plan content
  3. Display plan in UI — collapsible block in chat area or a popup/panel
  4. Allow user to edit the plan and call Plan.UpdateAsync() to save changes
  5. Agent picks up changes on next turn (plan file is source of truth)
  6. Handle ExitPlanModeRequestedEvent to transition UI out of plan mode

Context

  • PR Show plan in chat area during plan mode #116 (copilot/add-plan-mode-preview-option) has a stale implementation of plan display
  • The Implement & Challenge charter now tells workers to create checklists — these could be proper plans via the Plan API

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