@kuntur/a2a-carbon-chat-adapter 0.1.2 → 0.1.3

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 CHANGED
@@ -12,14 +12,15 @@ npm install @kuntur/a2a-carbon-chat-adapter @carbon/ai-chat react react-dom
12
12
 
13
13
  ```tsx
14
14
  import { A2AChat } from '@kuntur/a2a-carbon-chat-adapter';
15
- import '@carbon/ai-chat/styles.css';
15
+ import '@kuntur/a2a-carbon-chat-adapter/styles'; // Adapter layout styles
16
+ import '@carbon/ai-chat/dist/styles.css'; // Carbon AI Chat styles (if not already imported)
16
17
 
17
18
  function App() {
18
19
  return (
19
20
  <A2AChat
20
21
  agentUrl="https://your-agent.example.com"
21
22
  agentName="My Agent"
22
- layout="fullscreen"
23
+ layout="sidebar"
23
24
  />
24
25
  );
25
26
  }
@@ -67,9 +68,12 @@ function ChatWithSwitcher() {
67
68
  import { createA2AHandler } from '@kuntur/a2a-carbon-chat-adapter/server';
68
69
 
69
70
  export const POST = createA2AHandler({
70
- allowedAgentUrls: ['https://trusted-agents.example.com'],
71
+ allowedAgentUrls: ['https://trusted-agent.example.com'],
71
72
  timeout: 120000,
72
73
  });
74
+
75
+ export const runtime = 'nodejs';
76
+ export const dynamic = 'force-dynamic';
73
77
  ```
74
78
 
75
79
  ## Programmatic Usage with Hooks
@@ -0,0 +1,284 @@
1
+ /* src/styles/index.css */
2
+ .a2a-chat {
3
+ position: relative;
4
+ }
5
+ .a2a-chat--fullscreen {
6
+ height: 100vh;
7
+ width: 100%;
8
+ }
9
+ .a2a-chat--sidebar {
10
+ height: 100%;
11
+ width: 400px;
12
+ border-left: 1px solid var(--cds-border-subtle, #e0e0e0);
13
+ }
14
+ .a2a-chat--float {
15
+ position: fixed;
16
+ bottom: 20px;
17
+ right: 20px;
18
+ z-index: 1000;
19
+ }
20
+ .a2a-chat--loading {
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ min-height: 200px;
25
+ }
26
+ .a2a-chat__spinner {
27
+ width: 40px;
28
+ height: 40px;
29
+ border: 3px solid var(--cds-border-subtle, #e0e0e0);
30
+ border-top-color: var(--cds-interactive, #0f62fe);
31
+ border-radius: 50%;
32
+ animation: a2a-spin 1s linear infinite;
33
+ }
34
+ @keyframes a2a-spin {
35
+ to {
36
+ transform: rotate(360deg);
37
+ }
38
+ }
39
+ .a2a-chat--error {
40
+ padding: 1rem;
41
+ color: var(--cds-text-error, #da1e28);
42
+ }
43
+ .a2a-chat__form-overlay {
44
+ position: absolute;
45
+ inset: 0;
46
+ background: var(--cds-overlay, rgba(22, 22, 22, 0.5));
47
+ display: flex;
48
+ align-items: center;
49
+ justify-content: center;
50
+ z-index: 100;
51
+ }
52
+ .a2a-sources-list {
53
+ margin-top: 1rem;
54
+ padding-top: 1rem;
55
+ border-top: 1px solid var(--cds-border-subtle, #e0e0e0);
56
+ }
57
+ .a2a-sources-list__title {
58
+ font-size: 0.875rem;
59
+ font-weight: 600;
60
+ margin-bottom: 0.5rem;
61
+ color: var(--cds-text-secondary, #525252);
62
+ }
63
+ .a2a-sources-list__items {
64
+ list-style: decimal inside;
65
+ margin: 0;
66
+ padding: 0;
67
+ }
68
+ .a2a-sources-list__item {
69
+ font-size: 0.875rem;
70
+ margin-bottom: 0.25rem;
71
+ }
72
+ .a2a-sources-list__item a {
73
+ color: var(--cds-link-primary, #0f62fe);
74
+ text-decoration: none;
75
+ }
76
+ .a2a-sources-list__item a:hover {
77
+ text-decoration: underline;
78
+ }
79
+ .a2a-agent-switcher {
80
+ display: flex;
81
+ align-items: center;
82
+ gap: 0.5rem;
83
+ }
84
+ .a2a-agent-switcher__label {
85
+ font-size: 0.875rem;
86
+ color: var(--cds-text-secondary, #525252);
87
+ }
88
+ .a2a-agent-switcher__select {
89
+ padding: 0.5rem;
90
+ border: 1px solid var(--cds-border-strong, #8d8d8d);
91
+ border-radius: 4px;
92
+ background: var(--cds-field, #f4f4f4);
93
+ font-size: 0.875rem;
94
+ }
95
+ .a2a-agent-switcher--tabs .a2a-agent-switcher__tabs {
96
+ display: flex;
97
+ gap: 0;
98
+ border-bottom: 1px solid var(--cds-border-subtle, #e0e0e0);
99
+ }
100
+ .a2a-agent-switcher__tab {
101
+ padding: 0.75rem 1rem;
102
+ border: none;
103
+ background: transparent;
104
+ cursor: pointer;
105
+ font-size: 0.875rem;
106
+ color: var(--cds-text-secondary, #525252);
107
+ border-bottom: 2px solid transparent;
108
+ display: flex;
109
+ align-items: center;
110
+ gap: 0.5rem;
111
+ transition: color 0.15s, border-color 0.15s;
112
+ }
113
+ .a2a-agent-switcher__tab:hover {
114
+ color: var(--cds-text-primary, #161616);
115
+ }
116
+ .a2a-agent-switcher__tab--active {
117
+ color: var(--cds-text-primary, #161616);
118
+ border-bottom-color: var(--cds-interactive, #0f62fe);
119
+ }
120
+ .a2a-agent-switcher__icon {
121
+ width: 20px;
122
+ height: 20px;
123
+ border-radius: 50%;
124
+ }
125
+ .a2a-agent-switcher--cards .a2a-agent-switcher__cards {
126
+ display: flex;
127
+ flex-wrap: wrap;
128
+ gap: 0.75rem;
129
+ }
130
+ .a2a-agent-switcher__card {
131
+ display: flex;
132
+ align-items: center;
133
+ gap: 0.75rem;
134
+ padding: 0.75rem 1rem;
135
+ border: 1px solid var(--cds-border-subtle, #e0e0e0);
136
+ border-radius: 8px;
137
+ background: var(--cds-layer, #ffffff);
138
+ cursor: pointer;
139
+ transition: border-color 0.2s, box-shadow 0.2s;
140
+ }
141
+ .a2a-agent-switcher__card:hover {
142
+ border-color: var(--cds-interactive, #0f62fe);
143
+ }
144
+ .a2a-agent-switcher__card--active {
145
+ border-color: var(--cds-interactive, #0f62fe);
146
+ box-shadow: 0 0 0 1px var(--cds-interactive, #0f62fe);
147
+ }
148
+ .a2a-agent-switcher__card-icon {
149
+ width: 32px;
150
+ height: 32px;
151
+ border-radius: 50%;
152
+ }
153
+ .a2a-agent-switcher__card-content {
154
+ display: flex;
155
+ flex-direction: column;
156
+ gap: 0.25rem;
157
+ }
158
+ .a2a-agent-switcher__card-name {
159
+ font-size: 0.875rem;
160
+ font-weight: 500;
161
+ color: var(--cds-text-primary, #161616);
162
+ }
163
+ .a2a-agent-switcher__card-description {
164
+ font-size: 0.75rem;
165
+ color: var(--cds-text-secondary, #525252);
166
+ }
167
+ .a2a-citation-marker {
168
+ display: inline-flex;
169
+ align-items: center;
170
+ justify-content: center;
171
+ min-width: 1.25rem;
172
+ height: 1.25rem;
173
+ padding: 0 0.25rem;
174
+ margin: 0 0.125rem;
175
+ font-size: 0.75rem;
176
+ font-weight: 500;
177
+ color: var(--cds-link-primary, #0f62fe);
178
+ background: var(--cds-background-hover, #e8e8e8);
179
+ border-radius: 0.25rem;
180
+ cursor: pointer;
181
+ vertical-align: super;
182
+ transition: background-color 0.15s;
183
+ }
184
+ .a2a-citation-marker:hover {
185
+ background: var(--cds-background-active, #c6c6c6);
186
+ }
187
+ .a2a-error {
188
+ padding: 1rem;
189
+ background: var(--cds-notification-error-background, #fff1f1);
190
+ border-left: 3px solid var(--cds-support-error, #da1e28);
191
+ border-radius: 0 4px 4px 0;
192
+ }
193
+ .a2a-error__title {
194
+ font-weight: 600;
195
+ color: var(--cds-text-error, #da1e28);
196
+ margin-bottom: 0.5rem;
197
+ }
198
+ .a2a-error__message {
199
+ font-size: 0.875rem;
200
+ color: var(--cds-text-primary, #161616);
201
+ }
202
+ .a2a-error__stack {
203
+ margin-top: 0.75rem;
204
+ padding: 0.75rem;
205
+ background: var(--cds-field, #f4f4f4);
206
+ border-radius: 4px;
207
+ font-family: monospace;
208
+ font-size: 0.75rem;
209
+ white-space: pre-wrap;
210
+ overflow-x: auto;
211
+ }
212
+ .a2a-form {
213
+ background: var(--cds-layer, #ffffff);
214
+ border-radius: 8px;
215
+ padding: 1.5rem;
216
+ max-width: 400px;
217
+ width: 100%;
218
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
219
+ }
220
+ .a2a-form__title {
221
+ font-size: 1.125rem;
222
+ font-weight: 600;
223
+ margin-bottom: 0.5rem;
224
+ }
225
+ .a2a-form__description {
226
+ font-size: 0.875rem;
227
+ color: var(--cds-text-secondary, #525252);
228
+ margin-bottom: 1.5rem;
229
+ }
230
+ .a2a-form__fields {
231
+ display: flex;
232
+ flex-direction: column;
233
+ gap: 1rem;
234
+ }
235
+ .a2a-form__field {
236
+ display: flex;
237
+ flex-direction: column;
238
+ gap: 0.375rem;
239
+ }
240
+ .a2a-form__label {
241
+ font-size: 0.875rem;
242
+ font-weight: 500;
243
+ }
244
+ .a2a-form__input {
245
+ padding: 0.625rem 0.75rem;
246
+ border: 1px solid var(--cds-border-strong, #8d8d8d);
247
+ border-radius: 4px;
248
+ font-size: 0.875rem;
249
+ background: var(--cds-field, #f4f4f4);
250
+ }
251
+ .a2a-form__input:focus {
252
+ outline: 2px solid var(--cds-focus, #0f62fe);
253
+ outline-offset: -2px;
254
+ }
255
+ .a2a-form__actions {
256
+ display: flex;
257
+ justify-content: flex-end;
258
+ gap: 0.75rem;
259
+ margin-top: 1.5rem;
260
+ }
261
+ .a2a-form__button {
262
+ padding: 0.625rem 1rem;
263
+ border-radius: 4px;
264
+ font-size: 0.875rem;
265
+ font-weight: 500;
266
+ cursor: pointer;
267
+ transition: background-color 0.15s;
268
+ }
269
+ .a2a-form__button--secondary {
270
+ background: transparent;
271
+ border: 1px solid var(--cds-border-strong, #8d8d8d);
272
+ color: var(--cds-text-primary, #161616);
273
+ }
274
+ .a2a-form__button--secondary:hover {
275
+ background: var(--cds-background-hover, #e8e8e8);
276
+ }
277
+ .a2a-form__button--primary {
278
+ background: var(--cds-interactive, #0f62fe);
279
+ border: none;
280
+ color: #ffffff;
281
+ }
282
+ .a2a-form__button--primary:hover {
283
+ background: var(--cds-interactive-hover, #0353e9);
284
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuntur/a2a-carbon-chat-adapter",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "A2A protocol adapter for Carbon AI Chat - connect any A2A agent to Carbon Chat UI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",