@camunda/copilot-chat 0.7.0 → 0.8.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,307 @@
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;
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>;
22
10
  }
23
11
 
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;
12
+ export declare interface ArtifactRef {
13
+ readonly projectId: string;
14
+ readonly artifactId: string;
15
+ readonly name: string;
16
+ readonly type: ArtifactType;
34
17
  }
35
18
 
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
- }
19
+ export declare type ArtifactType = 'bpmn' | 'dmn' | 'form';
60
20
 
61
- declare interface AgentStoreCallbacks {
62
- readonly onMessageStatusUpdate?: MessageStatusCallback;
63
- readonly onStatusLabelClear?: StatusLabelCallback;
64
- readonly onMessageError?: MessageErrorCallback;
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;
65
27
  }
66
28
 
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
- }
29
+ export declare const CandidateReview: ({ candidate, onReviewReady }: CandidateReviewProps) => JSX.Element;
80
30
 
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>;
31
+ export declare interface CandidateReviewProps {
32
+ readonly candidate: Candidate;
33
+ readonly onReviewReady?: (ready: boolean) => void;
93
34
  }
94
35
 
95
- export declare const allBpmnSkills: ParsedSkill[];
36
+ export declare type CandidateState = 'proposed' | 'applied' | 'rejected' | 'cancelled' | 'stale';
96
37
 
97
- declare interface BackendToolPayload {
98
- readonly name: string;
99
- readonly description: string;
100
- readonly parameters: Record<string, unknown>;
101
- readonly category: string;
102
- }
38
+ export declare const closeSidecar: () => void;
103
39
 
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>;
40
+ export declare interface Conversation extends ConversationSummary {
41
+ readonly messages: ReadonlyArray<ConversationMessage>;
112
42
  }
113
43
 
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;
44
+ export declare type ConversationEvent = {
45
+ readonly type: 'turn_started';
46
+ readonly messageId: string;
47
+ readonly userMessageId: string;
48
+ readonly userContent: string;
49
+ } | {
50
+ readonly type: 'turn_finished';
51
+ readonly messageId: string;
52
+ readonly outcome: 'complete' | 'cancelled';
53
+ } | {
54
+ readonly type: 'candidate_proposed';
55
+ readonly messageId: string;
56
+ readonly candidateId: string;
57
+ } | {
58
+ readonly type: 'candidate_resolved';
59
+ readonly messageId: string;
60
+ readonly candidateId: string;
61
+ readonly state: CandidateState;
62
+ readonly checkpointId?: string;
63
+ } | {
64
+ readonly type: 'checkpoint_restored';
65
+ readonly checkpointId: string;
66
+ readonly contents: ReadonlyArray<{
67
+ readonly name: string;
68
+ readonly content: string | null;
120
69
  }>;
121
- }
122
-
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";
70
+ } | {
71
+ readonly type: 'failed';
72
+ readonly messageId: string;
73
+ readonly error: CopilotError;
74
+ } | {
75
+ readonly type: 'text';
76
+ readonly messageId: string;
77
+ readonly delta: string;
78
+ } | {
79
+ readonly type: 'activity';
80
+ readonly messageId: string;
81
+ readonly label: string;
82
+ } | {
83
+ readonly type: 'step_start';
84
+ readonly messageId: string;
85
+ readonly stepId: string;
86
+ readonly kind: StepKind;
87
+ readonly name?: string;
88
+ readonly label: string;
89
+ readonly description?: string;
90
+ readonly groupId?: string;
91
+ } | {
92
+ readonly type: 'step_end';
93
+ readonly messageId: string;
94
+ readonly stepId: string;
95
+ readonly status: 'complete' | 'error';
96
+ readonly description?: string;
97
+ } | {
98
+ readonly type: 'step_removed';
99
+ readonly messageId: string;
100
+ readonly stepId: string;
160
101
  };
161
102
 
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;
103
+ export declare interface ConversationMessage {
104
+ readonly messageId: string;
105
+ readonly role: 'user' | 'assistant';
209
106
  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;
234
- }
235
-
236
- declare interface ChatMessageProps {
237
- readonly message: ChatMessage_2;
238
- readonly isBusy?: boolean;
239
- }
240
-
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;
107
+ readonly steps: ReadonlyArray<MessageStep>;
108
+ readonly state?: MessageState;
109
+ readonly candidate?: Candidate;
110
+ readonly error?: CopilotError;
248
111
  }
249
112
 
250
- declare type ChatStore = ChatState & ChatActions;
251
-
252
- declare type ChatView = 'chat' | 'history';
253
-
254
- declare type ChatView_2 = 'chat' | 'history';
255
-
256
- export declare const closeSidecar: () => void;
113
+ export declare type ConversationStatus = 'idle' | 'running';
257
114
 
258
- export declare type ContentType = 'TEXT' | 'BPMN';
259
-
260
- export declare interface ContextItem {
261
- readonly id?: string;
262
- readonly label: string;
115
+ declare interface ConversationStoreState {
116
+ readonly conversationId: string | null;
117
+ readonly status: ConversationStatus | null;
118
+ readonly originArtifact: ArtifactRef | null;
119
+ readonly preview: string;
120
+ readonly pendingCandidate: boolean;
121
+ readonly messages: ReadonlyArray<MessageStoreState>;
122
+ readonly messagesLoaded: boolean;
263
123
  }
264
124
 
265
- export declare interface Conversation {
266
- readonly id: string;
267
- readonly name: string;
268
- readonly created: string;
269
- readonly updated: string;
125
+ export declare interface ConversationSummary {
126
+ readonly conversationId: string;
127
+ readonly status: ConversationStatus;
128
+ readonly originArtifact?: ArtifactRef;
129
+ readonly preview: string;
130
+ readonly pendingCandidate: boolean;
270
131
  }
271
132
 
272
- 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
- }
133
+ /**
134
+ * Pipeline probe for the Tailwind v4 precompiled-CSS setup: utilities scoped
135
+ * under `.copilot-chat-root`, one design-system token-based class
136
+ * (`bg-(--primary)`), one DS component. Replaced by real UI later.
137
+ */
138
+ export declare const CopilotBadge: ({ label }: CopilotBadgeProps) => JSX.Element;
284
139
 
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;
140
+ export declare interface CopilotBadgeProps {
141
+ label: string;
292
142
  }
293
143
 
294
- export declare interface ConversationsPage {
295
- readonly conversations: readonly Conversation[];
296
- readonly page: number;
297
- readonly size: number;
298
- readonly totalItems: number;
144
+ export declare interface CopilotClient {
145
+ postMessage(input: PostMessageInput): Promise<{
146
+ conversationId: string;
147
+ }>;
148
+ observe(conversationId: string, onEvent: (event: ConversationEvent) => void, onConnected?: () => void): () => void;
149
+ getConversation(conversationId: string): Promise<Conversation>;
150
+ listConversations(): Promise<ReadonlyArray<ConversationSummary>>;
151
+ approve(candidateId: string): Promise<void>;
152
+ reject(candidateId: string): Promise<void>;
153
+ restoreCheckpoint(checkpointId: string): Promise<void>;
154
+ cancelTurn(conversationId: string): Promise<void>;
299
155
  }
300
156
 
301
- declare interface ConversationTitleResult {
302
- readonly type: typeof ResultType.CONVERSATION_TITLE;
303
- readonly conversationTitle: string;
304
- }
157
+ export declare const CopilotConversationPanel: ({ client, conversationId, onConversationStarted, onSelectConversation, projectName, projectNameUnavailable, onOpenProject, onClose, renderReview, artifacts, suggestions, selectionContext, }: CopilotConversationPanelProps) => JSX.Element;
305
158
 
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;
159
+ export declare interface CopilotConversationPanelProps {
160
+ readonly client: CopilotClient;
161
+ readonly conversationId: string | null;
162
+ readonly onConversationStarted?: (conversationId: string) => void;
163
+ readonly onSelectConversation?: (conversationId: string | null) => void;
164
+ readonly projectName?: string;
165
+ readonly projectNameUnavailable?: boolean;
166
+ readonly onOpenProject?: (projectId: string) => void;
167
+ readonly onClose?: () => void;
168
+ readonly renderReview?: (candidate: Candidate, actions: {
169
+ approve: () => Promise<void>;
170
+ reject: () => Promise<void>;
171
+ }) => ReactNode;
172
+ readonly artifacts?: ReadonlyArray<ArtifactRef>;
173
+ readonly suggestions?: ReadonlyArray<string>;
174
+ readonly selectionContext?: {
175
+ readonly projectId: string;
176
+ readonly count: number;
177
+ };
324
178
  }
325
179
 
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;
180
+ export declare interface CopilotError {
181
+ readonly code: CopilotErrorCode;
182
+ readonly message: string;
183
+ readonly traceRef?: string;
334
184
  }
335
185
 
336
- declare type CopilotMessageType = 'USER' | 'ASSISTANT' | 'TOOL_CALL' | 'TOOL_OUTPUT' | 'SYSTEM';
186
+ export declare type CopilotErrorCode = 'PROVIDER_ERROR' | 'CANCELLED' | 'VALIDATION_FAILED' | 'BUDGET_EXCEEDED' | 'STALE_SOURCE';
337
187
 
338
- export declare const CopilotSidecar: ({ children, workareaSelector, headerSelector, zIndex, }: CopilotSidecarProps) => JSX.Element;
188
+ export declare const CopilotSidecar: ({ children }: CopilotSidecarProps) => JSX.Element;
339
189
 
340
190
  export declare interface CopilotSidecarProps {
341
191
  readonly children: (props: SidecarRenderProps) => ReactNode;
342
- readonly workareaSelector?: string;
343
- readonly headerSelector?: string;
344
- readonly zIndex?: number;
345
192
  }
346
193
 
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
- };
399
- }
400
-
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
- }>;
194
+ export declare const createFixtureClient: (options?: FixtureClientOptions) => CopilotClient;
412
195
 
413
- export declare type DescriptionFormatter = (args: Record<string, unknown>) => string;
196
+ export declare const createHttpClient: (options: HttpClientOptions) => CopilotClient;
414
197
 
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>;
198
+ export declare interface EventSourceLike {
199
+ onmessage: ((message: {
200
+ data: string;
201
+ }) => void) | null;
202
+ onopen?: (() => void) | null;
203
+ close(): void;
424
204
  }
425
205
 
426
- declare interface DmnModdle {
427
- readonly fromXML: (xml: string) => Promise<{
428
- rootElement: DmnDefinitions;
429
- }>;
430
- readonly create: (type: string, properties: Record<string, unknown>) => DmnModdleElement;
206
+ export declare interface FixtureClientOptions {
207
+ readonly resolveScript?: (input: PostMessageInput) => FixtureScript;
208
+ readonly originArtifact?: ArtifactRef;
209
+ readonly timing?: FixtureTiming;
431
210
  }
432
211
 
433
- declare interface DmnModdleElement extends Record<string, unknown> {
434
- readonly $type: string;
435
- readonly id?: string;
212
+ export declare interface FixtureScript {
213
+ readonly outcome: 'answer' | 'propose' | 'failed' | 'run_forever';
214
+ readonly answer?: string;
215
+ readonly changes?: ReadonlyArray<ArtifactChange>;
216
+ readonly error?: CopilotError;
217
+ readonly stepLabels?: ReadonlyArray<string>;
436
218
  }
437
219
 
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;
446
- }>;
220
+ declare interface FixtureTiming {
221
+ readonly start: number;
222
+ readonly step: number;
223
+ readonly word: number;
447
224
  }
448
225
 
449
- declare interface DmnViewer {
450
- readonly get: (serviceName: string, strict?: boolean) => unknown;
226
+ export declare interface HttpClientOptions {
227
+ readonly baseUrl: string;
228
+ readonly fetch?: typeof fetch;
229
+ readonly eventSource?: new (url: string) => EventSourceLike;
451
230
  }
452
231
 
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
- }
232
+ export declare type MessageState = 'streaming' | 'complete' | 'cancelled' | 'failed';
463
233
 
464
- export declare const EventStatus: {
465
- readonly IN_PROGRESS: "IN_PROGRESS";
466
- readonly COMPLETED: "COMPLETED";
467
- readonly ERROR: "ERROR";
468
- };
469
-
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;
498
- }
499
-
500
- export declare interface FormLintError {
501
- readonly fieldId: string;
502
- 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;
234
+ export declare interface MessageStep {
235
+ readonly stepId: string;
236
+ readonly kind: StepKind;
237
+ readonly name?: string;
238
+ readonly label: string;
239
+ readonly description?: string;
240
+ readonly groupId?: string;
241
+ readonly status: StepStatus;
510
242
  }
511
243
 
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 {
244
+ declare interface MessageStoreState {
245
+ readonly messageId: string;
246
+ readonly role: 'user' | 'assistant';
525
247
  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
- }
534
-
535
- export { layoutProcess }
536
-
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;
544
- }
545
-
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;
553
-
554
- export declare type MessageRole = 'user' | 'assistant';
555
-
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;
566
- }
567
-
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;
585
- }
586
-
587
- declare interface ModelerAccessOptions {
588
- readonly getModeler: () => BpmnModeler;
589
- readonly is: (element: unknown, type: string) => boolean;
590
- readonly getBusinessObject: (element: unknown) => Record<string, unknown>;
248
+ readonly steps: ReadonlyArray<MessageStep>;
249
+ readonly activity: string | null;
250
+ readonly state: MessageState | null;
251
+ readonly candidate: Candidate | null;
252
+ readonly error: CopilotError | null;
591
253
  }
592
254
 
593
255
  export declare const openSidecar: () => void;
594
256
 
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[];
601
- }
602
-
603
- export declare interface ProjectContext {
604
- readonly id: string;
605
- readonly folderId: string | null;
606
- }
607
-
608
- export declare class QueryCancelledError extends Error {
609
- constructor(message?: string);
257
+ export declare interface PostMessageInput {
258
+ readonly prompt: string;
259
+ readonly conversationId?: string;
260
+ readonly context?: Record<string, unknown>;
610
261
  }
611
262
 
612
- export declare interface RawBpmnLintError {
613
- readonly id: string;
614
- 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;
636
- }
637
-
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;
644
- readonly messageId: string;
645
- readonly content: string;
646
- readonly externalTools: readonly BackendToolPayload[];
647
- readonly context: Record<string, unknown>;
648
- }
649
-
650
- export declare const setupBpmnTools: (context: CopilotToolContext, registry: ToolRegistry) => void;
651
-
652
263
  export declare interface SidecarRenderProps {
653
264
  readonly onMinimize: () => void;
654
265
  readonly isOpen: boolean;
655
266
  }
656
267
 
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;
680
-
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';
268
+ export declare type StepKind = 'reasoning' | 'tool' | 'plan' | 'message';
700
269
 
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
- }
270
+ export declare type StepStatus = 'active' | 'complete' | 'error';
708
271
 
709
272
  export declare const toggleSidecar: () => void;
710
273
 
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
- }
274
+ export declare const useCopilotConversation: ({ client, conversationId, }: UseCopilotConversationOptions) => {
275
+ conversationId: string | null;
276
+ status: ConversationStatus | null;
277
+ originArtifact: ArtifactRef | null;
278
+ messages: readonly MessageStoreState[];
279
+ messagesLoaded: boolean;
280
+ pendingCandidate: boolean;
281
+ isRunning: boolean;
282
+ postMessage: (prompt: string) => Promise<string>;
283
+ refresh: () => Promise<void>;
284
+ approve: (candidateId: string) => Promise<void>;
285
+ reject: (candidateId: string) => Promise<void>;
286
+ restoreCheckpoint: (checkpointId: string) => Promise<void>;
287
+ cancelTurn: () => Promise<void>;
288
+ };
750
289
 
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;
290
+ export declare const useCopilotConversationList: ({ client }: UseCopilotConversationListOptions) => {
291
+ conversations: readonly ConversationStoreState[];
292
+ isLoading: boolean;
293
+ reload: () => Promise<void>;
765
294
  };
766
295
 
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';
296
+ export declare interface UseCopilotConversationListOptions {
297
+ readonly client: CopilotClient;
774
298
  }
775
299
 
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;
300
+ export declare interface UseCopilotConversationOptions {
301
+ readonly client: CopilotClient;
302
+ readonly conversationId: string | null;
784
303
  }
785
304
 
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
305
  export declare const useSidecarOpen: () => boolean;
793
306
 
794
307
  export { }