Repository navigation
Description
Describe the feature or problem you'd like to solve
Extensions cannot read or restore the text the user is still typing in the input box (the composer draft), so an extension that changes the session on its own cannot protect the user's unsent input.
Proposed solution
Expose the composer draft to extensions, for example:
session.rpc.ui.getDraft()returning{ text, attachments }, andsession.rpc.ui.setDraft({ text });- and/or a debounced
ui.draft_changedsession event that extensions can subscribe to.
Extensions can already act on the conversation without the user. An extension tool can call session.history.clearContext to continue a long session in a fresh context window, which saves a lot on long agentic loops such as PR review rounds. Messages the user has already submitted are covered too: session.queue.pendingItems and queue.insertAt reach them, and they survive a clear.
The one piece of user input an extension cannot see is the draft still being typed. Being able to read and set it would let an extension snapshot the draft before a programmatic change and put it back afterwards, or save it to a file. Unsent text would then never be lost, whatever the CLI does to the composer on such a change now or in a later version.
Example prompts or workflows
- A context-switch extension (a terminal tool that calls
history.clearContextwhen the context gets expensive) saves the draft just before the clear and restores it afterwards, while the user is mid-sentence. - An extension autosaves the draft to a per-session file, so a crash or a stray keystroke never loses a long prompt.
- A prompt-template extension puts a template into the composer for the user to edit before sending.
- A companion integration keeps a draft in sync between a terminal and another client.
Additional context
- Copilot CLI 1.0.105, extension SDK (
@github/copilot-sdk/extension), Windows. - The CLI already shares the draft with remote session hosts, so the data exists inside the CLI. Extensions are the only consumers that cannot reach it.
- Related, but a different problem: Prompt is discarded after 'Submission failed' (host-ack timeout): composer cleared, not saved to history, delivered late or never #5264, where a submitted prompt was lost after a failed submission.
Activity