Skip to content

Plugin API: append to a thread's composer draft by thread id #7014

Description

@kolsha

The workflow

A plugin wants to put text into the composer draft of a specific, already-open thread — append, not send — so the user can edit before sending. Motivating case (#6166, second prototype): "Reply in open side chat" appends a quoted review selection to the composer of the side chat the user already has open. The draft is the point of the UX: the user refines the quote plus their question, then sends manually.

What happens today

There is no SDK way to reach the draft of a thread by id:

  • PluginComposerApi handles are only obtainable for composers the plugin can currently see mounted: useComposer() in its own surfaces, useComposers() — "every composer on screen" (app-contract.ts#L5624) — and messageAction's composer, which is "the composer of the thread the message is in" (app-contract.ts#L3464-L3468). None targets an arbitrary thread id, hooks cannot be called from a run callback, and a backgrounded panel's composer is not mounted, so it is not in the list at all.
  • sdk.threads offers send and queued messages — that delivers a sent/queued message, a different UX than an editable draft.
  • ThreadChatProps has focusRequest but no draft seed/append prop (app-contract.ts#L4698).
  • Meanwhile core's prompt-draft store is already keyed by project id + thread id (usePromptDraftStorage.ts#L228) and mounted composers subscribe to it. The primitive exists in core; it is just not reachable from the SDK.

What you would expect

An SDK call that appends to (or seeds) a thread's composer draft by id, writing through the existing prompt-draft store:

sdk.threads.experimental_appendToComposerDraft(threadId: string, text: string): Promise<void>

A mounted composer picks the change up live through its existing store subscription; an unmounted one shows the appended draft the next time it mounts. (A declarative draft-seed prop on ThreadChat was considered as an alternative shape, but the imperative form also works when the target composer is mounted elsewhere or not mounted at all, which is the motivating case.)

Acceptance criteria:

  • Appending to a thread whose composer is mounted updates the visible draft live, preserving the existing draft content with the same separator behavior core quoting uses.
  • Appending to a thread whose composer is not mounted persists the draft; the composer shows it on next mount.
  • No send or queue side effects; the user edits and sends manually.
  • Per AGENTS.md, the new SDK member ships experimental_-prefixed with a docs/api_to_audit.md entry, and is listed in plugins/plugin-api-docs/src/surfaces.ts with a Plugin Guide example.
  • Tests: draft-store round-trip by thread id, live update of a mounted composer, and the unmounted-then-mounted path.

Context and alternatives

Checks

AGENT GENERATED

Activity

  1. added
    plugins
    ui
    on Nov 4, 2026
  2. bb-slop-cop commented on Nov 4, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied and verified the previously missing classification:

    • Type: Feature
    • Priority: Medium — enables a useful plugin workflow, with limited scope and no reported outage or data loss.
    • Effort: Medium — requires SDK integration with draft storage, live composer updates, documentation, and focused tests.
    • Labels: plugins, ui

    No existing classifications needed preservation. No reproduction report or pull request: this requests new SDK functionality, not a bug fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pluginsui

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions