| 1 | /** |
| 2 | * The draft key a queued-message edit borrows. |
| 3 | * |
| 4 | * `<environmentId>:<threadId>~queued-edit~<runId>`: the marker holds no colon, |
| 5 | * so `composerDraftEnvironmentId` still reads the environment from the segment |
| 6 | * before the last colon and attachment uploads keep working, while the user's |
| 7 | * own draft for the thread stays untouched under its own key. |
| 8 | * |
| 9 | * Lives apart from the edit session state so the draft store can recognize |
| 10 | * these keys without importing it. |
| 11 | */ |
| 12 | const QUEUED_EDIT_DRAFT_MARKER = "~queued-edit~"; |
| 13 | |
| 14 | export function queuedEditDraftKey(threadKey: string, runId: string): string { |
| 15 | return `${threadKey}${QUEUED_EDIT_DRAFT_MARKER}${runId}`; |
| 16 | } |
| 17 | |
| 18 | export function isQueuedEditDraftKey(draftKey: string): boolean { |
| 19 | return draftKey.includes(QUEUED_EDIT_DRAFT_MARKER); |
| 20 | } |