| 1 | import type { ComposerInvocation } from "./invocationDisplay"; |
| 2 | import type { SessionReference } from "./types"; |
| 3 | import type { SelectedTextReference } from "./selectedTextContext"; |
| 4 | import type { Attachment } from "./composerAttachments"; |
| 5 | |
| 6 | export interface WorkspaceReference { |
| 7 | path: string; |
| 8 | isDir?: boolean; |
| 9 | displayPath?: string; |
| 10 | } |
| 11 | |
| 12 | export type PastedBlock = { label: string; text: string }; |
| 13 | |
| 14 | export type PersistentComposerDraft = { |
| 15 | text: string; |
| 16 | invocations: ComposerInvocation[]; |
| 17 | attachments: Attachment[]; |
| 18 | workspaceRefs: WorkspaceReference[]; |
| 19 | pastedBlocks: PastedBlock[]; |
| 20 | openPastedLabels: string[]; |
| 21 | sessionRefs: SessionReference[]; |
| 22 | selectedTextRefs: SelectedTextReference[]; |
| 23 | }; |
| 24 | |
| 25 | export type PersistentComposerTarget = { |
| 26 | draftId: string; |
| 27 | generation: number; |
| 28 | initial: PersistentComposerDraft; |
| 29 | revision: number; |
| 30 | onChange: (draftId: string, generation: number, content: PersistentComposerDraft) => void; |
| 31 | onPatch?: (draftId: string, generation: number, patch: Partial<PersistentComposerDraft> | ((content: PersistentComposerDraft) => PersistentComposerDraft)) => void; |
| 32 | isCurrent?: (draftId: string, generation: number) => boolean; |
| 33 | canEdit?: (draftId: string, generation: number) => boolean; |
| 34 | onTaskError?: (draftId: string, generation: number, message: string) => void; |
| 35 | trackTask?: <T>(draftId: string, generation: number, promise: Promise<T>) => Promise<T>; |
| 36 | }; |
| 37 |