@camunda/copilot-chat 0.7.0 → 0.8.1-alpha.0

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
@@ -1,794 +1,334 @@
1
- import { JSX } from 'react/jsx-runtime';
2
- import { layoutProcess } from 'bpmn-auto-layout';
3
- import { MarkdownProps } from '@carbon/ai-chat-components/es/react/markdown';
1
+ import { JSX } from 'react';
4
2
  import { ReactNode } from 'react';
5
- import { StoreApi } from 'zustand';
6
- import { UseBoundStore } from 'zustand';
7
3
 
8
- export declare const adaptBpmnLintErrorsForLlm: (rawLintErrors: ReadonlyArray<RawBpmnLintError>) => ReadonlyArray<LintError>;
9
-
10
- export declare interface AgentAdapterConfig {
11
- readonly transport: AgentTransport;
12
- readonly onToolInvoke?: (toolName: string, args: Record<string, unknown>) => Promise<unknown>;
13
- readonly getStatusLabel?: (eventType: EventTypeValue, toolName?: string, eventStatus?: EventStatusValue) => string;
14
- }
15
-
16
- export declare interface AgentAdapterReturn {
17
- readonly sendMessage: (content: string, context: Record<string, unknown>) => Promise<void>;
18
- readonly stopGeneration: () => void;
19
- readonly resetConversation: () => void;
20
- readonly loadConversation: (conversationId: string) => Promise<void>;
21
- readonly isBusy: boolean;
22
- }
23
-
24
- export declare interface AgentEvent {
25
- readonly conversationId: string;
26
- readonly type: EventTypeValue;
27
- readonly status: EventStatusValue;
28
- readonly content?: string;
29
- readonly toolName?: string;
30
- readonly toolCallId?: string;
31
- readonly toolArguments?: string;
32
- readonly toolResult?: string;
33
- readonly skillName?: string;
34
- }
35
-
36
- export declare type AgentResult = ToolInvokeResult | MixedToolResultEvent | ConversationTitleResult;
37
-
38
- export declare const AgentState: {
39
- readonly IDLE: "IDLE";
40
- readonly BUSY: "BUSY";
41
- readonly AWAITING_TOOL: "AWAITING_TOOL";
42
- readonly ERROR: "ERROR";
43
- };
44
-
45
- export declare type AgentStateType = (typeof AgentState)[keyof typeof AgentState];
46
-
47
- declare type AgentStore = AgentStoreState & AgentStoreActions & {
48
- callbacks: AgentStoreCallbacks;
49
- };
50
-
51
- declare interface AgentStoreActions {
52
- readonly startConversation: (conversationId: string, messageId: string) => void;
53
- readonly processEvent: (event: AgentEvent) => AgentResult | null;
54
- readonly clearPendingTool: () => void;
55
- readonly setError: (error: string) => void;
56
- readonly reset: () => void;
57
- readonly setCallbacks: (callbacks: AgentStoreCallbacks) => void;
58
- readonly setConversationId: (conversationId: string) => void;
59
- }
60
-
61
- declare interface AgentStoreCallbacks {
62
- readonly onMessageStatusUpdate?: MessageStatusCallback;
63
- readonly onStatusLabelClear?: StatusLabelCallback;
64
- readonly onMessageError?: MessageErrorCallback;
65
- }
66
-
67
- declare interface AgentStoreState {
68
- readonly conversationId: string | null;
69
- readonly currentMessageId: string | null;
70
- readonly isBusy: boolean;
71
- readonly currentEventType: EventTypeValue | null;
72
- readonly currentToolName: string | null;
73
- readonly pendingToolInvoke: {
74
- readonly toolName: string;
75
- readonly toolCallId?: string;
76
- readonly toolArguments: Record<string, unknown>;
77
- } | null;
78
- readonly error: string | null;
79
- }
80
-
81
- export declare interface AgentTransport {
82
- subscribe(conversationId: string, onEvent: (event: AgentEvent) => void): void;
83
- unsubscribe(conversationId: string): void;
84
- sendMessage(payload: SendMessagePayload): Promise<void>;
85
- sendToolResult(payload: ToolResultPayload): Promise<void>;
86
- haltConversation?(conversationId: string): Promise<void>;
87
- updateConversation?(conversationId: string, payload: UpdateConversationPayload): Promise<void>;
88
- deleteConversation?(conversationId: string): Promise<void>;
89
- fetchConversations?(page: number, size: number): Promise<ConversationsPage>;
90
- fetchConversationMessages?(conversationId: string, cursor?: number | null, limit?: number): Promise<ConversationMessagesPage>;
91
- rollbackConversation?(conversationId: string, milestoneId: string): Promise<RollbackResponse | undefined>;
92
- registerSkills?(conversationId: string, skills: readonly SkillDefinition[]): Promise<void>;
4
+ export declare interface ArtifactChange {
5
+ readonly changeKind: 'create' | 'modify';
6
+ readonly artifact: ArtifactRef;
7
+ readonly content: string;
8
+ readonly before?: string;
9
+ readonly validationMessages?: ReadonlyArray<string>;
93
10
  }
94
11
 
95
- export declare const allBpmnSkills: ParsedSkill[];
96
-
97
- declare interface BackendToolPayload {
12
+ export declare interface ArtifactRef {
13
+ readonly projectId: string;
14
+ readonly artifactId: string;
98
15
  readonly name: string;
99
- readonly description: string;
100
- readonly parameters: Record<string, unknown>;
101
- readonly category: string;
102
- }
103
-
104
- export declare interface BpmnElement {
105
- readonly id: string;
106
- readonly type: string;
107
- readonly businessObject: Record<string, unknown>;
108
- readonly parent?: BpmnElement;
109
- readonly incoming?: ReadonlyArray<BpmnElement>;
110
- readonly outgoing?: ReadonlyArray<BpmnElement>;
111
- readonly children?: ReadonlyArray<BpmnElement>;
16
+ readonly type: ArtifactType;
112
17
  }
113
18
 
114
- export declare interface BpmnModeler {
115
- readonly get: (serviceName: string, strict?: boolean) => unknown;
116
- readonly saveXML: (options?: {
117
- format?: boolean;
118
- }) => Promise<{
119
- xml: string;
120
- }>;
121
- }
19
+ export declare type ArtifactType = 'bpmn' | 'dmn' | 'form';
122
20
 
123
- export declare const camundaDocsSearchTool: {
124
- readonly name: "camunda_docs_search";
125
- readonly displayName: "Searching docs";
126
- readonly description: string;
127
- readonly parameters: {
128
- readonly type: "object";
129
- readonly properties: {
130
- readonly query: {
131
- readonly type: "string";
132
- readonly description: "The search query to find information in the Camunda knowledge base";
133
- };
134
- };
135
- readonly required: readonly ["query"];
136
- };
137
- readonly type: "frontend";
138
- readonly contentType: "TEXT";
139
- readonly category: "GENERAL";
140
- readonly handler: ToolHandler;
141
- };
142
-
143
- export declare interface camundaDocsSearchToolResult {
144
- readonly answer: string;
145
- readonly sources: readonly KapaAiSearchResult[];
146
- }
147
-
148
- export declare const CAPABILITY: {
149
- readonly BPMN_EDITING: "BPMN_EDITING";
150
- readonly FORM_EDITING: "FORM_EDITING";
151
- readonly DMN_EDITING: "DMN_EDITING";
152
- readonly FEEL_EDITING: "FEEL_EDITING";
153
- readonly BPMN_VIEWING: "BPMN_VIEWING";
154
- readonly FORM_VIEWING: "FORM_VIEWING";
155
- readonly DMN_VIEWING: "DMN_VIEWING";
156
- readonly FILE_OPERATIONS: "FILE_OPERATIONS";
157
- readonly FILE_CREATION: "FILE_CREATION";
158
- readonly VALIDATION: "VALIDATION";
159
- readonly INTEGRATION: "INTEGRATION";
160
- };
161
-
162
- export declare type Capability = (typeof CAPABILITY)[keyof typeof CAPABILITY];
163
-
164
- declare interface ChatActions {
165
- readonly addUserMessage: (content: string) => string;
166
- readonly addAssistantMessage: (id: string) => void;
167
- readonly appendToMessage: (id: string, content: string) => void;
168
- readonly setMessageContent: (id: string, content: string) => void;
169
- readonly updateMessageStatus: (id: string, status: MessageStatus) => void;
170
- readonly updateMessageStatusLabel: (id: string, statusLabel: string) => void;
171
- readonly setMessageSources: (id: string, sources: readonly SourceReference[]) => void;
172
- readonly setStreaming: (isStreaming: boolean, messageId?: string | null) => void;
173
- readonly clearMessages: () => void;
174
- readonly addThinkingBlock: (messageId: string, blockId: string, label: string) => void;
175
- readonly appendToThinkingBlock: (messageId: string, blockId: string, content: string) => void;
176
- readonly completeThinkingBlock: (messageId: string, blockId: string) => void;
177
- readonly completeAllThinkingBlocks: (messageId: string) => void;
178
- readonly setMessageError: (id: string, errorMessage: string) => void;
179
- readonly addToolBlock: (messageId: string, blockId: string, toolName: string, stepNumber: number, toolArguments?: Record<string, unknown>) => void;
180
- readonly updateToolBlockStatus: (messageId: string, blockId: string, status: ToolBlockStatus) => void;
181
- readonly updateToolBlockResult: (messageId: string, blockId: string, toolResult: string) => void;
182
- readonly addErrorBlock: (messageId: string, blockId: string, errorMessage: string) => void;
183
- readonly setView: (view: ChatView_2) => void;
184
- readonly setConversationTitle: (title: string) => void;
185
- readonly loadConversation: (messages: readonly ChatMessage_2[], title: string | null) => void;
186
- readonly prependMessages: (messages: readonly ChatMessage_2[]) => void;
187
- readonly rollbackToMessage: (messageId: string) => void;
188
- readonly addRollbackMessage: (content: string, milestoneId: string) => void;
189
- readonly setLastAssistantMessageMilestone: (milestoneId: string) => void;
190
- readonly setLastUserMessageMilestone: (milestoneId: string) => void;
191
- }
192
-
193
- export declare const ChatInput: ({ onSend, onStop, isBusy, isDisabled, placeholder, isOpen, }: ChatInputProps) => JSX.Element;
194
-
195
- declare interface ChatInputProps {
196
- readonly onSend: (message: string) => void;
197
- readonly onStop?: () => void;
198
- readonly isBusy?: boolean;
199
- readonly isDisabled?: boolean;
200
- readonly placeholder?: string;
201
- readonly isOpen?: boolean;
202
- }
203
-
204
- export declare const ChatMessage: ({ message, isBusy }: ChatMessageProps) => JSX.Element;
205
-
206
- declare interface ChatMessage_2 {
207
- readonly id: string;
208
- readonly role: MessageRole;
209
- readonly content: string;
210
- readonly status: MessageStatus;
211
- readonly timestamp?: number;
212
- readonly statusLabel?: string;
213
- readonly thinkingBlocks?: readonly ThinkingBlock[];
214
- readonly sources?: readonly SourceReference[];
215
- readonly milestoneId?: string;
216
- }
217
- export { ChatMessage_2 as ChatMessageInterface }
218
- export { ChatMessage_2 as ChatMessageType }
219
-
220
- export declare const ChatMessageList: ({ messages, emptyStateTitle, emptyStateDescription, suggestions, onSuggestionClick, onRollback, onSeeVersion, isBusy, hasOlderMessages, isLoadingOlderMessages, onLoadOlderMessages, }: ChatMessageListProps) => JSX.Element;
221
-
222
- declare interface ChatMessageListProps {
223
- readonly messages: readonly ChatMessage_2[];
224
- readonly emptyStateTitle?: string;
225
- readonly emptyStateDescription?: ReactNode;
226
- readonly suggestions?: readonly Suggestion[];
227
- readonly onSuggestionClick?: (suggestion: Suggestion) => void;
228
- readonly onRollback?: (milestoneId: string) => void;
229
- readonly onSeeVersion?: (milestoneId: string) => void;
230
- readonly isBusy?: boolean;
231
- readonly hasOlderMessages?: boolean;
232
- readonly isLoadingOlderMessages?: boolean;
233
- readonly onLoadOlderMessages?: () => void;
21
+ export declare interface Candidate {
22
+ readonly candidateId: string;
23
+ readonly messageId: string;
24
+ readonly state: CandidateState;
25
+ readonly changes: ReadonlyArray<ArtifactChange>;
26
+ readonly checkpointId?: string;
234
27
  }
235
28
 
236
- declare interface ChatMessageProps {
237
- readonly message: ChatMessage_2;
238
- readonly isBusy?: boolean;
239
- }
29
+ export declare const CandidateReview: ({ candidate, onReviewReady }: CandidateReviewProps) => JSX.Element;
240
30
 
241
- declare interface ChatState {
242
- readonly view: ChatView_2;
243
- readonly messages: readonly ChatMessage_2[];
244
- readonly isStreaming: boolean;
245
- readonly streamingMessageId: string | null;
246
- readonly currentThinkingBlockId: string | null;
247
- readonly conversationTitle: string | null;
31
+ export declare interface CandidateReviewProps {
32
+ readonly candidate: Candidate;
33
+ readonly onReviewReady?: (ready: boolean) => void;
248
34
  }
249
35
 
250
- declare type ChatStore = ChatState & ChatActions;
251
-
252
- declare type ChatView = 'chat' | 'history';
253
-
254
- declare type ChatView_2 = 'chat' | 'history';
36
+ export declare type CandidateState = 'proposed' | 'applied' | 'rejected' | 'cancelled' | 'stale';
255
37
 
256
38
  export declare const closeSidecar: () => void;
257
39
 
258
- export declare type ContentType = 'TEXT' | 'BPMN';
259
-
260
- export declare interface ContextItem {
261
- readonly id?: string;
262
- readonly label: string;
40
+ export declare interface Conversation extends ConversationSummary {
41
+ readonly messages: ReadonlyArray<ConversationMessage>;
42
+ readonly verificationHealth?: VerificationHealth | null;
43
+ readonly sourceChangedMessageId?: string | null;
263
44
  }
264
45
 
265
- export declare interface Conversation {
266
- readonly id: string;
267
- readonly name: string;
268
- readonly created: string;
269
- readonly updated: string;
270
- }
46
+ export declare type ConversationEvent = {
47
+ readonly revision?: number;
48
+ } & ({
49
+ readonly type: 'turn_started';
50
+ readonly messageId: string;
51
+ readonly userMessageId: string;
52
+ readonly userContent: string;
53
+ } | {
54
+ readonly type: 'turn_finished';
55
+ readonly messageId: string;
56
+ readonly outcome: 'complete' | 'cancelled';
57
+ } | {
58
+ readonly type: 'candidate_proposed';
59
+ readonly messageId: string;
60
+ readonly candidateId: string;
61
+ } | {
62
+ readonly type: 'candidate_resolved';
63
+ readonly messageId: string;
64
+ readonly candidateId: string;
65
+ readonly state: CandidateState;
66
+ readonly checkpointId?: string;
67
+ } | {
68
+ readonly type: 'checkpoint_restored';
69
+ readonly checkpointId: string;
70
+ readonly contents: ReadonlyArray<{
71
+ readonly name: string;
72
+ readonly content: string | null;
73
+ }>;
74
+ } | {
75
+ readonly type: 'failed';
76
+ readonly messageId: string;
77
+ readonly error: CopilotError;
78
+ } | {
79
+ readonly type: 'text';
80
+ readonly messageId: string;
81
+ readonly delta: string;
82
+ } | {
83
+ readonly type: 'activity';
84
+ readonly messageId: string;
85
+ readonly label: string;
86
+ } | {
87
+ readonly type: 'step_start';
88
+ readonly messageId: string;
89
+ readonly stepId: string;
90
+ readonly kind: StepKind;
91
+ readonly name?: string;
92
+ readonly label: string;
93
+ readonly description?: string;
94
+ readonly groupId?: string;
95
+ } | {
96
+ readonly type: 'step_end';
97
+ readonly messageId: string;
98
+ readonly stepId: string;
99
+ readonly status: 'complete' | 'error';
100
+ readonly description?: string;
101
+ } | {
102
+ readonly type: 'step_removed';
103
+ readonly messageId: string;
104
+ readonly stepId: string;
105
+ } | {
106
+ readonly type: 'source_changed';
107
+ readonly messageId: string;
108
+ });
271
109
 
272
110
  export declare interface ConversationMessage {
273
- readonly id: string;
274
- readonly type: CopilotMessageType;
275
- readonly message?: string;
276
- readonly feel?: string;
277
- readonly artifactXml?: string;
278
- readonly artifactJson?: string;
279
- readonly toolCallId?: string;
280
- readonly toolName?: string;
281
- readonly milestoneId?: string;
282
- readonly created: string;
283
- }
284
-
285
- export declare interface ConversationMessagesPage {
286
- readonly id: string;
287
- readonly name: string;
288
- readonly messages: readonly ConversationMessage[];
289
- readonly nextCursor: number | null;
290
- readonly hasMore: boolean;
291
- readonly totalCount: number;
292
- }
293
-
294
- export declare interface ConversationsPage {
295
- readonly conversations: readonly Conversation[];
296
- readonly page: number;
297
- readonly size: number;
298
- readonly totalItems: number;
299
- }
300
-
301
- declare interface ConversationTitleResult {
302
- readonly type: typeof ResultType.CONVERSATION_TITLE;
303
- readonly conversationTitle: string;
304
- }
305
-
306
- export declare const CopilotChat: ({ onSendMessage, kapaAiIntegrationId, onStopGeneration, onResetConversation, isBusy, isDisabled, isOpen, emptyStateTitle, emptyStateDescription, suggestions, className, contextItems, onRemoveContext, onSeeVersion, }: CopilotChatProps) => JSX.Element;
307
-
308
- export declare interface CopilotChatProps {
309
- readonly kapaAiIntegrationId?: string | null;
310
- readonly onSendMessage: (message: string) => void;
311
- readonly onStopGeneration?: () => void;
312
- readonly onResetConversation?: () => void;
313
- readonly onLoadConversation?: (conversationId: string) => Promise<void>;
314
- readonly isBusy?: boolean;
315
- readonly isOpen?: boolean;
316
- readonly isDisabled?: boolean;
317
- readonly emptyStateTitle?: string;
318
- readonly emptyStateDescription?: ReactNode;
319
- readonly suggestions?: ReadonlyArray<Suggestion>;
320
- readonly className?: string;
321
- readonly contextItems?: ReadonlyArray<ContextItem>;
322
- readonly onRemoveContext?: (item: ContextItem) => void;
323
- readonly onSeeVersion?: (milestoneId: string) => void;
324
- }
325
-
326
- export declare const CopilotHeader: ({ onReset, onShowHistory, conversationTitle, view, isBusy, }: CopilotHeaderProps) => JSX.Element;
327
-
328
- declare interface CopilotHeaderProps {
329
- onReset?: () => void;
330
- onShowHistory?: () => void;
331
- conversationTitle?: string;
332
- view?: ChatView;
333
- isBusy?: boolean;
334
- }
335
-
336
- declare type CopilotMessageType = 'USER' | 'ASSISTANT' | 'TOOL_CALL' | 'TOOL_OUTPUT' | 'SYSTEM';
337
-
338
- export declare const CopilotSidecar: ({ children, workareaSelector, headerSelector, zIndex, }: CopilotSidecarProps) => JSX.Element;
339
-
340
- export declare interface CopilotSidecarProps {
341
- readonly children: (props: SidecarRenderProps) => ReactNode;
342
- readonly workareaSelector?: string;
343
- readonly headerSelector?: string;
344
- readonly zIndex?: number;
345
- }
346
-
347
- export declare interface CopilotToolContext {
348
- readonly modeler: ModelerAccess;
349
- readonly files: {
350
- readonly getContent: (fileId: string) => Promise<string>;
351
- readonly create: (params: {
352
- readonly name: string;
353
- readonly type: string;
354
- readonly content: string;
355
- readonly projectId: string;
356
- readonly folderId: string | null;
357
- }) => Promise<{
358
- readonly id: string;
359
- }>;
360
- readonly list: (projectId: string) => Promise<ReadonlyArray<FileInfo>>;
361
- };
362
- readonly templates: {
363
- readonly getCustom: () => ReadonlyArray<ElementTemplate>;
364
- readonly getOotbConnectors: () => ReadonlyArray<ElementTemplate>;
365
- readonly apply: (elementId: string, templateId: string, version?: number) => unknown;
366
- };
367
- readonly form: {
368
- readonly getContent: () => string | null;
369
- readonly isAvailable: () => boolean;
370
- readonly getLintErrors: () => Promise<ReadonlyArray<FormLintError>>;
371
- readonly importSchema: (content: unknown) => void;
372
- readonly update: () => Promise<void>;
373
- readonly getParsedContent: (json: string) => unknown;
374
- readonly getSchema: () => unknown;
375
- readonly getSelection: () => unknown;
376
- };
377
- readonly dmn: {
378
- readonly createModdle: () => DmnModdle;
379
- readonly getModeler: () => DmnModeler;
380
- };
381
- readonly feel: {
382
- readonly validate: (expression: string) => Promise<FeelValidationResult>;
383
- };
384
- readonly diagram: {
385
- readonly isBPMN: () => boolean;
386
- readonly isDMN: () => boolean;
387
- readonly canEdit: () => boolean;
388
- readonly getContent: () => string | null;
389
- readonly importContent: (xml: string) => Promise<ImportResult>;
390
- readonly saveContent: () => Promise<void>;
391
- readonly exportXml: () => Promise<string>;
392
- readonly getLintErrors: () => Promise<ReadonlyArray<LintError>>;
393
- readonly getDeploymentErrors: () => ReadonlyArray<unknown>;
394
- readonly ensureExecutionPlatform: () => void;
395
- };
396
- readonly project: {
397
- readonly resolve: () => ProjectContext;
398
- };
111
+ readonly messageId: string;
112
+ readonly role: 'user' | 'assistant';
113
+ readonly content: string;
114
+ readonly steps: ReadonlyArray<MessageStep>;
115
+ readonly state?: MessageState;
116
+ readonly candidate?: Candidate;
117
+ readonly error?: CopilotError;
399
118
  }
400
119
 
401
- export declare const createAllTools: (context: CopilotToolContext) => ReadonlyArray<ToolRegistration_2>;
402
-
403
- export declare const createModelerAccess: ({ getModeler, is, getBusinessObject, }: ModelerAccessOptions) => ModelerAccess;
404
-
405
- export declare const createWithAutoLayoutAndValidation: (context: CopilotToolContext, layoutProcess: (xml: string) => Promise<string>) => <T extends Record<string, unknown>>(mutationFn: (modeler: BpmnModeler) => T | Promise<T>) => Promise<T & {
406
- readonly validationErrors: ReadonlyArray<LintError>;
407
- }>;
408
-
409
- export declare const createWithValidation: (context: CopilotToolContext) => <T extends Record<string, unknown>>(mutationFn: (modeler: BpmnModeler) => T | Promise<T>) => Promise<T & {
410
- readonly validationErrors: ReadonlyArray<LintError>;
411
- }>;
120
+ export declare type ConversationStatus = 'idle' | 'running';
412
121
 
413
- export declare type DescriptionFormatter = (args: Record<string, unknown>) => string;
414
-
415
- declare interface DmnDefinitions extends DmnModdleElement {
416
- readonly $model: {
417
- readonly toXML: (definitions: DmnDefinitions, options?: {
418
- format?: boolean;
419
- }) => Promise<{
420
- xml: string;
421
- }>;
422
- };
423
- readonly drgElement?: ReadonlyArray<DmnModdleElement>;
122
+ declare interface ConversationStoreState {
123
+ readonly conversationId: string | null;
124
+ readonly revision?: number;
125
+ readonly snapshotRevision?: number;
126
+ readonly status: ConversationStatus | null;
127
+ readonly verificationHealth: VerificationHealth | null;
128
+ readonly sourceChangedMessageId: string | null;
129
+ readonly originArtifact: ArtifactRef | null;
130
+ readonly preview: string;
131
+ readonly pendingCandidate: boolean;
132
+ readonly messages: ReadonlyArray<MessageStoreState>;
133
+ readonly messagesLoaded: boolean;
134
+ }
135
+
136
+ export declare interface ConversationSummary {
137
+ readonly conversationId: string;
138
+ readonly revision?: number;
139
+ readonly status: ConversationStatus;
140
+ readonly originArtifact?: ArtifactRef;
141
+ readonly preview: string;
142
+ readonly pendingCandidate: boolean;
424
143
  }
425
144
 
426
- declare interface DmnModdle {
427
- readonly fromXML: (xml: string) => Promise<{
428
- rootElement: DmnDefinitions;
429
- }>;
430
- readonly create: (type: string, properties: Record<string, unknown>) => DmnModdleElement;
431
- }
145
+ /**
146
+ * Pipeline probe for the Tailwind v4 precompiled-CSS setup: utilities scoped
147
+ * under `.copilot-chat-root`, one design-system token-based class
148
+ * (`bg-(--primary)`), one DS component. Replaced by real UI later.
149
+ */
150
+ export declare const CopilotBadge: ({ label }: CopilotBadgeProps) => JSX.Element;
432
151
 
433
- declare interface DmnModdleElement extends Record<string, unknown> {
434
- readonly $type: string;
435
- readonly id?: string;
152
+ export declare interface CopilotBadgeProps {
153
+ label: string;
436
154
  }
437
155
 
438
- declare interface DmnModeler {
439
- readonly get: (serviceName: string, strict?: boolean) => unknown;
440
- readonly getActiveViewer?: () => DmnViewer | null;
441
- readonly getViews?: () => ReadonlyArray<unknown>;
442
- readonly saveXML?: (options?: {
443
- format?: boolean;
444
- }) => Promise<{
445
- xml: string;
156
+ export declare interface CopilotClient {
157
+ postMessage(input: PostMessageInput): Promise<{
158
+ conversationId: string;
446
159
  }>;
160
+ observe(conversationId: string, onEvent: (event: ConversationEvent) => void, onConnected?: () => void, onError?: (error: Error) => void): () => void;
161
+ getConversation(conversationId: string): Promise<Conversation>;
162
+ listConversations(): Promise<ReadonlyArray<ConversationSummary>>;
163
+ observeConversationList?(onSummary: (summary: ConversationSummary) => void, onConnected?: () => void, onError?: (error: Error) => void): () => void;
164
+ approve(candidateId: string): Promise<void>;
165
+ reject(candidateId: string): Promise<void>;
166
+ restoreCheckpoint(checkpointId: string): Promise<void>;
167
+ cancelTurn(conversationId: string): Promise<void>;
447
168
  }
448
169
 
449
- declare interface DmnViewer {
450
- readonly get: (serviceName: string, strict?: boolean) => unknown;
451
- }
452
-
453
- export declare interface ElementTemplate {
454
- readonly id: string;
455
- readonly name: string;
456
- readonly description?: string;
457
- readonly version: number;
458
- readonly appliesTo: ReadonlyArray<string>;
459
- readonly elementType?: string;
460
- readonly properties?: ReadonlyArray<Record<string, unknown>>;
461
- readonly groups?: ReadonlyArray<Record<string, unknown>>;
462
- }
463
-
464
- export declare const EventStatus: {
465
- readonly IN_PROGRESS: "IN_PROGRESS";
466
- readonly COMPLETED: "COMPLETED";
467
- readonly ERROR: "ERROR";
468
- };
170
+ export declare const CopilotConversationPanel: ({ client, conversationId, onConversationStarted, onSelectConversation, projectName, projectNameUnavailable, onOpenProject, onClose, renderReview, artifacts, suggestions, selectionContext, }: CopilotConversationPanelProps) => JSX.Element;
469
171
 
470
- export declare type EventStatusValue = (typeof EventStatus)[keyof typeof EventStatus];
471
-
472
- export declare const EventType: {
473
- readonly THINKING: "THINKING";
474
- readonly REASONING: "REASONING";
475
- readonly EXECUTION_PLAN: "EXECUTION_PLAN";
476
- readonly TOOL_PLANNING: "TOOL_PLANNING";
477
- readonly TOOL_INVOKE: "TOOL_INVOKE";
478
- readonly EXTERNAL_TOOL_CALL: "EXTERNAL_TOOL_CALL";
479
- readonly TOOL_RESULT: "TOOL_RESULT";
480
- readonly EXECUTION_COMPLETE: "EXECUTION_COMPLETE";
481
- readonly ERROR: "ERROR";
482
- readonly CONVERSATION_TITLE: "CONVERSATION_TITLE";
483
- readonly SKILL_ACTIVATED: "SKILL_ACTIVATED";
484
- };
485
-
486
- export declare type EventTypeValue = (typeof EventType)[keyof typeof EventType];
487
-
488
- declare interface FeelValidationResult {
489
- readonly error?: string;
490
- readonly warnings?: ReadonlyArray<string>;
491
- }
492
-
493
- export declare interface FileInfo {
494
- readonly id: string;
495
- readonly name: string;
496
- readonly type: string;
497
- readonly lastModified?: string;
172
+ export declare interface CopilotConversationPanelProps {
173
+ readonly client: CopilotClient;
174
+ readonly conversationId: string | null;
175
+ readonly onConversationStarted?: (conversationId: string) => void;
176
+ readonly onSelectConversation?: (conversationId: string | null) => void;
177
+ readonly projectName?: string;
178
+ readonly projectNameUnavailable?: boolean;
179
+ readonly onOpenProject?: (projectId: string) => void;
180
+ readonly onClose?: () => void;
181
+ readonly renderReview?: (candidate: Candidate, actions: {
182
+ approve: () => Promise<void>;
183
+ reject: () => Promise<void>;
184
+ }) => ReactNode;
185
+ readonly artifacts?: ReadonlyArray<ArtifactRef>;
186
+ readonly suggestions?: ReadonlyArray<string>;
187
+ readonly selectionContext?: {
188
+ readonly projectId: string;
189
+ readonly count: number;
190
+ };
498
191
  }
499
192
 
500
- export declare interface FormLintError {
501
- readonly fieldId: string;
193
+ export declare interface CopilotError {
194
+ readonly code: CopilotErrorCode;
502
195
  readonly message: string;
503
- readonly category: string;
504
- }
505
-
506
- export declare const getDefaultStatusLabel: (eventType: EventTypeValue, toolName?: string, eventStatus?: EventStatusValue) => string;
507
-
508
- export declare interface ImportResult {
509
- readonly error?: unknown;
196
+ readonly traceRef?: string;
510
197
  }
511
198
 
512
- export declare const isApplyElementTemplateCompleted: (event: AgentEvent) => boolean;
513
-
514
- export declare const isCurrentFileModified: (event: AgentEvent) => boolean;
515
-
516
- export declare const isLayoutBpmnXmlCompleted: (event: AgentEvent) => boolean;
517
-
518
- export declare const isToolAllowedWithCapabilities: (tool: {
519
- readonly requiredCapabilities?: ReadonlyArray<string>;
520
- }, capabilities: ReadonlyArray<string>) => boolean;
521
-
522
- export declare const isWriteArtifactCompleted: (event: AgentEvent) => boolean;
523
-
524
- declare interface KapaAiSearchResult {
525
- readonly content: string;
526
- readonly source_url: string;
527
- readonly title: string;
528
- readonly source_type: string;
529
- }
530
-
531
- declare interface KapaToolResult {
532
- readonly sources: readonly KapaAiSearchResult[];
533
- }
199
+ export declare type CopilotErrorCode = 'PROVIDER_ERROR' | 'CANCELLED' | 'VALIDATION_FAILED' | 'BUDGET_EXCEEDED' | 'STALE_SOURCE';
534
200
 
535
- export { layoutProcess }
201
+ export declare const CopilotSidecar: ({ children }: CopilotSidecarProps) => JSX.Element;
536
202
 
537
- export declare interface LintError {
538
- readonly elementId: string;
539
- readonly elementName?: string;
540
- readonly message: string;
541
- readonly category: string;
542
- readonly rule: string;
543
- readonly documentationUrl?: string;
203
+ export declare interface CopilotSidecarProps {
204
+ readonly children: (props: SidecarRenderProps) => ReactNode;
544
205
  }
545
206
 
546
- export declare const MarkdownRenderer: ({ content, streaming, highlight, ...rest }: MarkdownRendererProps) => JSX.Element | null;
547
-
548
- declare type MarkdownRendererProps = Omit<MarkdownProps, 'children'> & {
549
- readonly content: string;
550
- };
551
-
552
- declare type MessageErrorCallback = (messageId: string, errorMessage: string) => void;
207
+ export declare const createFixtureClient: (options?: FixtureClientOptions) => CopilotClient;
553
208
 
554
- export declare type MessageRole = 'user' | 'assistant';
209
+ export declare const createHttpClient: (options: HttpClientOptions) => CopilotClient;
555
210
 
556
- export declare type MessageStatus = 'pending' | 'streaming' | 'complete' | 'error';
557
-
558
- declare type MessageStatusCallback = (messageId: string, status: 'complete' | 'error') => void;
559
-
560
- declare type MixedToolHandler = (toolResult: string, onError: (toolName: string, error: Error) => void) => KapaToolResult | null;
561
-
562
- declare interface MixedToolResultEvent {
563
- readonly type: typeof ResultType.MIXED_TOOL_RESULT;
564
- readonly toolName: string;
565
- readonly toolResult: string;
211
+ export declare interface EventSourceLike {
212
+ onmessage: ((message: {
213
+ data: string;
214
+ }) => void) | null;
215
+ onopen?: (() => void) | null;
216
+ onerror?: (() => void) | null;
217
+ close(): void;
566
218
  }
567
219
 
568
- export declare interface ModelerAccess {
569
- readonly getModeler: () => BpmnModeler;
570
- readonly getCanvas: () => unknown;
571
- readonly getElementRegistry: () => {
572
- readonly get: (id: string) => BpmnElement | undefined;
573
- readonly getAll: () => ReadonlyArray<BpmnElement>;
574
- readonly filter: (predicate: (el: BpmnElement) => boolean) => ReadonlyArray<BpmnElement>;
575
- };
576
- readonly getModeling: () => unknown;
577
- readonly getCommandStack: () => unknown;
578
- readonly getElementFactory: () => unknown;
579
- readonly getModdle: () => unknown;
580
- readonly getSelection: () => unknown;
581
- readonly getElementById: (id: string) => BpmnElement;
582
- readonly is: (element: unknown, type: string) => boolean;
583
- readonly getBusinessObject: (element: unknown) => Record<string, unknown>;
584
- readonly getBpmnRules?: () => unknown;
220
+ export declare interface FixtureClientOptions {
221
+ readonly resolveScript?: (input: PostMessageInput) => FixtureScript;
222
+ readonly originArtifact?: ArtifactRef;
223
+ readonly timing?: FixtureTiming;
585
224
  }
586
225
 
587
- declare interface ModelerAccessOptions {
588
- readonly getModeler: () => BpmnModeler;
589
- readonly is: (element: unknown, type: string) => boolean;
590
- readonly getBusinessObject: (element: unknown) => Record<string, unknown>;
226
+ export declare interface FixtureScript {
227
+ readonly outcome: 'answer' | 'propose' | 'failed' | 'run_forever';
228
+ readonly answer?: string;
229
+ readonly changes?: ReadonlyArray<ArtifactChange>;
230
+ readonly error?: CopilotError;
231
+ readonly stepLabels?: ReadonlyArray<string>;
591
232
  }
592
233
 
593
- export declare const openSidecar: () => void;
594
-
595
- declare interface ParsedSkill {
596
- readonly slug: string;
597
- readonly name: string;
598
- readonly description: string;
599
- readonly content: string;
600
- readonly suggestedCapabilities?: readonly string[];
234
+ declare interface FixtureTiming {
235
+ readonly start: number;
236
+ readonly step: number;
237
+ readonly word: number;
601
238
  }
602
239
 
603
- export declare interface ProjectContext {
604
- readonly id: string;
605
- readonly folderId: string | null;
240
+ export declare interface HttpClientOptions {
241
+ readonly baseUrl: string;
242
+ readonly fetch?: typeof fetch;
243
+ readonly eventSource?: new (url: string) => EventSourceLike;
606
244
  }
607
245
 
608
- export declare class QueryCancelledError extends Error {
609
- constructor(message?: string);
610
- }
246
+ export declare type MessageState = 'streaming' | 'complete' | 'cancelled' | 'failed';
611
247
 
612
- export declare interface RawBpmnLintError {
613
- readonly id: string;
248
+ export declare interface MessageStep {
249
+ readonly stepId: string;
250
+ readonly kind: StepKind;
614
251
  readonly name?: string;
615
- readonly message: string;
616
- readonly category: string;
617
- readonly rule: string;
618
- readonly meta?: {
619
- readonly documentation?: {
620
- readonly url?: string;
621
- };
622
- };
623
- }
624
-
625
- export declare const ResultType: {
626
- readonly TOOL_INVOKE: "TOOL_INVOKE";
627
- readonly MIXED_TOOL_RESULT: "MIXED_TOOL_RESULT";
628
- readonly CONVERSATION_TITLE: "CONVERSATION_TITLE";
629
- };
630
-
631
- export declare type ResultTypeValue = (typeof ResultType)[keyof typeof ResultType];
632
-
633
- export declare interface RollbackResponse {
634
- readonly milestoneId: string;
635
- readonly message: string;
252
+ readonly label: string;
253
+ readonly description?: string;
254
+ readonly groupId?: string;
255
+ readonly status: StepStatus;
636
256
  }
637
257
 
638
- export declare const selectAgentState: (state: AgentStoreState) => string;
639
-
640
- export declare const selectIsBusy: (state: AgentStoreState) => boolean;
641
-
642
- export declare interface SendMessagePayload {
643
- readonly conversationId: string;
258
+ declare interface MessageStoreState {
644
259
  readonly messageId: string;
260
+ readonly role: 'user' | 'assistant';
645
261
  readonly content: string;
646
- readonly externalTools: readonly BackendToolPayload[];
647
- readonly context: Record<string, unknown>;
262
+ readonly steps: ReadonlyArray<MessageStep>;
263
+ readonly activity: string | null;
264
+ readonly state: MessageState | null;
265
+ readonly candidate: Candidate | null;
266
+ readonly error: CopilotError | null;
648
267
  }
649
268
 
650
- export declare const setupBpmnTools: (context: CopilotToolContext, registry: ToolRegistry) => void;
269
+ export declare const openSidecar: () => void;
270
+
271
+ export declare interface PostMessageInput {
272
+ readonly prompt: string;
273
+ readonly conversationId?: string;
274
+ readonly context?: Record<string, unknown>;
275
+ readonly reapplyCandidateId?: string;
276
+ }
651
277
 
652
278
  export declare interface SidecarRenderProps {
653
279
  readonly onMinimize: () => void;
654
280
  readonly isOpen: boolean;
655
281
  }
656
282
 
657
- export declare interface SkillDefinition {
658
- readonly slug: string;
659
- readonly name: string;
660
- readonly description: string;
661
- readonly content: string;
662
- readonly suggestedCapabilities?: readonly string[];
663
- }
664
-
665
- export declare const skillRegistry: {
666
- register: (skill: SkillDefinition) => void;
667
- get: (slug: string) => SkillDefinition | undefined;
668
- getAll: () => readonly SkillDefinition[];
669
- clear: () => void;
670
- };
671
-
672
- declare interface SourceReference {
673
- readonly content: string;
674
- readonly sourceUrl: string;
675
- readonly title: string;
676
- readonly sourceType: string;
677
- }
678
-
679
- declare type StatusLabelCallback = (messageId: string, label: string) => void;
283
+ export declare type StepKind = 'reasoning' | 'tool' | 'plan' | 'message';
680
284
 
681
- export declare interface Suggestion {
682
- readonly label: string;
683
- }
684
-
685
- declare interface ThinkingBlock {
686
- readonly id: string;
687
- readonly content: string;
688
- readonly label: string;
689
- readonly isComplete: boolean;
690
- readonly kind?: ThinkingBlockKind;
691
- readonly toolName?: string;
692
- readonly toolStatus?: ToolBlockStatus;
693
- readonly stepNumber?: number;
694
- readonly toolArguments?: Record<string, unknown>;
695
- readonly toolResult?: string;
696
- readonly description?: string;
697
- }
698
-
699
- declare type ThinkingBlockKind = 'reasoning' | 'tool' | 'error';
700
-
701
- export declare const ThinkingIndicator: ({ label, content, isComplete }: ThinkingIndicatorProps) => JSX.Element | null;
702
-
703
- declare interface ThinkingIndicatorProps {
704
- readonly label?: string;
705
- readonly content?: string;
706
- readonly isComplete: boolean;
707
- }
285
+ export declare type StepStatus = 'active' | 'complete' | 'error';
708
286
 
709
287
  export declare const toggleSidecar: () => void;
710
288
 
711
- declare type ToolBlockStatus = 'success' | 'processing' | 'error';
712
-
713
- export declare type ToolCategory = 'BPMN_CORE' | 'BPMN_MODIFICATION' | 'BPMN_QUERY' | 'DMN_QUERY' | 'DMN_MODIFICATION' | 'FEEL_CORE' | 'FORM_CORE' | 'INTEGRATION' | 'FILE_OPERATION' | 'GENERAL';
714
-
715
- export declare interface ToolDefinition {
716
- readonly name: string;
717
- readonly description: string;
718
- readonly parameters: Record<string, unknown>;
719
- readonly type: ToolType;
720
- readonly contentType: ContentType;
721
- readonly category: ToolCategory;
722
- readonly requiredCapabilities?: ReadonlyArray<string>;
723
- readonly displayName?: string;
724
- readonly descriptionFormatter?: DescriptionFormatter;
725
- }
726
-
727
- export declare type ToolHandler = (args: Record<string, unknown>, onError: (toolName: string, error: Error) => void) => Promise<unknown>;
728
-
729
- declare type ToolHandler_2 = (args: Record<string, unknown>, onError: (toolName: string, error: Error) => void) => Promise<unknown>;
730
-
731
- export declare interface ToolInvokeResult {
732
- readonly type: typeof ResultType.TOOL_INVOKE;
733
- readonly toolName: string;
734
- readonly toolCallId?: string;
735
- readonly toolArguments: Record<string, unknown>;
736
- }
737
-
738
- export declare interface ToolRegistration extends ToolDefinition {
739
- readonly handler: ToolHandler | MixedToolHandler;
740
- }
741
-
742
- declare interface ToolRegistration_2 extends ToolDefinition {
743
- readonly handler: ToolHandler_2;
744
- }
745
-
746
- export declare interface ToolRegistry {
747
- readonly registerTool: (registration: ToolRegistration_2) => void;
748
- readonly clear: () => void;
749
- }
289
+ export declare const useCopilotConversation: ({ client, conversationId, }: UseCopilotConversationOptions) => {
290
+ conversationId: string | null;
291
+ status: ConversationStatus | null;
292
+ originArtifact: ArtifactRef | null;
293
+ messages: readonly MessageStoreState[];
294
+ messagesLoaded: boolean;
295
+ pendingCandidate: boolean;
296
+ isRunning: boolean;
297
+ sourceChangedMessageId: string | null;
298
+ synchronizationError: Error | null;
299
+ verificationWarning: boolean;
300
+ postMessage: (prompt: string) => Promise<string>;
301
+ reapply: (candidateId: string, prompt?: string) => Promise<void>;
302
+ refresh: () => Promise<void>;
303
+ approve: (candidateId: string) => Promise<void>;
304
+ reject: (candidateId: string) => Promise<void>;
305
+ restoreCheckpoint: (checkpointId: string) => Promise<void>;
306
+ cancelTurn: () => Promise<void>;
307
+ };
750
308
 
751
- export declare const toolRegistry: {
752
- registerTool: (registration: ToolRegistration) => void;
753
- has: (name: string) => boolean;
754
- hasHandler: (name: string) => boolean;
755
- isMixed: (name: string) => boolean;
756
- getDisplayName: (name: string) => string | undefined;
757
- getDescription: (name: string, args: Record<string, unknown>) => string;
758
- hasCustomDescription: (name: string) => boolean;
759
- getContentType: (name: string) => ContentType;
760
- getMixedHandler: (name: string) => MixedToolHandler | undefined;
761
- getHandler: (name: string) => ToolHandler | undefined;
762
- executeHandler: (name: string, args: Record<string, unknown>, onError: (toolName: string, error: Error) => void) => Promise<unknown>;
763
- getToolsForBackend: () => readonly BackendToolPayload[];
764
- clear: () => void;
309
+ export declare const useCopilotConversationList: ({ client }: UseCopilotConversationListOptions) => {
310
+ conversations: readonly ConversationStoreState[];
311
+ isLoading: boolean;
312
+ error: Error | null;
313
+ reload: () => Promise<void>;
765
314
  };
766
315
 
767
- export declare interface ToolResultPayload {
768
- readonly conversationId: string;
769
- readonly type: 'TOOL_RESULT';
770
- readonly toolName: string;
771
- readonly toolCallId?: string;
772
- readonly toolResult: string;
773
- readonly contentType: 'TEXT' | 'BPMN' | 'JSON';
316
+ export declare interface UseCopilotConversationListOptions {
317
+ readonly client: CopilotClient;
774
318
  }
775
319
 
776
- export declare type ToolType = 'frontend' | 'mixed';
777
-
778
- export declare const traverseModdle: (root: DmnModdleElement | Record<string, unknown>, visitor: TraverseVisitor) => void;
779
-
780
- declare type TraverseVisitor = (element: DmnModdleElement) => void | false;
781
-
782
- declare interface UpdateConversationPayload {
783
- readonly conversationName: string;
320
+ export declare interface UseCopilotConversationOptions {
321
+ readonly client: CopilotClient;
322
+ readonly conversationId: string | null;
784
323
  }
785
324
 
786
- export declare const useAgentAdapter: ({ transport, onToolInvoke, getStatusLabel, }: AgentAdapterConfig) => AgentAdapterReturn;
787
-
788
- export declare const useAgentStore: UseBoundStore<StoreApi<AgentStore>>;
789
-
790
- export declare const useChatStore: UseBoundStore<StoreApi<ChatStore>>;
791
-
792
325
  export declare const useSidecarOpen: () => boolean;
793
326
 
327
+ /** ISO 8601 provider-verification timestamps for one assistant message, not a terminal state. */
328
+ export declare interface VerificationHealth {
329
+ readonly messageId: string;
330
+ readonly lastVerifiedAt: string | null;
331
+ readonly troubleStartedAt: string | null;
332
+ }
333
+
794
334
  export { }