@camunda/copilot-chat 0.0.0-alpha7 → 0.0.0-alpha9

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.
Files changed (60) hide show
  1. package/README.md +58 -74
  2. package/dist/CopilotChat.d.ts.map +1 -1
  3. package/dist/hooks/index.d.ts +1 -0
  4. package/dist/hooks/index.d.ts.map +1 -1
  5. package/dist/hooks/useAgentAdapter.d.ts +3 -0
  6. package/dist/hooks/useAgentAdapter.d.ts.map +1 -0
  7. package/dist/hooks/useCopilotSidecar.d.ts.map +1 -1
  8. package/dist/index.css +1 -29691
  9. package/dist/index.d.ts +6 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +5175 -24395
  12. package/dist/layout/SidecarLayoutManager.d.ts.map +1 -1
  13. package/dist/package.json +9 -5
  14. package/dist/store/agentStore.d.ts +5 -3
  15. package/dist/store/agentStore.d.ts.map +1 -1
  16. package/dist/store/chatStore.d.ts +5 -0
  17. package/dist/store/chatStore.d.ts.map +1 -1
  18. package/dist/store/index.d.ts +1 -0
  19. package/dist/store/index.d.ts.map +1 -1
  20. package/dist/store/messageContextStore.d.ts +21 -0
  21. package/dist/store/messageContextStore.d.ts.map +1 -0
  22. package/dist/styles/ensureSidecarStyles.d.ts.map +1 -1
  23. package/dist/types/agentTypes.d.ts +34 -0
  24. package/dist/types/agentTypes.d.ts.map +1 -1
  25. package/dist/types/chatTypes.d.ts +8 -1
  26. package/dist/types/chatTypes.d.ts.map +1 -1
  27. package/dist/utils/eventHandlers.d.ts +33 -0
  28. package/dist/utils/eventHandlers.d.ts.map +1 -0
  29. package/dist/utils/index.d.ts +3 -0
  30. package/dist/utils/index.d.ts.map +1 -0
  31. package/dist/utils/statusLabels.d.ts +3 -0
  32. package/dist/utils/statusLabels.d.ts.map +1 -0
  33. package/license.header +7 -0
  34. package/package.json +9 -5
  35. package/dist/components/ChatInput/ChatInput.d.ts +0 -9
  36. package/dist/components/ChatInput/ChatInput.d.ts.map +0 -1
  37. package/dist/components/ChatInput/index.d.ts +0 -2
  38. package/dist/components/ChatInput/index.d.ts.map +0 -1
  39. package/dist/components/ChatMessage/ChatMessage.d.ts +0 -7
  40. package/dist/components/ChatMessage/ChatMessage.d.ts.map +0 -1
  41. package/dist/components/ChatMessage/index.d.ts +0 -2
  42. package/dist/components/ChatMessage/index.d.ts.map +0 -1
  43. package/dist/components/ChatMessageList/ChatMessageList.d.ts +0 -9
  44. package/dist/components/ChatMessageList/ChatMessageList.d.ts.map +0 -1
  45. package/dist/components/ChatMessageList/index.d.ts +0 -2
  46. package/dist/components/ChatMessageList/index.d.ts.map +0 -1
  47. package/dist/components/CopilotHeader.d.ts +0 -7
  48. package/dist/components/CopilotHeader.d.ts.map +0 -1
  49. package/dist/components/CopilotLauncher.d.ts +0 -7
  50. package/dist/components/CopilotLauncher.d.ts.map +0 -1
  51. package/dist/components/CopilotStopButton.d.ts +0 -7
  52. package/dist/components/CopilotStopButton.d.ts.map +0 -1
  53. package/dist/components/MarkdownRenderer/MarkdownRenderer.d.ts +0 -6
  54. package/dist/components/MarkdownRenderer/MarkdownRenderer.d.ts.map +0 -1
  55. package/dist/components/MarkdownRenderer/index.d.ts +0 -2
  56. package/dist/components/MarkdownRenderer/index.d.ts.map +0 -1
  57. package/dist/components/ThinkingIndicator/ThinkingIndicator.d.ts +0 -9
  58. package/dist/components/ThinkingIndicator/ThinkingIndicator.d.ts.map +0 -1
  59. package/dist/components/ThinkingIndicator/index.d.ts +0 -2
  60. package/dist/components/ThinkingIndicator/index.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Camunda Copilot Client
1
+ # @camunda/copilot-chat
2
2
 
3
3
  React component library for embedding Camunda Copilot chat interface into web applications.
4
4
 
@@ -8,97 +8,81 @@ React component library for embedding Camunda Copilot chat interface into web ap
8
8
  npm install @camunda/copilot-chat
9
9
  ```
10
10
 
11
- ## Usage
11
+ **Peer Dependencies:**
12
+ ```bash
13
+ npm install react react-dom @carbon/react @carbon/icons-react
14
+ ```
15
+
16
+ ## Quick Start
12
17
 
13
18
  ```tsx
14
- import { CopilotChat } from '@camunda/copilot-chat';
19
+ import { CopilotChat, useChatStore } from '@camunda/copilot-chat';
20
+ import '@camunda/copilot-chat/style.css';
15
21
 
16
22
  function App() {
17
- const handleSendMessage = async (request, options, instance) => {
18
- // Handle message sending logic
19
- const response = {
20
- output: {
21
- generic: [
22
- {
23
- response_type: 'text',
24
- text: `You said: "${request.input.text}"`,
25
- },
26
- ],
27
- },
28
- };
29
-
30
- await instance.messaging.addMessage(response);
23
+ const handleSendMessage = async (message: string) => {
24
+ const { addAssistantMessage, appendToMessage, updateMessageStatus } = useChatStore.getState();
25
+ const messageId = `msg-${Date.now()}`;
26
+ addAssistantMessage(messageId);
27
+ appendToMessage(messageId, 'Hello!');
28
+ updateMessageStatus(messageId, 'complete'); // 'pending' | 'streaming' | 'complete' | 'error'
31
29
  };
32
30
 
33
- return <CopilotChat customSendMessage={handleSendMessage} workareaSelector="body" />;
31
+ return <CopilotChat onSendMessage={handleSendMessage} workareaSelector="body" />;
34
32
  }
35
33
  ```
36
34
 
37
- ### Props
38
-
39
- - **`customSendMessage`** (required): Function to handle message sending and responses
40
- - **`workareaSelector`** (optional): CSS selector for the workarea container (default: `"body"`)
41
-
42
- ### Features
43
-
44
- - Bottom-right floating launcher button
45
- - Sidecar panel that slides in from the right
46
- - Automatically injected styles (no separate CSS import needed)
47
-
48
- ## Development
49
-
50
- ### Prerequisites
51
-
52
- - Node.js ≥18.0.0
53
- - npm ≥9.0.0
54
-
55
- ### Setup
56
-
57
- ```bash
58
- npm install
59
- ```
60
-
61
- ### Local Development
62
-
63
- ```bash
64
- # Run both library build (watch mode) and demo app together
65
- npm run dev
66
-
67
- # Or run individually:
68
- # Build library in watch mode
69
- npm run build:watch
35
+ ## With Agent Adapter (Recommended)
70
36
 
71
- # Run demo app (in another terminal)
72
- npm run demo
37
+ For full agent orchestration with tool execution:
73
38
 
74
- # Run tests
75
- npm test
39
+ ```tsx
40
+ import { useMemo } from 'react';
41
+ import { CopilotChat, useAgentAdapter } from '@camunda/copilot-chat';
42
+ import '@camunda/copilot-chat/style.css';
76
43
 
77
- # Lint
78
- npm run lint
44
+ function App() {
45
+ const transport = useMemo(() => ({
46
+ subscribe: (id, onEvent) => { /* Subscribe to events */ },
47
+ unsubscribe: (id) => { /* Cleanup */ },
48
+ sendMessage: async (payload) => { /* POST to backend */ },
49
+ sendToolResult: async (payload) => { /* POST tool result */ },
50
+ }), []);
51
+
52
+ const { sendMessage, stopGeneration, resetConversation } = useAgentAdapter({
53
+ transport,
54
+ frontendTools: [{ name: 'my_tool', description: '...', parametersSchema: '{}' }],
55
+ onToolInvoke: async (toolName, args) => { /* Return result */ },
56
+ });
57
+
58
+ return (
59
+ <CopilotChat
60
+ onSendMessage={sendMessage}
61
+ onStopGeneration={stopGeneration}
62
+ onResetConversation={resetConversation}
63
+ />
64
+ );
65
+ }
79
66
  ```
80
67
 
81
- The demo app runs at `http://localhost:4200`. The `dev` command automatically rebuilds the library when you make changes and hot-reloads the demo app.
82
-
83
- ## Contributing
68
+ ## Props
84
69
 
85
- ```bash
86
- # 1. Create a feature branch
87
- git checkout -b '#ticketNumber/my-feature-description'
88
-
89
- # 2. Make changes and test with dev mode
90
- npm run dev
70
+ | Prop | Type | Required | Description |
71
+ |------|------|----------|-------------|
72
+ | `onSendMessage` | `(message: string) => Promise<void>` | Yes | Called when user sends a message |
73
+ | `onStopGeneration` | `() => void` | No | Called when user clicks stop button |
74
+ | `onResetConversation` | `() => void` | No | Called when user resets the conversation |
75
+ | `workareaSelector` | `string` | No | CSS selector for the main content area |
76
+ | `emptyStateTitle` | `string` | No | Title shown when chat is empty |
77
+ | `emptyStateDescription` | `string` | No | Description shown when chat is empty |
91
78
 
92
- # 3. Run tests
93
- npm test
79
+ ## Documentation
94
80
 
95
- # 4. Build to verify
96
- npm run build
81
+ See the [docs folder](../../docs) for detailed documentation:
97
82
 
98
- # 5. Commit and push
99
- git commit -m "feat: my feature"
100
- git push
101
- ```
83
+ - [Architecture Overview](../../docs/architecture.md)
84
+ - [Integration Guide](../../docs/integration.md)
85
+ - [Writing Adapters](../../docs/adapters.md)
102
86
 
103
87
  ## License
104
88
 
@@ -1 +1 @@
1
- {"version":3,"file":"CopilotChat.d.ts","sourceRoot":"","sources":["../src/CopilotChat.tsx"],"names":[],"mappings":"AAQA,OAAO,0BAA0B,CAAC;AAUlC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1C,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CACzC;AAED,eAAO,MAAM,WAAW,GAAI,6HAQzB,gBAAgB,4CAgFlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"CopilotChat.d.ts","sourceRoot":"","sources":["../src/CopilotChat.tsx"],"names":[],"mappings":"AAQA,OAAO,0BAA0B,CAAC;AAYlC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1C,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CACzC;AAED,eAAO,MAAM,WAAW,GAAI,6HAQzB,gBAAgB,4CAgFlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { useCopilotSidecar } from './useCopilotSidecar';
2
+ export { useAgentAdapter } from './useAgentAdapter';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AgentAdapterConfig, AgentAdapterReturn } from '../types/agentTypes';
2
+ export declare const useAgentAdapter: ({ transport, frontendTools, onToolInvoke, getStatusLabel, }: AgentAdapterConfig) => AgentAdapterReturn;
3
+ //# sourceMappingURL=useAgentAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAgentAdapter.d.ts","sourceRoot":"","sources":["../../src/hooks/useAgentAdapter.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,qBAAqB,CAAC;AA2D7B,eAAO,MAAM,eAAe,GAAI,6DAK7B,kBAAkB,KAAG,kBAkRvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCopilotSidecar.d.ts","sourceRoot":"","sources":["../../src/hooks/useCopilotSidecar.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAExC,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACnE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,iBAAiB,GAAI,qEAM/B,wBAAwB,SAe1B,CAAC"}
1
+ {"version":3,"file":"useCopilotSidecar.d.ts","sourceRoot":"","sources":["../../src/hooks/useCopilotSidecar.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAExC,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACnE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,iBAAiB,GAAI,qEAM/B,wBAAwB,SAe1B,CAAC"}