@camunda/copilot-chat 0.5.12-alpha.4 → 0.5.12-alpha.6

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.
@@ -0,0 +1,232 @@
1
+ export declare interface BpmnElement {
2
+ readonly id: string;
3
+ readonly type: string;
4
+ readonly businessObject: Record<string, unknown>;
5
+ readonly parent?: BpmnElement;
6
+ readonly incoming?: ReadonlyArray<BpmnElement>;
7
+ readonly outgoing?: ReadonlyArray<BpmnElement>;
8
+ readonly children?: ReadonlyArray<BpmnElement>;
9
+ }
10
+
11
+ export declare interface BpmnModeler {
12
+ readonly get: (serviceName: string, strict?: boolean) => unknown;
13
+ readonly saveXML: (options?: {
14
+ format?: boolean;
15
+ }) => Promise<{
16
+ xml: string;
17
+ }>;
18
+ }
19
+
20
+ declare type ContentType = 'TEXT' | 'BPMN';
21
+
22
+ export declare interface CopilotToolContext {
23
+ readonly modeler: ModelerAccess;
24
+ readonly files: {
25
+ readonly getContent: (fileId: string) => Promise<string>;
26
+ readonly create: (params: {
27
+ readonly name: string;
28
+ readonly type: string;
29
+ readonly content: string;
30
+ readonly projectId: string;
31
+ readonly folderId: string | null;
32
+ }) => Promise<{
33
+ readonly id: string;
34
+ }>;
35
+ readonly list: (projectId: string) => Promise<ReadonlyArray<FileInfo>>;
36
+ };
37
+ readonly templates: {
38
+ readonly getCustom: () => ReadonlyArray<ElementTemplate>;
39
+ readonly getOotbConnectors: () => ReadonlyArray<ElementTemplate>;
40
+ readonly apply: (elementId: string, templateId: string, version?: number) => unknown;
41
+ readonly getTemplateModule: () => unknown;
42
+ };
43
+ readonly form: {
44
+ readonly getContent: () => string | null;
45
+ readonly isAvailable: () => boolean;
46
+ readonly getLintErrors: () => Promise<ReadonlyArray<FormLintError>>;
47
+ readonly importSchema: (content: unknown) => void;
48
+ readonly update: () => Promise<void>;
49
+ readonly getParsedContent: (json: string) => unknown;
50
+ readonly getSchema: () => unknown;
51
+ readonly getSelection: () => unknown;
52
+ };
53
+ readonly dmn: {
54
+ readonly createModdle: () => DmnModdle;
55
+ readonly getModeler: () => DmnModeler;
56
+ };
57
+ readonly feel: {
58
+ readonly validate: (expression: string) => Promise<FeelValidationResult>;
59
+ };
60
+ readonly diagram: {
61
+ readonly isBPMN: () => boolean;
62
+ readonly isDMN: () => boolean;
63
+ readonly canEdit: () => boolean;
64
+ readonly getContent: () => string | null;
65
+ readonly importContent: (xml: string) => Promise<ImportResult>;
66
+ readonly saveContent: () => Promise<void>;
67
+ readonly exportXml: () => Promise<string>;
68
+ readonly getLintErrors: () => Promise<ReadonlyArray<LintError>>;
69
+ readonly getDeploymentErrors: () => ReadonlyArray<unknown>;
70
+ readonly getExecutionPlatform: () => {
71
+ readonly name: string;
72
+ readonly version: string;
73
+ } | null;
74
+ readonly ensureExecutionPlatform: () => void;
75
+ };
76
+ readonly project: {
77
+ readonly resolve: () => ProjectContext;
78
+ readonly getFileId: () => string | null;
79
+ readonly getFileType: () => 'bpmn' | 'dmn' | 'form' | null;
80
+ };
81
+ }
82
+
83
+ export declare const createAllTools: (context: CopilotToolContext) => ReadonlyArray<ToolRegistration>;
84
+
85
+ export declare const createModelerAccess: ({ getModeler, is, getBusinessObject }: ModelerAccessOptions) => ModelerAccess;
86
+
87
+ export declare const createWithAutoLayoutAndValidation: (context: CopilotToolContext, layoutProcess: (xml: string) => Promise<string>) => <T>(mutationFn: (modeler: BpmnModeler) => T | Promise<T>) => Promise<T & {
88
+ readonly validationErrors: ReadonlyArray<LintError>;
89
+ }>;
90
+
91
+ declare type DescriptionFormatter = (args: Record<string, unknown>) => string;
92
+
93
+ declare interface DmnDefinitions extends DmnModdleElement {
94
+ readonly $model: {
95
+ readonly toXML: (definitions: DmnDefinitions, options?: {
96
+ format?: boolean;
97
+ }) => Promise<{
98
+ xml: string;
99
+ }>;
100
+ };
101
+ readonly drgElement?: ReadonlyArray<DmnModdleElement>;
102
+ }
103
+
104
+ declare interface DmnModdle {
105
+ readonly fromXML: (xml: string) => Promise<{
106
+ rootElement: DmnDefinitions;
107
+ }>;
108
+ readonly create: (type: string, properties: Record<string, unknown>) => DmnModdleElement;
109
+ }
110
+
111
+ declare interface DmnModdleElement extends Record<string, unknown> {
112
+ readonly $type: string;
113
+ readonly id?: string;
114
+ }
115
+
116
+ declare interface DmnModeler {
117
+ readonly get: (serviceName: string, strict?: boolean) => unknown;
118
+ readonly getActiveViewer?: () => DmnViewer | null;
119
+ readonly getViews?: () => ReadonlyArray<unknown>;
120
+ readonly saveXML?: (options?: {
121
+ format?: boolean;
122
+ }) => Promise<{
123
+ xml: string;
124
+ }>;
125
+ }
126
+
127
+ declare interface DmnViewer {
128
+ readonly get: (serviceName: string, strict?: boolean) => unknown;
129
+ }
130
+
131
+ export declare interface ElementTemplate {
132
+ readonly id: string;
133
+ readonly name: string;
134
+ readonly description?: string;
135
+ readonly version: number;
136
+ readonly appliesTo: ReadonlyArray<string>;
137
+ readonly elementType?: string;
138
+ readonly properties?: ReadonlyArray<Record<string, unknown>>;
139
+ readonly groups?: ReadonlyArray<Record<string, unknown>>;
140
+ }
141
+
142
+ declare interface FeelValidationResult {
143
+ readonly error?: string;
144
+ readonly warnings?: ReadonlyArray<string>;
145
+ }
146
+
147
+ export declare interface FileInfo {
148
+ readonly id: string;
149
+ readonly name: string;
150
+ readonly type: string;
151
+ readonly lastModified?: string;
152
+ }
153
+
154
+ export declare interface FormLintError {
155
+ readonly fieldId: string;
156
+ readonly message: string;
157
+ readonly category: string;
158
+ }
159
+
160
+ export declare interface ImportResult {
161
+ readonly error?: unknown;
162
+ }
163
+
164
+ export declare interface LintError {
165
+ readonly elementId: string;
166
+ readonly elementName: string;
167
+ readonly message: string;
168
+ readonly category: string;
169
+ readonly rule: string;
170
+ readonly documentationUrl?: string;
171
+ }
172
+
173
+ export declare interface ModelerAccess {
174
+ readonly getModeler: () => BpmnModeler;
175
+ readonly getCanvas: () => unknown;
176
+ readonly getElementRegistry: () => {
177
+ readonly get: (id: string) => BpmnElement | undefined;
178
+ readonly getAll: () => ReadonlyArray<BpmnElement>;
179
+ readonly filter: (predicate: (el: BpmnElement) => boolean) => ReadonlyArray<BpmnElement>;
180
+ };
181
+ readonly getModeling: () => unknown;
182
+ readonly getCommandStack: () => unknown;
183
+ readonly getElementFactory: () => unknown;
184
+ readonly getModdle: () => unknown;
185
+ readonly getSelection: () => unknown;
186
+ readonly getElementById: (id: string) => BpmnElement;
187
+ readonly is: (element: unknown, type: string) => boolean;
188
+ readonly getBusinessObject: (element: unknown) => Record<string, unknown>;
189
+ readonly getBpmnRules?: () => unknown;
190
+ }
191
+
192
+ declare interface ModelerAccessOptions {
193
+ readonly getModeler: () => BpmnModeler;
194
+ readonly is: (element: unknown, type: string) => boolean;
195
+ readonly getBusinessObject: (element: unknown) => Record<string, unknown>;
196
+ }
197
+
198
+ export declare interface ProjectContext {
199
+ readonly id: string;
200
+ readonly folderId: string | null;
201
+ }
202
+
203
+ export declare const setupBpmnTools: (context: CopilotToolContext, registry: ToolRegistry) => void;
204
+
205
+ declare type ToolCategory = 'BPMN_CORE' | 'BPMN_MODIFICATION' | 'BPMN_QUERY' | 'DMN_QUERY' | 'DMN_MODIFICATION' | 'FEEL_CORE' | 'FORM_CORE' | 'INTEGRATION' | 'FILE_OPERATION' | 'GENERAL';
206
+
207
+ declare interface ToolDefinition {
208
+ readonly name: string;
209
+ readonly description: string;
210
+ readonly parameters: Record<string, unknown>;
211
+ readonly type: ToolType;
212
+ readonly contentType: ContentType;
213
+ readonly category: ToolCategory;
214
+ readonly requiredCapabilities?: ReadonlyArray<string>;
215
+ readonly displayName?: string;
216
+ readonly descriptionFormatter?: DescriptionFormatter;
217
+ }
218
+
219
+ declare type ToolHandler = (args: Record<string, unknown>, onError: (toolName: string, error: Error) => void) => Promise<unknown>;
220
+
221
+ declare interface ToolRegistration extends ToolDefinition {
222
+ readonly handler: ToolHandler;
223
+ }
224
+
225
+ export declare interface ToolRegistry {
226
+ readonly registerTool: (registration: ToolRegistration) => void;
227
+ readonly clear: () => void;
228
+ }
229
+
230
+ declare type ToolType = 'frontend' | 'mixed';
231
+
232
+ export { }
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import Hn from "@carbon/ai-chat-components/es/react/markdown";
9
9
  import $n from "@carbon/ai-chat-components/es/react/card";
10
10
  import Kn from "@carbon/ai-chat-components/es/react/toolbar";
11
11
  import Qn from "@carbon/ai-chat-components/es/react/chat-shell";
12
- import { a as Bl, e as Fl, s as Ul, E as Hl, L as $l, l as Kl, o as Ql, X as Gl } from "./index-D4wolqeC.mjs";
12
+ import { d as Bl, t as Fl, a as Ul, w as Hl, R as $l, l as Kl, s as Ql, G as Gl } from "./index-YtFHTHlf.mjs";
13
13
  const Gn = "_themeWrapper_neun4_9", Vn = "_container_neun4_17", Wn = "_messagesSlot_neun4_29", Xn = "_workspaceSlot_neun4_36", Yn = "_inputBlock_neun4_47", Oe = {
14
14
  themeWrapper: Gn,
15
15
  container: Vn,
@@ -4512,11 +4512,14 @@ const fa = (e) => {
4512
4512
  toolStatus: e.message?.includes("Error") ? "error" : "success"
4513
4513
  }), Lr = async (e, t, n) => {
4514
4514
  let s, a = "", o = [];
4515
+ const i = e.fetchConversationMessages;
4516
+ if (!i)
4517
+ throw new Error("fetchConversationMessages is not available on transport");
4515
4518
  for (; ; ) {
4516
- const i = await e.fetchConversationMessages(t, s, n);
4517
- if (a = a || i.name, o = [...o, ...i.messages], i.nextCursor == null)
4519
+ const r = await i(t, s, n);
4520
+ if (a = a || r.name, o = [...o, ...r.messages], r.nextCursor == null)
4518
4521
  return { name: a, messages: o };
4519
- s = i.nextCursor;
4522
+ s = r.nextCursor;
4520
4523
  }
4521
4524
  }, wa = {
4522
4525
  conversations: [],
@@ -4640,7 +4643,10 @@ const fa = (e) => {
4640
4643
  const a = A.getState().conversationId;
4641
4644
  a && (n.unsubscribe(a), A.getState().reset(), z.getState().clearMessages()), e({ error: null, conversations: [] });
4642
4645
  try {
4643
- await Promise.all(s.map((o) => n.deleteConversation(o.id)));
4646
+ const o = n.deleteConversation;
4647
+ if (!o)
4648
+ return;
4649
+ await Promise.all(s.map((i) => o(i.id)));
4644
4650
  } catch (o) {
4645
4651
  e({ conversations: s });
4646
4652
  const i = o instanceof Error ? o.message : "Failed to delete all conversations";
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/copilot-chat",
3
- "version": "0.5.12-alpha.3",
3
+ "version": "0.5.12-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
  "main": "./dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/copilot-chat",
3
- "version": "0.5.12-alpha.4",
3
+ "version": "0.5.12-alpha.6",
4
4
  "description": "Camunda Copilot Client Library - React components and utilities for Camunda Platform 8",
5
5
  "license": "Camunda License 1.0",
6
6
  "main": "./dist/index.js",