diff --git a/src/client/conversation-draft.ts b/src/client/conversation-draft.ts index f3f815e6..789b5309 100644 --- a/src/client/conversation-draft.ts +++ b/src/client/conversation-draft.ts @@ -5,34 +5,42 @@ * through `ctx.get` (the inject-free read the app's own plugins use); a * missing service or scope degrades to a logged no-op, never a crash. * - * File references additionally use DSH's own structured insert event - * (`slash/input-insert-reference`, see `insertFileReference`) instead of - * plain draft text: the native `@file` picker emits this event, and the - * conversation input machine mints one occurrence whose chip covers the - * whole reference. Plain text `@folder/file.ts` only ever gets DSH's - * folder-ref decoration (`@folder/`) — the file name stays undecorated — so - * plain append is the fallback, not the primary path, for files. + * **Inserts never go through `setDraft`.** `setDraft(text)` is DSH's + * whole-draft replacement: its documented contract is "replace the whole + * draft with plain text, **removing inline reference chips**" + * (`SessionInput.setDraft` in `@deepseek-ai/dsh-client-ui-conversation` — it + * clears the editor root and re-appends the string), so every chip already in + * the draft degrades to its clipboard text (`@dir/file.ts`) and loses its + * reference identity; DSH's plain-text scan then decorates only the folder + * prefix and the mention reads as two pieces. That was this module's own bug: + * one folder insert (or one file insert's fallback) flattened every earlier + * `@` pick. Both kinds now ride DSH's scoped composer events, which mutate the + * live document instead: * - * Insert position (fixes upstream issue #425): the draft store only exposes - * the whole string (`getSnapshot().draft` + `setDraft(text)`) — there is no - * caret API on the conversation service. The composer's `