@camunda/copilot-chat 0.8.1-alpha.4 → 0.8.1-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -11,14 +11,31 @@ export declare interface AnswerQuestionInput {
11
11
  readonly text?: string;
12
12
  }
13
13
 
14
- export declare interface ArtifactChange {
15
- readonly changeKind: 'create' | 'modify';
16
- readonly artifact: ArtifactRef;
17
- readonly content: string;
18
- readonly before?: string;
19
- readonly validationMessages?: ReadonlyArray<string>;
14
+ export declare interface ApplyDraftInput {
15
+ readonly conversationId: string;
16
+ readonly draftId: string;
17
+ readonly reviewedGeneration: number;
18
+ readonly confirmedLive: ReadonlyArray<{
19
+ readonly artifactKey: string;
20
+ readonly liveFingerprint: string;
21
+ }>;
20
22
  }
21
23
 
24
+ export declare type ApplyDraftResult = {
25
+ readonly status: 'applied';
26
+ readonly applyId: string;
27
+ } | {
28
+ readonly status: 'changed_since_review';
29
+ readonly draft: Draft;
30
+ } | {
31
+ readonly status: 'blocked';
32
+ readonly reasons: ReadonlyArray<{
33
+ readonly artifactKey: string;
34
+ readonly reason: 'no_edit_permission' | 'location_deleted' | 'hub_rule' | 'limit';
35
+ readonly message: string;
36
+ }>;
37
+ };
38
+
22
39
  export declare interface ArtifactRef {
23
40
  readonly projectId: string;
24
41
  readonly artifactId: string;
@@ -28,59 +45,74 @@ export declare interface ArtifactRef {
28
45
 
29
46
  export declare type ArtifactType = 'bpmn' | 'dmn' | 'form';
30
47
 
48
+ export declare interface AssistantMessage {
49
+ readonly kind: 'assistant';
50
+ readonly messageId: string;
51
+ readonly turnId: string;
52
+ readonly content: string;
53
+ readonly steps: ReadonlyArray<MessageStep>;
54
+ readonly createdAt: string;
55
+ readonly state: MessageState;
56
+ readonly cancellationReason?: TurnCancellationReason;
57
+ readonly inputDelivery: 'sending' | 'confirmed' | 'unverified';
58
+ readonly remoteStop?: RemoteStopStatus;
59
+ readonly phase?: MessagePhase;
60
+ readonly error?: CopilotError;
61
+ readonly questions?: ReadonlyArray<ConversationQuestion>;
62
+ }
63
+
31
64
  export declare interface BpmnElementReference {
32
65
  readonly artifactId: string;
33
66
  readonly elementId: string;
34
67
  }
35
68
 
36
- export declare interface Candidate {
37
- readonly candidateId: string;
38
- readonly messageId: string;
39
- readonly state: CandidateState;
40
- readonly changes: ReadonlyArray<ArtifactChange>;
41
- readonly checkpointId?: string;
42
- }
43
-
44
- export declare const CandidateReview: ({ candidate, onReviewReady }: CandidateReviewProps) => JSX.Element;
69
+ export declare const closeSidecar: () => void;
45
70
 
46
- export declare interface CandidateReviewProps {
47
- readonly candidate: Candidate;
48
- readonly onReviewReady?: (ready: boolean) => void;
71
+ export declare interface ContextRef {
72
+ readonly type: 'project';
73
+ readonly id: string;
74
+ readonly availability: 'available' | 'deleted' | 'no_access';
49
75
  }
50
76
 
51
- export declare type CandidateState = 'proposed' | 'applied' | 'rejected' | 'cancelled' | 'stale';
52
-
53
- export declare const closeSidecar: () => void;
54
-
55
77
  export declare interface Conversation extends ConversationSummary {
78
+ readonly context: ReadonlyArray<ContextRef>;
56
79
  readonly messages: ReadonlyArray<ConversationMessage>;
57
80
  readonly availability?: OrganizationAvailability;
58
81
  readonly verificationHealth?: VerificationHealth | null;
59
- readonly sourceChangedMessageId?: string | null;
82
+ readonly draft: Draft | null;
83
+ readonly lastApply?: {
84
+ readonly applyId: string;
85
+ readonly undoable: boolean;
86
+ readonly artifacts: ReadonlyArray<ArtifactRef>;
87
+ };
60
88
  }
61
89
 
62
90
  export declare const CONVERSATION_NAME_MAX_LENGTH = 100;
63
91
 
92
+ export declare type ConversationChanges = Omit<Conversation, 'messages' | 'draft'> & Partial<Pick<Conversation, 'draft'>> & {
93
+ readonly messages: readonly ConversationMessageRow[];
94
+ };
95
+
64
96
  export declare type ConversationEvent = RevisionedConversationEvent | {
65
97
  readonly type: 'availability_changed';
66
98
  readonly conversationId: string;
99
+ readonly revision: number;
67
100
  };
68
101
 
69
- export declare interface ConversationMessage {
70
- readonly messageId: string;
71
- readonly role: 'user' | 'assistant';
72
- readonly content: string;
73
- readonly steps: ReadonlyArray<MessageStep>;
74
- readonly createdAt?: string;
75
- readonly state?: MessageState;
76
- readonly phase?: MessagePhase;
77
- readonly remoteStop?: RemoteStopStatus;
78
- readonly cancellationReason?: TurnCancellationReason;
79
- readonly candidate?: Candidate;
80
- readonly error?: CopilotError;
81
- readonly questions?: ReadonlyArray<ConversationQuestion>;
102
+ export declare type ConversationMessage = UserMessage | AssistantMessage | EventMessage;
103
+
104
+ export declare interface ConversationMessagePage {
105
+ readonly messages: readonly ConversationMessageRow[];
106
+ readonly olderCursor: string | null;
82
107
  }
83
108
 
109
+ export declare type ConversationMessageRow = ConversationMessage & {
110
+ readonly sequence: number;
111
+ readonly revision: number;
112
+ };
113
+
114
+ export declare type ConversationPage = Omit<Conversation, 'messages'> & ConversationMessagePage;
115
+
84
116
  export declare interface ConversationQuestion {
85
117
  readonly questionId: string;
86
118
  readonly messageId: string;
@@ -103,20 +135,33 @@ export declare interface ConversationQuestion {
103
135
  readonly createdAt: string;
104
136
  }
105
137
 
138
+ export declare interface ConversationRevisionNotice {
139
+ readonly chatId: string;
140
+ readonly revision: number;
141
+ readonly reset?: true;
142
+ }
143
+
106
144
  export declare type ConversationStatus = 'idle' | 'running';
107
145
 
108
146
  declare interface ConversationStoreState {
109
147
  readonly conversationId: string | null;
110
148
  readonly revision?: number;
111
149
  readonly snapshotRevision?: number;
150
+ readonly draftRevision?: number;
151
+ readonly rows?: readonly ConversationMessageRow[];
152
+ readonly olderCursor?: string | null;
153
+ readonly oldestLoadedSequence?: number;
112
154
  readonly status: ConversationStatus | null;
113
155
  readonly verificationHealth: VerificationHealth | null;
114
- readonly sourceChangedMessageId: string | null;
115
156
  readonly name: string | null;
116
- readonly originArtifact: ArtifactRef | null;
157
+ readonly entryPoint: ArtifactRef | null;
117
158
  readonly preview: string;
118
- readonly pendingCandidate: boolean;
159
+ readonly hasOpenDraft: boolean;
160
+ readonly pendingMessageCount: number;
119
161
  readonly availability: OrganizationAvailability | null;
162
+ readonly context: Conversation['context'];
163
+ readonly draft: Draft | null;
164
+ readonly lastApply: Conversation['lastApply'] | null;
120
165
  readonly pendingQuestionId?: string;
121
166
  readonly messages: ReadonlyArray<MessageStoreState>;
122
167
  readonly messagesLoaded: boolean;
@@ -124,12 +169,13 @@ declare interface ConversationStoreState {
124
169
 
125
170
  export declare interface ConversationSummary {
126
171
  readonly conversationId: string;
127
- readonly revision?: number;
172
+ readonly revision: number;
128
173
  readonly status: ConversationStatus;
129
174
  readonly name?: string;
130
- readonly originArtifact?: ArtifactRef;
175
+ readonly entryPoint?: ArtifactRef;
131
176
  readonly preview: string;
132
- readonly pendingCandidate: boolean;
177
+ readonly hasOpenDraft: boolean;
178
+ readonly pendingMessageCount: number;
133
179
  readonly pendingQuestionId?: string;
134
180
  }
135
181
 
@@ -145,23 +191,41 @@ export declare interface CopilotBadgeProps {
145
191
  }
146
192
 
147
193
  export declare interface CopilotClient {
148
- getAvailability?(): Promise<OrganizationAvailability>;
149
- answerQuestion?(input: AnswerQuestionInput): Promise<void>;
150
- postMessage(input: PostMessageInput): Promise<{
151
- conversationId: string;
152
- }>;
153
- observe(conversationId: string, onEvent: (event: ConversationEvent) => void, onConnected?: () => void, onError?: (error: Error) => void): () => void;
154
- getConversation(conversationId: string): Promise<Conversation>;
194
+ getAvailability(): Promise<OrganizationAvailability>;
195
+ answerQuestion(input: AnswerQuestionInput): Promise<ConversationQuestion>;
196
+ postMessage(input: PostMessageInput): Promise<PostMessageResult>;
197
+ observe(conversationId: string, onRevision: (notice: ConversationRevisionNotice) => void, onConnected?: () => void, onError?: (error: Error) => void): () => void;
198
+ getConversation(conversationId: string): Promise<ConversationPage>;
199
+ getOlderMessages(conversationId: string, cursor: string): Promise<ConversationMessagePage>;
200
+ getChanges(conversationId: string, since: number): Promise<ConversationChanges>;
155
201
  listConversations(): Promise<ReadonlyArray<ConversationSummary>>;
156
- observeConversationList?(onSummary: (summary: ConversationSummary) => void, onConnected?: () => void, onError?: (error: Error) => void): () => void;
157
- renameConversation?(conversationId: string, name: string): Promise<ConversationSummary>;
158
- approve(candidateId: string): Promise<void>;
159
- reject(candidateId: string): Promise<void>;
160
- restoreCheckpoint(checkpointId: string): Promise<void>;
161
- cancelTurn(conversationId: string): Promise<void>;
202
+ observeConversationList(onSummary: (summary: ConversationSummary) => void, onConnected?: () => void, onError?: (error: Error) => void): () => void;
203
+ renameConversation(conversationId: string, name: string): Promise<ConversationSummary>;
204
+ deleteConversation(conversationId: string): Promise<void>;
205
+ sendHeldMessages(conversationId: string): Promise<void>;
206
+ retryMessage(conversationId: string, messageId: string): Promise<void>;
207
+ cancelMessage(conversationId: string, messageId: string): Promise<void>;
208
+ resendTurnInput(conversationId: string, turnId: string): Promise<void>;
209
+ stopTurn(conversationId: string): Promise<void>;
210
+ applyDraft(input: ApplyDraftInput): Promise<ApplyDraftResult>;
211
+ discardDraft(input: {
212
+ readonly conversationId: string;
213
+ readonly draftId: string;
214
+ readonly artifactKeys?: ReadonlyArray<string>;
215
+ }): Promise<void>;
216
+ revertDraft(input: {
217
+ readonly conversationId: string;
218
+ readonly draftId: string;
219
+ readonly beforeTurnId: string;
220
+ }): Promise<void>;
221
+ updateDraftFromLive(input: {
222
+ readonly conversationId: string;
223
+ readonly submissionId: string;
224
+ }): Promise<PostMessageResult>;
225
+ undoApply(conversationId: string, applyId: string): Promise<void>;
162
226
  }
163
227
 
164
- export declare const CopilotConversationPanel: ({ client, conversationId, onConversationStarted, onSelectConversation, projectName, projectNameUnavailable, readOnlyReason, onOpenProject, onClose, renderReview, renderElementReference, artifacts, suggestions, selectionContext, }: CopilotConversationPanelProps) => JSX.Element;
228
+ export declare const CopilotConversationPanel: ({ client, conversationId, onConversationStarted, onSelectConversation, projectName, projectNameUnavailable, readOnlyReason, onOpenProject, onClose, openDraftReview, renderElementReference, artifacts, suggestions, selectionContext, }: CopilotConversationPanelProps) => JSX.Element;
165
229
 
166
230
  export declare interface CopilotConversationPanelProps {
167
231
  readonly client: CopilotClient;
@@ -173,10 +237,9 @@ export declare interface CopilotConversationPanelProps {
173
237
  readonly readOnlyReason?: string;
174
238
  readonly onOpenProject?: (projectId: string) => void;
175
239
  readonly onClose?: () => void;
176
- readonly renderReview?: (candidate: Candidate, actions: {
177
- approve: () => Promise<void>;
178
- reject: () => Promise<void>;
179
- }) => ReactNode;
240
+ readonly openDraftReview: (input: OpenDraftReviewInput) => void;
241
+ /** @deprecated Retained for host compatibility. Chat restore uses `undoApply`. */
242
+ readonly openVersionHistory?: (fileId: string) => void;
180
243
  readonly artifacts?: ReadonlyArray<ArtifactRef>;
181
244
  readonly suggestions?: ReadonlyArray<string>;
182
245
  readonly selectionContext?: {
@@ -204,6 +267,41 @@ export declare const createFixtureClient: (options?: FixtureClientOptions) => Co
204
267
 
205
268
  export declare const createHttpClient: (options: HttpClientOptions) => CopilotClient;
206
269
 
270
+ export declare interface Draft {
271
+ readonly draftId: string;
272
+ readonly generation: number;
273
+ readonly writable: boolean;
274
+ readonly artifacts: ReadonlyArray<DraftArtifact>;
275
+ readonly steps: ReadonlyArray<DraftStep>;
276
+ }
277
+
278
+ export declare interface DraftArtifact {
279
+ readonly artifactKey: string;
280
+ readonly artifact: ArtifactRef;
281
+ readonly change: 'create' | 'modify' | 'delete' | 'rename' | 'move';
282
+ readonly fromIncompleteTurn: boolean;
283
+ readonly access: 'edit' | 'read' | 'none';
284
+ readonly divergence?: {
285
+ readonly kind: 'edited' | 'renamed' | 'moved' | 'deleted';
286
+ readonly liveFingerprint: string;
287
+ readonly by?: UserRef;
288
+ readonly at?: string;
289
+ };
290
+ readonly otherConversationIds: ReadonlyArray<string>;
291
+ readonly validationMessages?: ReadonlyArray<string>;
292
+ }
293
+
294
+ export declare type DraftArtifactView = 'draft' | 'diff' | 'live';
295
+
296
+ export declare interface DraftStep {
297
+ readonly stepId: string;
298
+ readonly kind: DraftStepKind;
299
+ readonly turnId?: string;
300
+ readonly reverted: boolean;
301
+ }
302
+
303
+ export declare type DraftStepKind = 'turn' | 'user_edits' | 'revert' | 'discard' | 'transfer';
304
+
207
305
  export declare type ElementReferenceRenderer = (reference: BpmnElementReference, context: {
208
306
  readonly label: string;
209
307
  readonly messageId: string;
@@ -212,6 +310,12 @@ export declare type ElementReferenceRenderer = (reference: BpmnElementReference,
212
310
 
213
311
  export declare const encodeBpmnElementReference: (reference: BpmnElementReference) => string;
214
312
 
313
+ export declare interface EventMessage {
314
+ readonly kind: 'event';
315
+ readonly messageId: string;
316
+ readonly event: TranscriptEvent;
317
+ }
318
+
215
319
  export declare interface EventSourceLike {
216
320
  onmessage: ((message: {
217
321
  data: string;
@@ -221,16 +325,26 @@ export declare interface EventSourceLike {
221
325
  close(): void;
222
326
  }
223
327
 
328
+ export declare interface FixtureArtifactChange {
329
+ readonly changeKind: 'create' | 'modify';
330
+ readonly artifact: ArtifactRef;
331
+ readonly content: string;
332
+ readonly before?: string;
333
+ readonly validationMessages?: ReadonlyArray<string>;
334
+ }
335
+
224
336
  export declare interface FixtureClientOptions {
225
337
  readonly resolveScript?: (input: PostMessageInput) => FixtureScript;
226
- readonly originArtifact?: ArtifactRef;
338
+ readonly entryPoint?: ArtifactRef;
227
339
  readonly timing?: FixtureTiming;
340
+ readonly onDraftApplied?: (changes: ReadonlyArray<FixtureArtifactChange>) => void;
341
+ readonly onApplyUndone?: (changes: ReadonlyArray<FixtureArtifactChange>) => void;
228
342
  }
229
343
 
230
344
  export declare interface FixtureScript {
231
345
  readonly outcome: 'answer' | 'propose' | 'failed' | 'run_forever';
232
346
  readonly answer?: string;
233
- readonly changes?: ReadonlyArray<ArtifactChange>;
347
+ readonly changes?: ReadonlyArray<FixtureArtifactChange>;
234
348
  readonly error?: CopilotError;
235
349
  readonly stepLabels?: ReadonlyArray<string>;
236
350
  readonly continuationStepLabels?: ReadonlyArray<string>;
@@ -266,20 +380,19 @@ export declare interface MessageStep {
266
380
  readonly startedAt?: string;
267
381
  }
268
382
 
269
- declare interface MessageStoreState {
270
- readonly messageId: string;
271
- readonly role: 'user' | 'assistant';
272
- readonly content: string;
273
- readonly steps: ReadonlyArray<MessageStep>;
274
- readonly createdAt: string | null;
383
+ declare type MessageStoreState = ConversationMessage & {
275
384
  readonly activity: string | null;
276
- readonly phase: MessagePhase | null;
277
- readonly remoteStop: RemoteStopStatus | null;
278
- readonly cancellationReason?: ConversationMessage['cancellationReason'];
279
- readonly state: MessageState | null;
280
- readonly candidate: Candidate | null;
281
- readonly error: CopilotError | null;
282
- readonly questions?: ReadonlyArray<ConversationQuestion>;
385
+ };
386
+
387
+ export declare interface OpenDraftArtifactInput {
388
+ readonly conversationId: string;
389
+ readonly artifactKey: string;
390
+ readonly view: DraftArtifactView;
391
+ }
392
+
393
+ export declare interface OpenDraftReviewInput {
394
+ readonly conversationId: string;
395
+ readonly draftId: string;
283
396
  }
284
397
 
285
398
  export declare const openSidecar: () => void;
@@ -298,52 +411,90 @@ export declare const parseBpmnElementReference: (destination: string) => {
298
411
  readonly reference: BpmnElementReference;
299
412
  };
300
413
 
301
- export declare interface PostMessageInput {
414
+ declare interface PostMessageFields {
415
+ readonly submissionId: string;
302
416
  readonly prompt: string;
303
- readonly conversationId?: string;
304
- readonly context?: Record<string, unknown>;
305
- readonly reapplyCandidateId?: string;
417
+ readonly focus?: Record<string, unknown>;
418
+ readonly context?: ReadonlyArray<ContextRef>;
419
+ }
420
+
421
+ export declare type PostMessageInput = PostMessageFields & ({
422
+ readonly conversationId: string;
423
+ readonly newConversationId?: never;
424
+ } | {
425
+ readonly conversationId?: never;
426
+ readonly newConversationId: string;
427
+ });
428
+
429
+ export declare interface PostMessageResult {
430
+ readonly conversationId: string;
431
+ readonly messageId: string;
432
+ readonly delivery: 'delivered' | 'pending' | 'answered_question';
306
433
  }
307
434
 
308
435
  export declare type RemoteStopStatus = 'not_sent' | 'pending' | 'confirmed' | 'unconfirmed';
309
436
 
310
437
  declare type RevisionedConversationEvent = {
311
- readonly revision?: number;
438
+ readonly revision: number;
312
439
  } & ({
313
440
  readonly type: 'question_requested' | 'question_answered' | 'question_delivery_changed';
314
441
  readonly messageId: string;
315
442
  readonly question: ConversationQuestion;
316
443
  } | {
317
444
  readonly type: 'turn_started';
318
- readonly messageId: string;
319
- readonly userMessageId: string;
320
- readonly userContent: string;
321
- } | {
445
+ readonly turnId: string;
446
+ readonly assistantMessageId: string;
447
+ readonly userMessageIds: ReadonlyArray<string>;
448
+ } | ({
322
449
  readonly type: 'turn_finished';
323
- readonly messageId: string;
324
- readonly outcome: 'complete' | 'cancelled';
450
+ readonly turnId: string;
451
+ readonly assistantMessageId: string;
452
+ readonly outcome: 'complete';
453
+ } & {
454
+ readonly cancellationReason?: never;
455
+ readonly error?: never;
456
+ }) | ({
457
+ readonly type: 'turn_finished';
458
+ readonly turnId: string;
459
+ readonly assistantMessageId: string;
460
+ readonly outcome: 'cancelled';
325
461
  readonly cancellationReason?: TurnCancellationReason;
462
+ } & {
463
+ readonly error?: never;
464
+ }) | {
465
+ readonly type: 'turn_finished';
466
+ readonly turnId: string;
467
+ readonly assistantMessageId: string;
468
+ readonly outcome: 'failed';
469
+ readonly error: CopilotError;
470
+ readonly cancellationReason?: never;
326
471
  } | {
327
- readonly type: 'candidate_proposed';
328
- readonly messageId: string;
329
- readonly candidateId: string;
472
+ readonly type: 'turn_input_delivery';
473
+ readonly turnId: string;
474
+ readonly inputDelivery: 'sending' | 'confirmed' | 'unverified';
330
475
  } | {
331
- readonly type: 'candidate_resolved';
476
+ readonly type: 'message_delivery';
332
477
  readonly messageId: string;
333
- readonly candidateId: string;
334
- readonly state: CandidateState;
335
- readonly checkpointId?: string;
478
+ readonly delivery: 'delivered' | 'pending' | 'held' | 'failed' | 'cancelled';
479
+ readonly deliveryError?: CopilotError;
336
480
  } | {
337
- readonly type: 'checkpoint_restored';
338
- readonly checkpointId: string;
339
- readonly contents: ReadonlyArray<{
340
- readonly name: string;
341
- readonly content: string | null;
342
- }>;
481
+ readonly type: 'draft_changed';
482
+ readonly draftId: string;
483
+ readonly generation: number;
343
484
  } | {
344
- readonly type: 'failed';
345
- readonly messageId: string;
346
- readonly error: CopilotError;
485
+ readonly type: 'draft_resolved';
486
+ readonly draftId: string;
487
+ readonly outcome: 'applied';
488
+ readonly applyId: string;
489
+ } | {
490
+ readonly type: 'draft_resolved';
491
+ readonly draftId: string;
492
+ readonly outcome: 'discarded' | 'transferred';
493
+ readonly applyId?: never;
494
+ } | {
495
+ readonly type: 'apply_undone';
496
+ readonly applyId: string;
497
+ readonly artifacts: ReadonlyArray<ArtifactRef>;
347
498
  } | {
348
499
  readonly type: 'text';
349
500
  readonly messageId: string;
@@ -375,9 +526,6 @@ declare type RevisionedConversationEvent = {
375
526
  readonly type: 'step_removed';
376
527
  readonly messageId: string;
377
528
  readonly stepId: string;
378
- } | {
379
- readonly type: 'source_changed';
380
- readonly messageId: string;
381
529
  });
382
530
 
383
531
  export declare interface SidecarRenderProps {
@@ -391,28 +539,70 @@ export declare type StepStatus = 'active' | 'complete' | 'error';
391
539
 
392
540
  export declare const toggleSidecar: () => void;
393
541
 
394
- export declare type TurnCancellationReason = 'organization_disabled';
542
+ export declare type TranscriptEvent = {
543
+ readonly type: 'draft_applied';
544
+ readonly draftId: string;
545
+ readonly applyId: string;
546
+ readonly generation: number;
547
+ readonly artifacts: ReadonlyArray<ArtifactRef>;
548
+ } | {
549
+ readonly type: 'draft_discarded';
550
+ readonly draftId: string;
551
+ readonly generation: number;
552
+ readonly artifactKeys: ReadonlyArray<string>;
553
+ } | {
554
+ readonly type: 'draft_reverted';
555
+ readonly draftId: string;
556
+ readonly beforeTurnId: string;
557
+ readonly generation: number;
558
+ readonly stepId: string;
559
+ readonly revertedStepIds: ReadonlyArray<string>;
560
+ } | {
561
+ readonly type: 'apply_undone';
562
+ readonly applyId: string;
563
+ readonly artifacts: ReadonlyArray<ArtifactRef>;
564
+ } | {
565
+ readonly type: 'continued_from';
566
+ readonly conversationId: string;
567
+ readonly sourceConversationId: string;
568
+ readonly sourceDraftId?: string;
569
+ };
570
+
571
+ export declare type TurnCancellationReason = 'user_stop' | 'redirected' | 'chat_deleted' | 'organization_disabled';
395
572
 
396
573
  export declare const useCopilotConversation: ({ client, conversationId, }: UseCopilotConversationOptions) => {
397
- refreshAvailability: () => Promise<OrganizationAvailability | null>;
398
- originArtifact: ArtifactRef | null;
574
+ refreshAvailability: () => Promise<OrganizationAvailability>;
575
+ entryPoint: ArtifactRef | null;
399
576
  messages: readonly MessageStoreState[];
400
577
  messagesLoaded: boolean;
401
- pendingCandidate: boolean;
578
+ hasOlderMessages: boolean;
579
+ loadOlderMessages: () => Promise<void>;
580
+ hasOpenDraft: boolean;
581
+ pendingMessageCount: number;
582
+ draft: Draft | null;
583
+ lastApply: {
584
+ readonly applyId: string;
585
+ readonly undoable: boolean;
586
+ readonly artifacts: ReadonlyArray<ArtifactRef>;
587
+ } | null | undefined;
588
+ context: readonly ContextRef[];
402
589
  pendingQuestion: ConversationQuestion | undefined;
403
- supportsQuestions: boolean;
404
590
  answerQuestion: (input: AnswerQuestionInput) => Promise<void>;
405
591
  isRunning: boolean;
406
- sourceChangedMessageId: string | null;
407
592
  synchronizationError: Error | null;
408
593
  verificationWarning: boolean;
409
- postMessage: (prompt: string) => Promise<string>;
410
- reapply: (candidateId: string, prompt?: string) => Promise<void>;
594
+ postMessage: (prompt: string) => Promise<PostMessageResult>;
595
+ applyDraft: (input: Parameters<CopilotClient["applyDraft"]>[0]) => Promise<ApplyDraftResult>;
596
+ discardDraft: (input: Parameters<CopilotClient["discardDraft"]>[0]) => Promise<void>;
597
+ revertDraft: (input: Parameters<CopilotClient["revertDraft"]>[0]) => Promise<void>;
598
+ updateDraftFromLive: () => Promise<PostMessageResult>;
599
+ undoApply: (applyId: string) => Promise<void>;
600
+ sendHeldMessages: () => Promise<void>;
601
+ retryMessage: (messageId: string) => Promise<void>;
602
+ cancelMessage: (messageId: string) => Promise<void>;
603
+ resendTurnInput: (turnId: string) => Promise<void>;
604
+ stopTurn: () => Promise<void>;
411
605
  refresh: () => Promise<void>;
412
- approve: (candidateId: string) => Promise<void>;
413
- reject: (candidateId: string) => Promise<void>;
414
- restoreCheckpoint: (checkpointId: string) => Promise<void>;
415
- cancelTurn: () => Promise<void>;
416
606
  availability: OrganizationAvailability | null;
417
607
  availabilityLoading: boolean;
418
608
  availabilityError: Error | null;
@@ -439,6 +629,21 @@ export declare interface UseCopilotConversationOptions {
439
629
  readonly conversationId: string | null;
440
630
  }
441
631
 
632
+ export declare interface UserMessage {
633
+ readonly kind: 'user';
634
+ readonly messageId: string;
635
+ readonly turnId?: string;
636
+ readonly content: string;
637
+ readonly createdAt: string;
638
+ readonly delivery?: 'pending' | 'held' | 'failed' | 'cancelled';
639
+ readonly deliveryError?: CopilotError;
640
+ }
641
+
642
+ export declare interface UserRef {
643
+ readonly id: string;
644
+ readonly name: string;
645
+ }
646
+
442
647
  export declare const useSidecarOpen: () => boolean;
443
648
 
444
649
  /** ISO 8601 provider-verification timestamps for one assistant message, not a terminal state. */
package/dist/index.js CHANGED
@@ -1,18 +1,17 @@
1
- import { C as s, a as o, b as t, c as i, d as n, e as r, f as C, g as c, h as l, o as p, i as d, t as S, u as m, j as u, k as E } from "./index-DAyxug2G.js";
1
+ import { C as o, a as s, b as t, c as i, d as n, e as r, f as c, g as l, o as p, h as C, t as d, u as S, i as m, j as u } from "./index-CNP5V04Z.js";
2
2
  export {
3
- s as CONVERSATION_NAME_MAX_LENGTH,
4
- o as CandidateReview,
5
- t as CopilotBadge,
6
- i as CopilotConversationPanel,
7
- n as CopilotSidecar,
8
- r as closeSidecar,
9
- C as createFixtureClient,
3
+ o as CONVERSATION_NAME_MAX_LENGTH,
4
+ s as CopilotBadge,
5
+ t as CopilotConversationPanel,
6
+ i as CopilotSidecar,
7
+ n as closeSidecar,
8
+ r as createFixtureClient,
10
9
  c as createHttpClient,
11
10
  l as encodeBpmnElementReference,
12
11
  p as openSidecar,
13
- d as parseBpmnElementReference,
14
- S as toggleSidecar,
15
- m as useCopilotConversation,
16
- u as useCopilotConversationList,
17
- E as useSidecarOpen
12
+ C as parseBpmnElementReference,
13
+ d as toggleSidecar,
14
+ S as useCopilotConversation,
15
+ m as useCopilotConversationList,
16
+ u as useSidecarOpen
18
17
  };
@@ -0,0 +1,4 @@
1
+ import { p } from "./index-CNP5V04Z.js";
2
+ export {
3
+ p as Mermaid
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/copilot-chat",
3
- "version": "0.8.1-alpha.4",
3
+ "version": "0.8.1-alpha.5",
4
4
  "description": "Camunda Copilot Client Library - React components and utilities for Camunda Platform 8",
5
5
  "license": "Camunda License 1.0",
6
6
  "type": "module",
@@ -1,4 +0,0 @@
1
- import { p } from "./index-DAyxug2G.js";
2
- export {
3
- p as Mermaid
4
- };