{"version":"2.1.300","anchor":"extension-api-composerattribute-and-viewshow","canonical_anchor":"extension-api-composerattribute-and-viewshow","heading":"Extensions gain composer.attribute to tag prompt edits, and the prompt draft gains a text watcher","tier":"use","area":"Plugins","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.300\/e\/extension-api-composerattribute-and-viewshow","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.300","markdown":"### Extensions gain composer.attribute to tag prompt edits, and the prompt draft gains a text watcher\n\nThe prompt draft can now tag edits with their origin and report changes, and extensions reach it through composer.attribute and attributeDraft\n\n**Unclear.** Which feature these belong to and how an extension reaches them is not known.\n\n**What**\n\nThe prompt draft is the text you are typing in the input box before you send it. It gains a way to record where each edit came from, and extensions (add-ons that use Claude Code's host API) can now reach it:\n\n- The draft store takes a `watchText` option. When set, it is given a way to read the current text and cursor, and it is told about every change as `changed({before, after, origin})`.\n\n- A new `attribute(origin, fn)` method tags every edit made inside `fn` with that origin.\n\n- The plugin host binding gains `attributeDraft`, alongside the existing `readDraft`, `fillDraft` and `suggestDraft`.\n\n- The host API for extensions gains `composer.attribute`, which calls `attributeDraft`, and `view.show`.\n\n- The text input gets new `virtualTexts` and `commitEdit` props. Clicking and selecting text now account for virtual text decorations, meaning text shown in the box that is not part of what you typed.\n\n- Undo now restores text inside an attributed edit, and typed edits go through a new path instead of the old recording path.\n\nThe finding did not show what supplies `watchText`.\n\n**Why**\n\nExtensions can now tag the prompt edits they make, so those edits can be told apart from your own typing. Nothing found shows a feature that uses this yet, so for now it is mainly something extension authors can build on.\n\n- Area: Plugins\n- Names: `composer.attribute`, `view.show`\n- Tier: Use it now\n- Useful: 5\/5\n- Signal: 4\/5\n- Scope: individual\n- Heads-up: no"}