@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.
- package/README.md +58 -74
- package/dist/CopilotChat.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useAgentAdapter.d.ts +3 -0
- package/dist/hooks/useAgentAdapter.d.ts.map +1 -0
- package/dist/hooks/useCopilotSidecar.d.ts.map +1 -1
- package/dist/index.css +1 -29691
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5175 -24395
- package/dist/layout/SidecarLayoutManager.d.ts.map +1 -1
- package/dist/package.json +9 -5
- package/dist/store/agentStore.d.ts +5 -3
- package/dist/store/agentStore.d.ts.map +1 -1
- package/dist/store/chatStore.d.ts +5 -0
- package/dist/store/chatStore.d.ts.map +1 -1
- package/dist/store/index.d.ts +1 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/messageContextStore.d.ts +21 -0
- package/dist/store/messageContextStore.d.ts.map +1 -0
- package/dist/styles/ensureSidecarStyles.d.ts.map +1 -1
- package/dist/types/agentTypes.d.ts +34 -0
- package/dist/types/agentTypes.d.ts.map +1 -1
- package/dist/types/chatTypes.d.ts +8 -1
- package/dist/types/chatTypes.d.ts.map +1 -1
- package/dist/utils/eventHandlers.d.ts +33 -0
- package/dist/utils/eventHandlers.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/statusLabels.d.ts +3 -0
- package/dist/utils/statusLabels.d.ts.map +1 -0
- package/license.header +7 -0
- package/package.json +9 -5
- package/dist/components/ChatInput/ChatInput.d.ts +0 -9
- package/dist/components/ChatInput/ChatInput.d.ts.map +0 -1
- package/dist/components/ChatInput/index.d.ts +0 -2
- package/dist/components/ChatInput/index.d.ts.map +0 -1
- package/dist/components/ChatMessage/ChatMessage.d.ts +0 -7
- package/dist/components/ChatMessage/ChatMessage.d.ts.map +0 -1
- package/dist/components/ChatMessage/index.d.ts +0 -2
- package/dist/components/ChatMessage/index.d.ts.map +0 -1
- package/dist/components/ChatMessageList/ChatMessageList.d.ts +0 -9
- package/dist/components/ChatMessageList/ChatMessageList.d.ts.map +0 -1
- package/dist/components/ChatMessageList/index.d.ts +0 -2
- package/dist/components/ChatMessageList/index.d.ts.map +0 -1
- package/dist/components/CopilotHeader.d.ts +0 -7
- package/dist/components/CopilotHeader.d.ts.map +0 -1
- package/dist/components/CopilotLauncher.d.ts +0 -7
- package/dist/components/CopilotLauncher.d.ts.map +0 -1
- package/dist/components/CopilotStopButton.d.ts +0 -7
- package/dist/components/CopilotStopButton.d.ts.map +0 -1
- package/dist/components/MarkdownRenderer/MarkdownRenderer.d.ts +0 -6
- package/dist/components/MarkdownRenderer/MarkdownRenderer.d.ts.map +0 -1
- package/dist/components/MarkdownRenderer/index.d.ts +0 -2
- package/dist/components/MarkdownRenderer/index.d.ts.map +0 -1
- package/dist/components/ThinkingIndicator/ThinkingIndicator.d.ts +0 -9
- package/dist/components/ThinkingIndicator/ThinkingIndicator.d.ts.map +0 -1
- package/dist/components/ThinkingIndicator/index.d.ts +0 -2
- package/dist/components/ThinkingIndicator/index.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
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
|
-
|
|
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 (
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
31
|
+
return <CopilotChat onSendMessage={handleSendMessage} workareaSelector="body" />;
|
|
34
32
|
}
|
|
35
33
|
```
|
|
36
34
|
|
|
37
|
-
|
|
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
|
-
|
|
72
|
-
npm run demo
|
|
37
|
+
For full agent orchestration with tool execution:
|
|
73
38
|
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
78
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
## Contributing
|
|
68
|
+
## Props
|
|
84
69
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
93
|
-
npm test
|
|
79
|
+
## Documentation
|
|
94
80
|
|
|
95
|
-
|
|
96
|
-
npm run build
|
|
81
|
+
See the [docs folder](../../docs) for detailed documentation:
|
|
97
82
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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;
|
|
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"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -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 @@
|
|
|
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":"
|
|
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"}
|